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;     }    }   }  }
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()); } long nextLong() { return Long.parseLong(next()); } }
1	public class Main { boolean eof;  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()); }  int NOD(int a, int b) {  while (a * b > 0) {  if (a > b) {   a %= b;  } else {   b %= a;  }  }  return a + b; }  void solve() {  int n = nextInt(), k= nextInt();  int[] a = new int[n];  for (int i = 0; i < n; ++i){  a[i] = nextInt() - 1;  }  int[] b = new int[100000];  int p = 0;  for (int i = 0; i < n; ++i){  ++b[a[i]];  if (b[a[i]] == 1){   ++p;  }  if (k == p){   int j;   for (j = 0; j <= i; ++j){   if (b[a[j]] > 1){    --b[a[j]];   } else {    break;   }   }   out.print((j + 1) + " " + (i + 1));   return;  }  }  out.print("-1 -1"); }  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 CF268_TwoSets {  public static void main(String[] args) {  MyScanner in = new MyScanner();  int N = in.nextInt();  int a = in.nextInt();  int b = in.nextInt();  int[] vals = new int[N];  HashMap<Integer, Integer> val2Ind = new HashMap<Integer, Integer>();  for (int i = 0; i < N; i++) {  vals[i] = in.nextInt();  val2Ind.put(vals[i], i);  }  int[] setAssignment = new int[N];  int[] friendA = new int[N];  int[] friendB = new int[N];  Arrays.fill(setAssignment, -1);  Arrays.fill(friendA, -1);  Arrays.fill(friendB, -1);    for (int i = 0; i < N; i++) {  Integer friendAInd = val2Ind.get(a - vals[i]);  if (friendAInd != null) {   friendA[i] = friendAInd;  }   Integer friendBInd = val2Ind.get(b - vals[i]);  if (friendBInd != null) {   friendB[i] = friendBInd;  }  }    Queue<Integer> toProc = new ArrayDeque<Integer>();  for (int i = 0; i < N; i++) {  int friends = 0;  if (friendA[i] != -1) {   friends++;  }  if (friendB[i] != -1) {   friends++;  }  if (friends == 1) {   toProc.add(i);  }  }    while (!toProc.isEmpty()) {   int ind = toProc.poll();   if (setAssignment[ind] != -1) {   continue;  }   if (friendA[ind] != -1) {   int other = friendA[ind];   if (setAssignment[other] == -1) {   setAssignment[ind] = 0;   setAssignment[other] = 0;      if (friendB[other] != -1) {    int otherOther = friendB[other];    friendB[otherOther] = -1;    toProc.add(otherOther);   }   } else {   System.out.println("NO");   return;   }   }   else if (friendB[ind] != -1) {   int other = friendB[ind];   if (setAssignment[other] == -1) {   setAssignment[ind] = 1;   setAssignment[other] = 1;      if (friendA[other] != -1) {    int otherOther = friendA[other];    friendA[otherOther] = -1;    toProc.add(otherOther);   }   } else {   System.out.println("NO");   return;   }   }   else {   System.out.println("NO");   return;  }  }      for(int i = 0; i < N; i++) {    if(setAssignment[i] != -1) {   continue;  }    if(friendA[i] == -1 && friendB[i] == -1) {   System.out.println("NO");   return;  }      setAssignment[i] = 0;  setAssignment[friendA[i]] = 0;  }     System.out.println("YES");  StringBuilder sb = new StringBuilder();  for(int i = 0; i < N; i++) {  sb.append(setAssignment[i]);  sb.append(" ");  }  sb.deleteCharAt(sb.length() - 1);  System.out.println(sb); }  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());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }  } }
2	public class Main {  public static void main(String[] args)  {   setup();   xuly();  }  private static long dp[][] = new long[20][170];  private static void setup() {   dp[0][0] = 1;   for (int i = 1; i < 20; i ++)    for (int j = 0; j < 170; j ++)     for (int k = Math.max(j - 9, 0); k <= j; k ++)      dp[i][j] += dp[i - 1][k];  }  private static int sumD(long x) {   int ret = 0;   while(x > 0) {    ret += x % 10;    x /= 10;   }   return ret;  }  private static long numSatisfy(long limit, int sumDigit) {   long ret = 0;   int curSum = sumD(limit);   if (curSum == sumDigit)    ret ++;   for (int i = 0; i < 20; i ++) {    int bound = (int) (limit % 10);    curSum -= bound;    for (int d = 0; d < bound && curSum + d <= sumDigit; d ++)     ret += dp[i][sumDigit - curSum - d];    limit /= 10;   }   return ret;  }  private static void xuly() {   Scanner scanner = new Scanner(System.in);   long n = scanner.nextLong();   long s = scanner.nextLong();   long ans = 0;   for (int sum = 1; sum < 170; sum ++)    if (n >= s + sum)     ans += numSatisfy(n, sum) - numSatisfy(s + sum - 1, sum);   System.out.print(ans);  } }
0	public class Main{  public static void main(String args[]){   Scanner in = new Scanner(System.in);   int T = in.nextInt();   while(T!=0){    T--;    int a = in.nextInt();    int b = in.nextInt();    int ans=0;    while(a>0&&b>0){     if(a>b){      int c = a;      a = b;      b = c;     }     ans += (b-(b%a))/a;     b = b%a;    }    System.out.println(ans);   }  }  }
2	public class Main {  static Scanner cin = new Scanner(System.in); static int n, x, y; static long c;  private static long f(int mid) {  long block = 1 + 4 * (long)(mid + 1) * mid / 2;  int l = y - mid;  int r = y + mid;  int u = x - mid;  int d = x + mid;  if(l <= 0)  block -= (long)(1 - l) * (1 - l);  if(r > n)  block -= (long)(r - n) * (r - n);  if(u <= 0)  block -= (long)(1 - u) * (1 - u);  if(d > n)  block -= (long)(d - n) * (d - n);  if(u <= 0 && 1 - u > n - y + 1) {  int t = (1 - u) - (n - y + 1);  block += (long)t * (1 + t) / 2;  }  if(u <= 0 && (1 - u) > y) {  int t = (1 - u) - y;  block += (long)t * (1 + t) / 2;  }  if(d > n && d - n > n - y + 1) {  int t = (d - n) - (n - y + 1);  block += (long)t * (1 + t) / 2;  }  if(d > n && d - n > y) {  int t = (d - n) - y;  block += (long)t * (1 + t) / 2;  }  return block; }  public static void main(String args[]) {   n = cin.nextInt();  x = cin.nextInt();  y = cin.nextInt();  c = cin.nextLong();   int low = 0, high = 1000000000;  int ans = -1;  while(low <= high) {   int mid = (low + high) / 2;   if(f(mid) >= c) {   ans = mid;   high = mid - 1;  } else {   low = mid + 1;  }  }  System.out.println(ans); } }
2	public class C3 { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  long n = nl();  long S = nl();  long ret = Math.max(0, n-S+1);  for(long i = S;i <= S + 300 && i <= n;i++){  long b = i;  for(long x = i;x > 0;x /= 10){   b -= x % 10;  }  if(b < S)ret--;  }  out.println(ret); }  void run() throws Exception {  is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());  out = new PrintWriter(System.out);   long s = System.currentTimeMillis();  solve();  out.flush();  tr(System.currentTimeMillis()-s+"ms"); }  public static void main(String[] args) throws Exception { new C3().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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
4	public class A23 {  static int solve(String s) {   for(int i = s.length(); i > 0; --i) {    for(int start = 0; start < s.length() - i; ++start) {     String str = s.substring(start, start + i);     int firstIndex = s.indexOf(str);     int lastIndex = s.lastIndexOf(str);     if(firstIndex != lastIndex)      return i;    }   }   return 0;  }  public static String[] EX = new String[] { "abcd", "ababa", "zzz", "qwertyuiopasdfghjklzxcvbnmqwepriuwpoep"};  public static int[] EX_A = new int[] { 0, 3, 2, 3};   public static void main(String[] args) throws IOException {   if(true) {    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));    String s = br.readLine();    System.out.println(solve(s));   }   else {    for(int i = 0; i < EX.length; ++i) {     int result = solve(EX[i]);     System.out.println(i + ": " + result + " " + (result == EX_A[i]? "ja" : "NEJ"));    }   }  } }
6	public class A {  FastScanner in;  PrintWriter out;  void solve() {   int tc = in.nextInt();   for (int t = 0; t < tc; t++) {    int n = in.nextInt();    int m = in.nextInt();    O[] a = new O[n * m];    int[][] cols = new int[m][n + n];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      cols[j][i] = cols[j][i + n] = in.nextInt();      a[i * m + j] = new O(i, j, cols[j][i]);     }    }    Arrays.sort(a);    boolean[] used = new boolean[m];    int cntUsed = 0;    for (O o : a) {     if (!used[o.y]) {      used[o.y] = true;      cntUsed++;      if (cntUsed == n) {       break;      }     }    }    int[] dp = new int[1 << n];    int[] ndp = new int[1 << n];    int[] maxndp = new int[1 << n];    for (int col = 0; col < m; col++) {     if (!used[col]) {      continue;     }     int[] curColumn = cols[col];     for (int shift = 0; shift < n; shift++) {      System.arraycopy(dp, 0, ndp, 0, ndp.length);      for (int mask = 0; mask < 1 << n; mask++) {       for (int bit = 0; bit < n; bit++) {        if (((1 << bit) & mask) == 0) {         int nmask = mask | (1 << bit);         ndp[nmask] = Math.max(ndp[nmask], ndp[mask] + curColumn[bit + shift]);        }       }      }      for (int i = 0; i < ndp.length; i++) {       maxndp[i] = Math.max(maxndp[i], ndp[i]);      }     }     int[] tmp = dp;     dp = maxndp;     maxndp = tmp;    }    out.println(dp[dp.length - 1]);   }  }  class O implements Comparable<O> {   int x, y, value;   public O(int x, int y, int value) {    this.x = x;    this.y = y;    this.value = value;   }   @Override   public int compareTo(O o) {    return -Integer.compare(value, o.value);   }  }   void run() {   try {    in = new FastScanner(new File("A.in"));    out = new PrintWriter(new File("A.out"));    solve();    out.close();   } catch (FileNotFoundException e) {    e.printStackTrace();   }  }  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;   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }  }  public static void main(String[] args) {   new A().runIO();  } }
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);  } }
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 HashSet<Pair> graph[];  static boolean oj = System.getProperty("ONLINE_JUDGE") != null;  static int n,T,input[],type[];  static long dp[][];  static long dfs(int mask,int t){   if(dp[mask][t]!=-1){    return dp[mask][t];   }   int s=0;   for(int i=0;i<n;i++){    if((mask&(1<<i))!=0){     s+=input[i];    }   }   if(s>T){    return 0;   }   if(s==T){    dp[mask][t]=1;    return dp[mask][t];   }   long ans=0;   for(int i=0;i<n;i++){    if((mask&(1<<i))==0&&type[i]!=t){     ans=(ans+dfs(mask|(1<<i),type[i]))%mod;    }   }   dp[mask][t]=ans;   return dp[mask][t];  }  public static void main (String[] args) throws Exception {   String st[]=nl();   n=pi(st[0]);   T=pi(st[1]);   input=new int[n];   type=new int[n];   for(int i=0;i<n;i++){    st=nl();    input[i]=pi(st[0]);    type[i]=pi(st[1]);   }   dp=new long[1<<n][4];   for(long arr[]:dp)    Arrays.fill(arr,-1);   long ans=dfs(0,0);      out.println(ans);   out.flush();   out.close();  }  static String[] nl() throws Exception{   return br.readLine().split(" ");  }  static String[] nls() throws Exception{   return br.readLine().split("");  }  static int pi(String str) {   return Integer.parseInt(str);  }  static long pl(String str){   return Long.parseLong(str);  }  static double pd(String str){   return Double.parseDouble(str);  }  static void printPrecision(double d){   DecimalFormat ft = new DecimalFormat("0.00000000000000000");   out.println(ft.format(d));  }  static void printMask(long mask){   System.out.println(Long.toBinaryString(mask));  }  static int countBit(int mask){   int ans=0;   while(mask!=0){    if(mask%2==1){     ans++;    }    mask/=2;   }   return ans;  }  static void Makegraph(int n){   graph=new HashSet[n];   for(int i=0;i<n;i++){    graph[i]=new HashSet<>();   }  }  static void addEdge(int a,int b){   graph[a].add(new Pair(b,1));  }  static void addEdge(int a,int b,int c){   graph[a].add(new Pair(b,c));  }   static class PairComp implements Comparator<Pair>{   public int compare(Pair p1,Pair p2){    return ((p1.u+p1.v)-(p2.u+p2.v));   }  }  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;   }   public int hashCode() {    int hu = (int) (u ^ (u >>> 32));    int hv = (int) (v ^ (v >>> 32));    return 31 * hu + hv;   }   public boolean equals(Object o) {    Pair other = (Pair) o;    return u == other.u && v == other.v;   }   public int compareTo(Pair other) {    if(index!=other.index)     return Long.compare(index, other.index);    return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);   }   public String toString() {    return "[u=" + u + ", v=" + v + "]";   }  }  static class PairCompL implements Comparator<Pairl>{   public int compare(Pairl p1,Pairl p2){    if((p1.u+2*p1.v)-(p2.u+2*p2.v)<0){     return -1;    }    else if((p1.u+2*p1.v)-(p2.u+2*p2.v)>0){     return 1;    }    else{     return 0;    }   }  }  static class Pairl implements Comparable<Pairl> {    long u;    long v;    int index=-1;    public Pairl(long u, long v) {     this.u = u;     this.v = v;    }     public int hashCode() {     int hu = (int) (u ^ (u >>> 32));     int hv = (int) (v ^ (v >>> 32));     return 31 * hu + hv;    }     public boolean equals(Object o) {     Pair other = (Pair) o;     return u == other.u && v == other.v;    }     public int compareTo(Pairl other) {     if(index!=other.index)      return Long.compare(index, other.index);     return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);    }     public String toString() {     return "[u=" + u + ", v=" + v + "]";    }   }  public static void debug(Object... o) {   if(!oj)   System.out.println(Arrays.deepToString(o));  }  static long modulo(long a,long b,long c) {   long x=1;   long y=a;   while(b > 0){    if(b%2 == 1){     x=(x*y)%c;    }    y = (y*y)%c;    b /= 2;   }   return x%c;  }  static long gcd(long x, long y)  {   if(x==0)    return y;   if(y==0)    return x;   long r=0, a, b;   a = (x > y) ? x : y;   b = (x < y) ? x : y;   r = b;   while(a % b != 0)   {    r = a % b;    a = b;    b = r;   }   return r;  }  static void sieveMake(int n){   sieve=new boolean[n];   Arrays.fill(sieve,true);   sieve[0]=false;   sieve[1]=false;   for(int i=2;i*i<n;i++){    if(sieve[i]){     for(int j=i*i;j<n;j+=i){      sieve[j]=false;     }    }   }   primes=new ArrayList<Integer>();   for(int i=0;i<n;i++){    if(sieve[i]){     primes.add(i);    }   }    } }
6	public class D11 {  static StreamTokenizer in; static PrintWriter out;  static int nextInt() throws IOException {  in.nextToken();  return (int)in.nval; }  static String nextString() throws IOException {  in.nextToken();  return in.sval; }  public static void main(String[] args) throws IOException {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(System.out);  n = nextInt();  m = nextInt();   g = new boolean[n][n];  for (int i = 0; i < m; i++) {  int a = nextInt()-1, b = nextInt()-1;  g[a][b] = g[b][a] = true;  }   long ans = 0;  for (int i = n; i > 0; i--) {    long cur = calc(g, i-1);  ans += cur;  }   out.println(ans/2);   out.flush(); }  static int n, m, V; static boolean[][] g;    static long calc(boolean[][] bs,int n){   long[][] dp=new long[1<<n][n];   for(int i=0;i<n;i++){     if(bs[i][n])       dp[1<<i][i] ++;   }   for(int i=1;i<1<<n;i++){     for(int j=0;j<n;j++)if(((i>>j)&1)==1)       for(int k=0;k<n;k++)if(((i>>k)&1)==0 && bs[j][k]){         dp[i|(1<<k)][k] += dp[i][j];       }   }   long res=0;   for(int i=0;i<1<<n;i++)for(int j=0;j<n;j++)if(Integer.bitCount(i)>=2&&bs[j][n])res+=dp[i][j];   return res; } }
6	public class ASimpleTask {    static long memo[][]; static int graph[]; static long hamiltonianPath(int mask , int u) {  if(memo[mask][u] != -1)  return memo[mask][u];  else if(u == Integer.numberOfTrailingZeros(mask))  return 0;  else {  long sum = 0;  for(int fromSet = mask ^ (1 << u);fromSet > 0; fromSet ^= Integer.lowestOneBit(fromSet)) {   int v = Integer.numberOfTrailingZeros(fromSet);     if((graph[u] & (1 << v)) != 0)    sum += hamiltonianPath(mask ^ (1 << u), v);  }    return memo[mask][u] = sum;  } }  private static void solveBottomUp(FastScanner s1, PrintWriter out){  int V = s1.nextInt();  int E = s1.nextInt();  graph = new int[V];  long DP[][] = new long[1 << V][V];  while(E-->0) {  int u = s1.nextInt() - 1;  int v = s1.nextInt() - 1;  graph[u] |= (1 << v);  graph[v] |= (1 << u);  }  for(int i=0;i<V;i++)  DP[1 << i][i] = 1;  for(int mask = 1 , end = 1 << V;mask < end;mask++) {  for(int set = mask;Integer.bitCount(set) > 1;set ^= Integer.highestOneBit(set)) {   int u = Integer.numberOfTrailingZeros(Integer.highestOneBit(set));   for(int fromSet = mask ^ (1 << u);fromSet > 0; fromSet ^= Integer.lowestOneBit(fromSet)) {   int v = Integer.numberOfTrailingZeros(fromSet);      if((graph[u] & (1 << v)) != 0)    DP[mask][u] += DP[mask ^ (1 << u)][v];      }  }  }  long totalCycles = 0;  for(int mask = 1 , end = 1 << V;mask < end;mask++) {  if(Integer.bitCount(mask) >= 3) {   int start = Integer.numberOfTrailingZeros(mask);   for(int set = mask;Integer.bitCount(set) > 1;set ^= Integer.highestOneBit(set)) {   int u = Integer.numberOfTrailingZeros(Integer.highestOneBit(set));   if((graph[u] & (1 << start)) != 0)    totalCycles += DP[mask][u];   }  }  }  totalCycles /= 2;  out.println(totalCycles); }  private static void solveTopDown(FastScanner s1, PrintWriter out){  int V = s1.nextInt();  int E = s1.nextInt();  graph = new int[V];  memo = new long[1 << V][V];   for(long l[] : memo)  Arrays.fill(l, -1);   while(E-->0) {  int u = s1.nextInt() - 1;  int v = s1.nextInt() - 1;  graph[u] |= (1 << v);  graph[v] |= (1 << u);  }  for(int i=0;i<V;i++)  memo[1 << i][i] = 1;   long totalCycles = 0;  for(int mask = 1 , end = 1 << V;mask < end;mask++) {  if(Integer.bitCount(mask) >= 3) {   int start = Integer.numberOfTrailingZeros(mask);   for(int set = mask;Integer.bitCount(set) > 1;set ^= Integer.highestOneBit(set)) {   int u = Integer.numberOfTrailingZeros(Integer.highestOneBit(set));   if((graph[u] & (1 << start)) != 0)    totalCycles += hamiltonianPath(mask, u);   }  }  }  totalCycles /= 2;   out.println(totalCycles); }       public static void main(String []args) throws IOException {  FastScanner in = new FastScanner(System.in);  PrintWriter out =   new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);  solveTopDown(in, out);  in.close();  out.close(); }   static class FastScanner{  BufferedReader reader;  StringTokenizer st;  FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}  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();}  String nextLine() {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}     int nextInt() {return Integer.parseInt(next());}  long nextLong() {return Long.parseLong(next());}   double nextDouble(){return Double.parseDouble(next());}  char nextChar() {return next().charAt(0);}  int[] nextIntArray(int n)   {int[] a= new int[n]; int i=0;while(i<n){a[i++]=nextInt();} return a;}  long[] nextLongArray(int n)  {long[]a= new long[n]; int i=0;while(i<n){a[i++]=nextLong();} return a;}  int[] nextIntArrayOneBased(int n) {int[] a= new int[n+1]; int i=1;while(i<=n){a[i++]=nextInt();} return a;}    long[] nextLongArrayOneBased(int n){long[]a= new long[n+1];int i=1;while(i<=n){a[i++]=nextLong();}return a;}    void close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}   }  }
2	public class C {  static long mod=(long)(1e9+7); public static long powMod(long e,long b) {   long res=1;   while(e>0)  {  if(e%2==1)   res=res*b%mod;  e/=2;  b=b*b%mod;  }  return res; }  public static void main(String[] args) throws IOException  {  Scanner sc=new Scanner(System.in);  PrintWriter pw=new PrintWriter(System.out);  long x=sc.nextLong(),k=sc.nextLong();  if(x==0)  {   System.out.println(0);   return;  }    if(k==0)  {   pw.println((2*x)%mod);        pw.close();return;  }    long ans=2*x-1;  ans=ans%mod;    long b=powMod(k,2);  ans=((ans*b)+1)%mod;      pw.println(ans);    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 double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public boolean ready() throws IOException {  return br.ready();  } } }
4	public class A implements Runnable {  private void solve() throws IOException {   String str = nextToken();   for (int i=str.length()-1; i>=0; --i)    for (int j=0; j+i<=str.length(); ++j)     if (str.substring(j+1).contains(str.substring(j, j+i))) {      writer.println(i);      return;     }   writer.println(0);  }  public static void main(String[] args) {   new Thread(new A()).start();  }  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();  } }
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  @SuppressWarnings("Duplicates")  class TaskC {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int MAX = 6000;    int MOD = 1000000007;    int n = in.nextInt();    int[][] dp = new int[n][MAX];    dp[0][0] = 1;    char next;    int current;    for (int i = 0; i < n; i++) {     next = in.next().charAt(0);     if (i == n - 1) continue;     current = 0;     for (int j = MAX - 1; j >= 0; j--) {      if (dp[i][j] != 0) {       if (next == 'f') {        if (j < MAX - 1) dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % MOD;       } else {        current = (current + dp[i][j]) % MOD;       }      }      if (next == 's') dp[i + 1][j] = current;     }    }    int res = 0;    for (int i = 0; i < MAX; i++) {     res = (res + dp[n - 1][i]) % MOD;    }    out.print(res);   }  }  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;   }  } }
6	public class Problem_8C { private static int dis(int x1, int y1, int x2, int y2) {  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); }  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int ox = sc.nextInt();  int oy = sc.nextInt();  int n = sc.nextInt();  int[] ix = new int[n];  int[] iy = new int[n];  int[] single = new int[n];  int[][] pair = new int[n][n];  for (int i = 0; i < n; i++) {  ix[i] = sc.nextInt();  iy[i] = sc.nextInt();  single[i] = dis(ox, oy, ix[i], iy[i]) * 2;  for (int j = 0; j < i; j++) {   pair[i][j] = pair[j][i] = dis(ix[i], iy[i], ix[j], iy[j]) + (single[i] + single[j]) / 2;  }  }  int[] min = new int[1 << n];  int[] pre = new int[1 << n];  for (int set = 1; set < 1 << n; set++) {  int i;  for (i = 0; i < n; i++) {   if ((set & (1 << i)) != 0) {   break;   }  }  min[set] = min[set ^ (1 << i)] + single[i];  pre[set] = set ^ (1 << i);  for (int j = 0; j < n; j++) {   if ((set & (1 << j)) == 0) {   continue;   }   if (min[set] > min[set ^ (1 << i) ^ (1 << j)] + pair[i][j]) {   min[set] = min[set ^ (1 << i) ^ (1 << j)] + pair[i][j];   pre[set] = set ^ (1 << i) ^ (1 << j);   }  }  }  System.out.println(min[(1 << n) - 1]);  for (int set = (1 << n) - 1; set != 0; set = pre[set]) {  System.out.print("0 ");  for (int i = 0; i < n; i++) {   if (((set ^ pre[set]) & (1 << i)) != 0) {   System.out.print((i + 1) + " ");   }  }  }  System.out.println("0");  sc.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);  } }
6	public class LookingForOrder { static int n; static int []x,y,memo; static StringBuilder sb; static int distance(int i,int j) { int dx=x[i]-x[j]; int dy=y[i]-y[j]; return dx*dx+dy*dy; } public static int dp(int msk) { if(msk==(1<<(n+1))-2)  return 0; if(memo[msk]!=-1)  return memo[msk]; int ans=10000000; boolean found=false; for(int i=1;i<=n && !found;i++)   for(int j=i;j<=n && (msk&1<<i)==0;j++)  if((msk&1<<j)==0)  {      found=true;   int newM=msk|1<<i;   newM|=1<<j;   ans=Math.min(ans, dp(newM)+Math.min(distance(0,i)+distance(i,j)+distance(j,0), distance(0,j)+distance(j,i)+distance(i,0)));  } return memo[msk]=ans;   } public static void print(int msk) { if(msk==(1<<(n+1))-2)  return ;  for(int i=1;i<=n;i++)   for(int j=i;j<=n && (msk&1<<i)==0;j++)  if((msk&1<<j)==0)  {      int newM=msk|1<<i;   newM|=1<<j;   int d1=distance(0,i)+distance(i,j)+distance(j,0);   int d2=distance(0,j)+distance(j,i)+distance(i,0);   if(dp(msk)== dp(newM)+Math.min(d1,d2))   {      if(i==j)       sb.append("0 "+i+" ");      else if(d1<d2)    sb.append("0 "+i+" "+j+" ");   else    sb.append("0 "+j+" "+i+" ");          print(newM);   return ;   }  }    } public static void main(String[] args) throws IOException {  Scanner sc=new Scanner(System.in);  int xS=sc.nextInt(),yS=sc.nextInt();  n=sc.nextInt();  x=new int [n+1];  y=new int [n+1];  x[0]=xS;y[0]=yS;  for(int i=1;i<=n;i++)  {   x[i]=sc.nextInt();  y[i]=sc.nextInt();   }  memo=new int [1<<(n+1)];  Arrays.fill(memo,-1);  sb=new StringBuilder();  sb.append(dp(0)+"\n");  print(0);  sb.append("0");  System.out.println(sb); } static class Scanner {  BufferedReader br;  StringTokenizer st;  public Scanner(InputStream s)  {  br=new BufferedReader(new InputStreamReader(s));  }  public String nextLine() throws IOException  {  return br.readLine();  }  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 boolean ready() throws IOException  {  return br.ready();  }  public long nextLong() throws IOException  {  return Long.parseLong(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);  }  static class Senator {   int loyalty;   int level;   public Senator(int level, int loyalty) {    this.level = level;    this.loyalty = loyalty;   }  }  private static 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;  }  private static 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 void run() {   try {    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));    output.flush();    output.close();   } catch (Throwable e) {    System.err.println(e.getMessage());    System.err.println(Arrays.deepToString(e.getStackTrace()));   }  }   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 double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  private long nextLong() throws IOException {   return Long.parseLong(nextToken());  }   private BufferedReader input;  private PrintWriter output;  private StringTokenizer tokens = null; }
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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
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);   APaintTheNumbers solver = new APaintTheNumbers();   solver.solve(1, in, out);   out.close();  }  static class APaintTheNumbers {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    int arr[] = in.nextIntArray(n);    Arrays.sort(arr);    int ans = 0;    for (int i = 0; i < n; i++) {     if (arr[i] == -1)      continue;     else {           ans++;      for (int j = i + 1; j < n; j++) {       if (arr[j] % arr[i] == 0)        arr[j] = -1;      }      arr[i] = -1;          }    }    out.println(ans);   }  }  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 int[] nextIntArray(int n) {    int[] array = new int[n];    for (int i = 0; i < n; ++i) array[i] = nextInt();    return array;   }   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 println(int i) {    writer.println(i);   }  } }
6	public class Main implements Runnable {  boolean multiple = false;  long MOD;  @SuppressWarnings({"Duplicates", "ConstantConditions"})  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++)   {    outer: 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;  }  class pii { int f, s; pii(int k, int v) { f = k; s = v; } }  class pli { long f; int s; pli(long k, int v) { f = k; s = v; } public String toString() { return "(" + f + ", " + s + ")"; } }  StringBuilder ANS = new StringBuilder();  void p(Object s) { ANS.append(s); } void p(double s) {ANS.append(s); } void p(long s) {ANS.append(s); } void p(char s) {ANS.append(s); }  void pl(Object s) { ANS.append(s); ANS.append('\n'); } void pl(double s) { ANS.append(s); ANS.append('\n'); } void pl(long s) { ANS.append(s); ANS.append('\n'); } void pl(char s) { ANS.append(s); ANS.append('\n'); } void pl() { ANS.append(('\n')); }  @Override public void run() { try { in = new BufferedReader(new InputStreamReader(System.in));out = new PrintWriter(System.out);sc = new FastScanner(in);if (multiple) { int q = sc.nextInt();for (int i = 0; i < q; i++) solve(); } else solve(); System.out.print(ANS); } catch (Throwable uncaught) { Main.uncaught = uncaught; } finally { out.close(); }} 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()); }public long nextLong() throws Exception { return Long.parseLong(nextToken()); }public double nextDouble() throws Exception { return Double.parseDouble(nextToken()); } }
6	public class Main{  static void debug(Object...os){   System.err.println(deepToString(os));  }  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;   }  }   double nextDouble(){   return Double.parseDouble(next());  }   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;   }  }   String nextLine(){   try{    StringBuilder res=new StringBuilder("");    int c=System.in.read();    while(c=='\r'||c=='\n')     c=System.in.read();    do{     res.append((char)c);     c=System.in.read();    }while(c!='\r'&&c!='\n');    return res.toString();   }catch(Exception e){    return null;   }  }  public static void main(String[] args){   new Main().run();  } }
5	public class Main  {  public static void main(String[] args)  {  Scanner keyboard = new Scanner(System.in);  int size = Integer.parseInt(keyboard.nextLine());  int[] arr = new int[size];  int i = 0;  while( size != 0 )  {   arr[i] = keyboard.nextInt();   size--;   i++;  }    if( arr.length == 1 )  {   System.out.println("NO");  }  else  {   Arrays.sort(arr);   boolean val = false;   int ans = 0;   for ( i = 0; i< arr.length-1 ; i++ )   {   if( arr[i] != arr[i+1] )   {   val = true;   ans = arr[i+1];   System.out.println(ans);   i = arr.length;   }   else if( i == arr.length-2 )  {   System.out.println("NO");   }   }  } } }
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+"").charAt((int)ms));  } }
2	public class Main { static StreamTokenizer st = new StreamTokenizer(new BufferedInputStream(System.in)); static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter pr = new PrintWriter(new BufferedOutputStream(System.out)); static Scanner sc = new Scanner(System.in);  public static void main(String[] args) throws NumberFormatException, IOException {  int a = sc.nextInt();  int b = sc.nextInt();  int i = 0;  int cont = 0;  while(cont<b) {  i++;  cont+=i;  }   if(i+cont-b==a) {  System.out.println(cont-b);  }else {  while(i+cont-b!=a) {   i++;   cont+=i;  }  System.out.println(cont-b);  } }  private static int nextInt() {  try {  st.nextToken();  } catch (IOException e) {  e.printStackTrace();  }  return (int) st.nval; } }
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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   } }
3	public class SameSumBlocks {  public static void main(String[] args) throws Exception {   FastScanner sc = new FastScanner();   PrintWriter out = new PrintWriter(System.out);   int N = sc.nextInt();   int[] pre = new int[N + 1];   for (int i = 1; i <= N; i++) {    pre[i] = pre[i - 1] + sc.nextInt();   }   var sumMap = new HashMap<Integer, ArrayList<Pair>>();   for (int i = 1; i <= N; i++) {    for (int j = i; j <= N; j++) {     int sum = pre[j] - pre[i - 1];     sumMap.computeIfAbsent(sum, val -> new ArrayList<>()).add(new Pair(i, j));    }   }   var ans = new ArrayList<Pair>();   for (var list : sumMap.values()) {    Collections.sort(list, Comparator.comparingInt(p -> p.r));       int last = 0;    var group = new ArrayList<Pair>();    for (Pair p : list) {     if (p.l > last) {      group.add(p);      last = p.r;     }    }    if (group.size() > ans.size()) {     ans = group;    }   }   out.println(ans.size());   for (Pair p : ans) {    out.println(p);   }   out.close();  }  static class Pair {   int l, r;   public Pair(int ll, int rr) {    l = ll; r = rr;   }   public String toString() {    return l + " " + r;   }  }  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 int[] nextInts(int N) {    int[] res = new int[N];    for (int i = 0; i < N; i++) {     res[i] = (int) nextLong();    }    return res;   }   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;   }   public String next() {    StringBuilder res = new StringBuilder();    while(c<=32)c=getChar();    while(c>32) {     res.append(c);     c=getChar();    }    return res.toString();   }   public String nextLine() {    StringBuilder res = new StringBuilder();    while(c<=32)c=getChar();    while(c!='\n') {     res.append(c);     c=getChar();    }    return res.toString();   }   public boolean hasNext() {    if(c>32)return true;    while(true) {     c=getChar();     if(c==NC)return false;     else if(c>32)return true;    }   }  } }
0	public class C { static long n = 0;  static void R (long a,long b){  n += a/b;  a = a%b;  if(a==0) return;  R(b,a);  } public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  long a = sc.nextLong();  long b = sc.nextLong();  R(a,b);  System.out.println(n); } }
2	public class ProblemB {  InputReader in; PrintWriter out;  void solve() {   int n = in.nextInt();   int x = in.nextInt();   int y = in.nextInt();   int c = in.nextInt();   int cur = 1;   for (int k = 1; k <= c; k++) {    if (cur >= c) {     out.println(k - 1);     return;    }       int iLess = n - x;    int iMore = y + k - n;    if (iLess > k)     iLess = k;    if (iMore < 0)     iMore = 0;    int add = iLess - iMore + 1;    if (add < 0)     add = 0;    cur += add;       iLess = n - x;    iMore = 1 + k - y;    if (iLess > k)     iLess = k;    if (iMore < 0)     iMore = 0;       add = iLess - iMore + 1;    if (add < 0)     add = 0;    cur += add;       iLess = x - 1;    iMore = 1 + k - y;    if (iLess > k)     iLess = k;    if (iMore < 0)     iMore = 0;    add = iLess - iMore + 1;    if (add < 0)     add = 0;    cur += add;       iLess = x - 1;    iMore = y + k - n;    if (iLess > k)     iLess = k;    if (iMore < 0)     iMore = 0;    add = iLess - iMore + 1;    if (add < 0)     add = 0;    cur += add;        if (x + k <= n)     cur--;    if (y - k >= 1)     cur--;    if (x - k >= 1)     cur--;    if (y + k <= n)     cur--;   }  }   ProblemB(){   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 ProblemB();  } } 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 int nextInt() {   return Integer.parseInt(next());  }  public long nextLong() {   return Long.parseLong(next());  }  public double nextDouble() {   return Double.parseDouble(next());  } }
2	public class B {  public static void main (String[] argv) {   Scanner in = new Scanner(System.in);   long n = in.nextLong();   long k = in.nextLong();   long max = ((k*(k-1))/2L)+1L;   long ans = -1;   if (n == 1) {    System.out.println(0);    return;   }   if (max < n) {    ans = -1;   } else if (max == n) {    ans = k-1;   } else {    if (k >= n) {     ans = 1;    } else {     long low = 1;     long high = k-1;     while (high > low+1) {      long mid = (low+high)/2;      long sum = (((mid+(k-1)) * (k-mid)) / 2) + 1;      if (sum >= n) {       low = mid;      } else {       high = mid;      }     }     ans = (k - low);    }   }   System.out.println(ans);   return;  } }
6	public class D { private Scanner in; private PrintWriter out;  private boolean[][] g;  public void solve() {  n = ni();  int m = ni();  g = new boolean[n][n];  for(int i = 0;i < m;i++){  int f = ni();  int t = ni();  g[f-1][t-1] = true;  g[t-1][f-1] = true;  }   long ret = 0L;  cache = new long[20 << 19];  for(int i = 0;i < n;i++){  start = i;  ret += rec(1 << start, i, 0);  }  out.println(ret/2); }  private long[] cache; private int n; private int start;  private long rec(int passed, int cur, int depth) {  int code = cur << 19 | passed;  if(cache[code] != 0)return cache[code];  long ret = 0L;   if(g[cur][start] && depth >= 2)ret++;  for(int i = start + 1;i < n;i++){  if((passed & (1 << i)) == 0 && g[cur][i]){   ret += rec(passed | (1 << i), i, depth + 1);  }  }   cache[code] = ret;  return ret; }  public void run() throws Exception {        in = new Scanner(System.in);  System.setOut(new PrintStream(new BufferedOutputStream(System.out)));  out = new PrintWriter(System.out);    int n = 1;  for(int i = 1;i <= n;i++){  long t = System.currentTimeMillis();  solve();  out.flush();  System.err.printf("%04d/%04d %7d%n", i, n, System.currentTimeMillis() - t);  } }   public static void main(String[] args) throws Exception {  new D().run(); }  private int ni() { return Integer.parseInt(in.next()); } private static void tr(Object... o) { System.out.println(o.length == 1 ? o[0] : Arrays.toString(o)); } private void tra(int[] a) {System.out.println(Arrays.toString(a));} private void tra(int[][] a) {  for(int[] e : a){  System.out.println(Arrays.toString(e));  } }  }
3	public class Main { public static void main(String[] args) {  Reader in = new Reader();  int n = in.nextInt();  int[] a = in.na(n);  HashMap<Long, ArrayList<Pair>> v = new HashMap<>();  for(int i = 0; i<n; i++) {  long s = 0;  for(int j = i; j<n; j++) {   s+=a[j];   Pair p = new Pair(i+1, j+1);   if(v.containsKey(s)) {   v.get(s).add(p);   }else {   ArrayList<Pair> xd = new ArrayList<>();   xd.add(p);   v.put(s,xd);   }  }  }  ArrayList<Pair> ans = new ArrayList<>();  for(Entry<Long,ArrayList<Pair>> e : v.entrySet()) {  ArrayList<Pair> pairs = e.getValue();  Collections.sort(pairs);  Stack<Pair> st = new Stack<>();  for(int i = 0; i<pairs.size(); i++) {   Pair cur = pairs.get(i);   if(st.isEmpty()||st.peek().r<cur.l) {   st.push(cur);   }else if(st.peek().r>cur.r) {    st.pop();    st.push(cur);   }   if(st.size()>ans.size()) ans = new ArrayList<>(st);  }  }  System.out.println(ans.size());  for(Pair p : ans)  System.out.println(p.l +" "+p.r); } static class Pair implements Comparable<Pair>{  int l,r;  public Pair(int l, int r) {  this.l = l;  this.r = r;  }  @Override  public int compareTo(Pair o) {  return this.l - o.l;  } } static class Reader {  static BufferedReader br;  static StringTokenizer st;  public Reader() {  this.br = new BufferedReader(new InputStreamReader(System.in));  }  public int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = nextInt();  return a;  }  public long[] nl(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  public String[] nS(int n) {  String[] a = new String[n];  for (int i = 0; i < n; i++)   a[i] = next();  return a;  }  public int nextInt() {  if (st == null || !st.hasMoreTokens())   try {   readLine();   } catch (Exception e) {   }  return Integer.parseInt(st.nextToken());  }  public double nextDouble() {  if (st == null || !st.hasMoreTokens())   try {   readLine();   } catch (Exception e) {   }  return Double.parseDouble(st.nextToken());  }  public Long nextLong() {  if (st == null || !st.hasMoreTokens())   try {   readLine();   } catch (Exception e) {   }  return Long.parseLong(st.nextToken());  }  public String next() {  if (st == null || !st.hasMoreTokens())   try {   readLine();   } catch (Exception e) {   }  return st.nextToken();  }  public static void readLine() {  try {   st = new StringTokenizer(br.readLine());  } catch (Exception e) {  }  } } }
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]);   }   } }
1	public class Dialog1 {   private static int n ;   private static String s ;   private static char[] a;   public static void main(String[] args) {    Scanner input = new Scanner(System.in);    n = input.nextInt() ;    s = input.next() ;    a = s.toCharArray();    for(int i = 0 ; i < 200 ; ++i) {     int cur = i ;     boolean fl = true ;     for(int j = 0 ; j < n ; ++j) {      if(a[j] == '+')       ++cur ;      else       --cur ;      if(cur < 0)       fl = false ;     }     if(fl) {      System.out.print(cur);      return ;     }    }   }  }
2	public class B {  final int MOD = (int)1e9 + 7; final double eps = 1e-12; final int INF = (int)1e9;  public B () {  long N = sc.nextInt();  long X = sc.nextInt() - 1;  long Y = sc.nextInt() - 1;  long C = sc.nextInt();  long [] A1 = new long [] { X, Y };  long [] A2 = new long [] { X, Y };  long [] B1 = new long [] { X, Y };  long [] B2 = new long [] { X, Y };  long [] C1 = new long [] { X, Y };  long [] C2 = new long [] { X, Y };  long [] D1 = new long [] { X, Y };  long [] D2 = new long [] { X, Y };   long cnt = 1, T = 0;   while (cnt < C) {  if (A1[0] > 0) --A1[0]; else --A1[1];  if (A2[0] > 0) --A2[0]; else ++A2[1];    if (B1[1] > 0) --B1[1]; else --B1[0];  if (B2[1] > 0) --B2[1]; else ++B2[0];    if (C1[0] < N-1) ++C1[0]; else --C1[1];  if (C2[0] < N-1) ++C2[0]; else ++C2[1];    if (D1[1] < N-1) ++D1[1]; else --D1[0];  if (D2[1] < N-1) ++D2[1]; else ++D2[0];      long [] Z = { B1[0] - A1[0],    C1[0] - B2[0],    C2[0] - D2[0],    D1[0] - A2[0] };    for (long z : Z)   if (z >= 0)   cnt += (z+1);    if (Arrays.equals(A1, A2)) --cnt;  if (Arrays.equals(B1, B2)) --cnt;  if (Arrays.equals(C1, C2)) --cnt;  if (Arrays.equals(D1, D2)) --cnt;    ++T;  }   exit(T); }    static MyScanner sc;  static class MyScanner {  public String next() {  newLine();  return line[index++];  }   public char nextChar() {  return next().charAt(0);  }    public int nextInt() {  return Integer.parseInt(next());  }   public long nextLong() {  return Long.parseLong(next());  }   public double nextDouble() {  return Double.parseDouble(next());  }   public String nextLine() {  line = null;  return readLine();  }   public String [] nextStrings() {  line = null;  return readLine().split(" ");  }   public char [] nextChars() {  return next().toCharArray();  }  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;  }     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) {  pw.println(build(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); }  void NO() {  throw new Error("NO!"); }    static String build(Object... a) {  StringBuilder b = new StringBuilder();  for (Object o : a)  append(b, o);  return b.toString().trim();  }  static void append(StringBuilder b, Object o) {  if (o.getClass().isArray()) {  int L = Array.getLength(o);  for (int i = 0; i < L; ++i)   append(b, Array.get(o, i));  } else if (o instanceof Iterable<?>) {  for (Object p : (Iterable<?>)o)   append(b, p);  } else  b.append(" ").append(o);  }    public static void main(String[] args) {  sc = new MyScanner ();  new B();  exit(); }  static void start() {  t = millis(); }  static PrintWriter pw = new PrintWriter(System.out);  static long t;  static long millis() {  return System.currentTimeMillis(); } }
5	public class Main { private static StreamTokenizer in; private static PrintWriter out;  private static int nextInt() throws Exception {  in.nextToken();  return (int)in.nval; }  private static String nextString() throws Exception {  in.nextToken();  return in.sval; }  public static void main(String[] args) throws Exception {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(System.out);   int n = nextInt();  int[] a = new int[n];  for (int i=0; i<n; i++)  a[i] = nextInt();  Arrays.sort(a);  int u = a[0];  for (int i=0; i<n; i++)  if (a[i]>u) {   out.println(a[i]);   out.flush();   return;  }  out.println("NO");  out.flush(); } }
5	public class A implements Runnable{  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()){  try{   tok = new StringTokenizer(in.readLine());  }catch (Exception e){   return null;  }  }  return tok.nextToken(); }  int readInt() throws IOException{  return Integer.parseInt(readString()); }  long readLong() throws IOException{  return Long.parseLong(readString()); }  double readDouble() throws IOException{  return Double.parseDouble(readString()); }  public static void main(String[] args){  new Thread(null, new A(), "", 128 * (1L << 20)).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"); }  void debug(Object... objects){  if (DEBUG){  for (Object o: objects){   System.err.println(o.toString());  }  } }  public void run(){  try{  timeBegin = System.currentTimeMillis();  memoryTotal = Runtime.getRuntime().freeMemory();  init();  solve();  out.close();  time();  memory();  }catch (Exception e){  e.printStackTrace(System.err);  System.exit(-1);  } }  boolean DEBUG = false;  void solve() throws IOException{  int n = readInt();   int[] a = new int[n];  Integer[] b = new Integer[n];  for (int i = 0; i < n; ++i){  a[i] = readInt();  b[i] = a[i];  }   Arrays.sort(b);  int count = 0;  for (int i = 0; i < n; ++i){  if (a[i] != b[i]){   count++;  }  }   if (count == 2 || count == 0){  out.println("YES");  }else{  out.println("NO");  } } }
3	public class paint { static PriorityQueue<Integer> sequence;  public static void main (String [] args) throws IOException {  BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out, true);  int numSeq = Integer.parseInt(f.readLine());  sequence = new PriorityQueue<Integer>();    StringTokenizer st = new StringTokenizer(f.readLine());  for(int i = 0; i < numSeq; i++) {   sequence.add(Integer.parseInt(st.nextToken()));  }    int numColors = 0;  while(sequence.size() > 0) {   numColors++;   int smallest = sequence.poll();   PriorityQueue<Integer> temp = new PriorityQueue<Integer>();   for(int each: sequence) {   if(each % smallest != 0) {    temp.add(each);   }   }   sequence = temp;  }    System.out.println(numColors);  out.close(); }  }
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);   F2SameSumBlocksHard solver = new F2SameSumBlocksHard();   solver.solve(1, in, out);   out.close();  }  static class F2SameSumBlocksHard {   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    long arr[] = new long[n];    for (int i = 0; i < n; i++) {     arr[i] = in.scanLong();    }     HashMap<Long, ArrayList<pair>> hm = new HashMap<>();    for (int i = 0; i < n; i++) {     long sum = 0;     for (int j = i; j < n; j++) {      sum += arr[j];      if (hm.containsKey(sum)) {       hm.get(sum).add(new pair(i + 1, j + 1));      } else {       hm.put(sum, new ArrayList<>());       hm.get(sum).add(new pair(i + 1, j + 1));      }     }    }     long maxi_sum = -1;    long sum = 0;    for (Map.Entry<Long, ArrayList<pair>> k : hm.entrySet()) {     Collections.sort(k.getValue(), new Comparator<pair>() {      public int compare(pair o1, pair o2) {       return o1.r - o2.r;      }     });     int count = k.getValue().size() > 0 ? 1 : 0;     int index = 0;     for (int i = 1; i < k.getValue().size(); i++) {      if (k.getValue().get(i).l > k.getValue().get(index).r) {       count++;       index = i;      }     }      if (count > maxi_sum) {      maxi_sum = count;      sum = k.getKey();     }    }    out.println(maxi_sum);    ArrayList<pair> tt = hm.get(sum);    Collections.sort(tt, new Comparator<pair>() {     public int compare(pair o1, pair o2) {      return o1.r - o2.r;     }    });     out.println(tt.size() > 0 ? (tt.get(0).l + " " + tt.get(0).r) : (" "));    int index = 0;    for (int i = 1; i < tt.size(); i++) {     if (tt.get(i).l > tt.get(index).r) {      out.println(tt.get(i).l + " " + tt.get(i).r);      index = i;     }    }    }   class pair {    int l;    int r;    public pair(int l, int r) {     this.l = l;     this.r = r;    }   }  }  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;   }   private boolean isWhiteSpace(int n) {    if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;    else return false;   }   public long scanLong() {    long 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;   }  } }
2	public class Temppp {  public static void main(String[] args) {     Scanner sc = new Scanner(System.in);   long n = sc.nextLong();   long k = sc.nextLong();     long ans = (long) ((java.lang.Math.sqrt((9+(8*(n+k))))-3)/2);   System.out.println(n-ans);    }  }
5	public class Solution {  private static 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;  } }
4	public class A {  private BufferedReader in;  private StringTokenizer st;   void solve() throws IOException{   int len = 0;  String x = next();  HashSet<String> h = new HashSet<String>();  for (int i = 0; i < x.length(); i++) {  for (int j = i+1; j <= x.length(); j++) {   String y = x.substring(i,j);   if(h.contains(y)){   if(y.length()>len) len = y.length();   }   else h.add(y);  }  }  System.out.println(len);   } 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()); }  long nextLong() throws IOException {  return Long.parseLong(next()); }  double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static void main(String[] args) throws IOException {    new A(); } }
2	public class B {   public static void main(String[] args) throws NumberFormatException,  IOException {  Scanner sc = new Scanner(System.in);  long n = sc.nextLong(), k = sc.nextLong();        if (n == 1) {  System.out.println(0);  return;  }  if (n <= k) {  System.out.println(1);  return;  }  long seg = (((k + 1) * (k) / 2) - 1);  seg += (2 - k);  if (seg < n) {  System.out.println(-1);  return;  }     long s = 1, f = k;  long mid = (s + f) / 2;  while (s + 1 < f) {  long seg_m = (((mid + k - 1) * (k - mid) / 2));      if (seg_m >= n - 1) {          s = mid;  } else   f = mid;  mid = (s + f) / 2;  }           System.out.println(k - s); } }
0	public class A {   public static void main(String[] args) {  Account acnt = new Account();  acnt.solve();  acnt.print(); } } class Account {  Account() {  Scanner scr = new Scanner(System.in);  n = scr.nextInt(); }  void solve() {  if (n > 0) {  ans = n;  }  else {  int nn = -n;  int ans1 = nn/10;  int ans2 = nn % 10 + (nn/100)*10;  if (ans1 < ans2){   ans = -ans1;  }  else {   ans = -ans2;  }  }   }  void print(){  System.out.println(ans); }  int ans; int n; }
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 char nextChar() {  return next().charAt(0);  }    public int nextInt() {  return Integer.parseInt(next());  }   public long nextLong() {  return Long.parseLong(next());  }   public double nextDouble() {  return Double.parseDouble(next());  }   public String nextLine() {  line = null;  return readLine();  }   public String [] nextStrings() {  line = null;  return readLine().split(" ");  }   public char [] nextChars() {  return next().toCharArray();  }  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 cprint(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); }  void NO() {  throw new Error("NO!"); }    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(); } }
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()); }  int[] nextIntArray(int size) throws IOException {  int[] ret = new int [size];  for (int i = 0; i < size; i++)  ret[i] = nextInt();  return ret; }  long[] nextLongArray(int size) throws IOException {  long[] ret = new long [size];  for (int i = 0; i < size; i++)  ret[i] = nextLong();  return ret; }  double[] nextDoubleArray(int size) throws IOException {  double[] ret = new double [size];  for (int i = 0; i < size; i++)  ret[i] = nextDouble();  return ret; }  String nextLine() throws IOException {  st = new StringTokenizer("");  return in.readLine(); }  boolean EOF() throws IOException {  while (!st.hasMoreTokens()) {  String s = in.readLine();  if (s == null)   return true;  st = new StringTokenizer(s);  }  return false; }   void printRepeat(String s, int count) {  for (int i = 0; i < count; i++)  out.print(s); }  void printArray(int[] array) {  if (array == null || array.length == 0)  return;  for (int i = 0; i < array.length; i++) {  if (i > 0) out.print(' ');  out.print(array[i]);  }  out.println(); }  void printArray(long[] array) {  if (array == null || array.length == 0)  return;  for (int i = 0; i < array.length; i++) {  if (i > 0) out.print(' ');  out.print(array[i]);  }  out.println(); }  void printArray(double[] array) {  if (array == null || array.length == 0)  return;  for (int i = 0; i < array.length; i++) {  if (i > 0) out.print(' ');  out.print(array[i]);  }  out.println(); }  void printArray(double[] array, String spec) {  if (array == null || array.length == 0)  return;  for (int i = 0; i < array.length; i++) {  if (i > 0) out.print(' ');  out.printf(Locale.US, spec, array[i]);  }  out.println(); }  void printArray(Object[] array) {  if (array == null || array.length == 0)  return;  boolean blank = false;  for (Object x : array) {  if (blank) out.print(' '); else blank = true;  out.print(x);  }  out.println(); }  @SuppressWarnings("rawtypes") void printCollection(Collection collection) {  if (collection == null || collection.isEmpty())  return;  boolean blank = false;  for (Object x : collection) {  if (blank) out.print(' '); else blank = true;  out.print(x);  }  out.println(); }   static String memoryStatus() {  return (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory() >> 20) + "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB"; }  static void checkMemory() {  System.err.println(memoryStatus()); }  static long prevTimeStamp = Long.MIN_VALUE;  static void updateTimer() {  prevTimeStamp = System.currentTimeMillis(); }  static long elapsedTime() {  return (System.currentTimeMillis() - prevTimeStamp); }  static void checkTimer() {  System.err.println(elapsedTime() + " ms"); }  static void chk(boolean f) {  if (!f) throw new RuntimeException("Assert failed"); }  static void chk(boolean f, String format, Object ... args) {  if (!f) throw new RuntimeException(String.format(format, args)); }  static void log(String format, Object ... args) {  if (writeLog) System.err.println(String.format(Locale.US, format, args)); } }
5	public class ProblemA {  private final BufferedReader in;  private final PrintStream out;  private StringTokenizer tok = new StringTokenizer("");  private String nextLine = null;  public static void main(String[] args) throws Exception {   new ProblemA();  }  private ProblemA() throws Exception {   in = new BufferedReader(new InputStreamReader(System.in));   out = System.out;   start();   end();  }  private int nextInt() {   return Integer.parseInt(nextWord());  }  private String nextWord() {   if (tok.hasMoreTokens()) {    return tok.nextToken();   } else {    while (!tok.hasMoreTokens()) {     try {      nextLine = in.readLine();      if (nextLine == null) {       return null;      } else {       tok = new StringTokenizer(nextLine);      }     } catch (IOException ex) {      Logger.getLogger(ProblemA.class.getName()).log(Level.SEVERE, null, ex);     }    }    return tok.nextToken();   }  }  private void start() {   int n = nextInt();   int k = nextInt();   T[] ts = new T[n];   for (int i = 0; i < n; i++) {    ts[i] = new T(nextInt(), nextInt());   }   Arrays.sort(ts, new Comparator<T>() {    @Override    public int compare(T o1, T o2) {     if (o1.p > o2.p) {      return -1;     }     if (o1.p < o2.p) {      return 1;     }     if (o1.t < o2.t) {      return -1;     }     if (o1.t > o2.t) {      return 1;     }     return 0;    }   });   int t = ts[k - 1].t;   int p = ts[k - 1].p;   int res = 0;   for (int i = 0; i < n; i++) {    if (ts[i].p == p && ts[i].t == t) {     res++;    }   }   out.println(res);  }  class T {   int p;   int t;   public T(int p, int t) {    this.p = p;    this.t = t;   }  }  private void end() {   out.close();  } }
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));  } }
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 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;  } } 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)); } }
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 class ii implements Comparable< ii >{   int x, y;   public ii(){}   public ii(int xx, int yy){ x=xx; y=yy; }   public int compareTo(ii p){ return x!=p.x ? x-p.x : y-p.y; }   public int hashCode(){ return 31*x+y; }   public boolean equals(Object o){    if(!(o instanceof ii)) return false;    ii p = (ii) o;    return x==p.x && y==p.y;   }   public String toString(){ return "("+x+", "+y+")"; }  }    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 void rev(Object[] a){ for(int i=0; i<a.length/2; ++i){ Object t=a[i]; a[i]=a[a.length-1-i]; a[a.length-1-i]=t; } }  public void rev(int[] a){ for(int i=0; i<a.length/2; ++i){ int t=a[i]; a[i]=a[a.length-1-i]; a[a.length-1-i]=t; } }  public int bit_count(long x){ return x==0 ? 0 : 1+bit_count(x&(x-1)); }  public int low_bit(int x){ return x&-x; }  public int sign(int x){ return x<0 ? -1 : x>0 ? 1 : 0; }  public int sign(double x){ return x<-EPS ? -1 : x>EPS ? 1 : 0; }  int[] unpack(ArrayList< Integer > a){   int[] ret = new int[a.size()];   for(int i=0; i<a.size(); ++i) ret[i] = a.get(i);   return ret;  }    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);  }       public class myScanner{   private BufferedReader f;   private StringTokenizer st;   public myScanner(BufferedReader ff){ f=ff; st=new StringTokenizer(""); }   public int nextInt(){ return Integer.parseInt(nextToken()); }   public double nextDouble(){ return Double.parseDouble(nextToken()); }   public String nextLine(){    st=new StringTokenizer("");    String ret="";    try{ ret=f.readLine(); }catch(Exception e){}    return ret;   }   public String nextToken(){    while(!st.hasMoreTokens()) try{ st=new StringTokenizer(f.readLine()); } catch(Exception e){}    return st.nextToken();   }  }  }
4	public final class Solution {   static PrintWriter out = new PrintWriter(System.out);  static FastReader in = new FastReader();  static long mod = (long) 1e9 + 7;  static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(1, 0), new Pair(0, -1), new Pair(0, 1)};          public static void main(String[] args) {   int n = i();   int m = i();   int k = i();   int[][] a = new int[n][m - 1];   for (int i = 0; i < n; i++) {    a[i] = input(m - 1);   }   int[][] b = new int[n - 1][m];   for (int i = 0; i < n - 1; i++) {    b[i] = input(m);   }   if (k % 2 > 0) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      out.print(-1 + " ");     }     out.println();    }    out.flush();    return;   }   int[][][] f = new int[n][m][k / 2 + 1];   for (int s = 1; s <= k / 2; s++) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      int ans = -1;      if (j > 0) {       ans = f[i][j - 1][s - 1] + a[i][j - 1];      }      if (i > 0) {       int t = f[i - 1][j][s - 1] + b[i - 1][j];       ans = ans == -1 ? t : Math.min(ans, t);      }      if (i < n - 1) {       int t = f[i + 1][j][s - 1] + b[i][j];       ans = ans == -1 ? t : Math.min(ans, t);      }      if (j < m - 1) {       int t = f[i][j + 1][s - 1] + a[i][j];       ans = ans == -1 ? t : Math.min(ans, t);      }      f[i][j][s] = ans;     }    }   }   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     out.print(f[i][j][k / 2] * 2 + " ");    }    out.println();   }   out.flush();  }  static int sd(long i) {   int d = 0;   while (i > 0) {    d += i % 10;    i = i / 10;   }   return d;  }  static Set<Integer> getFactors(int x) {   Set<Integer> res = new HashSet<>();   if (x <= 3) {    res.add(x);   } else {    int t = x;    for (int f = 2; f <= x / 2; f++) {     if (t == 1) {      break;     }     if (t % f == 0) {      res.add(f);      while (t % f == 0) {       t = t / f;      }     }    }    if (t > 1) {     res.add(t);    }   }   return res;  }   static int lower(long A[], long x) {   int l = -1, r = A.length;   while (r - l > 1) {    int m = (l + r) / 2;    if (A[m] >= x) {     r = m;    } else {     l = m;    }   }   return r;  }  static int upper(long A[], long x) {   int l = -1, r = A.length;   while (r - l > 1) {    int m = (l + r) / 2;    if (A[m] <= x) {     l = m;    } else {     r = m;    }   }   return l;  }  static void swap(int A[], int a, int b) {   int t = A[a];   A[a] = A[b];   A[b] = t;  }  static int lowerBound(int A[], int low, int high, int x) {   if (low > high) {    if (x >= A[high]) {     return A[high];    }   }   int mid = (low + high) / 2;   if (A[mid] == x) {    return A[mid];   }   if (mid > 0 && A[mid - 1] <= x && x < A[mid]) {    return A[mid - 1];   }   if (x < A[mid]) {    return lowerBound(A, low, mid - 1, x);   }   return lowerBound(A, mid + 1, high, x);  }   static long pow(long a, long b) {   long pow = 1;   long x = a;   while (b != 0) {    if ((b & 1) != 0) {     pow = (pow * x) % mod;    }    x = (x * x) % mod;    b /= 2;   }   return pow;  }  static boolean isPrime(long N) {   if (N <= 1) {    return false;   }   if (N <= 3) {    return true;   }   if (N % 2 == 0 || N % 3 == 0) {    return false;   }   for (int i = 5; i * i <= N; i = i + 6) {    if (N % i == 0 || N % (i + 2) == 0) {     return false;    }   }   return true;  }  static void print(char A[]) {   for (char c : A) {    out.print(c);   }   out.println();  }  static void print(boolean A[]) {   for (boolean c : A) {    out.print(c + " ");   }   out.println();  }  static void print(int A[]) {   for (int c : A) {    out.print(c + " ");   }   out.println();  }  static void print(long A[]) {   for (long i : A) {    out.print(i + " ");   }   out.println();  }  static void print(List<Integer> A) {   for (int a : A) {    out.print(a + " ");   }  }  static int i() {   return in.nextInt();  }  static long l() {   return in.nextLong();  }  static String s() {   return in.nextLine();  }  static int[] input(int N) {   int A[] = new int[N];   for (int i = 0; i < N; i++) {    A[i] = in.nextInt();   }   return A;  }  static long[] inputLong(int N) {   long A[] = new long[N];   for (int i = 0; i < A.length; i++) {    A[i] = in.nextLong();   }   return A;  }  static int GCD(int a, int b) {   if (b == 0) {    return a;   } else {    return GCD(b, a % b);   }  }  static long GCD(long a, long b) {   if (b == 0) {    return a;   } else {    return GCD(b, a % b);   }  } } class SegmentTree {  long[] t;  public SegmentTree(int n) {   t = new long[n + n];   Arrays.fill(t, Long.MIN_VALUE);  }  public long get(int i) {   return t[i + t.length / 2];  }  public void add(int i, long value) {   i += t.length / 2;   t[i] = value;   for (; i > 1; i >>= 1) {    t[i >> 1] = Math.max(t[i], t[i ^ 1]);   }  }    public long max(int a, int b) {   long res = Long.MIN_VALUE;   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;  } } class Pair {  int i, j;  Pair(int i, int j) {   this.i = i;   this.j = j;  } } 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());  }  double nextDouble() {   return Double.parseDouble(next());  }  String nextLine() {   String str = "";   try {    str = br.readLine();   } catch (IOException e) {    e.printStackTrace();   }   return str;  }  }
4	public class D { static byte[] buf = new byte[1<<26];  static int bp = -1;   public static void main(String[] args) throws IOException {    DataInputStream in = new DataInputStream(System.in);     in.read(buf, 0, 1<<26);   int n = nni();  int m = nni();  int k = nni();   if (k%2==1) {  for (int i = 0; i < n; ++i) {   StringBuilder ans = new StringBuilder();   String sp = "";   for (int j = 0; j < m; ++j) {   ans.append(sp+"-1");   sp = " ";   }   System.out.println(ans);  }  return;  }   int[][] lr = new int[n][m-1];  int[][] ud = new int[n-1][m];  for (int i = 0; i < n; ++i) {  for (int j = 0; j < m-1; ++j) {   lr[i][j] = nni();  }  }  for (int i = 0; i < n-1; ++i) {  for (int j = 0; j < m; ++j) {   ud[i][j] = nni();  }  }   int[][][] ans = new int[k/2+1][n][m];   for (int i = 0; i < n; ++i) {  for (int j = 0; j < m; ++j) {   for (int q = 1; q <= k/2; ++q) {   ans[q][i][j] = 123456789;   }  }  }   for (int uq = 0; uq < k/2; ++uq) {  for (int ui = 0; ui < n; ++ui) {   for (int uj = 0; uj < m; ++uj) {   int w = ans[uq][ui][uj];   if (ui>0 && w+ud[ui-1][uj]<ans[uq+1][ui-1][uj]) {    ans[uq+1][ui-1][uj] = w+ud[ui-1][uj];   }   if (ui<n-1 && w+ud[ui][uj]<ans[uq+1][ui+1][uj]) {    ans[uq+1][ui+1][uj] = w+ud[ui][uj];   }   if (uj>0 && w+lr[ui][uj-1]<ans[uq+1][ui][uj-1]) {    ans[uq+1][ui][uj-1] = w+lr[ui][uj-1];   }   if (uj<m-1 && w+lr[ui][uj]<ans[uq+1][ui][uj+1]) {    ans[uq+1][ui][uj+1] = w+lr[ui][uj];   }   }  }  }   for (int i = 0; i < n; ++i) {  StringBuilder as = new StringBuilder();  String sp = "";  for (int j = 0; j < m; ++j) {   as.append(sp+ans[k/2][i][j]*2);   sp = " ";  }  System.out.println(as);  } }  public static int nni() {   int ret = 0;   byte b = buf[++bp];   while (true) {    ret = ret*10+b-'0';    b = buf[++bp];    if (b<'0'||b>'9') {    while (buf[bp+1]=='\r'||buf[bp+1]=='\n'||buf[bp+1]==' ') {++bp;}    break;    }   }   return ret;  } }
5	public class Main {  static class Scanner {  StreamTokenizer in;  boolean forceMode = false;   Scanner(InputStream is, String codePage, boolean forceMode) {   in = new StreamTokenizer(new BufferedReader(new InputStreamReader(is)));   if (!forceMode) {    in.resetSyntax();    in.wordChars(33, 255);    in.whitespaceChars(0, 32);   }  }   Scanner(InputStream is, String codePage) {   in = new StreamTokenizer(new BufferedReader(new InputStreamReader(is)));   if (!forceMode) {    in.resetSyntax();    in.wordChars(33, 255);    in.whitespaceChars(0, 32);   }  }   String next() {   try {    in.nextToken();    return in.sval;   } catch (Exception e) {    throw new Error();   }  }   int nextInt() {   if (forceMode) {    try {     in.nextToken();     return (int) in.nval;    } catch (Exception e) {     throw new Error();    }   } else {    return Integer.parseInt(next());   }  }   long nextLong() {   if (forceMode) {    throw new Error("No long at force mod!");   } else {    return Long.parseLong(next());   }   }   double nextDouble() {   if (forceMode) {    try {     in.nextToken();     return in.nval;    } catch (Exception e) {     throw new Error();    }   } else {    return Double.parseDouble(next());   }  }  }  static class Assertion {  static void checkRE(boolean e) {   if (!e) {    throw new Error();   }  }   static void checkTL(boolean e) {   if (!e) {    int idx = 1;    while (idx > 0) {     idx++;    }   }  }  }  Scanner in;  PrintWriter out;  class Int implements Comparable<Int> {  int value;  int pos;   public Int(int value, int pos) {   this.value = value;   this.pos = pos;  }   @Override  public int compareTo(Int second) {   if (this.value == second.value) {    return this.pos - second.pos;   } else {    return this.value - second.value;   }  }  }  void solve() {  int n = in.nextInt();  Int ar[] = new Int[n];  for (int i = 0; i < ar.length; i++) {   ar[i] = new Int(in.nextInt(), i);  }  Arrays.sort(ar);  int cnt = 0;  for (int i = 0; i < ar.length; i++) {   if (ar[i].value!=ar[ar[i].pos].value) {    cnt++;   }  }  if (cnt == 2 || cnt == 0) {   out.println("YES");  } else {   out.println("NO");  }  }  final static String fileName = "";  void run() {                    in = new Scanner(System.in, "");  out = new PrintWriter(System.out);  try {   solve();  } catch (Exception e) {   throw new Error(e);  } finally {   out.close();  }  }  public static void main(String[] args) {  new Main().run();  } }
0	public class A {  public static void main(String args[]) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int f1 = 0;   int f2 = 1;   int f3 = 1;   while (f3 < n) {    f1 = f2;    f2 = f3;    f3 = f1 + f2;   }   if (n == 0) {    System.out.println(0 + " " + 0 + " " + 0);   } else if (f3 == n) {    System.out.println(f1 + " " + f1 + " " + (f2 - f1));   } else {    System.out.println("I'm too stupid to solve this problem");   }  } }
3	public class Solution{   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());   }   double nextDouble()   {    return Double.parseDouble(next());   }   String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  }   public static void main(String args[] ) {     FastReader sc = new FastReader();   int n = sc.nextInt();   int m = sc.nextInt();   int[] arr = new int[105];     for(int i=0;i<m;i++){    int a = sc.nextInt();    arr[a]++;   }     for(int i=1;i<=1000;i++){    int sum=0;       for(int a:arr){     if(a!=0){      sum+=(a/i);     }    }           if(sum<n){     System.out.println(i-1);     return;    }      }  } }
3	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();   int[] font=new int[n];   int[] cost=new int[n];   for(int i=0;i<n;i++) {    font[i]=sc.nextInt();     }   for(int i=0;i<n;i++) {    cost[i]=sc.nextInt();   }   int[] dou= new int[n];   for(int i=0;i<n;i++) {    int min=Integer.MAX_VALUE;    for(int j=0;j<i;j++) {     if(font[j]<font[i]) {      if(min>cost[i]+cost[j]) {       min=cost[i]+cost[j];      }     }    }    dou[i]=min;   }   int ans=Integer.MAX_VALUE;   for(int i=0;i<n;i++) {    int min=Integer.MAX_VALUE;    for(int j=0;j<i;j++) {     if(dou[j]!=Integer.MAX_VALUE && font[j]<font[i]) {      if(min>dou[j]+cost[i]) {       min=dou[j]+cost[i];      }     }    }    if(min<ans) {     ans=min;    }   }   if(ans==Integer.MAX_VALUE) {    System.out.println(-1);   }   else {    System.out.println(ans);   }  } } 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());  }   double nextDouble()  {   return Double.parseDouble(next());  }   String nextLine()  {   String str = "";   try   {    str = br.readLine();   }   catch (IOException e)   {    e.printStackTrace();   }   return str;  } }
5	public class _P015A{  Scanner sc=new Scanner(System.in);  int INF=1<<28;  double EPS=1e-9;  int n, t;  int[][] a;  void run(){   n=sc.nextInt();   t=sc.nextInt();   a=new int[n][2];   for(int i=0; i<n; i++){    a[i][0]=sc.nextInt();    a[i][1]=sc.nextInt();   }   solve();  }  void solve(){   sort(a, new Comparator<int[]>(){    @Override    public int compare(int[] a0, int[] a1){     return a0[0]-a1[0];    }   });   int ans=2;   for(int i=0; i<n-1; i++){    int s=(a[i+1][0]*2-a[i+1][1])-(a[i][0]*2+a[i][1]);    if(s>t*2){     ans+=2;    }else if(s==t*2){     ans++;    }   }   println(ans+"");  }  void println(String s){   System.out.println(s);  }  void print(String s){   System.out.print(s);  }  void debug(Object... os){   System.err.println(Arrays.deepToString(os));  }  public static void main(String[] args){   new _P015A().run();  } }
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 nextLine() {   String str = "";   try {   str = reader.readLine();  } catch (IOException e) {     e.printStackTrace();  }   return str;   }     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 double nextDouble() {   return Double.parseDouble(next());   }    } }
1	public class TwoSets<V> {  private static int n;  private static int a;  private static int b;  private static List<Node<Integer>> nodes = new LinkedList<Node<Integer>>();  private static Map<Integer, Node<Integer>> datas = new HashMap<Integer, Node<Integer>>();  private static Node<Integer> first;  private static Node<Integer> second;  private static TwoSets<Integer> sets = new TwoSets<Integer>();  private static class Node<V> {  V node;  Node<V> parent;  int rank;  int color = -1;  boolean inprogress;  public Node() {  this.parent = this; }  @Override public String toString() {  return String.format("{node: %s, parent: %s, rank: %s, color:%s}",   node, parent.node, rank, color); }  }  public Node<V> makeSet(V x) {  Node<V> node = new Node<V>();  node.node = x; node.parent = node; node.rank = 0;  return node;  }  public void link(Node<V> x, Node<V> y) {  if (x.rank > y.rank) {  y.parent = x; } else {  x.parent = y;  if (x.rank == y.rank) {  y.rank++;  } }  }  public Node<V> findSet(Node<V> x) {  if (x.parent != x) {  x.parent = findSet(x.parent); }  return x.parent;  }  public void union(Node<V> x, Node<V> y) {  Node<V> rtX = findSet(x); Node<V> rtY = findSet(y); if (rtX.parent != rtY.parent) {  link(rtX, rtY); }  }  public V getNode(Node<V> x) { return x.node;  }  private int getColor(Node<V> node) {  int color; Node<V> parent = findSet(node); color = parent.color;  return color;  }  private void setColor(Node<V> node, int color) { Node<V> parent = findSet(node); parent.color = color;  }  private static Node<Integer> getOrInitNode(Integer key) {  Node<Integer> node = datas.get(key);  if (node == null) {  node = sets.makeSet(key);  datas.put(key, node); }  return node;  }  private static void initNodes(Scanner scanner) {  int key; Node<Integer> node; for (int i = 0; i < n; i++) {  key = scanner.nextInt();  node = getOrInitNode(key);  nodes.add(node); }  }  private static void unionAll(Node<Integer> value) {  int color = sets.getColor(value); if (color == 0) {  if (first == null) {  first = value;  } else {  sets.union(first, value);  } } else if (color == 1) {  if (second == null) {  second = value;  } else {  sets.union(second, value);  } }  }  private static int getKey(Node<Integer> value, int color) {  int key = value.node;  if (color == 0) {  key = a - key; } else {  key = b - key; }  return key;  }  private static boolean checkOpposite(Node<Integer> value, int color) {  boolean valid;  if (value.inprogress) {  valid = Boolean.TRUE; } else {  value.inprogress = Boolean.TRUE;  int opColor = 1 - color;  int key = getKey(value, opColor);  Node<Integer> node = datas.get(key);  valid = (value.node.equals(key)) || (node == null);  if (!valid) {  key = getKey(node, color);  Node<Integer> child = datas.get(key);  valid = (child != null);  if (valid) {   valid = checkOpposite(child, color);   if (valid) {  sets.union(value, node);  sets.union(value, child);  value.inprogress = Boolean.FALSE;   }  }  }  value.inprogress = Boolean.FALSE; }  return valid;  }  private static boolean checkNodes(Node<Integer> value, int color) {  boolean valid;  int key = getKey(value, color); int opColor = 1 - color; Node<Integer> node = datas.get(key); valid = (value.node.equals(key)) || (node != null); if (valid) {  valid = checkOpposite(value, color);  if (valid) {  sets.union(value, node);  sets.setColor(value, color);  } else if (color == 0) {  valid = checkNodes(value, opColor);  } } else if (color == 0) {  valid = checkNodes(value, opColor); }  return valid;  }  private static void format(StringBuilder builder, int i) {  if (i > 0) {  builder.append(' '); }  }  private static String printNodes() {  String text;  StringBuilder builder = new StringBuilder(); Iterator<Node<Integer>> iterator = nodes.iterator(); int i = 0; Node<Integer> node; while (iterator.hasNext()) {  format(builder, i);  node = iterator.next();  builder.append(sets.getColor(node));  i++; } text = builder.toString().trim();  return text;  }  private static boolean checkNodes(int color) {  boolean valid = Boolean.TRUE;  for (Node<Integer> value : nodes) {  if (sets.getColor(value) == -1) {  valid = checkNodes(value, color);  if (valid) {   unionAll(value);  } else {   break;  }  } }  return valid;  }  private static void calculate() {  int color = 0; boolean valid = checkNodes(color); String message = "NO"; if (valid) {  message = "YES";  String array = printNodes();  System.out.println(message);  System.out.println(array); } else {  System.out.println(message); }  }  public static void main(String[] args) {  Scanner scanner = new Scanner(System.in); try {  n = scanner.nextInt();  a = scanner.nextInt();  b = scanner.nextInt();  initNodes(scanner);  calculate(); } finally {  scanner.close(); }  } }
1	public class hackerearth {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);   int n=sc.nextInt();   HashMap<String,Integer> map=new HashMap<>();   HashMap<String,Integer> map2=new HashMap<>();   for(int i=0;i<n;i++)   {    String s=sc.next();    if(map.containsKey(s))     map.put(s,map.get(s)+1);    else     map.put(s,1);   }   for(int i=0;i<n;i++)   {    String s=sc.next();    if(map2.containsKey(s))     map2.put(s,map2.get(s)+1);    else     map2.put(s,1);    if(map.containsKey(s)) {     int feq = map.get(s);     feq--;     if (feq <= 0)      map.remove(s);     else      map.put(s, feq);    }   }    int ans=0;   for(Map.Entry<String,Integer> entry:map.entrySet())   {    ans+=entry.getValue();   }   System.out.println(ans);   }  }
3	public class Codeshefcode{ public static void main(String[] args) throws IOException{  Solver Machine = new Solver() ;  Machine.Solve() ;  Machine.Finish() ;                           } } class Mod{ static long mod=1000000007 ; static long d(long a,long b){ return (a*MI(b))%mod ; } static long m(long a,long b){ return (a*b)%mod ; } static private long MI(long a){ return pow(a,mod-2) ; } static long pow(long a,long b){  if(b<0) return pow(MI(a),-b) ;  long val=a ; long ans=1 ;  while(b!=0){  if((b&1)==1) ans = (ans*val)%mod ;   val = (val*val)%mod ;   b/=2 ;  }  return ans ; } } class pair implements Comparable<pair>{ int x ; int y ;  pair(int x,int y){ this.x=x ; this.y=y ;}  public int compareTo(pair p){  return (this.x<p.x ? -1 : (this.x>p.x ? 1 : (this.y<p.y ? -1 : (this.y>p.y ? 1 : 0)))) ; } } 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 mylist extends ArrayList<Integer>{} class myset extends TreeSet<Integer>{} class mystack extends Stack<Integer>{} class mymap extends TreeMap<Long,Integer>{} 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()) ; } long l() throws IOException{  return Long.parseLong(s()) ; } double d() throws IOException {  return Double.parseDouble(s()) ; } }
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()); } }
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;  } }
5	public class Main { public static void main(String[] args) {  Scanner in =new Scanner(System.in);  int n = in.nextInt();  int k = in.nextInt();  int[] arr = new int[n];  for(int i = 0; i < n; i++)  arr[i] = in.nextInt();  for(int i = n-1; i > 0; i--)  arr[i] -= arr[i-1];  arr[0] = 0;  Arrays.sort(arr);  long sum = 0;  for(int i = n-k; i >= 0; i--)  sum += arr[i];  System.out.println(sum); } }
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);   F solver = new F();   solver.solve(1, in, out);   out.close();  }  static class F {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.ni(), m = in.ni();    int[][] a = new int[n][m];    for (int i = 0; i < n; i++) {     a[i] = in.na(m);    }    if (n == 1) {     int ans = Integer.MAX_VALUE;     for (int i = 1; i < m; i++) {      ans = Math.min(ans, Math.abs(a[0][i] - a[0][i - 1]));     }     out.println(ans);     return;    }    int[][] mk = new int[n][n];    int[][] mk1 = new int[n][n];    for (int i = 0; i < n; i++) {     for (int j = i + 1; j < n; j++) {      int minK = Integer.MAX_VALUE;      int minK1 = Integer.MAX_VALUE;      int minK2 = Integer.MAX_VALUE;      for (int l = 0; l < m; l++) {       minK = Math.min(minK, Math.abs(a[i][l] - a[j][l]));       if (l > 0) {        minK1 = Math.min(minK1, Math.abs(a[i][l] - a[j][l - 1]));        minK2 = Math.min(minK2, Math.abs(a[i][l - 1] - a[j][l]));       }      }      mk[i][j] = mk[j][i] = minK;      mk1[i][j] = minK1;      mk1[j][i] = minK2;     }    }    int ans = 0;    for (int first = 0; first < n; first++) {     int[][] dp = new int[1 << n][n];     for (int mask = 1; mask < (1 << n) - 1; mask++) {      int bc = Integer.bitCount(mask);      if ((mask & (1 << first)) != 0) {       if (bc == 1) {        dp[mask][first] = Integer.MAX_VALUE;       }       for (int i = 0; i < n; i++) {        if ((mask & (1 << i)) != 0) {         for (int j = 0; j < n; j++) {          if ((mask & (1 << j)) == 0) {           dp[mask | (1 << j)][j] = Math.max(dp[mask | (1 << j)][j], Math.min(dp[mask][i], mk[i][j]));          }         }        }       }      }     }     for (int i = 0; i < n; i++) {      if (i != first) {       ans = Math.max(ans, Math.min(dp[(1 << n) - 1][i], mk1[first][i]));      }     }    }    out.println(ans);   }  }  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 int[] na(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++) a[i] = ni();    return a;   }  } }
3	public class Main {  Scanner scanner = new Scanner(System.in);  public static void main(String[] args) {   new Main().solve();  }   void solve() {   int n = scanner.nextInt();   scanner.nextLine();   String s1 = scanner.nextLine();   String s2 = scanner.nextLine();    int ans = 0;   boolean a[] = new boolean[30];   boolean b[] = new boolean[30];   for (int i = 0; i < n; i++) {    if (s1.charAt(i) != s2.charAt(i)) {     ans ++;     a[s1.charAt(i) - 'a'] = true;     b[s2.charAt(i) - 'a'] = true;    }   }   for (int i = 0; i < n; i++) {    if (s1.charAt(i) != s2.charAt(i) && a[s2.charAt(i) - 'a'] && b[s1.charAt(i) - 'a']) {     for (int j = i + 1; j < n; j ++) {      if (s1.charAt(i) == s2.charAt(j) && s1.charAt(j) == s2.charAt(i)) {       out.println(ans - 2);       out.println((i + 1) + " " + (j + 1));       return;      }     }    }   }   for (int i = 0; i < n; i++) {    if (s1.charAt(i) != s2.charAt(i) && (a[s2.charAt(i) - 'a'] || b[s1.charAt(i) - 'a'])) {     for (int j = i + 1; j < n; j ++) {      if (s1.charAt(j) != s2.charAt(j) && (s1.charAt(i) == s2.charAt(j) || s1.charAt(j) == s2.charAt(i))) {       out.println(ans - 1);       out.println((i + 1) + " " + (j + 1));       return;      }     }    }   }   out.println(ans);   out.println(-1 + " " + -1);  } }
3	public class Solution {  static MyScanner sc;  private static 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();  }   private static void initData() {  }   private static 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] + " ");   }  }   private static void solveT() throws IOException {   int t = sc.nextInt();   while (t-- > 0) {    solve();   }  }  private static long gcd(long l, long l1) {   if (l > l1) return gcd(l1, l);   if (l == 0) return l1;   return gcd(l1 % l, l);  }  private static 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();   }   Integer[] nab(int n) {    Integer[] k = new Integer[n];    for (int i = 0; i < n; i++) {     k[i] = sc.fi();    }    return k;   }   int[] na(int n) {    int[] k = new int[n];    for (int i = 0; i < n; i++) {     k[i] = sc.fi();    }    return k;   }   long[] nl(int n) {    long[] k = new long[n];    for (int i = 0; i < n; i++) {     k[i] = sc.nextLong();    }    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());   }   double nextDouble() {    return Double.parseDouble(next());   }  }  }
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());  } }
5	public class D { FastScanner in; PrintWriter out; boolean systemIO = true;    public void solve() {  int n = in.nextInt();  HashMap<Long, Integer> map = new HashMap();  BigInteger sum = BigInteger.ZERO;  BigInteger ans = BigInteger.valueOf(0);  for (int i = 0; i < n; i++) {  long x = in.nextLong();  ans = ans.add(BigInteger.valueOf(i * x));  if (map.containsKey(x + 1)) {   ans = ans.add(BigInteger.valueOf(map.get(x + 1)));  }  if (map.containsKey(x - 1)) {   ans = ans.subtract(BigInteger.valueOf(map.get(x - 1)));  }  if (map.containsKey(x)) {   map.put(x, map.get(x) + 1);  } else {   map.put(x, 1);  }  ans = ans.subtract(sum);  sum = sum.add(BigInteger.valueOf(x));  }  out.print(ans.toString()); }  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 nextLine() {  try {   return br.readLine();  } catch (IOException e) {   return null;  }  }  String next() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  }   public static void main(String[] arg) {  new D().run(); } }
5	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()) 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()); }  class Dom implements Comparable<Dom>{  int x, a;  public int compareTo(Dom o) {  return x - o.x;  } }  void solve() throws Exception {  int n = nextInt();  int t = nextInt() * 2;  Dom[] a = new Dom[n];  for (int i = 0; i < n; i++) {  a[i] = new Dom();  a[i].x = nextInt() * 2;  a[i].a = nextInt();  }  Arrays.sort(a);  int ans = 2;  for (int i = 0; i < n - 1; i++) {  if (t < a[i + 1].x - a[i + 1].a - a[i].x - a[i].a) ans += 2;  if (t == a[i + 1].x - a[i + 1].a - a[i].x - a[i].a) ans += 1;  }  out.print(ans); }  public void run() {  try {  Locale.setDefault(Locale.US);  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  } catch (Exception e) {  e.printStackTrace();  }  out.flush(); } }
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 int dist(int x, int y, int xx, int yy) {  return abs(x - xx) + abs(y - yy); }  private boolean less(int x, int y, int xx, int yy) {  return x < xx || y > yy; }  private int mul(int x, int y) {  return (int)(1L * x * y % MOD); }  private int add(int x, int y) {  return (x + y) % MOD; }    private int nBit1(int v) {  int v0 = v;  int c = 0;  while (v != 0) {   ++c;   v = v & (v - 1);  }  return c; }  private long abs(long v) {  return v > 0 ? v : -v; }  private int abs(int v) {  return v > 0 ? v : -v; }  private int common(int v) {  int c = 0;  while (v != 1) {   v = (v >>> 1);   ++c;  }    return c; }  private void reverse(char[] a, int i, int j) {  while (i < j) {   swap(a, i++, j--);  } }  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); } private int max(int a, int b) {  return a > b ? a : b; }  private long max(long a, long b) {  return a > b ? a : b; }  private int min(int a, int b) {  return a > b ? b : a; }  private long min(long a, long b) {  return a > b ? b : a; }  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());   }    double nextDouble()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     return "";        }    return str;   }  } }
3	public class A1 {   public static BufferedReader br;  public static StringTokenizer st;  public static String next() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     throw new RuntimeException(e);    }   }   return st.nextToken();  }   public static Integer nextInt() {   return Integer.parseInt(next());  }   public static Long nextLong() {   return Long.parseLong(next());  }   public static Double nextDouble() {   return Double.parseDouble(next());  }   static long fast_pow(long base,long n,long M)  {   if(n==0)    return 1;   if(n==1)   return base;   long halfn=fast_pow(base,n/2,M);   if(n%2==0)    return ( halfn * halfn ) % M;   else    return ( ( ( halfn * halfn ) % M ) * base ) % M;  }   static long finextDoubleMMI_fermat(long n,int M)  {   return fast_pow(n,M-2,M);  }   static long nCrModPFermat(int n, int r, int p)  {   if (r == 0)    return 1;   long[] fac = new long[n+1];   fac[0] = 1;      for (int i = 1 ;i <= n; i++)    fac[i] = fac[i-1] * i % p;     return (fac[n]* finextDoubleMMI_fermat(fac[r], p)% p * finextDoubleMMI_fermat(fac[n-r], p) % p) % p;  }   static void merge(int arr[], int l, int m, int r)  {   int n1 = m - l + 1;   int n2 = r - m;    int L[] = new int [n1];   int R[] = new int [n2];    for (int i=0; i<n1; ++i)    L[i] = arr[l + i];   for (int j=0; j<n2; ++j)    R[j] = arr[m + 1+ j];   int i = 0, j = 0;      int k = l;   while (i < n1 && j < n2)   {    if (L[i] <= R[j])    {     arr[k] = L[i];     i++;    }    else    {     arr[k] = R[j];     j++;    }    k++;   }    while (i < n1)   {    arr[k] = L[i];    i++;    k++;   }    while (j < n2)   {    arr[k] = R[j];    j++;    k++;   }  }   static void sort(int arr[], int l, int r)  {   if (l < r)   {    int m = (l+r)/2;    sort(arr, l, m);    sort(arr , m+1, r);    merge(arr, l, m, r);   }  }   static void sort(int arr[])  {   int l=0;   int r=arr.length-1;   if (l < r)   {    int m = (l+r)/2;    sort(arr, l, m);    sort(arr , m+1, r);    merge(arr, l, m, r);   }  }   static long gcd(long a, long b){   if(a%b==0)    return b;   if(b%a==0)    return a;   if(a>b)    return gcd(a%b,b);   return gcd(a,b%a);  }   static PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   public static void main(String args[])throws IOException{  int i,j;   br = new BufferedReader(new InputStreamReader(System.in));   int n=nextInt();   int a[]=new int[n];   for(i=0;i<n;i++)    a[i]=nextInt();   Arrays.sort(a);   int l=0;   for(i=0;i<n;i++){    if(a[i]!=-1){     int p=a[i];     for(j=i;j<n;j++){      if(a[j]%p==0)       a[j]=-1;     }     l++;    }   }   pw.println(l);   pw.close();  } }
6	public class MaeDosDragoes { public static PrintWriter saida = new PrintWriter(System.out, false); public static class Escanear {   BufferedReader reader;   StringTokenizer tokenizer;  public Escanear() {    this(new InputStreamReader(System.in));   }  public Escanear(Reader in) {    reader = new BufferedReader(in);   }   String proximo() {    if (tokenizer == null || !tokenizer.hasMoreElements()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return tokenizer.nextToken();   }     int proximoNum() {    return Integer.parseInt(proximo());   }  }   public static void main(String[] args) {  Escanear escanear = new Escanear();   int proximoInt = escanear.proximoNum();   double proximoDouble = escanear.proximoNum();   long[] aux = new long[proximoInt];   for(Integer i = 0; i < proximoInt; i++) {    for(Integer j =0; j < proximoInt; j++) {     Integer val = escanear.proximoNum();     if (val.equals(1) || i.equals(j)) {   aux[i] |= 1L << j;   }    }   }   int esquerda = proximoInt/2;   int direita = proximoInt - esquerda;   int[] depois = new int[1 << esquerda];   int maiorMascara = 1 << esquerda;   for(int mascara = 1; mascara <maiorMascara; mascara++) {    int mascaraAtual = mascara;    for(int j = 0; j < esquerda; j++) {     if (((1 << j) & mascara) > 0) {      mascaraAtual &= aux[j + direita] >> direita;      depois[mascara] = Math.max(depois[mascara], depois[mascara ^ (1 << j)]);     }    }    if (mascara == mascaraAtual) {     depois[mascara] = Math.max(depois[mascara],Integer.bitCount(mascara));    }   }   int auxiliar = 0;   int mascaraMaxima = 1 << direita;   for(int mascara = 0; mascara < mascaraMaxima; mascara++) {    int mascaraCorrente = mascara;    int mascaraValor = maiorMascara -1;    for(int j = 0; j < direita; j++) {     if (((1 << j) & mascara) > 0) {      mascaraCorrente &= (aux[j] & (mascaraMaxima-1));      mascaraValor &= aux[j] >> direita;     }    }    if (mascaraCorrente != mascara) continue;    auxiliar = Math.max(auxiliar, Integer.bitCount(mascara) + depois[mascaraValor]);   }   proximoDouble/=auxiliar;   saida.println(proximoDouble * proximoDouble * (auxiliar * (auxiliar-1))/2);   saida.flush();  } }
0	public class Counterexample483A {  public static void main(String[] args)  {     Scanner sc = new Scanner(System.in);      long l = sc.nextLong();     long r = sc.nextLong();     if (l==r || l+1 == r)   {    System.out.println(-1);    return;   }   if (l+2 == r && l%2 == 1)   {    System.out.println(-1);    return;   }   if (l%2 == 0)   {    System.out.println(l + " " + (l+1) + " " + (l+2));    return;   }   System.out.println((l+1) + " " + (l+2) + " " + (l+3));  } }
4	public class C { private static PrintWriter out = new PrintWriter(System.out);  public static void solve() {  In in = new In();  int tests = in.ni();  while (tests-- > 0) {  int n = in.ni();  int[] a = in.nia(n);  Stack<Integer> st = new Stack<>();  StringBuilder sb = new StringBuilder();  for (int num : a) {   if (st.isEmpty()) {   st.push(num);   sb.append(num);   } else {      if (num == st.peek() + 1) {    st.pop();    st.push(num);    while (sb.length() > 0 && sb.charAt(sb.length() - 1) != '.') {    sb.deleteCharAt(sb.length() - 1);    }    sb.append(num);   }       else if (num == 1) {    st.push(num);    sb.append(".");    sb.append(num);   }       else {       while (!st.isEmpty() && st.peek() + 1 != num) {    st.pop();    while (sb.length() > 0 && sb.charAt(sb.length() - 1) != '.') {     sb.deleteCharAt(sb.length() - 1);    }    if (sb.length() > 0)     sb.deleteCharAt(sb.length() - 1);    }        if (!st.isEmpty() && st.peek() + 1 == num) {    st.pop();    st.add(num);    while (sb.length() > 0 && sb.charAt(sb.length() - 1) != '.') {     sb.deleteCharAt(sb.length() - 1);    }    sb.append(num);    }   }   }   out.println(sb);  }  } }  public static void main(String[] args) throws IOException {   solve();     out.flush(); }  @SuppressWarnings("unused") private static class In {  final private static int BUFFER_SIZE = 1024;  private byte[] buf;  private InputStream is;  private int buflen;  private int bufptr;  public In() {  is = System.in;  buf = new byte[BUFFER_SIZE];  buflen = bufptr = 0;  }  public In(String input) {  is = new ByteArrayInputStream(input.getBytes());  buf = new byte[BUFFER_SIZE];  buflen = bufptr = 0;  }  public int readByte() {  if (bufptr >= buflen) {   try {   buflen = is.read(buf);   } catch (IOException ioe) {   throw new InputMismatchException();   }   bufptr = 0;  }  if (buflen <= 0)   return -1;  return buf[bufptr++];  }  public boolean isSpaceChar(int c) {  return !(c >= 33 && c <= 126);  }  public int skip() {  int b;  while ((b = readByte()) != -1 && isSpaceChar(b))   ;  return b;  }    public char nc() {  return (char) skip();  }    public double nd() {  return Double.parseDouble(ns());  }    public String ns() {  final StringBuilder sb = new StringBuilder();  int b = skip();  while (!isSpaceChar(b)) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }    public int ni() {  boolean minus = false;  int num = 0;  int b;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))   ;  if (b == '-') {   minus = true;   b = readByte();  }  while (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');   b = readByte();  }  return minus ? -num : num;  }    public long nl() {  boolean minus = false;  long num = 0;  int b;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))   ;  if (b == '-') {   minus = true;   b = readByte();  }  while (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');   b = readByte();  }  return minus ? -num : num;  }    public int[] nia(int n) {  final int[] arr = new int[n];  for (int i = 0; i < n; i++)   arr[i] = ni();  return arr;  }    public long[] nla(int n) {  final long[] arr = new long[n];  for (int i = 0; i < n; i++)   arr[i] = nl();  return arr;  }    public String[] nsa(int n) {  final String[] arr = new String[n];  for (int i = 0; i < n; i++)   arr[i] = ns();  return arr;  }    public char[] nca(int n) {  final char[] arr = new char[n];  for (int i = 0; i < n; i++)   arr[i] = nc();  return arr;  }    public double[] nda(int n) {  final double[] arr = new double[n];  for (int i = 0; i < n; i++)   arr[i] = nc();  return arr;  }    public int[][] nim(int n, int m) {  final int[][] arr = new int[n][m];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++)   arr[i][j] = ni();  return arr;  }    public long[][] nlm(int n, int m) {  final long[][] arr = new long[n][m];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++)   arr[i][j] = nl();  return arr;  }    public String[][] nsm(int n, int m) {  final String[][] arr = new String[n][m];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++)   arr[i][j] = ns();  return arr;  }    public char[][] ncm(int n, int m) {  final char[][] arr = new char[n][m];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++)   arr[i][j] = nc();  return arr;  }    public double[][] ndm(int n, int m) {  final double[][] arr = new double[n][m];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++)   arr[i][j] = nd();  return arr;  }  public static void log(Object... o) {  System.out.println(Arrays.deepToString(o));  } } }
5	public class CottageVillage {  public static void main(String[] args){  Scanner scan = new Scanner(System.in);  while(scan.hasNext()){  int counter = 0;  int numbCottages = scan.nextInt();  int t = scan.nextInt();  House[] cottages = new House[numbCottages];  for(int i =0; i<numbCottages; i++){   int centre = scan.nextInt();   int length = scan.nextInt();   double beginning = centre - ((double)length)/2;   double end = centre + ((double)length)/2;   cottages[i]= new House(beginning, end);     }    Arrays.sort(cottages);            for(int i =0; i<numbCottages-1; i++){     if(cottages[i].end + t <= cottages[i+1].beginning){   counter++;   }     if (cottages[i+1].beginning - t >= cottages[i].end){   counter++;   }     if (Math.abs((cottages[i].end + t - cottages[i+1].beginning)) < 1e-8){   counter--;         }      }    System.out.println(counter+2);    } }  static class House implements Comparable<House>{  double beginning;  double end;  House(double _beginning, double _end){  beginning = _beginning;  end = _end;  }  @Override  public int compareTo(House house) {       return Double.valueOf(beginning).compareTo(house.beginning);  }    } }
1	public class _G14 {  public static void main(String[] args) {   MyScanner sc = new MyScanner();   PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));   int t = sc.nextInt();   Set<Long> square = new HashSet<>();   for (long i = 1; i <= (long) 1e5; i++) square.add(i * i);   while (t-- > 0) {    long n = sc.nextLong();    if ((n % 2 ==0 && square.contains(n / 2))|| (n % 4 == 0 &&square.contains(n / 4))) {     out.println("YES");    } else {     out.println("NO");    }   }   out.close();  }   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());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   } }
2	public class Main {  BufferedReader in; StringTokenizer str = null; PrintWriter out;  private String next() throws Exception{  if (str == null || !str.hasMoreElements())  str = new StringTokenizer(in.readLine());  return str.nextToken(); }  private int nextInt() throws Exception{  return Integer.parseInt(next()); }  private long nextLong() throws Exception{  return Long.parseLong(next()); }  private double nextDouble() throws Exception{  return Double.parseDouble(next()); }  public void run() throws Exception{  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  long n = nextLong();  if (n == 1) {  System.out.println(0);  return;  }  long k = nextLong();  long t = 1-(k-1) + k*(k+1)/2-1;  if (t < n){  System.out.println(-1);  return;  }  long l = 0;  long r = k;  while(r - l > 1) {  long m = (r + l)/2;  long s = 1 - m + k*(k+1)/2 - (k-m)*(k-m+1)/2;    if (s >= n){   r = m;  }else{   l = m;  }  }  System.out.println(r);  out.close(); }   public static void main(String[] args) throws Exception{  new Main().run(); } }
5	public class Main {     public static void main(String[] args) throws Exception{   Scanner scan = new Scanner(System.in);   int n = scan.nextInt();   int k = scan.nextInt() - 1;   int[] arr = new int[n];   for (int i = 0; i < n; i++) {    int p = scan.nextInt();    int t = scan.nextInt();    arr[i] = -p * 10000 + t;   }   Arrays.sort(arr);   int count = 0;   for (int i = 0; i < n; i++) {    if (arr[i] == arr[k]) {     count++;    }   }   System.out.println(count);  } }
5	public class A {  public A() throws Exception {   int n = in.nextInt();   int[] arr = new int[n];   for (int i=0; i<n; i++) arr[i] = in.nextInt();   int[] arr2 = arr.clone();   Arrays.sort(arr2);   int diff = 0;   for (int i=0; i<n; i++) {    if (arr2[i]!=arr[i]) diff++;   }   if (diff<=2) System.out.println("YES");   else System.out.println("NO");  }  Scanner in = new Scanner(System.in);  StringBuilder buf = new StringBuilder();  public static void main(String[] args) throws Exception {   new A();  }  public static void debug(Object... arr) {   System.err.println(Arrays.deepToString(arr));  }  public static class Scanner {   BufferedReader br;   String line;   StringTokenizer st;   public Scanner(InputStream in) {    br = new BufferedReader(new InputStreamReader(in));   }   public boolean hasNext() throws IOException {    while ((st==null||!st.hasMoreTokens())&&(line=br.readLine())!=null)     st = new StringTokenizer(line);    return st.hasMoreTokens();   }   public String next() throws IOException {    if (hasNext()) return st.nextToken();    throw new NoSuchElementException();   }   public int nextInt() throws IOException {    return Integer.parseInt(next());   }   public long nextLong() throws IOException {    return Long.parseLong(next());   }   public double nextDouble() throws IOException {    return Double.parseDouble(next());   }  } }
0	public class Main { public static void main(String[] args) throws NumberFormatException,  IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  String s = n + "";  if (n >= 0)  System.out.println(n);  else {  int a = n, b = Integer.parseInt(s.substring(0, s.length() - 1)), c = Integer.parseInt(s.substring(0, s.length()-2)+s.charAt(s.length()-1));  System.out.println(Math.max(a, Math.max(b,c)));  } } }
3	public class Main {  public static void main(String[] args) throws IOException {   PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));  FastScanner sc = new FastScanner();  int dp[][]=new int[6000][6000];  char a[]=new char[6000];  final int n=sc.nextInt();  boolean flag=false;  int cnt=0;  char pre='f';  for(int i=1;i<=n;i++)  {   a[i]=sc.next().charAt(0);  }  dp[1][1]=1;  final int mod=(int)1e9+7;  dp[1][1]=1;  for(int i=2;i<=n;i++)  {  if(a[i-1]=='s')  {   int now=0;   for(int j=5050;j>=1;j--)   {   now=(now+dp[i-1][j])%mod;   dp[i][j]=now;   }  }  else  {   for(int j=5050;j>=1;j--)   {   dp[i][j]=dp[i-1][j-1]%mod;   }  }  }  int ans=0;  for(int i=0;i<=5050;i++)  {  ans+= dp[n][i]%mod;  ans%=mod;  }  out.println(ans%mod);  out.flush(); }  static class FastScanner {  BufferedReader br;  StringTokenizer st;  private FastScanner() {  try {   br = new BufferedReader(new InputStreamReader(System.in));   st = new StringTokenizer(br.readLine());  } catch (Exception e){e.printStackTrace();}  }  private boolean hasNextToken()  {  if(st.countTokens()!=StreamTokenizer.TT_EOF)  {   return true;  }  else   return false;  }  private String next() {  if (st.hasMoreTokens()) return st.nextToken();  try {st = new StringTokenizer(br.readLine());}  catch (Exception e) {e.printStackTrace();}  return st.nextToken();  }  private BigInteger nextBigInteger(){return new BigInteger(next());}  private BigDecimal nextBigDecimal(){return new BigDecimal(next());}  private int nextInt() {return Integer.parseInt(next());}  private long nextLong() {return Long.parseLong(next());}  private double nextDouble() {return Double.parseDouble(next());}  private String nextLine() {  String line = "";  if(st.hasMoreTokens()) line = st.nextToken();  else try {return br.readLine();}catch(IOException e){e.printStackTrace();}  while(st.hasMoreTokens()) line += " "+st.nextToken();  return line;  }  private int[] nextIntArray(int n) {  int[] a = new int[n];  for(int i = 0; i < n; i++) a[i] = nextInt();  return a;  }  private long[] nextLongArray(int n){  long[] a = new long[n];  for(int i = 0; i < n; i++) a[i] = nextLong();  return a;  }  private double[] nextDoubleArray(int n){  double[] a = new double[n];  for(int i = 0; i < n; i++) a[i] = nextDouble();  return a;  }  private char[][] nextGrid(int n, int m){  char[][] grid = new char[n][m];  for(int i = 0; i < n; i++) grid[i] = next().toCharArray();  return grid;  }  private void sort(int arr[])  {  int cnt[]=new int[(1<<16)+1];  int ys[]=new int[arr.length];  for(int j=0;j<=16;j+=16){   Arrays.fill(cnt,0);   for(int x:arr){cnt[(x>>j&0xFFFF)+1]++;}   for(int i=1;i<cnt.length;i++){cnt[i]+=cnt[i-1];}   for(int x:arr){ys[cnt[x>>j&0xFFFF]++]=x;}   { final int t[]=arr;arr=ys;ys=t;}  }  if(arr[0]<0||arr[arr.length-1]>=0)return;  int i,j,c;  for(i=arr.length-1,c=0;arr[i]<0;i--,c++){ys[c]=arr[i];}  for(j=arr.length-1;i>=0;i--,j--){arr[j]=arr[i];}  for(i=c-1;i>=0;i--){arr[i]=ys[c-1-i];}  } } }
4	public class Solution {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   for (int i = 0, t = sc.nextInt(); i < t; i++) {    int n = sc.nextInt();    LinkedList<Set<Integer>> stack = new LinkedList<>();    for (int j = 0; j < n; j++) {     printStack(stack);     int val = sc.nextInt();     if (val == 1) {      Set<Integer> branch = new HashSet<>();      branch.add(val);      stack.push(branch);      continue;     }     Set<Integer> branch = stack.peek();     assert branch != null;     while (branch.contains(val) || branch.stream().max(Integer::compareTo).get() + 1 != val) {      stack.pop();      branch = stack.peek();     }     branch.add(val);    }    printStack(stack);   }  }  public static void printStack(LinkedList<Set<Integer>> stack) {   if (stack.size() == 0) {    return;   }   StringBuilder sb = new StringBuilder();   for (int i = stack.size() - 1; i >= 0; i--) {    sb.append(stack.get(i).stream().max(Integer::compareTo).get()).append(".");   }   System.out.println(sb.substring(0, sb.length() - 1));  } }
6	public class E implements Runnable { FastReader scn; PrintWriter out; String INPUT = "";  void solve() {  int t = scn.nextInt();  while(t-- > 0) {  int n = scn.nextInt(), m = scn.nextInt();  int[][] arr = scn.next2DInt(n, m);    int[][] col = new int[m][2];  for(int j = 0; j < m; j++) {   int max = 0;   for(int i = 0; i < n; i++) {   max = Math.max(max, arr[i][j]);   }   col[j][0] = max;   col[j][1] = j;  }  Arrays.parallelSort(col, (o1, o2) -> o2[0] - o1[0]);    m = Math.min(n, m);    int[][] lol = new int[n][m];    for(int j = 0; j < m; j++) {   for(int i = 0; i < n; i++) {   lol[i][j] = arr[i][col[j][1]];   }  }    int[] row = new int[n];  for(int i = 0; i < n; i++) {   row[i] = lol[i][0];  }    ans = 0;  func(lol, 1, row);  out.println(ans);  } }  int ans;  void func(int[][] arr, int col, int[] rowM) {  int n = arr.length, m = arr[0].length;  if(col >= m) {  int rv = 0;  for(int a : rowM) {   rv += a;  }  ans = Math.max(ans, rv);  return;  }   int max = 0, ind = -1;  for(int i = 0; i < n; i++) {  if(arr[i][col] > max) {   max = arr[i][col];   ind = i;  }  }   boolean in = false;  for(int r = 0; r < n; r++) {  if(max <= rowM[r]) {   continue;  }  int rot = (ind - r + n) % n;  int[] need = new int[n], copy = Arrays.copyOf(rowM, n);  for(int i = 0; i < n; i++) {   need[i] = arr[(i + rot) % n][col];  }  for(int i = 0; i < n; i++) {   arr[i][col] = need[i];   copy[i] = Math.max(rowM[i], arr[i][col]);  }    ind = r;  in = true;  func(arr, col + 1, copy);  }   if(!in) {  func(arr, col + 2, rowM);  } }  public void run() {  long time = System.currentTimeMillis();  boolean oj = System.getProperty("ONLINE_JUDGE") != null;  out = new PrintWriter(System.out);  scn = new FastReader(oj);  solve();  out.flush();  if (!oj) {  System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));  } }  public static void main(String[] args) {  new Thread(null, new E(), "Main", 1 << 26).start(); }  class FastReader {  InputStream is;  public FastReader(boolean onlineJudge) {  is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());  }  byte[] inbuf = new byte[1024];  public int lenbuf = 0, ptrbuf = 0;  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++];  }  boolean isSpaceChar(int c) {  return !(c >= 33 && c <= 126);  }  int skip() {  int b;  while ((b = readByte()) != -1 && isSpaceChar(b))   ;  return b;  }  double nextDouble() {  return Double.parseDouble(next());  }  char nextChar() {  return (char) skip();  }  String next() {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(isSpaceChar(b))) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }  String nextLine() {  int b = skip();  StringBuilder sb = new StringBuilder();  while ((!isSpaceChar(b) || b == ' ')) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }  char[] next(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);  }  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 * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }  long nextLong() {  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();  }  }  char[][] nextMatrix(int n, int m) {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)   map[i] = next(m);  return map;  }  int[] nextIntArray(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = nextInt();  return a;  }  long[] nextLongArray(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  int[][] next2DInt(int n, int m) {  int[][] arr = new int[n][];  for (int i = 0; i < n; i++) {   arr[i] = nextIntArray(m);  }  return arr;  }  long[][] next2DLong(int n, int m) {  long[][] arr = new long[n][];  for (int i = 0; i < n; i++) {   arr[i] = nextLongArray(m);  }  return arr;  }  int[] shuffle(int[] arr) {  Random r = new Random();  for (int i = 1, j; i < arr.length; i++) {   j = r.nextInt(i);   int c = arr[i];   arr[i] = arr[j];   arr[j] = c;  }  return arr;  }  long[] shuffle(long[] arr) {  Random r = new Random();  for (int i = 1, j; i < arr.length; i++) {   j = r.nextInt(i);   long c = arr[i];   arr[i] = arr[j];   arr[j] = c;  }  return arr;  }  int[] uniq(int[] arr) {  arr = scn.shuffle(arr);  Arrays.sort(arr);  int[] rv = new int[arr.length];  int pos = 0;  rv[pos++] = arr[0];  for (int i = 1; i < arr.length; i++) {   if (arr[i] != arr[i - 1]) {   rv[pos++] = arr[i];   }  }  return Arrays.copyOf(rv, pos);  }  long[] uniq(long[] arr) {  arr = scn.shuffle(arr);  Arrays.sort(arr);  long[] rv = new long[arr.length];  int pos = 0;  rv[pos++] = arr[0];  for (int i = 1; i < arr.length; i++) {   if (arr[i] != arr[i - 1]) {   rv[pos++] = arr[i];   }  }  return Arrays.copyOf(rv, pos);  }  int[] reverse(int[] arr) {  int l = 0, r = arr.length - 1;  while (l < r) {   arr[l] = arr[l] ^ arr[r];   arr[r] = arr[l] ^ arr[r];   arr[l] = arr[l] ^ arr[r];   l++;   r--;  }  return arr;  }  long[] reverse(long[] arr) {  int l = 0, r = arr.length - 1;  while (l < r) {   arr[l] = arr[l] ^ arr[r];   arr[r] = arr[l] ^ arr[r];   arr[l] = arr[l] ^ arr[r];   l++;   r--;  }  return arr;  }  int[] compress(int[] arr) {  int n = arr.length;  int[] rv = Arrays.copyOf(arr, n);  rv = uniq(rv);  for (int i = 0; i < n; i++) {   arr[i] = Arrays.binarySearch(rv, arr[i]);  }  return arr;  }  long[] compress(long[] arr) {  int n = arr.length;  long[] rv = Arrays.copyOf(arr, n);  rv = uniq(rv);  for (int i = 0; i < n; i++) {   arr[i] = Arrays.binarySearch(rv, arr[i]);  }  return arr;  } } }
4	public class Main implements Runnable {   public static void main(String[] args) {  new Thread(new Main()).start(); }  public void run() {  Locale.setDefault(Locale.US);  try {  run1();  } catch (IOException e) {  throw new RuntimeException();  } }  int nextInt(StreamTokenizer st) throws IOException {  st.nextToken();  return (int) st.nval; }  private List<Integer> kmp(String x, String a) {  String s = a + "$" + x;  int[] oppa = new int[s.length()];  oppa[0] = 0;  int tmp = 0;  List<Integer> res = new ArrayList<Integer>();  for (int i = 1; i < s.length(); i++) {  while (tmp != 0 && s.charAt(tmp) != s.charAt(i)) {     tmp = oppa[tmp - 1];  }  if (s.charAt(tmp) == s.charAt(i))   tmp++;  oppa[i] = tmp;  if (tmp == a.length()) {   res.add(i - a.length() - a.length());  }  }  return res; }  double nextDouble(StreamTokenizer st) throws IOException {  st.nextToken();  return st.nval; }  String nextLine(StreamTokenizer st) throws IOException {  st.nextToken();  return st.sval; }  int cnt = 0; int[] col;  void unite(int a, int b) {  if (cnt % 2 == 0)  col[getCol(a)] = getCol(b);  else  col[getCol(b)] = getCol(a);  cnt++; }  int getCol(int a) {  return a == col[a] ? a : (col[a] = getCol(col[a])); }  public void run1() throws IOException {  Scanner sc = new Scanner(new InputStreamReader(System.in));      String s= sc.next();  int res = 0;  int n = s.length();  for(int i = 0; i < n; i++)  for(int j = i + 1; j < n; j++) {   int k = 0;   while(j + k < n && s.charAt(i + k) == s.charAt(j + k))   k++;   res = Math.max(res, k);  }  System.out.println(res); } }
4	public class Main {  static final long MOD = 1000000007L;      static final int INF = 1000000005;  static final int NINF = -1000000005;   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);    int Q = sc.ni();   for (int q = 0; q < Q; q++) {    int N = sc.ni();    int[] nums = sc.intArray(N, 0);    pw.println(1);    ArrayDeque<Integer> ad = new ArrayDeque<Integer>();    ad.push(1);    for (int i = 1; i < N; i++) {     if (nums[i]==1) {      ad.push(1);     } else {      while (!ad.isEmpty()) {       int d = ad.pop();       if (d==nums[i]-1) {        ad.push(nums[i]);        break;       }      }     }     printAD(ad);    }   }   pw.close();  }  public static void printAD(ArrayDeque<Integer> v) {   Object[] arr = v.toArray();   for (int i = arr.length-1; i >= 0; i--) {    pw.print(arr[i]);    if (i>0) pw.print(".");   }   pw.println();  }   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[]>() {    @Override    public int compare(int[] a, int[] b) {     return a[0]-b[0];    }   });  }   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[]>() {    @Override    public int compare(long[] a, long[] b) {     if (a[0] > b[0])      return 1;     else if (a[0] < b[0])      return -1;     else      return 0;        }   });  }   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());   }    int[][] graph(int N, int[][] edges) {    int[][] graph = new int[N][];    int[] sz = new int[N];    for (int[] e: edges) {     sz[e[0]] += 1;     sz[e[1]] += 1;    }    for (int i = 0; i < N; i++) {     graph[i] = new int[sz[i]];    }    int[] cur = new int[N];    for (int[] e: edges) {     graph[e[0]][cur[e[0]]] = e[1];     graph[e[1]][cur[e[1]]] = e[0];     cur[e[0]] += 1;     cur[e[1]] += 1;    }    return graph;   }    int[] intArray(int N, int mod) {    int[] ret = new int[N];    for (int i = 0; i < N; i++)     ret[i] = ni()+mod;    return ret;   }    char[] charArray(int N) {    char[] ret = new char[N];    for (int i = 0; i < N; i++)     ret[i] = next().charAt(0);    return ret;   }    long nl() {    return Long.parseLong(next());   }    long[] longArray(int N, long mod) {    long[] ret = new long[N];    for (int i = 0; i < N; i++)     ret[i] = nl()+mod;    return ret;   }    double nd() {    return Double.parseDouble(next());   }    String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
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(); } private static int nextInt() throws IOException {  return Integer.parseInt(next()); } private static long nextLong() throws IOException {  return Long.parseLong(next()); } private static double nextDouble() throws IOException {  return Double.parseDouble(next()); } private static String next() throws IOException {  while (st==null || !st.hasMoreTokens())  st = new StringTokenizer(br.readLine());  return st.nextToken(); } }
3	public class Main {  static long[][] c ;  static long[] arr;  static long n , m , k;  static long dp[][][];  public static void main(String[] args) throws IOException {   Reader.init(System.in);   int n = Reader.nextInt();   int[] arr = new int[n];   int[] mark = new int[n];   for (int i = 0 ; i < n ; i++){    arr[i] = Reader.nextInt();   }   Arrays.sort(arr);   int[] v = new int[n];   int ans = 0;   for (int i = 0 ; i < n ; i++){    if (v[i]==0){     for (int j = i ; j < n ; j++){      if (arr[j]%arr[i]==0){       v[j] = arr[i];      }     }    }   }   TreeSet<Integer> s = new TreeSet<>();   for (int i = 0 ; i < n ;i++){    s.add(v[i]);   }   System.out.println(s.size());       }   public static void sortbyColumn_asc(int arr[][], int col)  {     Arrays.sort(arr, new Comparator<int[]>() {    @Override       public int compare(final int[] entry1,         final int[] entry2) {              if (entry1[col] > entry2[col])      return 1;     else      return -1;    }   });  }  public static void sortbyColumn_dsc(int arr[][], int col)  {     Arrays.sort(arr, new Comparator<int[]>() {    @Override       public int compare(final int[] entry1,         final int[] entry2) {              if (entry1[col] > entry2[col])      return -1;     else      return 1;    }   });  }  static void swap(char[] arr , int i , int j){   char tmp = arr[i];   arr[i] = arr[j];   arr[j] = tmp;  }  static void swap(int[] arr , int i , int j){   int tmp = arr[i];   arr[i] = arr[j];   arr[j] = tmp;  }   } class Node implements Comparable<Node>{  int a , b;  Node(int a , int b){   this.a = a;   this.b = b;  }  public int compareTo(Node o) {   if (this.a == o.a){    return this.b - o.b;   }   return this.a - o.a;  } } class Edge implements Comparable<Edge>{  int x , y , w;  public Edge(int x, int y, int w) {   this.x = x;   this.y = y;   this.w = w;  }  @Override  public int compareTo(Edge o) {   return this.w - o.w;  } } class Reader {  static BufferedReader reader;  static StringTokenizer tokenizer;    static void init(InputStream input) {   reader = new BufferedReader(     new InputStreamReader(input) );   tokenizer = new StringTokenizer("");  }   static String next() throws IOException {   while ( ! tokenizer.hasMoreTokens() ) {       tokenizer = new StringTokenizer(      reader.readLine() );   }   return tokenizer.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt( next() );  }  static long nextLong() throws IOException {   return Long.parseLong( next() );  }  static double nextDouble() throws IOException {   return Double.parseDouble( next() );  } } class MergeSort {      void merge(int arr[], int l, int m, int r)  {     int n1 = m - l + 1;   int n2 = r - m;      int L[] = new int [n1];   int R[] = new int [n2];      for (int i=0; i<n1; ++i)    L[i] = arr[l + i];   for (int j=0; j<n2; ++j)    R[j] = arr[m + 1+ j];         int i = 0, j = 0;      int k = l;   while (i < n1 && j < n2)   {    if (L[i] <= R[j])    {     arr[k] = L[i];     i++;    }    else    {     arr[k] = R[j];     j++;    }    k++;   }      while (i < n1)   {    arr[k] = L[i];    i++;    k++;   }      while (j < n2)   {    arr[k] = R[j];    j++;    k++;   }  }     void sort(int arr[], int l, int r)  {   if (l < r)   {       int m = (l+r)/2;        sort(arr, l, m);    sort(arr , m+1, r);        merge(arr, l, m, r);   }  }    static void printArray(int arr[])  {   int n = arr.length;   for (int i=0; i<n; ++i)    System.out.print(arr[i] + " ");   System.out.println();  }   }
1	public class B {  public static void main(String[] args) {   FastScanner in = new FastScanner();   PrintWriter out = new PrintWriter(System.out);   int t = in.nextInt(), tt = 0;   while(t-->0) {    int n = in.nextInt();   if(n%2!=0) out.println("NO");   else{    n/=2;    if(Math.sqrt(n)==Math.ceil(Math.sqrt(n))) out.println("YES");    else{    if(n%2!=0) out.println("NO");    else{     n/=2;     if(Math.sqrt(n)==Math.ceil(Math.sqrt(n))) out.println("YES");     else out.println("NO");    }    }   }     }   out.flush(); }  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) {}  return st.nextToken();  }   String nextLine(){  try{ return br.readLine(); }   catch(IOException e) { } return "";  }   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;  } }  static final Random random = new Random();  static void ruffleSort(int[] a){  int n = a.length;  for(int i=0;i<n;i++){  int j = random.nextInt(n), temp = a[j];  a[j] = a[i]; a[i] = temp;  }  Arrays.sort(a);  } }
4	public class Main { public static void main(String[] args) throws FileNotFoundException {  Scanner sc = new Scanner(new File("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  ArrayList<ArrayList<Integer>> fire = new ArrayList<ArrayList<Integer>>();  while (k-- != 0) {  ArrayList<Integer> t = new ArrayList<Integer>();  t.add(sc.nextInt());  t.add(sc.nextInt());  fire.add(t);  }   int maxI = 0, maxJ = 0, maxManhatten = -1;  for(int i = 1; i <= n; i++)  for(int j = 1; j <= m; j++){   int curManhatten = Integer.MAX_VALUE;   for(int u = 0; u < fire.size(); u++)   curManhatten = Math.min(curManhatten, manhatten(i, j, fire.get(u).get(0), fire.get(u).get(1)));     if(curManhatten > maxManhatten){   maxManhatten = curManhatten;   maxI = i;   maxJ = j;   }  }   out.print(maxI + " " + maxJ);  out.flush();  out.close(); }  private static int manhatten(int i, int j, Integer a, Integer b) {  return Math.abs(i - a) + Math.abs(j - b); } }
0	public class A {  static Scanner scanner = new Scanner(System.in); static int s;  public static void main(String[] args) {  s = scanner.nextInt();  if (s >= 0) {  System.out.println(s);  }  else {  if (s >= -10) {   System.out.println(0);  }  else {   int ss = -s;   int a, b;   a = ss % 10;   b = (ss % 100) / 10;   if (a > b) {   ss = ss / 10;   }   else {   ss = (ss / 100) * 10 + a;   }   if (ss == 0) {   System.out.println(0);   }   else {   System.out.println("-" + ss);   }  }  } } }
1	public class helloWorld { public static void main(String[] args)  {   Scanner in = new Scanner(System.in);  int n = in.nextInt();  int m = in.nextInt();  int[] ar = new int[200];   String str = in.next();  for(int i = 0; i < str.length(); i++)  ar[ str.charAt(i) ]++;    int ans = 100000;   for(int i = 'A'; i < 'A' + m; i++)  ans = Math.min(ans, ar[i]);  ans *= m;   System.out.println(ans);   in.close(); } }
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);   }  boolean check(int cnt[][], int[] tcnt, int mid) {   boolean ok = true;   for (int j = 0; j < 27; j++) {    if (cnt[mid][j] < tcnt[j]) {     ok = false;    }   }   return ok;  }  class Pair {   int c, f;  }  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());   }   Integer[] nextA(int n) {    Integer a[] = new Integer[n];    for (int i = 0; i < n; i++) {     a[i] = scanner.nextInt();    }    return a;   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    try {     return reader.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }  } }
3	public class ProblemD {  public static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); public static StringTokenizer tok = null;  public static void main(String args[]) throws IOException {  tok = new StringTokenizer(in.readLine());  int n = Integer.parseInt(tok.nextToken());   int tab[] = new int[n];  tok = new StringTokenizer(in.readLine());  for (int i=0; i<n; i++)  tab[i] = Integer.parseInt(tok.nextToken());   int inversions = countInversions(tab);  boolean isOdd = inversions % 2 == 1;   tok = new StringTokenizer(in.readLine());  int k = Integer.parseInt(tok.nextToken());   int start, end, len;   for (int i=0; i<k; i++) {  tok = new StringTokenizer(in.readLine());  start = Integer.parseInt(tok.nextToken());  end = Integer.parseInt(tok.nextToken());    len = (end - start + 1) % 4;  if (len == 2 || len ==3)   isOdd = !isOdd;    out.println(isOdd ? "odd" : "even");  }   out.close();   }  private static int countInversions(int tab[]) {  int n = tab.length;  int auxTab[] = new int[n+1];  return _countInversions(tab, 0, n, auxTab); };  private static int _countInversions(int tab[], int start, int end, int auxTab[]) {   if (start+1 >= end)  return 0;   int mid = (start + end) / 2;  int lowerFound = 0;  int higherFound = 0;   int count = 0;   for (int i=start; i<end; i++){  if (tab[i] < mid+1){   count += higherFound;   auxTab[start+lowerFound] = tab[i];   lowerFound++;  } else {   auxTab[mid + higherFound] = tab[i];   higherFound++;  }  }   for (int i=start; i<end; i++)  tab[i] = auxTab[i];   count += _countInversions(tab, start, mid, auxTab);  count += _countInversions(tab, mid, end, auxTab);   return count; }    }
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();  }  public int nextInt() {  return Integer.parseInt(next());  }   public double nextDouble() {  return Double.parseDouble(next());  }   public long nextLong() {  return Long.parseLong(next());  }   public String nextLine() {  try {   return reader.readLine();  } catch (IOException e) {   return null;  }  } } }
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());  } }
1	public class HamstersAndTigers {  public static void main(String[] args) {  Scanner sc = new Scanner(new BufferedInputStream(System.in));  int numAnimals = sc.nextInt();  String positions = sc.next();  int numTigers = 0;  int numHamsters = 0;  for(int i = 0; i < positions.length(); i++) {  if(positions.charAt(i) == 'T') {   numTigers++;  } else {   numHamsters++;  }  }  int minDifference = Integer.MAX_VALUE;  StringBuilder tigerChars = new StringBuilder(1000);  StringBuilder hamsterChars = new StringBuilder(1000);  for(int i = 0; i < numHamsters; i++) {  hamsterChars.append('H');  }  StringBuilder remainingTigerChars = new StringBuilder(1000);  for(int i = 0; i < numTigers; i++) {  remainingTigerChars.append('T');  }  for(int i = 0; i <= numTigers; i++) {  StringBuilder generated = new StringBuilder();  generated.append(tigerChars);  generated.append(hamsterChars);  generated.append(remainingTigerChars);       if(remainingTigerChars.length() >= 1) {   remainingTigerChars.deleteCharAt(remainingTigerChars.length() - 1);  }  tigerChars.append('T');   int diffCount = stringDiffCount(positions, generated.toString());  if(diffCount < minDifference) {   minDifference = diffCount;  }  }    hamsterChars = new StringBuilder(1000);  tigerChars = new StringBuilder(1000);  for(int i = 0; i < numTigers; i++) {  tigerChars.append('T');  }  StringBuilder remainingHamsterChars = new StringBuilder(1000);  for(int i = 0; i < numHamsters; i++) {  remainingHamsterChars.append('H');  }  for(int i = 0; i <= numHamsters; i++) {  StringBuilder generated = new StringBuilder();  generated.append(hamsterChars);  generated.append(tigerChars);  generated.append(remainingHamsterChars);     if(remainingHamsterChars.length() >= 1) {   remainingHamsterChars.deleteCharAt(remainingHamsterChars.length() - 1);  }  hamsterChars.append('H');   int diffCount = stringDiffCount(positions, generated.toString());  if(diffCount < minDifference) {   minDifference = diffCount;  }  }  System.out.println(minDifference / 2); }  private static int stringDiffCount(String strOne, String strTwo) {  int diffCount = 0;  for(int i = 0; i < strOne.length(); i++) {  if(strOne.charAt(i) != strTwo.charAt(i)) {   diffCount++;  }  }  return diffCount; } }
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());  } }
3	public class Main {  static BufferedReader reader;  static StringTokenizer tokenizer;  static PrintWriter writer;  static String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  static void banana() throws IOException {   int n = nextInt();   int[] a = new int[n];   int[] color = new int[n];   for (int i = 0; i < n; i++) {    a[i] = nextInt();   }   int c = 0;   while(true) {    int mn = 1000;    for (int i = 0; i < n; i++) {     if(color[i] == 0) {      mn = Math.min(mn, a[i]);     }    }    if (mn == 1000) {     break;    }    c++;    for (int i = 0; i < n; i++) {     if (color[i] == 0) {      if (a[i] % mn == 0) {       color[i] = c;      }     }    }   }   writer.println(c);  }  public static void main(String[] args) throws IOException {   reader = new BufferedReader(new InputStreamReader(System.in));   tokenizer = null;   writer = new PrintWriter(System.out);   banana();   reader.close();   writer.close();  } }
5	public class a { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  double w = in.nextDouble();  int tot = 2;  Interval[] houses = new Interval[n];  for(int i=0; i<n; i++) {  double center = in.nextDouble();  double wid = in.nextDouble();  houses[i] = new Interval(center-wid/2,center+wid/2);  }  Arrays.sort(houses);  for(int i=1; i<n; i++) {  double dist = houses[i].s - houses[i-1].e;  if(dist+1e-6 >= w) {   tot+=2;   if(Math.abs(w-dist) < 1e-6)   tot--;  }  }  System.out.println(tot); } } class Interval implements Comparable<Interval> { double s, e; Interval(double a, double b) {  s=a;  e=b; } public int compareTo(Interval i) {  return (int)Math.signum(s-i.s); } }
0	public class e { public static class FastReader { BufferedReader br; StringTokenizer st;    public FastReader() {  br = new BufferedReader(new InputStreamReader(System.in)); }  String next() {  while (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(br.readLine());  } catch (Exception r) {   r.printStackTrace();  }  }  return st.nextToken(); }  int nextInt() {  return Integer.parseInt(next()); }  double nextDouble() {  return Double.parseDouble(next()); }  long nextLong() {  return Long.parseLong(next()); }  String nextLine() {  String str = "";  try {  str = br.readLine();  } catch (Exception r) {  r.printStackTrace();  }  return str; } } static ArrayList<String>list1=new ArrayList<String>(); static void combine(String instr, StringBuffer outstr, int index,int k) { if(outstr.length()==k) {  list1.add(outstr.toString());return; } if(outstr.toString().length()==0) outstr.append(instr.charAt(index));  for (int i = 0; i < instr.length(); i++)  {   outstr.append(instr.charAt(i));     combine(instr, outstr, i + 1,k);   outstr.deleteCharAt(outstr.length() - 1);  }  index++; } static ArrayList<ArrayList<Integer>>l=new ArrayList<>(); static void comb(int n,int k,int ind,ArrayList<Integer>list) { if(k==0) {  l.add(new ArrayList<>(list));  return; }   for(int i=ind;i<=n;i++) {  list.add(i);  comb(n,k-1,ind+1,list);   list.remove(list.size()-1);   }      }  public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));  public static void main(String[] args) {   FastReader in=new FastReader(); HashMap<Integer,Integer>map=new HashMap<Integer,Integer>();  int n=in.nextInt(); int r=in.nextInt();   double theta=(double)360/(double)n;   double b=1-((double)2/(double)(1-Math.cos((double)2*Math.PI/(double)n))); double x=Math.sqrt(1-b)-1; double ans=(double)r/(double)x; System.out.println(ans);    } }
6	public final class LookingForOrder {  private static Map<Integer, Integer> es = new HashMap<Integer, Integer>();  private static void init() { for (int i = 0; i <= 24; i++) es.put(1 << i, i); }  private static int x, y;  private static int[] xs, ys;  private static int sqr(int i) { return i * i; }  private static int dist(int i, int j) {   return sqr(x - xs[i]) + sqr(y - ys[i]) +    sqr(xs[i] - xs[j]) + sqr(ys[i] - ys[j]) +    sqr(x - xs[j]) + sqr(y - ys[j]);  }  private static int n;  private static int[] tb, prevs;  private static int recur(int j) {   if (j == 0 || es.get(j) != null || tb[j] != 0) return tb[j];   int bl = j & -j;   int b = j ^ bl;   tb[j] = recur(bl) + recur(b);   prevs[j] = bl;   for (int i = es.get(bl) + 1; i <25; i++) {    if (((1 << i) & b) == 0) continue;    int k = bl | 1 << i;    int v = dist(es.get(bl), es.get(1 << i)) + recur(j ^ k);    if (v >= tb[j]) continue;    tb[j] = v;    prevs[j] = k;   }   return tb[j];  }  public static void main(String[] args) {   init();   Scanner s = new Scanner(System.in);   x = s.nextInt(); y = s.nextInt();   n = s.nextInt();   xs = new int[n]; ys = new int[n];   tb = new int[1 << n]; prevs = new int[1 << n];   for (int i = 0; i < n; i++) {    xs[i] = s.nextInt(); ys[i] = s.nextInt();    tb[1 << i] = sqr(x - xs[i]) + sqr(y - ys[i]) << 1;   }   int all = (1 << n) - 1;   out.println(recur(all));   StringBuilder sb = new StringBuilder();   int p = prevs[all];   int c = all;   while(p != 0 && p != c) {    if ((p ^ (p & -p)) == 0) sb.append("0 " + (es.get(p & -p) + 1) + " ");    else sb.append("0 " + (es.get(p & -p) + 1) + " " + (es.get(p ^ (p & -p)) + 1) + " ");    c = c ^ p;    p = prevs[c];   }   if ((c ^ (c & -c)) == 0) sb.append("0 " + (es.get(c & -c) + 1) + " 0");   else sb.append("0 " + (es.get(c & -c) + 1) + " " + (es.get(c ^ (c & -c)) + 1) + " 0");   out.println(sb);  } }
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;  }  public String readLine() {   try {    return super.readLine();   } catch (IOException e) {    return null;   }  } } 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 CodeD { 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());  }   public double nextDouble()  {  return Double.parseDouble(next());  }   public int[] nextIntArray(int n)  {  int[] res = new int[n];  for(int i = 0; i < res.length; i++)   res[i] = nextInt();  return res;  }   public long[] nextLongArray(int n)  {  long[] res = new long[n];  for(int i = 0; i < res.length; i++)   res[i] = nextLong();  return res;  }   public double[] nextDoubleArray(int n)  {  double[] res = new double[n];  for(int i = 0; i < res.length; i++)   res[i] = nextLong();  return res;  }  public void sortIntArray(int[] array)  {  Integer[] vals = new Integer[array.length];  for(int i = 0; i < array.length; i++)   vals[i] = array[i];  Arrays.sort(vals);  for(int i = 0; i < array.length; i++)   array[i] = vals[i];  }   public void sortLongArray(long[] array)  {  Long[] vals = new Long[array.length];  for(int i = 0; i < array.length; i++)   vals[i] = array[i];  Arrays.sort(vals);  for(int i = 0; i < array.length; i++)   array[i] = vals[i];  }   public void sortDoubleArray(double[] array)  {  Double[] vals = new Double[array.length];  for(int i = 0; i < array.length; i++)   vals[i] = array[i];  Arrays.sort(vals);  for(int i = 0; i < array.length; i++)   array[i] = vals[i];  } } static final Scanner sc; static final int n; static final int[][] distancias; static final int[] distancia; static final int[] dp; static final int[] dpNext; static final int X; static final int Y;  static {  sc = new Scanner();  X = sc.nextInt();  Y = sc.nextInt();  n = sc.nextInt();  distancias = new int[n][n];  distancia = new int[n];  dp = new int[1 << n];  Arrays.fill(dp, -1);  dpNext = new int[1 << n]; }   static int dp(int mascara) {  if(dp[mascara] != -1)  return dp[mascara];  int highest = -1;  for(int i = 0, tmp = mascara; tmp != 0; i++, tmp >>= 1)  {  if((tmp & 1) == 1)  {   highest = i;   break;  }  }  if(highest == -1)  return 0;  int nextMsc = mascara ^ (1 << highest);  int costHighest = distancia[highest];  int best = (costHighest << 1) + dp(nextMsc);  int bestNext = nextMsc;  for(int i = 0, tmp = nextMsc, iC = 1; tmp != 0; i++, tmp >>= 1, iC <<= 1)  {  if((tmp & 1) == 1)  {   int msc = nextMsc ^ iC;   int possibleA = costHighest + distancias[highest][i] + distancia[i] + dp(msc);   if(possibleA < best)   {   best = possibleA;   bestNext = msc;   }  }  }  dpNext[mascara] = bestNext;  return dp[mascara] = best;   } public static void main(String[] args) {  int[][] objetos = new int[n][2];  for(int i = 0; i < n; i++)  {  objetos[i][0] = sc.nextInt();  objetos[i][1] = sc.nextInt();  distancia[i] = (X - objetos[i][0]) * (X - objetos[i][0]) + (Y - objetos[i][1]) * (Y - objetos[i][1]);  }  for(int i = 0; i < n; i++)  for(int j = 0; j < n; j++)   distancias[i][j] = (objetos[i][0] - objetos[j][0]) * (objetos[i][0] - objetos[j][0]) + (objetos[i][1] - objetos[j][1]) * (objetos[i][1] - objetos[j][1]);  int ans = dp((1 << n) - 1);  System.out.println(ans);  int current = (1 << n) - 1;  while(current != 0)  {  int next = dpNext[current];  int differents = next ^ current;  System.out.print("0 ");  for(int i = 0; i < n; i++)   if((differents & (1 << i)) != 0)   System.out.print((i + 1) + " ");  current = next;  }  System.out.println("0"); } }
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();  } }
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 class node implements Comparable<node> {  int l,r;  node(){}  node(int l,int r) {  this.l=l;  this.r=r;  }  @Override  public int compareTo(node rhs) {  return r-rhs.r;  } } public static void main(String[] args) throws IOException {  BufferedReader in=new BufferedReader(new InputStreamReader(System.in));  PrintWriter out=new PrintWriter(System.out);  StringTokenizer sa=new StringTokenizer(in.readLine());  int n=Integer.parseInt(sa.nextToken());  sa=new StringTokenizer(in.readLine());  int[] a=new int[n];  TreeMap<Integer,ArrayList<node>> mp=new TreeMap();  for (int i=0;i<n;++i) a[i]=Integer.parseInt(sa.nextToken());  ArrayList<node> ans=new ArrayList<node>();  for (int i=0;i<n;++i) {  int tmp=0;  for (int j=i;j<n;++j) {   tmp+=a[j];   if (!mp.containsKey(tmp)) {   ArrayList<node> t=new ArrayList();   t.add(new node(i,j));   mp.put(tmp,t);   } else {   ArrayList<node> t=mp.get(tmp);   int left=0,right=t.size()-1,res=t.size();   while (left<=right) {    int mid=(left+right)>>1;    if (t.get(mid).r>=i) {    res=mid;    right=mid-1;    } else left=mid+1;   }   if (res==t.size()) t.add(new node(i,j));   else if (t.get(res).r>j) t.set(res,new node(i,j));   }   if (mp.get(tmp).size()>ans.size()) ans=mp.get(tmp);  }  }  out.println(ans.size());  for (int i=0;i<ans.size();++i)  out.printf("%d %d\n",ans.get(i).l+1,ans.get(i).r+1);  out.flush(); } }
1	public class A {  private static Scanner sc = new Scanner(new InputStreamReader(System.in));  public static void main (String[] args) throws IOException {   BitSet b = new BitSet(1001);   BitSet p = primes(1001);   for (int i = 0; i < ps.length - 1; i++) {    b.set(ps[i] + ps[i+1] + 1);   }   int n = sc.nextInt(), k = sc.nextInt();   for (int x = 0; x <= n; x++) {    if (b.get(x) && p.get(x)) k--;   }   System.out.println(k > 0 ? "NO" : "YES");  }  private static BitSet primes (int n) {   BitSet b = new BitSet(n+1);   b.set(2, n);   for (int p = 2; p <= n; p++) {    if (b.get(p)) {     for (int x = p * 2; x <= n; x += p) {      b.clear(x);     }    }   }   return b;  }   private static int [] ps = 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}; }
3	public class D911 {  public static long total = 0; public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  ArrayList<Integer> temp = new ArrayList<>();  int[] ar = new int[n];  int[] memo = new int[n];  for (int i = 0; i < n; i++) {  int t = in.nextInt();  int index = -1*Collections.binarySearch(temp, t)-1;  temp.add(index, t);  ar[i] = t;  memo[i] = i - index;  total += memo[i];  }  int m = in.nextInt();  for (int i = 0; i < m; i++) {   total += (-1*(in.nextInt() - 1 - in.nextInt() + 1) + 1) / 2;  System.out.println(total%2 == 0 ? "even" : "odd");  } }  public static void query(int[] ar, int[] memo, int a, int b) {  if (a >= b) {  return;  }  if (ar[a] < ar[b]) {  memo[a]++;  total++;  } else {  memo[b]--;  total--;  }  int t = ar[a];  ar[b] = ar[a];  ar[b] = t;  t = memo[a];  memo[b] = memo[a];  memo[b] = t;  query(ar, memo, a + 1, b - 1); }  }
2	public class C {   public static void main(String[] args)  {   Scanner sc = new Scanner(System.in);   long n = sc.nextLong();   long s = sc.nextLong();     BigInteger k = findFirst(BigInteger.valueOf(s));   if (BigInteger.valueOf(n).compareTo(k) >= 0)   {    System.out.println(n - k.longValue() + 1);   }   else   {    System.out.println("0");   }  }   public static BigInteger findFirst(BigInteger s)  {   BigInteger b = BigInteger.ZERO;   while (cd(b).compareTo(b.subtract(s)) > 0)   {    BigInteger c = BigInteger.ONE;    while (cd(b.add(c)).compareTo(b.add(c).subtract(s)) > 0) {     c = c.multiply(BigInteger.TEN);    }       c = c.divide(BigInteger.TEN);    if (c.compareTo(BigInteger.TEN) < 0) c = BigInteger.TEN;    b = b.add(c);   }   return b;  }   public static BigInteger cd(BigInteger n)  {   BigInteger t = BigInteger.ZERO;   while (n.compareTo(BigInteger.ZERO) > 0)   {    t = t.add(n.mod(BigInteger.TEN));    n = n.divide(BigInteger.TEN);   }   return t;  } }
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);   atskb solver = new atskb();   solver.solve(1, in, out);   out.close();  }  static class atskb {   long s;   public void solve(int testNumber, InputReader in, PrintWriter out) {    long n = in.nextLong();    s = in.nextLong();    long ans = binarysearch(0, (long) Math.pow(10, 18) + 20 * 9);    if (ans > n) {     out.print(0);    } else {     out.print(n - ans + 1);    }   }   public long binarysearch(long l, long r) {    if (l == r) {     if (check(l))      return l;     return -1;    }    if (l - r == -1) {     if (check(l))      return l;     if (check(r)) {      return r;     }         }    long mid = l + (r - l) / 2;    if (check(mid))     return binarysearch(l, mid);    return binarysearch(mid + 1, r);   }   public boolean check(long m) {    String str = m + "";    long sum = 0;    for (int i = 0; i < str.length(); i++) {     sum += str.charAt(i) - '0';    }    if (sum + s <= m)     return true;    return false;   }  }  static class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar;   private int snumChars;   public InputReader(InputStream st) {    this.stream = st;   }   public int read() {    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 long nextLong() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;    do {     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;   }  } }
5	public class SecondOrderStatistics implements Runnable { public static void main(String[] args) throws Exception {  new SecondOrderStatistics().run(); }  private void solve() throws Exception {  int n = nextInt();  SortedSet<Integer> sset = new TreeSet<Integer>();  for (int i = 0; i < n; i++)  {  int a = nextInt();  sset.add(a);  }  if (sset.size() < 2)  out.println("NO");  else  {  Integer v[] = (Integer[]) sset.toArray(new Integer[sset.size()]);  sort(v);  out.println(v[1]);  } }   private BufferedReader in; PrintWriter out; StringTokenizer tokenizer;  public void run() {   try  {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new BufferedOutputStream(System.out));  solve();  out.flush();  in.close();  out.close();  }  catch (Exception e)  {  e.printStackTrace();    } }  String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens())  {  tokenizer = new StringTokenizer(in.readLine());  }  return tokenizer.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()); } }
5	public class Main {  static int n;  static long TotalTime;  static Problem[] problems;  static StringBuilder sb;  public static void main(String[] args) {   FastScanner sc = new FastScanner();   sb = new StringBuilder();   n = sc.nextInt();   TotalTime = sc.nextLong();   problems = new Problem[n];   for (int i = 0; i < n; i++) {    problems[i] = new Problem (sc.nextInt(), sc.nextLong(), i);   }   Arrays.sort(problems);   long num = -1;   long high = n;   long low = 0;   int iter = 0;   while (high - low > 1) {    num = (high + low) / 2;    if (test(num, false)) {     low = num;    }    else {     high = num;    }   }   if (test(high, false))    num = high;   else    num = low;   test(num, true);   System.out.print(sb);  }  public static boolean test (long num, boolean print) {   int count = 0;   long sum = 0L;   if (print) sb.append(num + "\n" + num + "\n");   for (int i = 0; i < n && count < num; i++) {    if (problems[i].a >= num) {     count++;     sum += problems[i].t;     if (print) sb.append((problems[i].index + 1) + " ");    }   }   return (count == num) && (sum <= TotalTime);  }  public static class Problem implements Comparable<Problem> {   int a;   long t;   int index;     public int compareTo(Problem o) {   return Long.compare(t, o.t);   }   public Problem (int a, long t, int index) {    this.a = a;    this.t = t;    this.index = index;   }  }   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());   }   String readNextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   int[] readIntArray(int n) {    int[] a = new int[n];    for (int idx = 0; idx < n; idx++) {     a[idx] = nextInt();    }    return a;   }   long[] readLongArray(int n) {    long[] a = new long[n];    for (int idx = 0; idx < n; idx++) {     a[idx] = nextLong();    }    return a;   }  } }
1	public class EdD { 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 t = sc.nextInt();  for(int i = 0;i<t;i++){   int n =sc.nextInt();   if (n%2== 1)   out.println("NO");   else{    while(n%2 == 0){    n/=2;   }   verdict(isSquare(n) || isSquare(2*n));      }  }  out.close();    } public static boolean isSquare(int n) {  int d = (int)Math.sqrt(n);  for(long s = d-2;s<=d+2;s++){  if (s*s == n)   return true;  }  return false; } 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 String[] readArrayString(int n){  String[] array = new String[n];  for(int j =0 ;j<n;j++)  array[j] = sc.next();  return array; } static int[] readArrayInt(int n){  int[] array = new int[n];  for(int j = 0;j<n;j++)   array[j] = sc.nextInt();  return array;  } static int[] readArrayInt1(int n){  int[] array = new int[n+1];  for(int j = 1;j<=n;j++){  array[j] = sc.nextInt();  }  return array; } static long[] readArrayLong(int n){  long[] array = new long[n];  for(int j =0 ;j<n;j++)  array[j] = sc.nextLong();  return array; } static double[] readArrayDouble(int n){  double[] array = new double[n];  for(int j =0 ;j<n;j++)  array[j] = sc.nextDouble();  return array; } static int minIndex(int[] array){  int minValue = Integer.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } static int minIndex(long[] array){  long minValue = Long.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } static int minIndex(double[] array){  double minValue = Double.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } 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; } static void verdict(boolean a){   out.println(a ? "YES" : "NO");  }  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());   }   String nextLine() {    String str = "";    try{     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }    } }
5	public class A implements Runnable {  final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  BufferedReader in; PrintWriter out; StringTokenizer tok;  @Override public void run() {  try {  long startTime = System.currentTimeMillis();  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");  }  tok = new StringTokenizer("");  Locale.setDefault(Locale.US);  solve();  in.close();  out.close();  long endTime = System.currentTimeMillis();  long totalMemory = Runtime.getRuntime().totalMemory();  long freeMemory = Runtime.getRuntime().freeMemory();  System.err.println("Time = " + (endTime - startTime) + " ms");  System.err.println("Memory = " + ((totalMemory - freeMemory) / 1024) + " KB");  } catch (Throwable e) {  e.printStackTrace(System.err);  System.exit(-1);  } }  String readString() throws IOException {  while (!tok.hasMoreTokens()) {  tok = new StringTokenizer(in.readLine());  }  return tok.nextToken(); }  int readInt() throws IOException {  return Integer.parseInt(readString()); }  long readLong() throws IOException {  return Long.parseLong(readString()); }  double readDouble() throws IOException {  return Double.parseDouble(readString()); }  void debug(Object... o) {  if (!ONLINE_JUDGE) {  System.err.println(Arrays.deepToString(o));  } }  public static void main(String[] args) {  new Thread(null, new A(), "", 256 * 1024 * 1024).start(); }  static class Utils {  private Utils() {}  public static void mergeSort(int[] a) {  mergeSort(a, 0, a.length - 1);  }  private static void mergeSort(int[] a, int leftIndex, int rightIndex) {  final int MAGIC_VALUE = 50;  if (leftIndex < rightIndex) {   if (rightIndex - leftIndex <= MAGIC_VALUE) {   insertionSort(a, leftIndex, rightIndex);   } else {   int middleIndex = (leftIndex + rightIndex) / 2;   mergeSort(a, leftIndex, middleIndex);   mergeSort(a, middleIndex + 1, rightIndex);   merge(a, leftIndex, middleIndex, rightIndex);   }  }  }  private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {  int length1 = middleIndex - leftIndex + 1;  int length2 = rightIndex - middleIndex;  int[] leftArray = new int[length1];  int[] rightArray = new int[length2];  System.arraycopy(a, leftIndex, leftArray, 0, length1);  System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);  for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {   if (i == length1) {   a[k] = rightArray[j++];   } else if (j == length2) {   a[k] = leftArray[i++];   } else {   a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];   }  }  }  private static void insertionSort(int[] a, int leftIndex, int rightIndex) {  for (int i = leftIndex + 1; i <= rightIndex; i++) {   int current = a[i];   int j = i - 1;   while (j >= leftIndex && a[j] > current) {   a[j + 1] = a[j];   j--;   }   a[j + 1] = current;  }  }  }    void solve() throws IOException {  int n = readInt();  int[] a = new int[n];  int sum = 0;  for (int i = 0; i < n; i++) {  a[i] = readInt();  sum += a[i];  }  Utils.mergeSort(a);  int s = 0, c = 0;  for (int i = n-1; i >= 0; i--) {  s += a[i];  c++;  if (2 * s > sum) {   break;  }  }  out.println(c);   }  }
3	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 HashSet<Pair> graph[];  static boolean oj = System.getProperty("ONLINE_JUDGE") != null;  public static void main (String[] args) throws Exception {   String st[]=nl();   int n=pi(st[0]);   int input[]=new int[n];   st=nl();   for(int i=0;i<n;i++){    input[i]=pi(st[i]);   }   int ans=0;   Arrays.sort(input);   boolean dp[]=new boolean[n];   for(int i=0;i<n;i++){    if(!dp[i]){     ans++;     for(int j=input[i];j<=200;j+=input[i]){      for(int k=i;k<n;k++){       if(input[k]==j&&!dp[k])dp[k]=true;      }     }    }   }   out.println(ans);   out.flush();   out.close();  }  static String[] nl() throws Exception{   return br.readLine().split(" ");  }  static String[] nls() throws Exception{   return br.readLine().split("");  }  static int pi(String str) {   return Integer.parseInt(str);  }  static long pl(String str){   return Long.parseLong(str);  }  static double pd(String str){   return Double.parseDouble(str);  }  static void printPrecision(double d){   DecimalFormat ft = new DecimalFormat("0.000000000000000000000");   out.println(ft.format(d));  }  static void printMask(long mask){   System.out.println(Long.toBinaryString(mask));  }  static int countBit(int mask){   int ans=0;   while(mask!=0){    if(mask%2==1){     ans++;    }    mask/=2;   }   return ans;  }  static void Makegraph(int n){   graph=new HashSet[n];   for(int i=0;i<n;i++){    graph[i]=new HashSet<>();   }  }  static void addEdge(int a,int b){   graph[a].add(new Pair(b,1));  }  static void addEdge(int a,int b,int c){   graph[a].add(new Pair(b,c));  }   static class PairComp implements Comparator<Pair>{   public int compare(Pair p1,Pair p2){    return p1.u-p2.u;   }  }  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;   }   public int hashCode() {    int hu = (int) (u ^ (u >>> 32));    int hv = (int) (v ^ (v >>> 32));    return 31 * hu + hv;   }   public boolean equals(Object o) {    Pair other = (Pair) o;    return u == other.u && v == other.v;   }   public int compareTo(Pair other) {    if(index!=other.index)     return Long.compare(index, other.index);    return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);   }   public String toString() {    return "[u=" + u + ", v=" + v + "]";   }  }  static class PairCompL implements Comparator<Pairl>{   public int compare(Pairl p1,Pairl p2){    if(p1.u-p2.u<0){     return -1;    }    else if(p1.u-p2.u>0){     return 1;    }    else{     if(p1.v-p2.v<0){      return -1;     }     else if(p1.v-p2.v>0){      return 1;     }     else{      return 0;     }    }   }  }  static class Pairl implements Comparable<Pairl> {    long u;    long v;    int index=-1;    public Pairl(long u, long v) {     this.u = u;     this.v = v;    }     public int hashCode() {     int hu = (int) (u ^ (u >>> 32));     int hv = (int) (v ^ (v >>> 32));     return 31 * hu + hv;    }     public boolean equals(Object o) {     Pairl other = (Pairl) o;     return u == other.u && v == other.v;    }     public int compareTo(Pairl other) {     if(index!=other.index)      return Long.compare(index, other.index);     return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);    }     public String toString() {     return "[u=" + u + ", v=" + v + "]";    }   }  public static void debug(Object... o) {   if(!oj)   System.out.println(Arrays.deepToString(o));  }  static long modulo(long a,long b,long c) {   long x=1;   long y=a;   while(b > 0){    if(b%2 == 1){     x=(x*y)%c;    }    y = (y*y)%c;    b /= 2;   }   return x%c;  }  static long gcd(long x, long y)  {   if(x==0)    return y;   if(y==0)    return x;   long r=0, a, b;   a = (x > y) ? x : y;   b = (x < y) ? x : y;   r = b;   while(a % b != 0)   {    r = a % b;    a = b;    b = r;   }   return r;  }  static void sieveMake(int n){   sieve=new boolean[n];   Arrays.fill(sieve,true);   sieve[0]=false;   sieve[1]=false;   for(int i=2;i*i<n;i++){    if(sieve[i]){     for(int j=i*i;j<n;j+=i){      sieve[j]=false;     }    }   }   primes=new ArrayList<Integer>();   for(int i=0;i<n;i++){    if(sieve[i]){     primes.add(i);    }   }    } }
5	public class TaskA implements Runnable { private InputReader in; private PrintWriter out;  public static void main(String[] args) {  new TaskA().run(); }  public TaskA() {      in = new InputReader(System.in);  out = new PrintWriter(System.out); }  public void run() {    int n = in.readInt();  int min = 101;  int[] a = new int[n];  for (int i = 0; i < n; i++)  min = Math.min(min, a[i] = in.readInt());  int ans = 101;  for (int i = 0; i < n; i++) {  if (a[i] > min)   ans = Math.min(ans, a[i]);  }  if (ans == 101)  out.println("NO");  else  out.println(ans);  out.close(); }  private 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;  }  public long readLong() {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  long res = 0;  do {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  } while (!isSpaceChar(c));  return res * sgn;  }  public String readString() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuffer res = new StringBuffer();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  private boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  private String readLine0() {  StringBuffer buf = new StringBuffer();  int c = read();  while (c != '\n' && c != -1) {   buf.appendCodePoint(c);   c = read();  }  return buf.toString();  }  public String readLine() {  String s = readLine0();  while (s.trim().length() == 0)   s = readLine0();  return s;  }  public String readLine(boolean ignoreEmptyLines) {  if (ignoreEmptyLines)   return readLine();  else   return readLine0();  }  public BigInteger readBigInteger() {  try {   return new BigInteger(readString());  } catch (NumberFormatException e) {   throw new InputMismatchException();  }  }  public char readCharacter() {  int c = read();  while (isSpaceChar(c))   c = read();  return (char) c;  }  public double readDouble() {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.') {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  if (c == '.') {   c = read();   double m = 1;   while (!isSpaceChar(c)) {   if (c < '0' || c > '9')    throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();   }  }  return res * sgn;  } } }
6	public class D {  Reader in = new Reader(System.in);  PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {   new D().run();  }  int n, m;  boolean[][] adjacency;   void run() throws IOException {   n = in.nextInt();   m = in.nextInt();   adjacency = new boolean[n+1][n];   for (int i = 0; i < m; i++) {    int u = in.nextInt(), v = in.nextInt();    adjacency[u-1][v-1] = adjacency[v-1][u-1] = true;    }   final int MASK_BOUND = (1 << n);             long[][] dp = new long[MASK_BOUND][n];   for (int i = 0; i < n; i++)    dp[1<<i][i] = 1;   long sum = 0;   for (int mask = 1; mask < MASK_BOUND; mask++) {    int lowestVertex = (int) (Math.log(lowest(mask)) / Math.log(2));    for (int i = 0; i < n; i++) {     if (bit(i, mask) && i != lowestVertex) {      for (int j = 0; j < n; j++) {       if (adjacency[j][i]) {        dp[mask][i] += dp[mask^(1<<i)][j];       }      }            if (count(mask) >= 3 && adjacency[lowestVertex][i])       sum += dp[mask][i];     } else {          }    }   }   out.println(sum / 2);    out.flush();  }    int count(int mask) {   int count = 0;   while (mask > 0) {    if ((mask & 1) == 1)     count++;    mask >>= 1;   }   return count;  }     int lowest(int mask) {          return mask & (-mask);  }    boolean bit(int index, int mask) {   return ((1 << index) & mask) > 0;  }  static class Reader {   BufferedReader reader;   StringTokenizer tokenizer;   public Reader(InputStream input) {    reader = new BufferedReader(new InputStreamReader(input));    tokenizer = new StringTokenizer("");   }      String nextToken() throws IOException {    while ( ! tokenizer.hasMoreTokens() ) {         tokenizer = new StringTokenizer( reader.readLine() );    }    return tokenizer.nextToken();   }   String readLine() throws IOException {    return reader.readLine();   }   int nextInt() throws IOException {    return Integer.parseInt( nextToken() );   }   long nextLong() throws IOException {    return Long.parseLong( nextToken() );   }   double nextDouble() throws IOException {    return Double.parseDouble( nextToken() );   }  } }
1	public class Main {  public static void main(String[] args) {   new Thread(null, new Runnable() {    public void run() {     new Main().solve();    }   }, "1", 1 << 26).start();  }  void solve() {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   ASonyaAndHotels solver = new ASonyaAndHotels();   solver.solve(1, in, out);   out.close();  }  static class ASonyaAndHotels {   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    int d = in.scanInt();    int[] ar = new int[n];    int ans = 2;    for (int i = 0; i < n; i++) ar[i] = in.scanInt();    for (int i = 0; i < n - 1; i++) {     if (ar[i + 1] - ar[i] == 2 * d) ans++;     else if (ar[i + 1] - ar[i] > 2 * d) ans += 2;    }    out.println(ans);   }  }  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;   }  } }
5	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 TaskB();   solver.solve(1, in, out);   Exit.exit(in, out);  } } abstract class InputReader {  private boolean finished = false;  public abstract int read();  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();   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;  }  public void setFinished(boolean finished) {   this.finished = finished;  }  public abstract void close(); } 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) {   }  } } class Exit {  private Exit() {  }  public static void exit(InputReader in, PrintWriter out) {   in.setFinished(true);   in.close();   out.close();  } } interface Solver {  public void solve(int testNumber, InputReader in, PrintWriter out); } class TaskB implements Solver {  public void solve(int testNumber, InputReader in, PrintWriter out)  {   int n = in.readInt();   int m = in.readInt();   int k = in.readInt();   int[] a = new int[n];   for(int i=0;i<n;i++) a[i] = in.readInt();   Arrays.sort(a);   if(k>=m)   {    out.println(0);   }   else   {    for(int i=n-1;i>=0;i--)    {     k += (a[i]-1);     if(k>=m)     {      out.println(n-i);      return;     }    }    if(k<m) out.println(-1);   }  } }
4	public class Main { static final FastReader FR = new FastReader(); static final BufferedWriter BW = new BufferedWriter(new OutputStreamWriter(System.out));  public static void main(String[] args) throws IOException {  StringBuilder solution = new StringBuilder();  int rows = FR.nextInt();  int cols = FR.nextInt();  int moves = FR.nextInt();  Map<Integer, Integer> horizontalEdgeWeights = new HashMap<Integer, Integer>();  for (int r = 0; r < rows; r++) {  for (int c = 0; c < cols - 1; c++) {   int hash = getHash(r, c);   horizontalEdgeWeights.put(hash, FR.nextInt());  }  }  Map<Integer, Integer> verticalEdgeWeights = new HashMap<Integer, Integer>();  for (int r = 0; r < rows - 1; r++) {  for (int c = 0; c < cols; c++) {   int hash = getHash(r, c);   verticalEdgeWeights.put(hash, FR.nextInt());  }  }   List<List<Integer>> result = getResult(rows, cols, moves, horizontalEdgeWeights, verticalEdgeWeights);  for (int r = 0; r < rows; r++) {  for (int c = 0; c < cols; c++) {   int value = (result != null ? result.get(r).get(c) : -1);   solution.append(value + " ");  }  solution.append("\n");  }  BW.write(solution.toString());  BW.close(); }  static List<List<Integer>> getResult(int rows, int cols, int moves, Map<Integer, Integer> horizontalEdgeWeights, Map<Integer, Integer> verticalEdgeWeights) {  if ((moves & 1) == 1) {  return null;  }  int mid = moves >> 1;  List<List<List<Integer>>> minForDistance = new ArrayList<List<List<Integer>>>(rows);  for (int r = 0; r < rows; r++) {  minForDistance.add(new ArrayList<List<Integer>>(cols));   for (int c = 0; c < cols; c++) {   minForDistance.get(r).add(new ArrayList<Integer>(Collections.nCopies(mid+1, Integer.MAX_VALUE)));   minForDistance.get(r).get(c).set(0, 0);  }  }  for (int m = 1; m <= mid; m++) {  for (int r = 0; r < rows; r++) {   for (int c = 0; c < cols; c++) {   int minBoredom = minForDistance.get(r).get(c).get(m);   int hash = getHash(r, c);    if (r > 0) {    if (minForDistance.get(r-1).get(c).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r-1).get(c).get(m-1) + verticalEdgeWeights.get(getHash(r-1, c));    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }    if (c > 0) {    if (minForDistance.get(r).get(c-1).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r).get(c-1).get(m-1) + horizontalEdgeWeights.get(getHash(r, c-1));    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }      if (r + 1 < rows) {    if (minForDistance.get(r+1).get(c).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r+1).get(c).get(m-1) + verticalEdgeWeights.get(hash);    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }     if (c + 1 < cols) {    if (minForDistance.get(r).get(c+1).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r).get(c+1).get(m-1) + horizontalEdgeWeights.get(hash);    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }    minForDistance.get(r).get(c).set(m, minBoredom);   }  }  }  List<List<Integer>> result = new ArrayList<List<Integer>>(rows);  for (int r = 0; r < rows; r++) {  result.add(new ArrayList<Integer>(cols));   for (int c = 0; c < cols; c++) {   result.get(r).add(minForDistance.get(r).get(c).get(mid) << 1);  }  }  return result; }  static int getHash(int row, int col) {  return (row * 1000 + col); } static int getRow(int hash) {  return hash / 1000; } static int getCol(int hash) {  return hash % 1000; }  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());  }  double nextDouble() {  return Double.parseDouble(next());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  } } }
1	public class codef8 {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);  int num = sc.nextInt();  int beacon[] = new int[1000001];  int pos[] = new int[num];  for (int i = 0; i < num; i++) {  int position = sc.nextInt();  beacon[position] = sc.nextInt();  pos[i] = position;  }  int dp[] = new int[1000001];  int max = 0;  if (beacon[0] != 0)  dp[0] = 1;   for (int i = 1; i <= 1000000; i++) {  if (beacon[i] == 0) {   dp[i] = dp[i-1];  }   else {   int j = i - beacon[i] - 1;   if (j < 0) {   dp[i] = 1;   }   else {   dp[i] = dp[j] + 1;   }  }  max = Math.max(max, dp[i]);  }   System.out.println(num-max); } }
6	public class Solution{  public static long mod = 1000000007;  public static void main(String[] args)throws IOException{   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(System.out);   StringTokenizer st = new StringTokenizer(br.readLine());   int n = Integer.parseInt(st.nextToken());   int t = Integer.parseInt(st.nextToken());   int[] d = new int[n];   int[] g = new int[n];   for(int i=0;i<n;i++){    st = new StringTokenizer(br.readLine());    d[i] = Integer.parseInt(st.nextToken());    g[i] = Integer.parseInt(st.nextToken())-1;   }   long[][] dp = new long[(1<<n)][3];   for(int i=0;i<n;i++){    dp[(1<<i)][g[i]] = 1;   }   long res = 0;   for(int i=1;i<(1<<n);i++){    int k = i;    int sum = 0;    for(int j=n-1;j>=0;j--){     if(k>=(1<<j)){      k-=(1<<j);      sum += d[j];     }     else{      for(int r=0;r<3;r++) if(r!=g[j]) dp[i+(1<<j)][g[j]] += dp[i][r];      dp[i+(1<<j)][g[j]] %= mod;     }    }    if(sum==t){     res += dp[i][0] +dp[i][1] +dp[i][2];     res %= mod;    }   }   out.println(res);   out.flush();  } }
0	public class LuckyDivision {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);     int n = in.nextInt();     if( n % 4==0 ||    n % 7==0 ||    n % 47==0 ||    n % 74==0 ||    n % 447==0 ||    n % 474==0 ||    n % 477==0 ||    n % 744==0 ||    n % 774==0 ||    n % 777==0   )    System.out.println("YES");   else    System.out.println("NO");  } }
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[] diameter(int[][] g) {   int n = g.length;   int f0 = -1, f1 = -1, d01 = -1;   int[] q = new int[n];   boolean[] ved = new boolean[n];   {    int qp = 0;    q[qp++] = 0; ved[0] = true;    for(int i = 0;i < qp;i++){     int cur = q[i];     for(int e : g[cur]){      if(!ved[e]){       ved[e] = true;       q[qp++] = e;       continue;      }     }    }    f0 = q[n-1];   }   {    int[] d = new int[n];    int qp = 0;    Arrays.fill(ved, false);    q[qp++] = f0; ved[f0] = true;    for(int i = 0;i < qp;i++){     int cur = q[i];     for(int e : g[cur]){      if(!ved[e]){       ved[e] = true;       q[qp++] = e;       d[e] = d[cur] + 1;       continue;      }     }    }    f1 = q[n-1];    d01 = d[f1];   }   return new int[]{d01, f0, f1};  }  public static long c(int n, int k) {   return (fac[n] * facInv[k] % MOD) * facInv[n - k] % MOD;  }    public static class SegmentTreeRMQ {   public int M, H, N;   public int[] st;   public SegmentTreeRMQ(int n)   {    N = n;    M = Integer.highestOneBit(Math.max(N-1, 1))<<2;    H = M>>>1;    st = new int[M];    Arrays.fill(st, 0, M, Integer.MAX_VALUE);   }   public SegmentTreeRMQ(int[] a)   {    N = a.length;    M = Integer.highestOneBit(Math.max(N-1, 1))<<2;    H = M>>>1;    st = new int[M];    for(int i = 0;i < N;i++){     st[H+i] = a[i];    }    Arrays.fill(st, H+N, M, Integer.MAX_VALUE);    for(int i = H-1;i >= 1;i--)propagate(i);   }   public void update(int pos, int x)   {    st[H+pos] = x;    for(int i = (H+pos)>>>1;i >= 1;i >>>= 1)propagate(i);   }   private void propagate(int i)   {    st[i] = Math.min(st[2*i], st[2*i+1]);   }   public int minx(int l, int r){    int min = Integer.MAX_VALUE;    if(l >= r)return min;    while(l != 0){     int f = l&-l;     if(l+f > r)break;     int v = st[(H+l)/f];     if(v < min)min = v;     l += f;    }    while(l < r){     int f = r&-r;     int v = st[(H+r)/f-1];     if(v < min)min = v;     r -= f;    }    return min;   }   public int min(int l, int r){ return l >= r ? 0 : min(l, r, 0, H, 1);}   private int min(int l, int r, int cl, int cr, int cur)   {    if(l <= cl && cr <= r){     return st[cur];    }else{     int mid = cl+cr>>>1;     int ret = Integer.MAX_VALUE;     if(cl < r && l < mid){      ret = Math.min(ret, min(l, r, cl, mid, 2*cur));     }     if(mid < r && l < cr){      ret = Math.min(ret, min(l, r, mid, cr, 2*cur+1));     }     return ret;    }   }  }  public static char[] rev(char[] a){char[] b = new char[a.length];for(int i = 0;i < a.length;i++)b[a.length-1-i] = a[i];return b;}  public static double dist(double a, double b){   return Math.sqrt(a * a + b * b);  }  public static long inv(long a){   return quickPOW(a, MOD - 2);  }  public class Interval {   int start;   int end;   public Interval(int start, int end) {    this.start = start;    this.end = end;   }  }  public static ArrayList<Integer> sieveOfEratosthenes(int n) {   boolean prime[] = new boolean[n + 1];   Arrays.fill(prime, true);   for (int p = 2; p * p <= n; p++) {    if (prime[p]) {     for (int i = p * 2; i <= n; i += p) {      prime[i] = false;     }    }   }   ArrayList<Integer> primeNumbers = new ArrayList<>();   for (int i = 2; i <= n; i++) {    if (prime[i]) {     primeNumbers.add(i);    }   }   return primeNumbers;  }   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 int rlowerBound(int[] a, int v){ return lowerBound(a, 0, a.length, v); }  public static int rlowerBound(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 C(int n, int m)  {   if(m == 0 || m == n) return 1l;   if(m > n || m < 0) return 0l;   long res = fac[n] * quickPOW((fac[m] * fac[n - m]) % MOD, MOD - 2) % MOD;   return res;  }  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 Randomized {   public static void shuffle(int[] data) {    shuffle(data, 0, data.length - 1);   }   public static void shuffle(int[] data, int from, int to) {    to--;    for (int i = from; i <= to; i++) {     int s = nextInt(i, to);     int tmp = data[i];     data[i] = data[s];     data[s] = tmp;    }   }   public static void shuffle(long[] data) {    shuffle(data, 0, data.length - 1);   }   public static void shuffle(long[] data, int from, int to) {    to--;    for (int i = from; i <= to; i++) {     int s = nextInt(i, to);     long tmp = data[i];     data[i] = data[s];     data[s] = tmp;    }   }   public static int nextInt(int l, int r) {    return RandomWrapper.INSTANCE.nextInt(l, r);   }  }  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());   }   double nd() {    return Double.parseDouble(next());   }   String nextLine(){    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  }  }
4	public class Problem implements Runnable {  private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  private BufferedReader in;  private PrintWriter out;  private StringTokenizer tok = new StringTokenizer("");  private void init() throws FileNotFoundException {   Locale.setDefault(Locale.US);   String fileName = "";       in = new BufferedReader(new FileReader("input.txt"));     out = new PrintWriter("output.txt");     }   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());  }  long readLong() {   return Long.parseLong(readString());  }  double readDouble() {   return Double.parseDouble(readString());  }  int[] readIntArray(int size) {   int[] a = new int[size];   for (int i = 0; i < size; i++) {    a[i] = readInt();   }   return a;  }  public static void main(String[] args) {     new Problem().run();  }  long timeBegin, timeEnd;  void time() {   timeEnd = System.currentTimeMillis();   System.err.println("Time = " + (timeEnd - timeBegin));  }  @Override  public void run() {   try {    timeBegin = System.currentTimeMillis();    init();    solve();    out.close();    time();   } catch (Exception e) {    e.printStackTrace();    System.exit(-1);   }  }  int[][] dist;  int n, m;  private void solve() throws IOException {   n = readInt();   m = readInt();   int k=readInt();   dist = new int[n][m];   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     dist[i][j] = -1;   for (int i = 0; i < k; i++) {    dist[readInt()-1][readInt()-1]=0;   }   for (int i=0;i<n;i++)    for (int j=0;j<m;j++)     if (dist[i][j]==0)      bfs(i, j);   int max=0,X=0,Y=0;   for (int i=0;i<n;i++)    for (int j=0;j<m;j++)     if (dist[i][j]>=max){      max=dist[i][j];      X=i+1; Y=j+1;     }   out.println(X+" "+Y);  }  public void bfs(int x, int y) {   int[] dx = {0, 1, 0, -1};   int[] dy = {1, 0, -1, 0};   dist[x][y] = 0;   ArrayDeque<P> q = new ArrayDeque<>();   q.add(new P(x, y));   while (!q.isEmpty()) {    P v = q.poll();    for (int i = 0; i < 4; i++) {     int nx = v.x + dx[i];     int ny = v.y + dy[i];     if (inside(nx, ny) && (dist[nx][ny] == -1 || (dist[nx][ny] > dist[v.x][v.y] + 1&&dist[nx][ny]!=0))) {      q.add(new P(nx, ny));      dist[nx][ny] = dist[v.x][v.y] + 1;     }    }   }  }  public boolean inside(int x, int y) {   if (x < n && y < m && x >= 0 && y >= 0) {    return true;   }   return false;  } }  class P {  int x, y;  public P(int x, int y) {   this.x = x;   this.y = y;  } }
3	public class Paint_The_Numbers {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  ArrayList<Integer> paint = new ArrayList<Integer>();  int num = scan.nextInt();  for(int i = 0; i < num;i++)  paint.add(scan.nextInt());  Collections.sort(paint);  int counter = 0;   while(paint.size()!=0) {  num = paint.remove(0);  for(int i = 0; i<paint.size();i++) {   if(paint.get(i)%num==0) {   paint.remove(i--);   }  }  counter++;  }  System.out.println(counter); } }
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 Pair {   public String x;   public int y;   public Pair(String x, int y){    this.x = x;    this.y=y;   }                                 }   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());   }   public double nextDouble(){    return Double.parseDouble(nextToken());   }   public long nextLong(){    return Long.parseLong(nextToken());   }  } }
4	public class ViewAngle{    private static int V,level[][],count=-1,lev_dfs[],degree=0,no_vert_conn_comp=0;    private static Stack <Integer>st=new Stack();    private static LinkedList<Integer > adj[];    private static boolean[][] Visite;    private static boolean [] Visited;    private static TreeSet<Integer> ts=new TreeSet();        private static Queue<Pair> queue = new LinkedList<Pair>();    ViewAngle(int V){   V++;   this.V=(V);   adj=new LinkedList[V];   Visite=new boolean[100][100];    Visited=new boolean[V];     lev_dfs=new int[V];   for(int i=0;i<V;i++)   adj[i]=new LinkedList<Integer>();   }    static File inFile,outFile;    static FileWriter fWriter;    static PrintWriter pWriter;    public static void main(String[] args) throws IOException {       inFile=new File("input.txt");    outFile = new File ("output.txt");    fWriter = new FileWriter (outFile);   pWriter = new PrintWriter (fWriter);   Scanner sc = new Scanner (inFile);   int n=sc.nextInt();   int m=sc.nextInt();   char c[][]=new char[n][m];   for(int i=0;i<n;i++){   for(int j=0;j<m;j++){    c[i][j]='.';   }   }   setup(n, m);   int k=sc.nextInt();   for(int i=0;i<k;i++){   int x=sc.nextInt();   int y=sc.nextInt();   queue.add(new Pair(x-1, y-1));   c[x-1][y-1]='X';   level[x-1][y-1]=-1;   Visite[x-1][y-1]=true;   }  BFS(c, n, m);   pWriter.close();   sc.close();   }   static void addEdge(int v,int w){      if(adj[v]==null){    adj[v]=new LinkedList();   }   adj[v].add(w);         }     public static int BFS2(int startVert,int dest){   Visited=new boolean[V];   for(int i=1;i<V;i++){    lev_dfs[i]=-1;   }   Queue<Integer> q=new LinkedList<Integer>();   q.add(startVert);      lev_dfs[startVert]=0;   while(!q.isEmpty()){    int top=q.poll();       Iterator<Integer> i= adj[top].listIterator();    while(i.hasNext()){    int n=i.next();    if(!Visited[n]){     q.add(n);     Visited[n]=true;     lev_dfs[n]=lev_dfs[top]+1;    if(n==dest){     q.clear();     return lev_dfs[n];        }    }    }   }   q.clear();   return -1;   }   public int getEd(){   return degree/2;   }   public void get(int from,int to){   int h=lev_dfs[from]-lev_dfs[to];   if(h<=0){    System.out.println(-1);   }else{    System.out.println(h-1);   }   }   public static void setup(int n,int m){    level=new int[n][m];   Visite=new boolean[n][m];   }   private static boolean check(int x,int y,char c[][]){     if((x>=0 && y>=0) && (x<c.length && y<c[0].length) && c[x][y]=='.'){      return true;   }   return false;  }   public static int BFS(char[][] c,int n,int m)   {          int count=0;      while (!queue.isEmpty())    {         Pair temp = queue.poll();     int x=temp.w;     int y=temp.h;     Visite[x][y]=true;     if(check(x+1,y,c) && !Visite[x+1][y]){     level[x+1][y]=level[x][y]+1;     queue.add(new Pair(x+1, y));     Visite[x+1][y]=true;     }     if(check(x-1,y,c) && !Visite[x-1][y]){     level[x-1][y]=level[x][y]+1;     queue.add(new Pair(x-1, y));     Visite[x-1][y]=true;     }     if(check(x,y+1,c) && !Visite[x][y+1]){     level[x][y+1]=level[x][y]+1;     queue.add(new Pair(x, y+1));     Visite[x][y+1]=true;     }     if(check(x,y-1,c) && !Visite[x][y-1]){     level[x][y-1]=level[x][y]+1;     queue.add(new Pair(x, y-1));     Visite[x][y-1]=true;     }            }    int prev_lev=-1,x=-1,y=-1;    for(int i=0;i<n;i++){    for(int j=0;j<m;j++){     if(level[i][j]>=prev_lev){     prev_lev=level[i][j];     x=i;y=j;     }         }        }       pWriter.println((x+1)+" "+(y+1));    return V;   }     private void getAns(int startVertex){   for(int i=0;i<adj[startVertex].size();i++){    int ch=adj[startVertex].get(i);    for(int j=0;j<adj[ch].size();j++){    int ch2=adj[ch].get(j);    if(adj[ch2].contains(startVertex)){     System.out.println(startVertex+" "+ch+" "+ch2);     System.exit(0);    }    }   }   }      public long dfs(int startVertex){          if(!Visited[startVertex]) {     return dfsUtil(startVertex,Visited);      }            return 0;   }  private long dfsUtil(int startVertex, boolean[] Visited) {    int c=1;   long cout=0;   degree=0;   Visited[startVertex]=true;      st.push(startVertex);   while(!st.isEmpty()){      int top=st.pop();      Iterator<Integer> i=adj[top].listIterator();   degree+=adj[top].size();     while(i.hasNext()){     int n=i.next();     if( !Visited[n]){     Visited[n]=true;     st.push(n);          lev_dfs[n]=top;        }    }    }      for(int i=1;i<V;i++){   if(lev_dfs[i]!=0){    System.out.print(lev_dfs[i]+" ");   }   }   return cout;                     }       }  class Pair implements Comparable<Pair>{   int w; int h; Pair(int w,int h){  this.w=w;  this.h=h; } @Override public int compareTo(Pair o) {    if(w>o.w){  return 1;  }else if(w<o.w){  return -1;  }else{  if(h>o.h)   return 1;  else if(h<o.h)   return -1;  else  return 0;  }    } }
4	public class Test {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   StringBuilder text = new StringBuilder(in.nextLine()); String substr; String max="";   for(int i=2; i<=text.length(); i++){    for(int j=0; j<i; j++){     substr = text.substring(j, i);     if(text.lastIndexOf(substr) != text.indexOf(substr)){      if(substr.length() > max.length()){ max = substr;}     }    }   }   System.out.println(max.length());  } }
4	public class Main {  InputStream is;  PrintWriter out;  String INPUT = "";   long MAX = 100000L, MOD = 1000000007L, INF = (long) 1e18;   boolean isValid(int x, int y, int n, int m){   return x>=0 && y>=0 && x<n && y<m;  }   void solve(int TC) throws Exception {   helper hp = new helper(MOD, (int)MAX);   hp.initIO("input.txt", "output.txt");   int n = hp.nextInt(), m = hp.nextInt();   boolean[][] a = new boolean[n][m];   int k = hp.nextInt();   ArrayDeque<int[]> q = new ArrayDeque<>();   for(int i=0;i<k;i++){    int x = hp.nextInt() - 1;    int y = hp.nextInt() - 1;    a[x][y] = true;    q.add(new int[]{x,y});   }   int lastX = 0,lastY = 0;   int[] dx = new int[]{1,-1,0,0};   int[] dy = new int[]{0,0,1,-1};   while(!q.isEmpty()){    int[] X = q.pollFirst();    for(int i=0;i<4;i++){     int x = X[0] + dx[i];     int y = X[1] + dy[i];     if(isValid(x,y,n,m) && !a[x][y]){      a[x][y] = true;      lastX = x;      lastY = y;      q.add(new int[]{x,y});     }    }   }   hp.println((lastX+1) + " " + (lastY+1)); hp.flush();  }   boolean TestCases = false;  public static void main(String[] args) throws Exception { new Main().run(); }   void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}  static void dbg(Object... o){System.err.println(Arrays.deepToString(o));}   void run() throws Exception {   is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());   out = new PrintWriter(System.out);   long s = System.currentTimeMillis();   int T = TestCases ? ni() : 1;   for(int t=1;t<=T;t++) solve(t);   out.flush();   if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");  }   void p(Object o) { out.print(o); }  void pn(Object o) { out.println(o); }  void pni(Object o) { out.println(o);out.flush(); }  double PI = 3.141592653589793238462643383279502884197169399;   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();   }  }   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();   }  }   double nd() { return Double.parseDouble(ns()); }  char nc() { return (char)skip(); }   int BUF_SIZE = 1024 * 8;  byte[] inbuf = new byte[BUF_SIZE];  int lenbuf = 0, ptrbuf = 0;   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++];  }   boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }  int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }   String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b))) {    sb.appendCodePoint(b); b = readByte();   } return sb.toString();  }   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);  }   void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); } }  class helper {  final long MOD;  final int MAXN;  final Random rnd;  public helper(long mod, int maxn) {   MOD = mod;   MAXN = maxn;   rnd = new Random();  }   static final int BUFSIZE = 1 << 20;  static byte[] buf;  static int index, total;  static InputStream in;  static BufferedWriter bw;   public void initIO(InputStream is, OutputStream os) {   try {    in = is;    bw = new BufferedWriter(new OutputStreamWriter(os));    buf = new byte[BUFSIZE];   } catch (Exception e) {   }  }  public void initIO(String inputFile, String outputFile) {   try {    in = new FileInputStream(inputFile);    bw = new BufferedWriter(new OutputStreamWriter(      new FileOutputStream(outputFile)));    buf = new byte[BUFSIZE];   } catch (Exception e) {    e.printStackTrace();   }  }   private int scan() throws Exception {   if (index >= total) {    index = 0;    total = in.read(buf);    if (total <= 0)     return -1;   }   return buf[index++];  }  public String next() throws Exception {   int c;   for (c = scan(); c <= 32; c = scan()) ;   StringBuilder sb = new StringBuilder();   for (; c > 32; c = scan())    sb.append((char) c);   return sb.toString();  }  public int nextInt() throws Exception {   int c, val = 0;   for (c = scan(); c <= 32; c = scan()) ;   boolean neg = c == '-';   if (c == '-' || c == '+')    c = scan();   for (; c >= '0' && c <= '9'; c = scan())    val = (val << 3) + (val << 1) + (c & 15);   return neg ? -val : val;  }  public long nextLong() throws Exception {   int c;   long val = 0;   for (c = scan(); c <= 32; c = scan()) ;   boolean neg = c == '-';   if (c == '-' || c == '+')    c = scan();   for (; c >= '0' && c <= '9'; c = scan())    val = (val << 3) + (val << 1) + (c & 15);   return neg ? -val : val;  }   public long pow(long base, long exp, long MOD) {   base %= MOD;   long ret = 1;   while (exp > 0) {    if ((exp & 1) == 1) ret = ret * base % MOD;    base = base * base % MOD;    exp >>= 1;   }   return ret;  }   public void println(Object a) throws Exception {   bw.write(a.toString()+"\n");  }  public void print(Object a) throws Exception {   bw.write(a.toString());  }  public void flush() throws Exception {   bw.flush();  }   public static int[] sieve;  public static ArrayList<Integer> primes;   public void setSieve() {   primes = new ArrayList<>();   sieve = new int[MAXN];   int i, j;   for (i = 2; i < MAXN; ++i)    if (sieve[i] == 0) {     primes.add(i);     for (j = i; j < MAXN; j += i) {      sieve[j] = i;     }    }  } }
6	public class Main {  private static final int SIM = 1; private static final int NAO = 2;  public static void main(String[] args) {  Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));   int n = in.nextInt();  int m = in.nextInt();  int[][] a = new int[n][m];  int[][] graphVerticial = null;  int[][] graphDiagonal = null;   for(int i = 0; i < n; i++) {  for(int j = 0; j < m; j++) {   a[i][j] = in.nextInt();  }  }   graphVerticial = createGraphVertical(n, m, a);  graphDiagonal = createGraphDiagonal(n, m, a);      int result = 0;  int k = 1;  int piso = 0;  int teto = 1000000000;   while(true) {    k = (int) Math.ceil((teto - piso) / 2.0) + piso;    if(isOk(n, k, graphVerticial, graphDiagonal)) {   result = Math.max(result, k);   piso = k;  }  else{   teto = k - 1;  }       if(teto <= piso) break;    }   System.out.println(result);   }  public static int[][] createGraphVertical(int n, int m, int[][] a){   int[][] graph = new int[n][n];   for(int i = 0; i < n; i++) {    for(int j = 0; j < n; j++) {     if(i == j) continue;   if(i > j) {graph[i][j] = graph[j][i]; continue;}     graph[i][j] = Integer.MAX_VALUE;     for(int k = 0; k < m; k++) {   graph[i][j] = Math.min(graph[i][j], Math.abs(a[i][k] - a[j][k]));   }  }  }   return graph; }  public static int[][] createGraphDiagonal(int n, int m, int[][] a){   int[][] graph = new int[n][n];   for(int i = 0; i < n; i++) {    for(int j = 0; j < n; j++) {     graph[i][j] = Integer.MAX_VALUE;     for(int k = 0; k < m - 1; k++) {   graph[i][j] = Math.min(graph[i][j], Math.abs(a[j][k] - a[i][k + 1]));   }  }  }   return graph; }  public static int hasPath(int n, int k, int origem, int destino, int conjunto, int[][] graph, int[][][] pd) {        if(pd[origem][destino][conjunto] != 0) return pd[origem][destino][conjunto];   if(conjunto == 0) {  return origem == destino ? SIM : NAO;  }  else if(origem == destino){  return NAO;  }   for(int i = 0; i < n; i++) {    if(i == origem) continue;    int novoConjunto = conjunto - (1 << i);  boolean pertenceConjunto = ((conjunto >> i) % 2) == 1;    if(pertenceConjunto && graph[origem][i] >= k && hasPath(n, k, i, destino, novoConjunto, graph, pd) == SIM) {   pd[origem][destino][conjunto] = SIM;   return pd[origem][destino][conjunto];  }  }   pd[origem][destino][conjunto] = NAO;   return pd[origem][destino][conjunto];   }  public static boolean isOk(int n, int k, int[][] graphVertical, int[][] graphDiagonal) {   int conjunto = (int) Math.pow(2, n) - 1;   int[][][] pd = new int[n][n][(int)Math.pow(2, n)];   for(int i = 0; i < n; i++) {    for(int j = 0; j < n; j++) {     if(i == j && n > 1) continue;     int novoConjunto = conjunto - (1 << i);     if(graphDiagonal[i][j] >= k && hasPath(n, k, i, j, novoConjunto, graphVertical, pd) == SIM) {   return true;   }     }  }   return false;   }  public static void print(int[][] graph) {   for(int i = 0; i < graph.length; i++) {    for(int j = 0; j < graph.length; j++) {      System.out.print(graph[i][j] + " ");     }    System.out.println();    }   }  public static void print(int n) {   List<Integer> bits = new Vector<>();   while(n > 0) {    bits.add(n % 2);  n /= 2;  }   for(int i = bits.size() - 1; i >= 0; i--) {  System.out.print(bits.get(i));  }   System.out.println();   }  }
1	public class Main {  class node{  int data;  node next;  public node(int val){  data=val;  next=null;  } } class linkedlist{  node start;  node end;  int size;  int turn;  public linkedlist(){  start=null;  end=null;  size=0;  }  void add(int val){  if(size==0){   node t=new node(val);   start=t;   end=t;   size++;  }  else{   node t=new node(val);   end.next=t;   end=end.next;   size++;  }  }  void myfunc(){  if(start.data>start.next.data){     node t=new node(start.next.data);   start.next=start.next.next;   end.next=t;   end=end.next;  }  else{     int t=start.data;   start=start.next;   add(t);   size--;  }  }  int findmax(){  int m=0;  node temp=start;  for(int i=0;i<size;i++){   if(temp.data>m){   m=temp.data;   }   temp=temp.next;  }  return m;  }  void display(){  node temp=start;  for(int i=0;i<size;i++){   System.out.print(temp.data+" ");   temp=temp.next;  }  System.out.println("");  } } linkedlist l; public Main(){  l=new linkedlist(); } public static void main(String [] argv) throws IOException {  BufferedReader in=new BufferedReader(new InputStreamReader(System.in));  Main ma=new Main();  String[] l1=in.readLine().split(" ");  int n=Integer.parseInt(l1[0]);  int q=Integer.parseInt(l1[1]);  String[] ar=in.readLine().split(" ");  int a1=Integer.parseInt(ar[0]);  int b1=Integer.parseInt(ar[1]);  for(int i=0;i<n;i++){  ma.l.add(Integer.parseInt(ar[i]));  }  int m=ma.l.findmax();  int[][] pair=new int[n][2];  int t=0;  for(int i=0;i<n;i++){  if(ma.l.start.data==m)   break;  ma.l.myfunc();  pair[t][0]=ma.l.start.data;  pair[t][1]=ma.l.start.next.data;  t++;  }  int rl[]=new int[n];  node temp=ma.l.start;  for(int i=0;i<n;i++){  rl[i]=temp.data;  temp=temp.next;  }  for(int i=0;i<q;i++){  long a=Long.parseLong(in.readLine());  if(a==1){   System.out.println(a1 + " " + b1);  }  else{   if(a<=t+1){   System.out.println(pair[(int)(a-2)][0]+" "+pair[(int)(a-2)][1]);   }   else{   if((a-t)%(n-1)==0){    System.out.println(rl[0]+" "+rl[n-1]);   }   else{    System.out.println(rl[0]+" "+rl[(int)((a-t)%(n-1))]);   }   }  }  } } }
2	public class cf256b { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  long n = in.nextLong();  long x = in.nextLong()-1;  long y = in.nextLong()-1;  long c = in.nextLong();   long lo = 0, hi = 2*n+10;  while(hi - lo > 2) {  long mid = (hi+lo)/2;  if(calc(n,x,y,mid) >= c)   hi = mid;  else   lo = mid;  }  while(calc(n,x,y,lo) < c) lo++;  System.out.println(lo); } static long calc(long n, long x, long y, long t) {  long ans = (2*t)*(t+1)+1;   long top = Math.max(0,t-x);  long bottom = Math.max(0,t-(n-1-x));  long left = Math.max(0,t-y);  long right = Math.max(0,t-(n-1-y));  ans -= top*top + bottom*bottom + left*left + right*right;   long tl = Math.max(0, t - (x+y+1));  long tr = Math.max(0, t - (x+(n-1-y)+1));  long bl = Math.max(0, t - ((n-1-x)+y+1));  long br = Math.max(0, t - ((n-1-x) + (n-1-y) + 1));   ans += (tl*tl+tl)/2 + (tr*tr+tr)/2 + (bl*bl+bl)/2 + (br*br+br)/2;  return ans; } }
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(); } }
0	public class A { static Scanner scan = new Scanner (System.in); static PrintStream out = System.out;  static void go (int n) {  if (n == 0) {  System.out.println (0 + " " + 0 + " " + 0);  return;  }  int a = 0, b = 1;  int c = a + b;  while (n > c) {  a = b;  b = c;  c = a + b;  }  System.out.println (0 + " " + a + " " + b); }  public static void main (String[] args) {  int n = scan.nextInt();  go (n);  }    }
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 void debug(Object... obj) {   System.err.println(Arrays.deepToString(obj));  }  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();    }   }  } }
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));  } }
2	public class Main implements Runnable {  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private SpaceCharFilter filter;   private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   public InputReader(InputStream stream) {    this.stream = stream;   }     public int read() {    if (numChars==-1)     throw new InputMismatchException();       if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     }     catch (IOException e) {      throw new InputMismatchException();     }         if(numChars <= 0)          return -1;    }    return buf[curChar++];   }     public String nextLine() {    String str = "";    try {     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }   public int nextInt() {    int c = read();       while(isSpaceChar(c))     c = read();       int sgn = 1;       if (c == '-') {     sgn = -1;     c = read();    }       int res = 0;    do {     if(c<'0'||c>'9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));        return res * sgn;   }     public long nextLong() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;       do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));     return res * sgn;   }     public double nextDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, nextInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, nextInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }     public String readString() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    }    while (!isSpaceChar(c));       return res.toString();   }     public boolean isSpaceChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }     public String next() {    return readString();   }     public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  public static void main(String args[]) throws Exception {   new Thread(null, new Main(),"Main",1<<26).start();  }  long fast_pow(long a, long b) {   if(b == 0)    return 1L;   long val = fast_pow(a, b / 2);   if(b % 2 == 0)    return val * val % mod;   else    return val * val % mod * a % mod;  }  long mod = (long)1e9 + 7;  public void run() {   InputReader sc = new InputReader(System.in);   PrintWriter w = new PrintWriter(System.out);   long x = sc.nextLong();   long k = sc.nextLong();   if(x == 0) {    w.print("0");    w.close();    return;   }   x = x % mod;   long pkp1 = fast_pow(2, k + 1L);   long pk = fast_pow(2, k);   long sub = (pk - 1 + mod) % mod * pk % mod;   long add = x * pkp1 % mod * pk % mod;   long num = (add - sub + mod) % mod;   long deninv = fast_pow(pk, mod - 2);   long ans = num * deninv % mod;   w.print(ans);   w.close();   } }
0	public class ATestingRound5 {  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int T = in.nextInt();  while(T --> 0) {  int a = in.nextInt();  int b = in.nextInt();  int count = 0;    int[] arr = {a, b};  Arrays.sort(arr);  while(arr[0] != 0) {   count += arr[1] / arr[0];   arr[1] = arr[1] % arr[0];     Arrays.sort(arr);  }  System.out.println(count);  }  in.close(); } }
5	public class A {    public static void main(String[] args) {   HomeWorks hw = new HomeWorks();   hw.sol();   hw.print();  } } class HomeWorks {  HomeWorks(){   Scanner scr = new Scanner(System.in);     n = scr.nextInt();   a = scr.nextInt();   b = scr.nextInt();   h = new int[n];     for (int i = 0; i < n; i++){    h[i] = scr.nextInt();   }   scr.close();  }   void sol() {   Arrays.sort(h);   int Vasya = h[b-1];   int Petya = h[b];      ans = Petya - Vasya;   if (ans < 0){    ans = 0;   }    }   void print(){   PrintWriter pw = new PrintWriter(System.out);   pw.println(ans);   pw.flush();   pw.close();  }   int ans;   int[] h;   int n;  int a;  int b; }
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);              } }
2	public class Main {   static long[] dx = new long[]{0, 1, 0, -1}; static long[] dy = new long[]{-1, 0, 1, 0}; public static void main(String[] args) {  Scanner r = new Scanner(System.in);   long N = r.nextLong();  long X = r.nextLong();  long Y = r.nextLong();  long C = r.nextLong();   long lo = 0, hi = N * 2;   while(lo < hi){  long T = (lo + hi) / 2;    long[] NX = new long[4];  long[] NY = new long[4];    for(int d = 0; d < 4; d++){   NX[d] = X + dx[d] * T;   NY[d] = Y + dy[d] * T;  }    long ret = (T + 1) * (T + 1) + T * T;    ret -= half(1 - NY[0]);  ret -= half(NY[2] - N);  ret -= half(NX[1] - N);  ret -= half(1 - NX[3]);    ret += quarter(1 - NY[0] - (N - X + 1));  ret += quarter(1 - NY[0] - (X));  ret += quarter(NY[2] - N - (N - X + 1));  ret += quarter(NY[2] - N - (X));    if(ret < C)lo = T + 1;  else hi = T;  }   System.out.println(lo);   } private static long half(long x) {  if(x <= 0)return 0;  else return 2 * quarter(x) - x; } private static long quarter(long x){  if(x <= 0)return 0;  return x * (x + 1) / 2; } }
6	public class cf8c { static int n; static int[] bb; static int[] memo; static int[][] cost; static FastIO in = new FastIO(), out = in; public static void main(String[] args) {  vec2 cen = new vec2(in.nextInt(),in.nextInt());  n = in.nextInt();  cost = new int[n][n];  vec2[] v = new vec2[n];  for(int i=0; i<n; i++)  v[i] = new vec2(in.nextInt(),in.nextInt());  for(int i=0; i<n; i++)  for(int j=0; j<n; j++)   cost[i][j] = v[i].dist(cen) + v[i].dist(v[j]) + v[j].dist(cen);  memo = new int[1<<n];  bb = new int[1<<n];  Arrays.fill(memo,-1);  out.println(go(0));  build(0);  out.close(); } static void build(int mask) {  if(mask == (1<<n)-1) {  out.println(0);  return;  }  int first = 0;  while((mask & (1<<first)) != 0) first++;  int second = bb[mask];  out.print("0 " + (first+1) + " ");  if(second != first)  out.print((second+1)+" ");  build(mask|(1<<first)|(1<<second)); } static int go(int mask) {  if(mask == (1<<n)-1) return 0;  if(memo[mask] != -1) return memo[mask];  int first = 0;  int ans = Integer.MAX_VALUE;  while((mask & (1<<first)) != 0) first++;  for(int second = first; second < n; second++) {  if((mask & (1<<second)) != 0) continue;  int tans = cost[first][second] + go(mask|(1<<first)|(1<<second));  if(tans < ans) {   ans = tans;   bb[mask] = second;  }  }  return memo[mask] = ans; } static class vec2 {  int x, y;  vec2(int a, int b) {  x = a; y = b;  }  vec2 sub(vec2 v) {  return new vec2(x-v.x,y-v.y);  }  int dist(vec2 v) {  return sub(v).mag2();  }  int mag2() {  return x*x+y*y;  } } static class FastIO extends PrintWriter {  BufferedReader br;  StringTokenizer st;   public FastIO() {  this(System.in,System.out);  }  public FastIO(InputStream in, OutputStream out) {  super(new BufferedWriter(new OutputStreamWriter(out)));  br = new BufferedReader(new InputStreamReader(in));  scanLine();  }  public void scanLine() {  try {   st = new StringTokenizer(br.readLine().trim());  } catch(Exception e) {   throw new RuntimeException(e.getMessage());  }  }  public int numTokens() {  if(!st.hasMoreTokens()) {   scanLine();   return numTokens();  }  return st.countTokens();  }  public String next() {  if(!st.hasMoreTokens()) {   scanLine();   return next();  }  return st.nextToken();  }  public double nextDouble() {  return Double.parseDouble(next());  }  public long nextLong() {  return Long.parseLong(next());  }  public int nextInt() {  return Integer.parseInt(next());  } } }
4	public class test {   static boolean isOK(String str, int len)  { HashSet<String> hs=new HashSet<String>();  for(int i=0;i<=str.length()-len;i++) {  String s=str.substring(i,len+i);  if(hs.contains(s))  return true;  else  hs.add(s); }  return false;  }  public static void main(String[] args)  {   Scanner in=new Scanner(System.in);   String str=in.next();     int i;   for(i=str.length()-1;i>=1;i--)    if(isOK(str,i))    {   break;    }     System.out.println(i);  } }
0	public class ToyArmy {  int N;  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String[] tok;  String s;  private String[] getTok() throws IOException {return br.readLine().split(" ");}  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();  } }
3	public class TimePass implements Runnable {  InputStream is;  PrintWriter out;  String INPUT = "";   boolean debug=true;  static long mod=998244353;  static long mod2=1000000007;   void solve() throws IOException  {   int n=ni();   int[] a=na(n);   long[] sum=new long[n];   sum[0]=a[0];   for(int i=1;i<n;i++)sum[i]=sum[i-1]+a[i];   HashMap<Long,ArrayList<Pair>> map=new HashMap<>();   for(int i=0;i<n;i++)   {    for(int j=i;j<n;j++)    {     long curr=sum[j]-(i>0?sum[i-1]:0);     if(map.containsKey(curr))     {      map.get(curr).add(new Pair(i+1,j+1));     }     else     {      ArrayList<Pair> list=new ArrayList<>();      list.add(new Pair(i+1,j+1));      map.put(curr,list);     }    }   }   int max=0;   long maxSum=0;   for(long key:map.keySet())   {    ArrayList<Pair> list=map.get(key);    list.sort(new Comparator<Pair>(){     public int compare(Pair p1,Pair p2)     {      return p1.b-p2.b;     }    });    int prevl=0;    int cnt=0;    for(Pair pr:list)    {     if(pr.a>prevl)     {      cnt++;      prevl=pr.b;     }    }    if(max<cnt)    {     max=cnt;     maxSum=key;    }   }   int prevl=0;   ArrayList<Pair> list=map.get(maxSum);   ArrayList<Pair> ans=new ArrayList<>();   for(Pair pr:list)   {    if(pr.a>prevl)    {         ans.add(pr);         prevl=pr.b;    }   }   out.println(ans.size());   for(Pair pr:ans)   {    out.println(pr.a+" "+pr.b);   }  }   static long fnc(int a,int b)  {   return a+(long)1000000007*b;  }   static Pair[][] packU(int n,int[] from,Pair[] to)  {   Pair[][] g=new Pair[n][];   int[] p=new int[n];   for(int f:from)   {    p[f]++;   }   int m=from.length;   for(int i=0;i<n;i++)   {    g[i]=new Pair[p[i]];   }   for(int i=0;i<m;i++)   {    g[from[i]][--p[from[i]]]=to[i];   }   return g;  }  static int[][] packD(int n,int[] from,int[] to)  {   int[][] g=new int[n][];   int[] p=new int[n];   for(int f:from)   {    p[f]++;   }   int m=from.length;   for(int i=0;i<n;i++)   {    g[i]=new int[p[i]];   }   for(int i=0;i<m;i++)   {    g[from[i]][--p[from[i]]]=to[i];   }   return g;  }    static class Pair  {   int a,b,c;   public Pair(int a,int b     )   {    this.a=a;    this.b=b;      }  }   static long lcm(int a,int b)  {   long val=a;   val*=b;   return (val/gcd(a,b));  }   static long gcd(long a,long b)  {   if(a==0)return b;   return gcd(b%a,a);  }   static int pow(int a, int b, int p)  {   long ans = 1, base = a;   while (b!=0)   {    if ((b & 1)!=0)    {     ans *= base;     ans%= p;    }    base *= base;    base%= p;    b >>= 1;   }   return (int)ans;  }  static int inv(int x, int p)  {   return pow(x, p - 2, p);  }   public static long[] radixSort(long[] f){ return radixSort(f, f.length); }  public static long[] radixSort(long[] f, int n)  {   long[] to = new long[n];   {    int[] b = new int[65537];    for(int i = 0;i < n;i++)b[1+(int)(f[i]&0xffff)]++;    for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];    for(int i = 0;i < n;i++)to[b[(int)(f[i]&0xffff)]++] = f[i];    long[] d = f; f = to;to = d;   }   {    int[] b = new int[65537];    for(int i = 0;i < n;i++)b[1+(int)(f[i]>>>16&0xffff)]++;    for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];    for(int i = 0;i < n;i++)to[b[(int)(f[i]>>>16&0xffff)]++] = f[i];    long[] d = f; f = to;to = d;   }   {    int[] b = new int[65537];    for(int i = 0;i < n;i++)b[1+(int)(f[i]>>>32&0xffff)]++;    for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];    for(int i = 0;i < n;i++)to[b[(int)(f[i]>>>32&0xffff)]++] = f[i];    long[] d = f; f = to;to = d;   }   {    int[] b = new int[65537];    for(int i = 0;i < n;i++)b[1+(int)(f[i]>>>48&0xffff)]++;    for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];    for(int i = 0;i < n;i++)to[b[(int)(f[i]>>>48&0xffff)]++] = f[i];    long[] d = f; f = to;to = d;   }   return f;  }    public void run()  {   if(debug)oj=true;   is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());   out = new PrintWriter(System.out);     long s = System.currentTimeMillis();   try {    solve();   } catch (IOException e) {       e.printStackTrace();   }   out.flush();   tr(System.currentTimeMillis()-s+"ms");  }   public static void main(String[] args) throws Exception {new Thread(null,new TimePass(),"Main",1<<26).start();}   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 double nd() { return Double.parseDouble(ns()); }  private char nc() { return (char)skip(); }   private String ns()  {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b))){    sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }   private char[] ns(int n)  {   char[] buf = new char[n];   int b = skip(), p = 0;   while(p < n && !(isSpaceChar(b))){    buf[p++] = (char)b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }   private char[][] nm(int n, int m)  {   char[][] map = new char[n][];   for(int i = 0;i < n;i++)map[i] = ns(m);   return map;  }   private int[] na(int n)  {   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = ni();   return a;  }   private int ni()  {   int num = 0, b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }     while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }   private long nl()  {   long num = 0;   int b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }     while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }   private boolean oj = System.getProperty("ONLINE_JUDGE") != null;  private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
6	public class CF8C { static int n; static int[] mem; static HashMap<Integer, String> map; static int INF = (int) 1e9; static StringBuilder sb;  public static void main(String[] args) throws IOException {  MyScanner sc = new MyScanner(System.in);  String s = sc.nextLine();  n = sc.nextInt();  mem = new int[1 << n];  Arrays.fill(mem, -1);  map = new HashMap<>();  map.put(0, s);  for (int i = 1; i <= n; i++) {  map.put(i, sc.nextLine());  }  int val = dp(0);  PrintWriter pw = new PrintWriter(System.out);  pw.println(val);  sb = new StringBuilder();  sb.append("0 ");  build(0);  pw.println(sb);  pw.flush(); }   private static int dp(int msk) {  if (msk == (1 << n) - 1)  return 0;  if(mem[msk] != -1)  return mem[msk];  boolean foundFirst = false;  int val = (int)1e9;  int mark = -1;  for (int i = 1; i <= n; i++) {  if ((msk & 1 << (i - 1)) == 0){   if(!foundFirst){   foundFirst = true;   mark = i;   val = dist(0, mark)*2 + dp(msk | 1 << (mark - 1));   }else{   val = Math.min(val, dist(0, mark) + dist(mark, i) + dist(i, 0) + dp((msk|1 << (mark - 1))|1 << (i - 1)));   }  }  }  return mem[msk] = val; }  private static int dist(int node, int i) {  String from = map.get(i);  String to = map.get(node);  String[] fromco = from.split(" ");  String[] toco = to.split(" ");  int xs = Integer.parseInt(fromco[0]);  int ys = Integer.parseInt(fromco[1]);  int xf = Integer.parseInt(toco[0]);  int yf = Integer.parseInt(toco[1]);  return (xs - xf) * (xs - xf) + (ys - yf) * (ys - yf); }  private static void build(int msk) {  if (msk == (1 << n) - 1)   return;  boolean foundFirst = false;  int ans = dp(msk);  int mark = -1;  int val = (int)1e9;  for (int i = 1; i <= n; i++) {  if ((msk & 1 << (i - 1)) == 0){   if(!foundFirst){   foundFirst = true;   mark = i;   val = dist(0, mark)*2 + dp(msk | 1 << (mark - 1));   if(val == ans){    sb.append(mark + " 0 ");    build(msk | 1 << (mark - 1));    return;   }   }else{   val = dist(0, mark) + dist(mark, i) + dist(i, 0) + dp(msk|1 << (mark - 1)|1 << (i - 1));   if(val == ans){    sb.append(mark + " " + i + " 0 ");    build(msk|1 << (mark - 1)|1 << (i - 1));    return;   }   }  }  } }  static class MyScanner {  StringTokenizer st;  BufferedReader br;  public MyScanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s));  }  public MyScanner(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 String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-') {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.') {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public boolean ready() throws IOException {  return br.ready();  }  } }
4	public class A {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   String s = in.readLine();   for (int i = s.length() - 1; i > 0; i--)    for (int j = 0; j <= s.length() - i; j++)     if (s.substring(0, j + i - 1).contains(s.substring(j, j + i))       || s.substring(j + 1).contains(s.substring(j, j + i))) {      System.out.println(i);      return;     }   System.out.println(0);  } }
3	public class Main { HashMap<Integer,Pair> map; int n,a[]; private void solve()throws IOException {  n=nextInt();  a=new int[n+1];  for(int i=1;i<=n;i++)  a[i]=nextInt();  map=new HashMap<>();  for(int i=1;i<=n;i++)  {  int sum=0;  for(int j=i;j>=1;j--)  {   sum+=a[j];   if(!map.containsKey(sum))   map.put(sum,new Pair(i,1));   else   {   Pair p=map.get(sum);   if(p.pos<j)    map.put(sum,new Pair(i,p.cnt+1));   }  }  }  int sum=0,ans=0;  for(int i:map.keySet())  if(map.get(i).cnt>ans)  {   ans=map.get(i).cnt;   sum=i;  }  out.println(ans);  ArrayList<String> list=new ArrayList<>();  for(int i=1,prev=0;i<=n;i++)  {  int s=0;  for(int j=i;j>=1;j--)  {   s+=a[j];   if(s==sum && j>prev)   {   list.add(j+" "+i);   prev=i;   }  }  }  for(String s:list)  out.println(s); } class Pair{  int pos,cnt;  Pair(int a,int b){   pos=a;   cnt=b;  } }    public void run()throws IOException {  br=new BufferedReader(new InputStreamReader(System.in));  st=null;  out=new PrintWriter(System.out);  solve();   br.close();  out.close(); } public static void main(String args[])throws IOException{  new Main().run(); } BufferedReader br; StringTokenizer st; PrintWriter out; String nextToken()throws IOException{  while(st==null || !st.hasMoreTokens())  st=new StringTokenizer(br.readLine());  return st.nextToken(); } String nextLine()throws IOException{  return br.readLine(); } int nextInt()throws IOException{  return Integer.parseInt(nextToken()); } long nextLong()throws IOException{  return Long.parseLong(nextToken()); } double nextDouble()throws IOException{  return Double.parseDouble(nextToken()); } }
5	public class A { 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);  }  catch (NullPointerException e)  {  line=null;    }   }  int NextInt() {  String n = inputParser.nextToken();  int val = Integer.parseInt(n);     return val; }  long NextLong() {  String n = inputParser.nextToken();  long val = Long.parseLong(n);     return val; }  String NextString() {  String n = inputParser.nextToken();  return n; }  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 A(filePath); }  public void readFInput() {  for(;;)  {  try  {   readNextLine();   FInput+=line+" ";  }  catch(Exception e)  {   break;  }  }  inputParser = new StringTokenizer(FInput, " "); }   public A(String inputFile) {  openInput(inputFile);   readNextLine();  int n=NextInt();   int ret=0;  int [] p = new int [n];  readNextLine();  int sum=0;  for(int i=0; i<n; i++)  {  int a=NextInt();  p[i]=a;  sum+=a;  }  Arrays.sort(p);  int my=0;   for(int i=n-1; i>=0; i--)  {  my+=p[i];  ret++;  if(my*2>sum)break;  }   System.out.println(ret);   closeInput();  } }
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 char nextChar() {  return next().charAt(0);  }    public int nextInt() {  return Integer.parseInt(next());  }   public long nextLong() {  return Long.parseLong(next());  }   public double nextDouble() {  return Double.parseDouble(next());  }   public String nextLine() {  line = null;  return readLine();  }   public String [] nextStrings() {  line = null;  return readLine().split(" ");  }   public char [] nextChars() {  return next().toCharArray();  }  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 cprint(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); }  void NO() {  throw new Error("NO!"); }    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 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);   }  } }
3	public class D {  private void solve() {   br = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   int n = nextInt(), m = nextInt(), u = 1, d = n;   while (u < d) {    for (int i = 1; i <= m; i++) {     out.println(u + " " + i);     out.println(d + " " + (m - i + 1));    }    u++;    d--;   }   if (u == d) {    int l = 1, r = m;    while (l < r) {     out.println(u + " " + l++);     out.println(d + " " + r--);    }    if (l == r) out.println(u + " " + l);   }   out.close();  }  public static void main(String[] args) {   new D().solve();  }  private BufferedReader br;  private StringTokenizer st;  private PrintWriter out;  private String next() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     throw new RuntimeException(e);    }   }   return st.nextToken();  }  private int nextInt() {   return Integer.parseInt(next());  }  private long nextLong() {   return Long.parseLong(next());  }  private double nextDouble() {   return Double.parseDouble(next());  } }
1	public class Test5 {  static StreamTokenizer st = new StreamTokenizer(new InputStreamReader(System.in));  static int[] m;  public static void main(String[] z) throws Exception {   PrintWriter pw = new PrintWriter(System.out);   Scanner s = new Scanner(System.in);   int a = ni(), b=ni(), o=2;   m = new int[a];   for(int q=0; q<a; q++) m[q] = ni();   Arrays.sort(m);   for(int q=1; q<a; q++){    if(m[q]-m[q-1]==b*2) o++;    else if(m[q]-m[q-1]>b*2) o+=2;   }   System.out.println(o);   pw.flush();  }  static int ni() throws Exception{   st.nextToken();   return (int)st.nval;  }  static String ns() throws Exception{   st.nextToken();   return st.sval;  }  static long gcd(long a, long b){   for(; a>0 && b>0;)    if(a>b) a%=b;   else b%=a;   return a+b;  }  static class PyraSort {   private static int heapSize;   public static void sort(int[] a) {    buildHeap(a);    while (heapSize > 1) {     swap(a, 0, heapSize - 1);     heapSize--;     heapify(a, 0);    }   }   private static void buildHeap(int[] a) {    heapSize = a.length;    for (int i = a.length / 2; i >= 0; i--) {     heapify(a, i);    }   }   private static void heapify(int[] a, int i) {    int l = 2 * i + 2;    int r = 2 * i + 1;    int largest = i;    if (l < heapSize && a[i] < a[l]) {     largest = l;    }    if (r < heapSize && a[largest] < a[r]) {     largest = r;    }    if (i != largest) {     swap(a, i, largest);     heapify(a, largest);    }   }   private static void swap(int[] a, int i, int j) {    a[i] ^= a[j] ^= a[i];    a[j] ^= a[i];   }  } }
3	public class C {   private static int[][][] dp; private static boolean[] wasLoop; private static int MOD=1000000007; private static int n;  public static void solve(FastScanner fs) {  n=fs.nextInt();  dp=new int[2][n][n];  for (int i=0; i<dp.length; i++)  for (int j=0; j<dp[i].length; j++)   Arrays.fill(dp[i][j], -1);  wasLoop=new boolean[n];  for (int i=0; i<n; i++)  wasLoop[i]=fs.next().equals("f");   int ans=go(0, 0, 0);  System.out.println(ans); }  private static int go(int firstInLoop, int index, int indentLevel) {  if (index>=n)  return 1;  if (dp[firstInLoop][index][indentLevel]!=-1)  return dp[firstInLoop][index][indentLevel];     if (firstInLoop==1)  return dp[firstInLoop][index][indentLevel]=go(wasLoop[index]?1:0, index+1, indentLevel+(wasLoop[index]?1:0));     if (indentLevel==0) {  return dp[firstInLoop][index][indentLevel]=go(wasLoop[index]?1:0, index+1, wasLoop[index]?1:0);  }  else {    int total=0;  total+=go(firstInLoop, index, indentLevel-1);  total+=go(wasLoop[index]?1:0, index+1, indentLevel+(wasLoop[index]?1:0));  total%=MOD;  return dp[firstInLoop][index][indentLevel]=total;  } }      public static void main(String[] args) throws NumberFormatException, IOException {  FastScanner scanner = new FastScanner(System.in);  solve(scanner); }   private static 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());  }  double nextDouble() {  return Double.parseDouble(next());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }  int[] readArray(int n) {  int[] a=new int[n];  for (int i=0; i<n; i++)   a[i]=nextInt();  return a;  } } }
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;  tag: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 tag;   }   x*=10;  } } }
5	public class A {  public static void main(String[] args) {  new A().run(); }  private void run() {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = sc.nextInt();  Arrays.sort(a);  int i = 0;  while (i < n && a[i] == a[0])  i++;  if (i < n)  System.out.println(a[i]);  else  System.out.println("NO");  sc.close(); }  }
1	public class CFA {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  private static final long MOD = 1000 * 1000 * 1000 + 7;  private static final int[] dx = {0, -1, 0, 1};  private static final int[] dy = {1, 0, -1, 0};  private static final String yes = "Yes";  private static final String no = "No";  void solve() throws IOException {   int n = nextInt();   String[] arr1 = new String[n];   String[] arr2 = new String[n];   for (int i = 0; i < n; i++) {    arr1[i] = nextString();   }   for (int i = 0; i < n; i++) {    arr2[i] = nextString();   }   Map<String, Integer> m1 = getMap(arr1);   Map<String, Integer> m2 = getMap(arr2);   int res = 0;   for (Map.Entry<String, Integer> entry : m2.entrySet()) {    String key = entry.getKey();    int val = entry.getValue();    if (m1.containsKey(key)) {     int v2 = m1.get(key);     if (val > v2) {      res += val - v2;     }    }    else {     res += val;    }   }   for (Map.Entry<String, Integer> entry : m1.entrySet()) {    String key = entry.getKey();    int val = entry.getValue();    if (m2.containsKey(key)) {     int v2 = m2.get(key);     if (val > v2) {      res += val - v2;     }    }    else {     res += val;    }   }   outln(res / 2);  }  Map<String, Integer> getMap(String[] arr) {   Map<String, Integer> res = new HashMap<>();   for (String str : arr) {    res.put(str, res.getOrDefault(str, 0) + 1);   }   return res;  }  void shuffle(int[] a) {   int n = a.length;   for(int i = 0; i < n; i++) {    int r = i + (int) (Math.random() * (n - i));    int tmp = a[i];    a[i] = a[r];    a[r] = tmp;   }  }  long gcd(long a, long b) {   while(a != 0 && b != 0) {    long c = b;    b = a % b;    a = c;   }   return a + b;  }  private void outln(Object o) {   out.println(o);  }  private void out(Object o) {   out.print(o);  }  private void formatPrint(double val) {   outln(String.format("%.9f%n", val));  }  public CFA() 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 CFA();  }  public long[] nextLongArr(int n) throws IOException{   long[] res = new long[n];   for(int i = 0; i < n; i++)    res[i] = nextLong();   return res;  }  public int[] nextIntArr(int n) throws IOException {   int[] res = new int[n];   for(int i = 0; i < n; i++)    res[i] = nextInt();   return res;  }  public String nextToken() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return null;    }   }   return st.nextToken();  }  public String nextString() {   try {    return br.readLine();   } catch (IOException e) {    eof = true;    return null;   }  }  public int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  public long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  public double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
0	public class A { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  long l = in.nextLong();  long r = in.nextLong();  long a = 0;  long b = 0;  long c = 0;  if (r - l < 2)  System.out.println(-1);  else if (r - l < 3 && l % 2 == 1)  System.out.println(-1);  else {  if (l % 2 == 0) {   a = l;   b = l + 1;   c = l + 2;  } else {   if (l == 1) {   a = 2;   b = 3;   c = 4;   } else {   a = l + 1;   b = l + 2;   c = l + 3;   }  }  System.out.println(a + " " + b + " " + c);  }   } }
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 yesno(boolean b)  {   pw.println(b ? "YES" : "NO");  }   void run() throws IOException  {   int n = sc.nextInt();   if (n % 2 == 0)   {    pw.print(4 + " " + (n - 4));   }   else   {    pw.print(9 + " " + (n - 9));   }  } }
6	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();   int m = sc.nextInt();   int[][] a = new int[n][m];   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     a[i][j] = sc.nextInt();   val = new int[n][n];   for (int i = 0; i < n; i++)    Arrays.fill(val[i], Integer.MAX_VALUE);   for (int i = 0; i < n; i++)    for (int j = i; j < n; j++) {     for (int k = 0; k < m; k++)      val[i][j] = val[j][i] = Math.min(val[i][j], Math.abs(a[i][k] - a[j][k]));    }   val2 = new int[n][n];   for (int i = 0; i < n; i++)    Arrays.fill(val2[i], Integer.MAX_VALUE);   for (int i = 0; i < n; i++)    for (int j = 0; j < n; j++) {     for (int k = 0; k < m - 1; k++)      val2[i][j] = Math.min(val2[i][j], Math.abs(a[i][k] - a[j][k + 1]));    }   mem = new Integer[n][n][1 << n];   int ans = 0;   for (int i = 0; i < n; i++) {    ans = Math.max(ans, dp(i, i, 1 << i));   }   if (n == 1)    pw.println(val2[0][0]);   else    pw.println(ans);    pw.flush();   pw.close();  }  static int n;  static int[][] val, val2;  static Integer[][][] mem;  static int dp(int st, int lst, int msk) {   int bits = Integer.bitCount(msk);   if (mem[st][lst][msk] != null)    return mem[st][lst][msk];   int ans = 0;   for (int i = 0; i < n; i++)    if ((msk & (1 << i)) == 0) {     int newMsk = (msk | (1 << i));     if (bits < n - 1)      ans = Math.max(ans, Math.min(val[lst][i], dp(st, i, newMsk)));     else      ans = Math.max(ans, Math.min(val[lst][i], val2[i][st]));    }   return mem[st][lst][msk] = ans;  }  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());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
4	public class D {   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 t = 1;     while(t-- > 0) {   int n = in.nextInt();   int m = in.nextInt();   int K = in.nextInt();      long[][] x = new long[n][];      for(int i = 0; i < n; i++) {    x[i] = in.nextLongArray(m - 1);   }      long[][] y = new long[n - 1][];   for(int i = 0; i < n - 1; i++) {    y[i] = in.nextLongArray(m);   }      if(K % 2 != 0) {    for(int i = 0; i < n; i++) {     for(int j = 0; j < m; j++) {     out.print("-1 ");     }     out.println();    }    continue;   }   K /= 2;      long[][][] dp = new long[K + 1][n][m];      for(int i = 0; i < n; i++) {    for(int j = 0; j < m; j++) {    for(int k = 1; k <= K; k++) {     dp[k][i][j] = Integer.MAX_VALUE;    }    }   }      for(int k = 1; k <= K; k++) {    for(int i = 0; i < n; i++) {    for(int j = 0; j < m; j++) {     if(i + 1 < n) {     dp[k][i][j] = Math.min(dp[k][i][j], dp[k - 1][i + 1][j] + 2 * y[i][j]);     }     if(i - 1 >= 0) {     dp[k][i][j] = Math.min(dp[k][i][j], dp[k - 1][i - 1][j] + 2 * y[i - 1][j]);     }     if(j + 1 < m) {     dp[k][i][j] = Math.min(dp[k][i][j], dp[k - 1][i][j + 1] + 2 * x[i][j]);     }     if(j - 1 >= 0) {     dp[k][i][j] = Math.min(dp[k][i][j], dp[k - 1][i][j - 1] + 2 * x[i][j - 1]);     }    }    }   }      for(int i = 0; i < n; i++) {    for(int j = 0; j < m; j++) {    out.print(dp[K][i][j] + " ");    }    out.println();   }      }     out.close();    }   public static void main(String[] args) {   new Thread(null ,new Runnable(){    public void run()    {     try{      solve();     } catch(Exception e){      e.printStackTrace();     }    }   },"1",1<<26).start();  }   static int[][] graph(int from[], int to[], int n)  {   int g[][] = new int[n][];   int cnt[] = new int[n];   for (int i = 0; i < from.length; i++) {    cnt[from[i]]++;    cnt[to[i]]++;   }   for (int i = 0; i < n; i++) {    g[i] = new int[cnt[i]];   }   Arrays.fill(cnt, 0);   for (int i = 0; i < from.length; i++) {    g[from[i]][cnt[from[i]]++] = to[i];    g[to[i]][cnt[to[i]]++] = from[i];   }   return g;  }   static class Pair implements Comparable<Pair>{   int x,y,z;    Pair (int x,int y,int z){  this.x=x;  this.y=y;  this.z=z;  }     public int compareTo(Pair o) {  if (this.x == o.x)   return Integer.compare(this.y,o.y);  return Integer.compare(this.x,o.x);    }   public boolean equals(Object o) {    if (o instanceof Pair) {     Pair p = (Pair)o;     return p.x == x && p.y == y;    }    return false;   }   public int hashCode() {    return new Integer(x).hashCode() * 31 + new Integer(y).hashCode();   }     @Override   public String toString() {   return x + " " + y;   }   }    static String rev(String s) {   StringBuilder sb = new StringBuilder(s);   sb.reverse();   return sb.toString();  }  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 int abs(int a, int b) {   return (int) Math.abs(a - b);  }  static long abs(long a, long b) {   return (long) Math.abs(a - b);  }  static int max(int a, int b) {   if (a > b) {    return a;   } else {    return b;   }  }  static int min(int a, int b) {   if (a > b) {    return b;   } else {    return a;   }  }  static long max(long a, long b) {   if (a > b) {    return a;   } else {    return b;   }  }  static long min(long a, long b) {   if (a > b) {    return b;   } else {    return a;   }  }  static long pow(long n, long p, long m) {   long result = 1;   if (p == 0) {    return 1;   }   while (p != 0) {    if (p % 2 == 1) {     result *= n;    }    if (result >= m) {     result %= m;    }    p >>= 1;    n *= n;    if (n >= m) {     n %= m;    }   }   return result;  }  static long pow(long n, long p) {   long result = 1;   if (p == 0) {    return 1;   }   if (p == 1) {    return n;   }   while (p != 0) {    if (p % 2 == 1) {     result *= n;    }    p >>= 1;    n *= n;   }   return result;  }   static void debug(Object... o) {    System.out.println(Arrays.deepToString(o));  }  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 int[] nextIntArray(int n)   {     int a[] = new int[n];     for (int i = 0; i < n; i++)     {       a[i] = nextInt();     }     return a;   }   public long[] nextLongArray(int n)   {     long a[] = new long[n];     for (int i = 0; i < n; i++)     {       a[i] = nextLong();     }     return a;   }   public String readString()   {     int c = snext();     while (isSpaceChar(c))     {       c = snext();     }     StringBuilder res = new StringBuilder();     do     {       res.appendCodePoint(c);       c = snext();     } while (!isSpaceChar(c));     return res.toString();   }   public String nextLine()   {     int c = snext();     while (isSpaceChar(c))       c = snext();     StringBuilder res = new StringBuilder();     do     {       res.appendCodePoint(c);       c = snext();     } while (!isEndOfLine(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;   }   private boolean isEndOfLine(int c)   {     return c == '\n' || c == '\r' || c == -1;   }   public interface SpaceCharFilter   {     public boolean isSpaceChar(int ch);   }  } }
4	public class Main1 {  static int dr[] = { 0, 0, 1, -1 }; static int dc[] = { 1, -1, 0, 0 };  static boolean isValid(int r, int c) {  if (r >= n || r < 0 || c >= m || c < 0)  return false;  return true; }  static int grid[][]; static int n, m;  public static void main(String[] args) throws IOException {  FastReader input = new FastReader();  PrintWriter out = new PrintWriter("output.txt");  n = input.nextInt();  m = input.nextInt();  grid = new int[n][m];  int k = input.nextInt();  for (int i = 0; i < n; i++) {  Arrays.fill(grid[i], Integer.MAX_VALUE);  }  Queue<Pair> q = new LinkedList<Pair>();  for (int i = 0; i < k; i++) {  int x = input.nextInt() - 1;  int y = input.nextInt() - 1;   q.add(new Pair(x, y));  grid[x][y] = 0;   while (!q.isEmpty()) {   Pair cur = q.poll();   for (int j = 0; j < dr.length; j++) {   int r = cur.x;   int c = cur.y;   int nr = r + dr[j];   int nc = c + dc[j];   int dist = grid[r][c] + 1;    if (isValid(nr, nc) && grid[nr][nc] > dist) {    grid[nr][nc] = dist;    q.add(new Pair(nr, nc));   }   }  }  }  int max = -1;  int x = -1;  int y = -1;  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   if (grid[i][j] > max) {   max = grid[i][j];   x = i + 1;   y = j + 1;   }  }  }  out.println(x + " " + y);  out.flush(); }  static class FastReader {  BufferedReader br;  StringTokenizer st;  public FastReader() throws FileNotFoundException {  br = new BufferedReader(new FileReader(new File("input.txt")));  }  String next() throws IOException {  while (st == null || !st.hasMoreElements()) {   st = new StringTokenizer(br.readLine());  }  return st.nextToken();  }  int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(next());  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(next());  }  String nextLine() throws IOException {  String str = "";  str = br.readLine();  return str;  } }  static class con {  static int IINF = (int) 1e9;  static int _IINF = (int) -1e9;  static long LINF = (long) 1e15;  static long _LINF = (long) -1e15;  static double EPS = 1e-9; }  static class Triple implements Comparable<Triple> {  int x;  int y;  int z;  Triple(int x, int y, int z) {  this.x = x;  this.y = y;  this.z = z;  }  @Override  public int compareTo(Triple o) {  if (x == o.x && y == o.y)   return z - o.z;  if (x == o.x)   return y - o.y;  return x - o.x;  } }  static class Pair implements Comparable<Pair> {  int x;  int y;  Pair(int x, int y) {  this.x = x;  this.y = y;  }  @Override  public int compareTo(Pair o) {  if (x == o.x)   return y - o.y;  return x - o.x;  }  @Override  public String toString() {   return "(" + x + ", " + y + ")";  }  }  static void shuffle(int[] a) {  for (int i = 0; i < a.length; i++) {  int r = i + (int) (Math.random() * (a.length - i));  int tmp = a[r];  a[r] = a[i];  a[i] = tmp;  } }  static int gcd(int a, int b) {  return b == 0 ? a : gcd(b, a % b); } }
3	public class Solver {  public static void main(String[] args) {   FastReader in = new FastReader();   PrintWriter out = new PrintWriter(System.out);   TaskC solver = new TaskC(in, out);   solver.solve();   out.close();  }  static class TaskC {   FastReader in;   PrintWriter out;   public TaskC(FastReader in, PrintWriter out) {    this.in = in;    this.out = out;   }   public void solve() {    solveA();   }   public void solveA() {    int n = in.nextInt();    int[] inputColors = in.nextIntArray(n);    int colors = 0;    Arrays.sort(inputColors);    for (int i = 0; i < inputColors.length; i++) {     if (inputColors[i] == -1) {      continue;     }     int colorCode = inputColors[i];     boolean colorFound = false;     for (int j = i; j < inputColors.length; j++) {      if (inputColors[j] != -1 && inputColors[j] % colorCode == 0) {       if (!colorFound) {        colorFound = true;        colors++;       }       inputColors[j] = -1;      }     }    }    out.println(colors);   }   public void solveB() {   }   public void solveC() {   }   public void solveD() {   }   public void solveE() {   }   public void solveF() {   }   public void solveG() {   }   public void solveH() {   }  }  private static long gcd(long a, long b) {   if (a == 0) {    return b;   }   return gcd(b % a, a);  }  private static long lcm(long a, long b) {   return (a * b) / gcd(a, b);  }  private static int min(int a, int b) {   return a < b ? a : b;  }  private static int max(int a, int b) {   return a > b ? a : b;  }  private static int min(ArrayList<Integer> list) {   int min = Integer.MAX_VALUE;   for (int el : list) {    if (el < min) {     min = el;    }   }   return min;  }  private static int max(ArrayList<Integer> list) {   int max = Integer.MIN_VALUE;   for (int el : list) {    if (el > max) {     max = el;    }   }   return max;  }  private static int min(int[] list) {   int min = Integer.MAX_VALUE;   for (int el : list) {    if (el < min) {     min = el;    }   }   return min;  }  private static int max(int[] list) {   int max = Integer.MIN_VALUE;   for (int el : list) {    if (el > max) {     max = el;    }   }   return max;  }  private static void fill(int[] array, int value) {   for (int i = 0; i < array.length; i++) {    array[i] = value;   }  }   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());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   int[] nextIntArray(int n) {    int[] array = new int[n];    for (int i = 0; i < n; i++) {     array[i] = nextInt();    }    return array;   }  } }
3	public class F11141 { static class Solver {  ArrayList<int[]> ranges[];  HashMap<Long, Integer> hm = new HashMap<>();  int id(long s) {  if (!hm.containsKey(s))   hm.put(s, hm.size());  return hm.get(s);  }     int[] memo;  int go(int r) {  memo[N] = 0;  int last = N;  for(int[] a : ranges[r]) {   while(a[0] < last) {   memo[last - 1] = memo[last];   last--;   }   memo[a[0]] = Math.max(memo[a[0]], Math.max(memo[a[0]], 1 + memo[a[1] + 1]));   last = a[0];  }  return memo[last];  }  ArrayDeque<int[]> ans = new ArrayDeque<>();   void go2(int r) {  memo[N] = 0;  int last = N;  int minAt[] = new int[N], oo = 987654321;  Arrays.fill(minAt, oo);  for(int[] a : ranges[r]) {   minAt[a[0]] = Math.min(minAt[a[0]], a[1] - a[0]);   while(a[0] < last) {   memo[last - 1] = memo[last];   last--;   }   memo[a[0]] = Math.max(memo[a[0]], Math.max(memo[a[0]], 1 + memo[a[1] + 1]));   last = a[0];  }  while(0 < last) {   memo[last - 1] = memo[last];   last--;  }  int k = 0;  for(; k < N;) {   if(minAt[k] == oo || memo[k] != 1 + memo[k + minAt[k] + 1]) k++;   else {   ans.push(new int[] {k, k + minAt[k]});   k += minAt[k] + 1;   }  }  }   @SuppressWarnings("unchecked")  Solver() {  ranges = new ArrayList[2250001];  for (int i = 0; i < ranges.length; i++)   ranges[i] = new ArrayList<>();  }  int N, LID;  long[] a;  void solve(Scanner s, PrintWriter out) {  N = s.nextInt();  a = new long[N + 1];  for (int i = 1; i <= N; i++)   a[i] = s.nextLong() + a[i - 1];  for (int i = N; i >= 1; i--)   for (int j = i; j <= N; j++) {   int x = id(a[j] - a[i - 1]);   ranges[x].add(new int[] { i - 1, j - 1 });   }    int best = 0, bid = -1;  memo = new int[N + 1];  Arrays.sort(ranges, (a, b) -> b.size() - a.size());  for(int i = 0; i < ranges.length; i++, LID++) {   if(ranges[i].size() <= best) break;   int ans = go(i);   if(ans > best) {   best = ans;   bid = i;   }  }      out.println(best);  go2(bid);      while(!ans.isEmpty()) {   int[] c = ans.pop();   out.println(++c[0] + " " + ++c[1]);  }    }  }  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  Solver solver = new Solver();  solver.solve(s, out);  out.close();  } }
5	public class One { InputStreamReader inp = new InputStreamReader(System.in); BufferedReader in = new BufferedReader(inp); boolean test = false;    String[] inData = { "4","1 1 2" };  static int id = -1;  public String readLine() throws IOException {  id++;  if (test)  return inData[id];  else  return in.readLine(); }  public void solve() throws Exception {  readLine();  String readLine = readLine();   String[] split = readLine.split(" ");  List<Integer> ints = new ArrayList<Integer>();   for (int i = 0; i < split.length; i++) {  ints.add(Integer.valueOf(split[i]));  }   Collections.sort(ints);  Integer object = ints.get(0);  for (int i = 0; i < split.length; i++) {  if(ints.get(i).compareTo(object) > 0){   System.out.println(ints.get(i));   return;  }  }  System.out.println("NO"); }  public static void main(String[] args) throws Exception {  new One().solve();  } }
5	public class AA { static class O implements Comparable<O> {  int problems;  int penalty;  public O(int p, int pp) {  problems = p;  penalty = pp;  }  public int compareTo(O arg0) {  if (problems == arg0.problems) {   return penalty - arg0.penalty;  }  return -(problems - arg0.problems);  }  }  public static void main(String[] args) throws IOException {  BufferedReader r = new BufferedReader(new InputStreamReader(System.in));  String s = r.readLine();  String[] sp = s.split("[ ]+");  int n = new Integer(sp[0]), k = new Integer(sp[1]) - 1;  O[] arr = new O[n];  for (int i = 0; i < arr.length; i++) {  s = r.readLine();  sp = s.split("[ ]+");  arr[i] = new O(new Integer(sp[0]), new Integer(sp[1]));  }  Arrays.sort(arr);  int res = 1;  int i = k + 1;  while (i < arr.length && arr[i].problems == arr[k].problems   && arr[i].penalty == arr[k].penalty) {  i++;  res++;  }  i = k - 1;  while (i >= 0 && arr[i].problems == arr[k].problems   && arr[i].penalty == arr[k].penalty) {  i--;  res++;  }  System.out.println(res);  } }
2	public class Solution1 {  private void solve() throws IOException {   long MOD = 1_000_000_007;   long x = in.nextLong();   long k = in.nextLong();   if (x == 0) {    System.out.println(0);    return;   }   long val = binpow(2, k + 1, MOD) % MOD;   long kek = (binpow(2, k, MOD) - 1 + MOD) % MOD;   x = (val % MOD) * (x % MOD) % MOD;   long ans = (x % MOD - kek % MOD + MOD) % MOD;   System.out.println(ans % MOD);  }  private long binpow(long a, long n, long mod) {   long res = 1;   while (n > 0) {    if (n % 2 == 1)     res = (res % mod) * (a % mod) % mod;    a = (a % mod) * (a % mod) % mod;    n >>= 1;   }   return res % mod;  }   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;   public MyScanner() throws IOException {    this.br = new BufferedReader(new InputStreamReader(System.in));   }   public MyScanner(String fileTitle) throws IOException {    this.br = new BufferedReader(new FileReader(fileTitle));   }   public String nextLine() throws IOException {    String s = br.readLine();    return s == null ? "-1" : s;   }   public 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 Long nextLong() throws IOException {    return Long.parseLong(this.next());   }   public Double nextDouble() throws IOException {    return Double.parseDouble(this.next());   }   public void close() throws IOException {    this.br.close();   }  }  public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);   new Solution1().run();  } }
3	public class c implements Runnable{ int N; int[] arr; public static void main(String[] args) { new Thread(null, new c(), "", 1<<27).start(); } public void run() {  arr = new int[N = nextInt()];  for(int n=0;n<N;n++) {   if(nextString().charAt(0) == 'f') {   arr[n] = 1;  }  }  long[][] dp = new long[N+1][N+1];  dp[0][0] = 1;  for(int i = 0; i < N; i++) {    if(arr[i] == 0) {        long sum = 0;   for(int j = N; j >= 0; j--) {   sum += dp[i][j];   sum %= 1_000_000_007L;   dp[i+1][j] += sum;   dp[i+1][j] %= 1_000_000_007L;   }  }    else {     for(int j = 1; j <= N; j++) {   dp[i+1][j] += dp[i][j-1];   dp[i+1][j] %= 1_000_000_007L;   }  }  }     long ans = 0;  for(long l : dp[N-1]) ans = (ans + l) % 1_000_000_007;  System.out.println(ans); }    BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line = null; int line_ptr = 0; void read() {  try {  line = br.readLine().split(" ");  }  catch(IOException ioe) {  System.err.println("bad input");  line = null;  } } void ensure() {  while(line == null || line.length <= line_ptr) {  read();  line_ptr = 0;  } } int nextInt() {  ensure();  return Integer.parseInt(line[line_ptr++]); } long nextLong() {  ensure();  return Integer.parseInt(line[line_ptr++]); } String nextString() {  ensure();  return line[line_ptr++]; } }
4	public class substring { static BufferedReader br; static StringTokenizer st; static PrintWriter out; public static void main(String[] args) throws IOException {  InputStream input = System.in;   OutputStream output = System.out;   br = new BufferedReader(new InputStreamReader(input));  out = new PrintWriter(output);  String in = br.readLine();  int len = in.length();  int doub = len;  boolean found = false;  while (!found)   {   int count = 0;   String[] parts = new String[len - doub + 1];   for (int i = 0; i < len - doub + 1; i++)    parts[i] = in.substring(i,i+doub);   for (int i = 1; i < len - doub + 1; i++)    for (int j = 0; j < i; j++)     if (parts[i].equals(parts[j]))     count++;   if (count >= 1)    found = true;   doub--;   }  out.println(doub+1);  out.close(); } }
3	public class cfs584A {  static long LINF = Long.MAX_VALUE / 4;  static long IING = Integer.MAX_VALUE / 4;  public static void main(String[] args) {   FastScanner sc = new FastScanner();   StringBuilder sb = new StringBuilder();   int N = sc.nextInt();   int[] nums = sc.readIntArray(N);   ArrayList<Integer> num = new ArrayList<>();   for (int i = 0; i < N; i++) {    num.add(nums[i]);   }    int count = 0;   while (!num.isEmpty()) {    count++;    int size = num.size();    int min = 200;    for (int j = size-1; j >=0; j--) {     if (num.get(j) < min) {      min = num.get(j);     }    }    for (int j = size-1; j >=0; j--) {     int div = num.get(j) / min;     if ((div * min) == num.get(j)) {      num.remove(j);     }    }   }   sb.append(count);   System.out.print(sb);  }  static void Assert(boolean b) {   if (!b) throw new Error("Assertion Failed");  }  static class Pair implements Comparable<Pair> {   int x, y;   Pair(int _x, int _y) {    x = _x;    y = _y;   }   public int compareTo(Pair o) {    int c1 = Integer.compare(x, o.x);    return c1 != 0 ? c1 : Integer.compare(y, o.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());   }   double nextDouble() {    return Double.parseDouble(next());   }   String readNextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   int[] readIntArray(int n) {    int[] a = new int[n];    for (int idx = 0; idx < n; idx++) {     a[idx] = nextInt();    }    return a;   }   long[] readLongArray(int n) {    long[] a = new long[n];    for (int idx = 0; idx < n; idx++) {     a[idx] = nextLong();    }    return a;   }  } }
3	public class inversions {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int N = sc.nextInt();   int[] values = new int[N];   for(int i=0;i<N;i++){    values[i] = sc.nextInt();   }   int query = sc.nextInt();   int[][] tasks = new int[query][2];   for(int i=0;i<query;i++){    tasks[i][0] = sc.nextInt();    tasks[i][1] = sc.nextInt();   }   int startinversions = 0;   for(int i=1;i<values.length;i++){    for(int j=i-1;j>=0;j--){     if(values[i]<values[j]){      startinversions++;     }    }   }   int value = startinversions%2;   for(int[] task : tasks){    int n = task[1]-task[0];    if(n*(n+1)/2 % 2 != 0){     value = (value+1)%2;    }    if(value==1){     System.out.println("odd");    }    else{     System.out.println("even");    }   }  } }
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 int compareTo(mPoint p) {  return b < p.b ? 1 : (b > p.b) ? -1 : 0;  } }  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; }  }
1	public class Solution {  public static void main(String args[]) {  Scanner scanner = new Scanner(System.in);  int n = scanner.nextInt();  int[] arr = new int[n];  for (int i = 0; i < n; ++i) {   arr[i] = scanner.nextInt();  }  boolean isOdd = false;  if ((arr[0] % 2 == 0 && arr[1] % 2 == 0) || (arr[0] % 2 == 0 && arr[2] % 2 == 0)   || (arr[1] % 2 == 0 && arr[2] % 2 == 0)) {   isOdd = true;  }  if (isOdd) {   for (int i = 0; i < n; ++i) {   if (arr[i] % 2 == 1) {    System.out.println(i + 1);    break;   }   }  } else {   for (int i = 0; i < n; ++i) {   if (arr[i] % 2 == 0) {    System.out.println(i + 1);    break;   }   }  }  } }
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);  } }
0	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());  }  double nextDouble() {   return Double.parseDouble(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 int sub(int a, int b) {   int res = 0;   while (b > 0) {    res += a / b;    int m = a % b;    a = b;    b = m;   }   return res;  }  public void solve() throws Exception {   int n = nextInt();   while (n-- > 0) {    out.println(sub(nextInt(), nextInt()));   }  }  public static void main(String[] args) throws Exception {   new Template().run();  } }
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());  }  long nextLong() throws IOException {   return Long.parseLong(next());  }  final int MOD = 1000 * 1000 * 1000 + 7;  int sum(int a, int b) {   a += b;   return a >= MOD ? a - MOD : a;  }  @SuppressWarnings("unchecked")  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++;     }    }    void cancel(int u) {     forbidden = u;     int v = next[u];     if(v != 0) {      maxMatch--;      prev[v] = 0;      next[u] = 0;      for (int i : rg.get(v)) {       if(next[i] == 0) {        amend(i);       }      }     }     if(prev[u] != 0) {      maxMatch--;      amend(prev[u]);      prev[u] = 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;  }  void test() {   final int N = 4;   final int[] ef = new int[N * N];   final int[] et = new int[N * N];   for(int i = 1; i <= N; i++) {    for(int j = 1; j <= N; j++) {     ef[(i - 1) * N + j - 1] = i;     et[(i - 1) * N + j - 1] = j;    }   }   List<Integer> good = new ArrayList<>();   for(int mask = 0; mask < 1 << N * N; mask++) {    int[] in = new int[N + 1];    int[] out = new int[N + 1];    for(int i = 0; i < N * N; i++) {     if((mask >> i) % 2 == 1) {      out[ef[i]]++;      in[et[i]]++;     }    }    boolean ok = false;    for(int i = 1; i <= N; i++) {     if(in[i] == N && out[i] == N) {      in[i] = 2;      out[i] = 2;      ok = true;      break;     }    }    for(int i = 1; i <= N; i++) {     if(in[i] != 2 || out[i] != 2) {      ok = false;     }    }    if(ok) {     good.add(mask);    }   }   System.out.println("good graphs count: " + good.size());   for (int mask : good) {    int m = Integer.bitCount(mask);    int[] from = new int[m];    int[] to = new int[m];    int index = 0;    for(int i = 0; i < N * N; i++) {     if((mask >> i) % 2 == 1) {      from[index] = ef[i];      to[index] = et[i];      index++;     }    }    if(solve(N, m, from, to) != 0) {     writer.println(N + " " + m);     for(int i = 0; i < m; i++) {      writer.println(from[i] + " " + to[i]);     }     writer.close();     return;    }   }   for(int mask = 0; mask < 1 << N * N; mask++) {    int optimal = Integer.MAX_VALUE;    for (Integer i : good) {     optimal = Math.min(optimal, Integer.bitCount(i ^ mask));    }    int m = Integer.bitCount(mask);    int[] from = new int[m];    int[] to = new int[m];    int index = 0;    for(int i = 0; i < N * N; i++) {     if((mask >> i) % 2 == 1) {      from[index] = ef[i];      to[index] = et[i];      index++;     }    }    final int fast = solve(N, m, from, to);    if(optimal != fast) {     System.out.println("fast = " + fast + ", optimal = " + optimal);     writer.println(N + " " + m);     for(int i = 0; i < m; i++) {      writer.println(from[i] + " " + to[i]);     }     writer.close();     return;    }   }  }  public static void main(String[] args) throws IOException {   new D().solve();  } }
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 {   final private 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++];   }  } }
3	public class ProblemF {  private static boolean debug = false;  private static int N;  private static int[] A;  private static void solveProblem(InputStream instr) throws Exception {   InputReader sc = new InputReader(instr);   int testCount = 1;   if (debug) {    testCount = sc.nextInt();   }   for (int t = 1; t <= testCount; t++) {    printDebug("------ " + t + " ------");    N = sc.nextInt();    A = readInts(sc, N);    Object result = solveTestCase();    System.out.println(result);   }  }  private static Object solveTestCase() {   int sum[] = new int[N];   sum[0] = A[0];   for (int i = 1; i < N; i++) {    sum[i] = sum[i - 1] + A[i];   }   Map<Integer, List<int[]>> map = new HashMap<>();   for (int i = 0; i < N; i++) {    for (int j = i; j < N; j++) {     int groupSum = sum[j] - (i == 0 ? 0 : sum[i - 1]);     map.putIfAbsent(groupSum, new ArrayList<>());     map.get(groupSum).add(new int[]{i, j});    }   }   int max = -1;   List<int[]> maxAnswer = null;   for (Map.Entry<Integer, List<int[]>> entry : map.entrySet()) {    List<int[]> values = entry.getValue();    if (values.size() <= max) {     continue;    }    List<int[]> curr = findMax(values);    if (curr.size() > max) {     max = curr.size();     maxAnswer = curr;    }   }   List<String> answer = new ArrayList<>();   for (int[] value : maxAnswer) {    answer.add((value[0] + 1) + " " + (value[1] + 1));   }   return max + "\n" + joinValues(answer, "\n");  }  private static List<int[]> findMax(List<int[]> values) {   values.sort(new Comparator<int[]>() {    @Override    public int compare(int[] o1, int[] o2) {     return o1[1] - o2[1];    }   });   List<int[]> answer = new ArrayList<>();   int right = -1;   for (int i = 0; i < values.size(); i++) {    int[] value = values.get(i);    if (value[0] > right) {     answer.add(value);     right = value[1];    }   }   return answer;  }  private static int[] readInts(InputReader sc, int N) throws Exception {   int[] arr = new int[N];   for (int i = 0; i < N; i++) {    arr[i] = sc.nextInt();   }   return arr;  }  private static String joinValues(List<? extends Object> list, String delim) {   return list.stream().map(Object::toString).collect(Collectors.joining(delim));  }  private static String joinValues(int[] arr, String delim) {   List<Object> list = new ArrayList<>();   for (Object value : arr) {    list.add(value);   }   return list.stream().map(Object::toString).collect(Collectors.joining(delim));  }  public static void printDebug(Object str) {   if (debug) {    System.out.println("DEBUG: " + str);   }  }  private static final class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[1024];   private int curChar;   private int Chars;   public InputReader(InputStream stream) {    this.stream = stream;   }   private int read() throws Exception {    if (curChar >= Chars) {     curChar = 0;     Chars = stream.read(buf);     if (Chars <= 0)      return -1;    }    return buf[curChar++];   }   public final int nextInt() throws Exception {    return (int)nextLong();   }   public final long nextLong() throws Exception {    int c = read();    while (isSpaceChar(c)) {     c = read();     if (c == -1)      throw new IOException();    }    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 final int[] nextIntBrray(int size) throws Exception {    int[] arr = new int[size];    for (int i = 0; i < size; i++)     arr[i] = nextInt();    return arr;   }   public final String next() throws Exception {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.append((char)c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   public final String nextLine() throws Exception {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.append((char)c);     c = read();    } while (c != '\n' && c != -1);    return res.toString();   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  }  public static void main(String[] args) throws Exception {   long currTime = System.currentTimeMillis();   if (debug) {    solveProblem(new FileInputStream(new File("input.in")));    System.out.println("Time: " + (System.currentTimeMillis() - currTime));   } else {    solveProblem(System.in);   }  } }
0	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 {  public void solve(int testNumber, Parser in, OutputWriter out) {   long a = in.nextLong();   long b = in.nextLong();   long cnt = 0;   while (a != 0 && b != 0) {    if (a > b) {     cnt += a / b;     a %= b;    }    else {     cnt += b / a;     b = b % a;    }   }   out.println(cnt);  } } 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 long nextLong()  {   return Long.parseLong(next());  }  } class OutputWriter extends PrintWriter {  public OutputWriter(Writer out) {   super(out);  }  public OutputWriter(OutputStream out) {   super(out);  }  }
1	public class B {   public static void main(String[] args) throws Exception {    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));    PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));    int n = Integer.parseInt(bf.readLine());    StringTokenizer st = new StringTokenizer(bf.readLine());    Integer[] a = new Integer[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());    Arrays.sort(a);    int[] b = new int[n];    for(int i=0; i<n; i++) b[i] = a[i].intValue();    boolean diff = false;    boolean diff2 = false;    Set<Integer> vals = new HashSet<Integer>();    vals.add(b[0]);    int valval = 0;    for(int i=1; i<n; i++) {     vals.add(b[i]);     if(b[i] == b[i-1]) {      if(!diff) {       diff = true;       valval = b[i];      }      else diff2 = true;     }    }    long sum = 0;    for(int i : b) sum += i;    sum -= 1L*n*(n-1)/2;    if(diff && !diff2) {     if(!vals.contains((valval-1)) && (valval > 0)) {      if(sum%2 == 0) out.println("cslnb"); else out.println("sjfnb");     }     else out.println("cslnb");    }    else if(diff2) out.println("cslnb");    else if(sum%2 == 0) out.println("cslnb"); else out.println("sjfnb");             out.close(); System.exit(0);   }  }
6	public class E2 { InputStream is; PrintWriter out; String INPUT = "";   void solve() {  int n = ni(), K = ni();  long[] g = new long[n];  for(int i = 0;i < n;i++){  for(int j = 0;j < n;j++){   g[i] |= nl()<<j;  }  g[i] |= 1L<<i;  }      int mc = solveMaximumClique(g);  out.printf("%.14f\n", (double)K*K*(mc-1)/2/mc); }  public static int solveMaximumClique(long[] g) {  int n = g.length;  int h = n/2;  int[] dp = new int[1<<n-h];  for(int i = 0;i < 1<<h;i++){  long cover = (1L<<n)-1;  for(int j = 0;j < h;j++){   if(i<<~j<0)cover &= g[j];  }  if((cover&i) == i){   dp[(int)(cover>>>h)] = Math.max(dp[(int)(cover>>>h)], Integer.bitCount(i));  }  }  for(int i = 0;i < n-h;i++){  for(int j = 0;j < 1<<n-h;j++){   if(j<<~i>=0){   dp[j] = Math.max(dp[j], dp[j|1<<i]);   }  }  }   int ret = 0;  for(int i = 0;i < 1<<n-h;i++){  long cover = (1L<<n)-1;  for(int j = 0;j < n-h;j++){   if(i<<~j<0)cover &= g[j+h];  }  if((cover&(long)i<<h) == (long)i<<h){   ret = Math.max(ret, Integer.bitCount(i) + dp[i]);  }  }  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 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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
5	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st;   st = new StringTokenizer(in.readLine());     int n = Integer.parseInt(st.nextToken()),    a = Integer.parseInt(st.nextToken()),    b = Integer.parseInt(st.nextToken());     st = new StringTokenizer(in.readLine());     ArrayList<Integer> A = new ArrayList<Integer>();     for (int i = 0 ; i < n ; i++) {    A.add(Integer.parseInt(st.nextToken()));   }     Collections.sort(A);     System.out.println(A.get(b) - A.get(b - 1));  } }
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] + " ");   }  } }
3	public class A {  public void realMain() throws Exception {  BufferedReader fin = new BufferedReader(new InputStreamReader(System.in), 1000000);  String in = fin.readLine();  String[] ar = in.split(" ");  int n = Integer.parseInt(ar[0]);   int[] a = new int[n];  for(int i = 0; i < n; i++) {  int ret = 0;  boolean dig = false;  for (int ch = 0; (ch = fin.read()) != -1; ) {    if (ch >= '0' && ch <= '9') {      dig = true;      ret = ret * 10 + ch - '0';    } else if (dig) break;   }   a[i] = ret;    }  int ret = 0;  Arrays.sort(a);  boolean[] colored = new boolean[n];  for(int i = 0; i < n; i++) {  if(!colored[i]) {   ret++;   for(int j = i; j < n; j++) {   if(a[j] % a[i] == 0) {    colored[j] = true;   }   }  }  }  System.out.println(ret);   }  public static void main(String[] args) throws Exception {  A a = new A();  a.realMain(); } }
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 String nextLine() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isEndOfLine(c));    return res.toString();   }     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 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;   }   } }
5	public class A {  public void solve() throws Exception {     int n = nextInt();   int[] p = nextArr(n);   Arrays.sort(p);   int sum = 0;   for (int i=0; i<n; ++i) sum+=p[i];   int curr = 0;   for (int i=n-1; i>=0; --i) {    curr += p[i];    if (curr>sum-curr) halt(n-i);   }    }       boolean showDebug = true;  static boolean useFiles = false;  static String inFile = "input.txt";  static String outFile = "output.txt";  double EPS = 1e-7;  int INF = Integer.MAX_VALUE;  long INFL = Long.MAX_VALUE;  double INFD = Double.MAX_VALUE;    int absPos(int num) {   return num<0 ? 0:num;  }  long absPos(long num) {   return num<0 ? 0:num;  }  double absPos(double num) {   return num<0 ? 0:num;  }   int min(int... nums) {   int r = Integer.MAX_VALUE;   for (int i: nums)    if (i<r) r=i;   return r;  }  int max(int... nums) {   int r = Integer.MIN_VALUE;   for (int i: nums)    if (i>r) r=i;   return r;  }  long minL(long... nums) {   long r = Long.MAX_VALUE;   for (long i: nums)    if (i<r) r=i;   return r;  }  long maxL(long... nums) {   long r = Long.MIN_VALUE;   for (long i: nums)    if (i>r) r=i;   return r;  }  double minD(double... nums) {   double r = Double.MAX_VALUE;   for (double i: nums)    if (i<r) r=i;   return r;  }  double maxD(double... nums) {   double r = Double.MIN_VALUE;   for (double i: nums)    if (i>r) r=i;   return r;  }   long sumArr(int[] arr) {   long res = 0;   for (int i: arr)    res+=i;   return res;  }  long sumArr(long[] arr) {   long res = 0;   for (long i: arr)    res+=i;   return res;  }  double sumArr(double[] arr) {   double res = 0;   for (double i: arr)    res+=i;   return res;  }  long partsFitCnt(long partSize, long wholeSize) {   return (partSize+wholeSize-1)/partSize;  }  boolean odd(long num) {   return (num&1)==1;  }   boolean hasBit(int num, int pos) {   return (num&(1<<pos))>0;  }  long binpow(long a, int n) {   long r = 1;   while (n>0) {    if ((n&1)!=0) r*=a;    a*=a;    n>>=1;   }   return r;  }  boolean isLetter(char c) {   return (c>='a' && c<='z') || (c>='A' && c<='Z');  }  boolean isLowercase(char c) {   return (c>='a' && c<='z');  }  boolean isUppercase(char c) {   return (c>='A' && c<='Z');  }  boolean isDigit(char c) {   return (c>='0' && c<='9');  }   boolean charIn(String chars, String s) {   if (s==null) return false;   if (chars==null || chars.equals("")) return true;   for (int i=0; i<s.length(); ++i)    for (int j=0; j<chars.length(); ++j)     if (chars.charAt(j)==s.charAt(i)) return true;   return false;  }   String stringn(String s, int n) {   if (n<1 || s==null) return "";   StringBuilder sb = new StringBuilder(s.length()*n);   for (int i=0; i<n; ++i) sb.append(s);   return sb.toString();  }  String str(Object o) {   if (o==null) return "";   return o.toString();  }   long timer = System.currentTimeMillis();  void startTimer() {   timer = System.currentTimeMillis();  }  void stopTimer() {   System.err.println("time: "+(System.currentTimeMillis()-timer)/1000.0);  }   static class InputReader {   private byte[] buf;   private int bufPos = 0, bufLim = -1;   private InputStream stream;   public InputReader(InputStream stream, int size) {    buf = new byte[size];    this.stream = stream;   }   private void fillBuf() throws IOException {    bufLim = stream.read(buf);    bufPos = 0;   }   char read() throws IOException {    if (bufPos>=bufLim) fillBuf();    return (char)buf[bufPos++];   }   boolean hasInput() throws IOException {    if (bufPos>=bufLim) fillBuf();    return bufPos<bufLim;   }  }   static InputReader inputReader;  static BufferedWriter outputWriter;  char nextChar() throws IOException {   return inputReader.read();  }  char nextNonWhitespaceChar() throws IOException {   char c = inputReader.read();   while (c<=' ') c=inputReader.read();   return c;  }  String nextWord() throws IOException {   StringBuilder sb = new StringBuilder();   char c = inputReader.read();   while (c<=' ') c=inputReader.read();   while (c>' ') {    sb.append(c);    c = inputReader.read();   }   return new String(sb);  }  String nextLine() throws IOException {   StringBuilder sb = new StringBuilder();   char c = inputReader.read();   while (c<=' ') c=inputReader.read();   while (c!='\n' && c!='\r') {    sb.append(c);    c = inputReader.read();   }   return new String(sb);  }  int nextInt() throws IOException {   int r = 0;   char c = nextNonWhitespaceChar();   boolean neg = false;   if (c=='-') neg=true;   else r=c-48;   c = nextChar();   while (c>='0' && c<='9') {    r*=10;    r+=c-48;    c=nextChar();   }   return neg ? -r:r;  }  long nextLong() throws IOException {   long r = 0;   char c = nextNonWhitespaceChar();   boolean neg = false;   if (c=='-') neg=true;   else r = c-48;   c = nextChar();   while (c>='0' && c<='9') {    r*=10L;    r+=c-48L;    c=nextChar();   }   return neg ? -r:r;  }  double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextWord());  }  int[] nextArr(int size) throws NumberFormatException, IOException {   int[] arr = new int[size];   for (int i=0; i<size; ++i)    arr[i] = nextInt();   return arr;  }  long[] nextArrL(int size) throws NumberFormatException, IOException {   long[] arr = new long[size];   for (int i=0; i<size; ++i)    arr[i] = nextLong();   return arr;  }  double[] nextArrD(int size) throws NumberFormatException, IOException {   double[] arr = new double[size];   for (int i=0; i<size; ++i)    arr[i] = nextDouble();   return arr;  }  String[] nextArrS(int size) throws NumberFormatException, IOException {   String[] arr = new String[size];   for (int i=0; i<size; ++i)    arr[i] = nextWord();   return arr;  }  char[] nextArrCh(int size) throws IOException {   char[] arr = new char[size];   for (int i=0; i<size; ++i)    arr[i] = nextNonWhitespaceChar();   return arr;  }  char[][] nextArrCh(int rows, int columns) throws IOException {   char[][] arr = new char[rows][columns];   for (int i=0; i<rows; ++i)    for (int j=0; j<columns; ++j)     arr[i][j] = nextNonWhitespaceChar();   return arr;  }  char[][] nextArrChBorders(int rows, int columns, char border) throws IOException {   char[][] arr = new char[rows+2][columns+2];   for (int i=1; i<=rows; ++i)    for (int j=1; j<=columns; ++j)     arr[i][j] = nextNonWhitespaceChar();   for (int i=0; i<columns+2; ++i) {    arr[0][i] = border;    arr[rows+1][i] = border;   }   for (int i=0; i<rows+2; ++i) {    arr[i][0] = border;    arr[i][columns+1] = border;   }   return arr;  }  void printf(String format, Object... args) throws IOException {   outputWriter.write(String.format(format, args));  }  void print(Object o) throws IOException {   outputWriter.write(o.toString());  }  void println(Object o) throws IOException {   outputWriter.write(o.toString());   outputWriter.newLine();  }  void print(Object... o) throws IOException {   for (int i=0; i<o.length; ++i) {    if (i!=0) outputWriter.write(' ');    outputWriter.write(o[i].toString());   }  }  void println(Object... o) throws IOException {   print(o);   outputWriter.newLine();  }  void printn(Object o, int n) throws IOException {   String s = o.toString();   for (int i=0; i<n; ++i) {    outputWriter.write(s);    if (i!=n-1) outputWriter.write(' ');   }  }  void printnln(Object o, int n) throws IOException {   printn(o, n);   outputWriter.newLine();  }  void printArr(int[] arr) throws IOException {   for (int i=0; i<arr.length; ++i) {    if (i!=0) outputWriter.write(' ');    outputWriter.write(Integer.toString(arr[i]));   }  }  void printArr(long[] arr) throws IOException {   for (int i=0; i<arr.length; ++i) {    if (i!=0) outputWriter.write(' ');    outputWriter.write(Long.toString(arr[i]));   }  }  void printArr(double[] arr) throws IOException {   for (int i=0; i<arr.length; ++i) {    if (i!=0) outputWriter.write(' ');    outputWriter.write(Double.toString(arr[i]));   }  }  void printArr(String[] arr) throws IOException {   for (int i=0; i<arr.length; ++i) {    if (i!=0) outputWriter.write(' ');    outputWriter.write(arr[i]);   }  }  void printArr(char[] arr) throws IOException {   for (char c: arr) outputWriter.write(c);  }  void printlnArr(int[] arr) throws IOException {   printArr(arr);   outputWriter.newLine();  }  void printlnArr(long[] arr) throws IOException {   printArr(arr);   outputWriter.newLine();  }  void printlnArr(double[] arr) throws IOException {   printArr(arr);   outputWriter.newLine();  }  void printlnArr(String[] arr) throws IOException {   printArr(arr);   outputWriter.newLine();  }  void printlnArr(char[] arr) throws IOException {   printArr(arr);   outputWriter.newLine();  }  void halt(Object... o) throws IOException {   if (o.length!=0) println(o);   outputWriter.flush(); outputWriter.close();   System.exit(0);  }   void debug(Object... o) {   if (showDebug) System.err.println(Arrays.deepToString(o));  }   public static void main(String[] args) throws Exception {   Locale.setDefault(Locale.US);   if (!useFiles) {    inputReader = new InputReader(System.in, 1<<16);    outputWriter = new BufferedWriter(new OutputStreamWriter(System.out), 1<<16);   } else {    inputReader = new InputReader(new FileInputStream(new File(inFile)), 1<<16);    outputWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outFile))), 1<<16);   }   new A().solve();   outputWriter.flush(); outputWriter.close();  } }
2	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   String s = sc.nextLine();   String[] info = s.split(" ");   long n = Long.parseLong(info[0]);   long k = Long.parseLong(info[1]);   sc.close();   long maximum = k * (k - 1) / 2 + 1;   if (n == 1)    System.out.println(0);   else if (n > maximum)    System.out.println(-1);   else {    long left = 0, right = k - 1;    while (left + 1 < right) {     long mid = (right + left) / 2;     if (mid * (k - 1 + k - mid) / 2 + 1 >= n)      right = mid;     else      left = mid;    }    System.out.println(right);   }  } }
1	public class Main {   void change(int [] all, char c, int val) {   if (Character.isUpperCase(c))    all[c - 'A' + 26] += val;   else    all[c - 'a'] += val;  }  int countDistinct(int [] a) {   int res = 0;   for (int i = 0 ; i< a.length ; i++) {    if (a[i] > 0)     res ++;   }   return res;  }  public void solve() throws IOException {   int n = nextInt();   String s = next();   int [] all = new int[52];   for (int i = 0 ; i < s.length() ; i++) {    char c = s.charAt(i);    change(all, c, 1);   }   int distinct = countDistinct(all);   int [] window = new int[52];   int best = n;   for (int i = 0, j = 0 ; i < s.length() ; i++) {    if (i > 0) {     change(window, s.charAt(i-1), -1);    }    while (j < s.length()) {     if (countDistinct(window) == distinct)      break;     change(window, s.charAt(j), 1);     j ++;    }    if (countDistinct(window) < distinct)     break;    best = Math.min(best, j - i);   }   out.println(best);  }       BufferedReader bf;  StringTokenizer st;  PrintWriter out;   public String next() throws IOException {   while (st == null || !st.hasMoreTokens())    st = new StringTokenizer(bf.readLine());   return st.nextToken();  }  public int nextInt() throws IOException {   return Integer.parseInt(next());  }   public long nextLong() throws IOException {   return Long.parseLong(next());  }  public Main() throws IOException {   bf = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(new OutputStreamWriter(System.out));    solve();   bf.close();   out.close();  }   public static void main(String args[]) throws IOException {   new Main();  } }
2	public class Main {  static int d[][];  static int N;  static boolean used[];  static class point  {   int x = 0;   int y = 0;  }  static point dats[];    public static void main(String[] args)  {   Scanner scan = new Scanner(System.in);        long n = scan.nextLong();   long k = scan.nextLong();   if(n==1)   {    System.out.print("0");    return;   }   if(n<=k)   {    System.out.print("1");    return;   }   long d = 9-4*(2*n-k*k+k);   if(d<0)   {    System.out.print("-1");    return;   }   double a = ((3+Math.sqrt(d)) / 2) ;    if(a>=1)     System.out.println(Math.max(2, k-(long)a+1));    else    System.out.println(-1);       }   }
1	public class Main implements Runnable { StreamTokenizer ST;  PrintWriter out;  BufferedReader br;  int inf = 1000000000;  int nextInt() throws IOException{   ST.nextToken();   return (int)ST.nval;  } long nextLong() throws IOException{   ST.nextToken();   return (long)ST.nval;  }  String next() throws IOException{   ST.nextToken();   return ST.sval;  }  double nextD() throws IOException{   ST.nextToken();   return ST.nval;  }  public static void main(String[] args) throws IOException {    new Thread(new Main()).start();  } public void run() {   try {     br = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));     ST = new StreamTokenizer(br);    solve();    out.close();   br.close();     }    catch (IOException e) {     throw new IllegalStateException(e);    }  }  String code(int x) {  x--;  StringBuilder sb = new StringBuilder();  while (x>0) {   int c = x%26;   if (x<10) sb.append((char)(c+'0')); else sb.append((char)('A'+c-10));   x /= 26;  }  if (sb.length()==0) sb.append("0");  return sb.toString(); } StringBuilder sb = new StringBuilder(); public void solve() throws IOException {  int tt = Integer.parseInt(br.readLine());  HashMap<String, Integer> map = new HashMap<String, Integer>();  for (int i=1; i<=10; i++) map.put(code(i), i);  while (tt-->0) {   String s = br.readLine();   if (s.matches("^[A-Z]+[0-9]+$")) {    int t = 0;    while (Character.isLetter(s.charAt(t))) t++;    int r = Integer.parseInt(s.substring(t));    s = s.substring(0, t);    int res = 0;    for (int c:s.toCharArray()) {     res *= 26;     res += c-'A'+1;    }    out.println("R"+r+"C"+res);   } else {    int t = s.indexOf('C');    int c = Integer.parseInt(s.substring(1, t));    int r = Integer.parseInt(s.substring(t+1));       sb.setLength(0);    while (r>0) {     r--;     int ch = r%26;     sb.append((char)('A'+ch));     r /= 26;    }    sb = sb.reverse();    out.println(sb+""+c);   }    }    } }
2	public class B { static long sum(long from, long to){  final long d = to - from;  return (d*(d + 1))/2 + (d + 1)*from; } static long howMany(long n, long k){  if (n == 1){  return 0;  }  if (n > (k*(k - 1))/2 + 1){  return -1;  }  long hi = k - 1;  long lo = 1;  while (lo < hi){  final long mi = (lo + hi + 1) >> 1;  final long sum = sum(mi, k - 1);  if (n - 1 - sum < mi){   lo = mi;  }else{   hi = mi - 1;  }  }  long res = k - lo;  final long sum = sum(lo, k - 1);  if (n - 1 - sum > 0){  res++;  }  return res; } public static void main(String [] args){  try (Scanner s = new Scanner(System.in)){  final long n = s.nextLong();  final long k = s.nextLong();  System.out.println(howMany(n, k));  } } }
3	public class C {  static int N; static char[] a; static int[][] memo; static int[] ind; static final int MOD = (int) 1e9 + 7;  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 char[N];  for(int i = 0; i < N; i++) a[i] = sc.nextChar();   if(N == 1){out.println(1); out.flush(); return;}  memo = new int[N][N + 5];  for(int[] a : memo) Arrays.fill(a, -1);   out.println(dp(0, 1));  out.flush();  out.close(); }  static int dp(int i, int ind) {  if(i == N - 1) return a[i - 1] == 'f'? 1 : ind;  if(i == 0) return dp(i + 1, a[i] == 's'? 1 : 2);  if(memo[i][ind] != -1) return memo[i][ind];  int ans = 0;  if(a[i - 1] == 'f')  ans = dp(i + 1, a[i] == 's'? ind : ind + 1);  else  {  if(ind > 1)   ans = (ans + dp(i, ind -1)) % MOD;  ans = (ans + dp(i + 1, a[i] == 's'? ind : ind + 1)) % MOD;  }  return memo[i][ind] = ans; }  static class Scanner  {  StringTokenizer st;  BufferedReader br;  Scanner(InputStream system) {br = new BufferedReader(new InputStreamReader(system));}  Scanner(String file) throws FileNotFoundException {br = new BufferedReader(new FileReader(file));}  String next() throws IOException  {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  String nextLine()throws IOException{return br.readLine();}  int nextInt() throws IOException {return Integer.parseInt(next());}  double nextDouble() throws IOException {return Double.parseDouble(next());}  char nextChar()throws IOException{return next().charAt(0);}  Long nextLong()throws IOException{return Long.parseLong(next());}  boolean ready() throws IOException{return br.ready();}  void waitForInput(){for(long i = 0; i < 3e9; i++);} } }
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()); }  double nextDouble() {  return Double.parseDouble(next()); }  class Point implements Comparable<Point> {  int x, y;  public Point(int x, int y) {  this.x=x;   this.y=y;  }  public int compareTo(Point o) {  return x-o.x;  }  public String toString() {  return x + " " + y;  } }   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();  } }
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);   }  }
3	public class A { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni();  int[] a = na(n);  Arrays.sort(a);  boolean[] done = new boolean[n];  int ans = 0;  for(int i = 0;i < n;i++){  if(!done[i]){   ans++;   for(int j = i+1;j < n;j++){   if(a[j] % a[i] == 0){    done[j] = true;   }   }  }  }  out.println(ans); }  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]; 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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
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);  } } }
2	public class Main{  public static boolean check(BigInteger a, BigInteger b){  long n = 0;  String aStr = a.toString();  for (int i=0; i < aStr.length() ;i++ ) {  n += Long.valueOf(aStr.charAt(i)-'0');  }  return a.subtract(BigInteger.valueOf(n)).compareTo(b) >= 0; }  public static void main(String[] args) {  try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))){  String[] str = in.readLine().split(" ");  BigInteger n = new BigInteger(str[0]);  BigInteger s = new BigInteger(str[1]);   BigInteger left = BigInteger.ONE;  BigInteger right = new BigInteger(n.toString()).add(BigInteger.TEN);   BigInteger TWO = BigInteger.ONE.add(BigInteger.ONE);   BigInteger t;   while(right.subtract(left).compareTo(BigInteger.ONE)>0){   t = left.add(right.subtract(left).divide(TWO));   if(check(t, s)){   right = t;   }else{   left = t;   }  }  BigInteger result = n.subtract(right).add(BigInteger.ONE);  if (result.compareTo(BigInteger.ZERO)<=0) {   System.out.println(0);  }else{   System.out.println(result);  }  }catch (IOException e) {  e.printStackTrace();  } } }
2	public class C_Edu_Round_23 {  public static long MOD = 1000000007;  static long[][][][] dp;  public static void main(String[] args) throws FileNotFoundException {        PrintWriter out = new PrintWriter(System.out);   Scanner in = new Scanner();   long n = in.nextLong();   long s = in.nextLong();   if (s == 0) {    out.println(n);   } else {    String N = "" + n;    dp = new long[N.length()][163][2][2];    long re = 0;    for (int i = 1; i < 163 && i <= n; i++) {     long tmp = s + i;     if (tmp <= n) {      String S = "" + tmp;      while(S.length() < N.length()){       S = '0' + S;      }      for (long[][][] a : dp) {       for (long[][] b : a) {        for (long[] c : b) {         Arrays.fill(c, -1);        }       }      }      re += cal(0, i, 0, 0, N, S);     }    }    out.println(re);   }   out.close();  }  public static long cal(int index, int left, int lessThanN, int largerThanS, String n, String s) {   if (index == n.length()) {    if (left == 0) {     return 1;    }    return 0;   }   if (dp[index][left][lessThanN][largerThanS] != -1) {    return dp[index][left][lessThanN][largerThanS];   }   int x = n.charAt(index) - '0';   int y = s.charAt(index) - '0';   long re = 0;   for (int i = 0; i < 10 && i <= left; i++) {    if (i <= x || lessThanN == 1) {     if (i >= y || largerThanS == 1) {      re += cal(index + 1, left - i, i < x ? 1 : lessThanN, i > y ? 1 : largerThanS, n, s);     }    }   }   return dp[index][left][lessThanN][largerThanS] = re;  }  public static int[] KMP(String val) {   int i = 0;   int j = -1;   int[] result = new int[val.length() + 1];   result[0] = -1;   while (i < val.length()) {    while (j >= 0 && val.charAt(j) != val.charAt(i)) {     j = result[j];    }    j++;    i++;    result[i] = j;   }   return result;  }  public static boolean nextPer(int[] data) {   int i = data.length - 1;   while (i > 0 && data[i] < data[i - 1]) {    i--;   }   if (i == 0) {    return false;   }   int j = data.length - 1;   while (data[j] < data[i - 1]) {    j--;   }   int temp = data[i - 1];   data[i - 1] = data[j];   data[j] = temp;   Arrays.sort(data, i, data.length);   return true;  }  public static int digit(long n) {   int result = 0;   while (n > 0) {    n /= 10;    result++;   }   return result;  }  public static double dist(long a, long b, long x, long y) {   double val = (b - a) * (b - a) + (x - y) * (x - y);   val = Math.sqrt(val);   double other = x * x + a * a;   other = Math.sqrt(other);   return val + other;  }  public static class Point implements Comparable<Point> {   int x, y;   public Point(int start, int end) {    this.x = start;    this.y = end;   }   @Override   public int hashCode() {    int hash = 5;    hash = 47 * hash + this.x;    hash = 47 * hash + this.y;    return hash;   }   @Override   public boolean equals(Object obj) {    if (obj == null) {     return false;    }    if (getClass() != obj.getClass()) {     return false;    }    final Point other = (Point) obj;    if (this.x != other.x) {     return false;    }    if (this.y != other.y) {     return false;    }    return true;   }   @Override   public int compareTo(Point o) {    return Integer.compare(x, o.x);   }  }  public static class FT {   long[] data;   FT(int n) {    data = new long[n];   }   public void update(int index, long value) {    while (index < data.length) {     data[index] += value;     index += (index & (-index));    }   }   public long get(int index) {    long result = 0;    while (index > 0) {     result += data[index];     index -= (index & (-index));    }    return result;   }  }  public static long gcd(long a, long b) {   if (b == 0) {    return a;   }   return gcd(b, a % b);  }  public static long pow(long a, long b, 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 long nextLong() {    return Long.parseLong(next());   }   public int nextInt() {    return Integer.parseInt(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    st = null;    try {     return br.readLine();    } catch (Exception e) {     throw new RuntimeException();    }   }   public boolean endLine() {    try {     String next = br.readLine();     while (next != null && next.trim().isEmpty()) {      next = br.readLine();     }     if (next == null) {      return true;     }     st = new StringTokenizer(next);     return st.hasMoreTokens();    } catch (Exception e) {     throw new RuntimeException();    }   }  } }
4	public class C{ public static void main(String args[]) throws Exception{  Scanner in = new Scanner(new FileReader("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  int N = in.nextInt();  int M = in.nextInt();  int K = in.nextInt();  int[] X = new int[K], Y = new int[K];  for (int i = 0; i < K; i++){  X[i] = in.nextInt();  Y[i] = in.nextInt();  }  int d = -1;  int a = -1; int b = -1;  for (int i = 1; i <= N; i++)  for (int j = 1; j <= M; j++){   int h = Integer.MAX_VALUE;   for (int p = 0; p < K; p++)   h = Math.min(h,Math.abs(i-X[p]) + Math.abs(j-Y[p]));   if (h > d){   d = h; a = i; b = j;   }  }   out.print(a + " " + b);  out.close(); } }
6	public class Main { public static void main(String[]args) throws Exception {  int n=ni();  double ke=ni();  boolean[][]a=new boolean[n][n];  for(int i=0; i<n; i++)   for(int j=0; j<n; j++)   a[i][j]=ni()==0;  int left=n/2;  int[]ldp=new int[1<<left];  int[]rdp=new int[1<<(n-left)];  int[]pow=new int[25];  pow[0]=1;  for(int i=1; i<25; i++)   pow[i]=pow[i-1]<<1;  for(int i=0; i<pow[left]; i++)   ou:for(int j=0; j<left; j++)   if((i>>j)%2==0)   {    int te=i;    for(int k=0; te>0; k++,te>>=1)    if(a[j][k]&&(te&1)!=0)    {     ldp[i+pow[j]]=max(ldp[i+pow[j]],ldp[i]);     continue ou;    }    ldp[i+pow[j]]=max(ldp[i+pow[j]],ldp[i]+1);   }  int right=n-left;  for(int i=0; i<pow[right]; i++)   ou:for(int j=0; j<right; j++)   if((i>>j)%2==0)   {    int lul=j+left;    int te=i;    for(int k=left; te>0; k++,te>>=1)    if(a[lul][k]&&(te&1)!=0)    {     rdp[i+pow[j]]=max(rdp[i+pow[j]],rdp[i]);     continue ou;    }    rdp[i+pow[j]]=max(rdp[i+pow[j]],rdp[i]+1);   }  int maxi=0;  for(int i=0; i<pow[left]; i++)  {   int lol=0;   int te=i;   for(int j=0; te>0; j++,te>>=1)   if((te&1)!=0)    for(int k=0; k<right; k++)    if(a[j][k+left])     lol|=pow[k];   maxi=max(maxi,ldp[i]+rdp[pow[right]-1-lol]);  }  pr((ke*ke*(maxi-1))/(2*maxi));  System.out.println(output); }     static final int mod=1000_000_007; static final double eps=1e-7; static final long inf=1000_000_000_000_000_000L; static class pair {  int a,b;  pair(){}  pair(int c,int d){a=c;b=d;}  @Override  public int hashCode()  {  return (a+" "+b).hashCode();  }  public boolean equals(Object c)  {  return (a==(((pair)c).a)&&b==(((pair)c).b));  } } public static void sort(int[][]a) {  Arrays.sort(a, new Comparator<int[]>()   {  public int compare(int[]a,int[]b)  {   if(a[0]>b[0])   return 1;   if(a[0]<b[0])   return -1;   return 0;  }   }); } static interface combiner {  public int combine(int a, int b); } static void pr(Object a){output.append(a+"\n");} static void pr(){output.append("\n");} static void p(Object a){output.append(a);} static void pra(int[]a){for(int i:a)output.append(i+" ");output.append("\n");} static void pra(long[]a){for(long i:a)output.append(i+" ");output.append("\n");} static void pra(String[]a){for(String i:a)output.append(i+" ");output.append("\n");} static void pra(double[]a){for(double i:a)output.append(i+" ");output.append("\n");} static void sop(Object a){System.out.println(a);} static void flush(){System.out.print(output);output=new StringBuilder();} static int ni(){return Integer.parseInt(in.next());} static long nl(){return Long.parseLong(in.next());} static String ns(){return in.next();} static double nd(){return Double.parseDouble(in.next());} static int[] nia(int n){int a[]=new int[n];for(int i=0; i<n; i++)a[i]=ni();return a;} static int[] pnia(int n){int a[]=new int[n+1];for(int i=1; i<=n; i++)a[i]=ni();return a;} static long[] nla(int n){long a[]=new long[n];for(int i=0; i<n; i++)a[i]=nl();return a;} static String[] nsa(int n){String a[]=new String[n];for(int i=0; i<n; i++)a[i]=ns();return a;} static double[] nda(int n){double a[]=new double[n];for(int i=0; i<n; i++)a[i]=nd();return a;} static Reader in=new Reader(); static StringBuilder output=new StringBuilder(); static Random rn=new Random(); static void reverse(int[]a){for(int i=0; i<a.length/2; i++){a[i]^=a[a.length-i-1];a[a.length-i-1]^=a[i];a[i]^=a[a.length-i-1];}} static int log2n(long a) {  int te=0;  while(a>0)  {  a>>=1;  ++te;  }  return te; } static class vectorl implements Iterable<Long> {  long a[];  int size;  vectorl(){a=new long[10];size=0;}  vectorl(int n){a=new long[n];size=0;}  public void add(long b){if(++size==a.length)a=Arrays.copyOf(a, 2*size);a[size-1]=b;}  public void sort(){Arrays.sort(a, 0, size);}  public void sort(int l, int r){Arrays.sort(a, l, r);}  @Override  public Iterator<Long> iterator() {  Iterator<Long> hola=new Iterator<Long>()   {   int cur=0;    @Override    public boolean hasNext() {    return cur<size;    }    @Override    public Long next() {    return a[cur++];    }     };  return hola;  } } static class vector implements Iterable<Integer> {  int a[],size;  vector(){a=new int[10];}  vector(int n){a=new int[n];}  public void add(int b){if(++size==a.length)a=Arrays.copyOf(a, 2*size);a[size-1]=b;}  public void sort(){Arrays.sort(a, 0, size);}  public void sort(int l, int r){Arrays.sort(a, l, r);}  @Override  public Iterator<Integer> iterator() {  Iterator<Integer> hola=new Iterator<Integer>()   {   int cur=0;    @Override    public boolean hasNext() {    return cur<size;    }    @Override    public Integer next() {    return a[cur++];    }     };  return hola;  } } static void exit(){System.out.print(output);System.exit(0);} static int min(int... a){int min=a[0];for(int i:a)min=Math.min(min, i);return min;} static int max(int... a){int max=a[0];for(int i:a)max=Math.max(max, i);return max;}  static int gcd(int... a){int gcd=a[0];for(int i:a)gcd=gcd(gcd, i);return gcd;}  static long min(long... a){long min=a[0];for(long i:a)min=Math.min(min, i);return min;} static long max(long... a){long max=a[0];for(long i:a)max=Math.max(max, i);return max;}  static long gcd(long... a){long gcd=a[0];for(long i:a)gcd=gcd(gcd, i);return gcd;}  static String pr(String a, long b){String c="";while(b>0){if(b%2==1)c=c.concat(a);a=a.concat(a);b>>=1;}return c;} static long powm(long a, long b, long mod2){long an=1;long c=a%mod2;while(b>0){if(b%2==1)an=(an*c)%mod2;c=(c*c)%mod2;b>>=1;}return an;} static long pow(long a, long b){long an=1;long c=a;while(b>0){if(b%2==1)an*=c;c*=c;b>>=1;}return an;} static int gcd(int a, int b){if(b==0)return a;return gcd(b, a%b);} static long gcd(long a, long b){if(b==0)return a;return gcd(b, a%b);} static class Reader{   public BufferedReader reader;   public StringTokenizer tokenizer;   public Reader() {    reader = new BufferedReader(new InputStreamReader(System.in));    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();   }  } }
1	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();    String word = in.next();    int cnt[] = new int[1000];    int let = 0;    Set<Character> set = new TreeSet<>();    for (int i = 0; i < word.length(); i++) {     set.add(word.charAt(i));    }    int uniq = set.size();    int i = 0, j = -1;    int ans = Integer.MAX_VALUE;    while (i < N && j < N) {     while (j + 1 < N && let < uniq) {      j++;      if (cnt[word.charAt(j)] == 0) {       let++;      }      cnt[word.charAt(j)]++;     }     if (let == uniq)      ans = Math.min(ans, j - i + 1);     cnt[word.charAt(i)]--;     if (cnt[word.charAt(i)] == 0) let--;     i++;    }    out.println(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());   }  } }
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();   }  }  static class IOUtils {   public static void readIntArrays(InputReader in, int[]... arrays) {    for(int i = 0; i < arrays[0].length; i++) {     for(int j = 0; j < arrays.length; j++)      arrays[j][i] = in.readInt();    }   }  } }
1	public class CodehorsesT_shirts {  public static void main(String[] args) throws Exception {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(reader.readLine());   HashMap<String, Integer> map = new HashMap<String, Integer>();   String input;   for (int i = 0; i < n; i++) {    input = reader.readLine();    if (map.containsKey(input)) {     map.put(input, map.get(input) + 1);    } else {     map.put(input, 1);    }   }   int change = 0;   for (int i = 0; i < n; i++) {    input = reader.readLine();    if (map.containsKey(input)) {     map.put(input, map.get(input) - 1);    } else {     map.put(input, -1);    }   }   for (int x : map.values()) {    change += Math.abs(x);   }   System.out.println(change/2);  } }
0	public class A {  public static void main(String[] args) {   OutputStream outputStream = System.out;   PrintWriter out = new PrintWriter(outputStream);   Application solver = new Application();   solver.solve(System.in, out);   out.close();  } }  class Application {  int max(int a, int b) { return a > b ? a : b; }  public void solve(InputStream in, PrintWriter out) {   Scanner scanner = new Scanner(in);   int n = scanner.nextInt();   int n1 = n/10;   int n2 = (n/100)*10+(n%10);   int m = max(max(n1, n2), n);   out.println(m);  } }
4	public class teama {  static int mod = 2_000_000_007;  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   PrintWriter pw = new PrintWriter(System.out);   int T = Integer.parseInt(br.readLine());   for (int t = 0; t < T; t++) {    int N = Integer.parseInt(br.readLine());    Stack<Integer> stack = new Stack();    for (int i = 0; i < N; i++) {     int a = Integer.parseInt(br.readLine());     if (a != 1) {      while (stack.peek() + 1 != a) {       stack.pop();      }      stack.pop();     }     stack.push(a);     boolean dummy = false;     for (int j : stack) {      if (dummy) {       pw.print(".");      }      pw.print(j);      dummy = true;     }     pw.println();    }   }   pw.close();   br.close();  } }
5	public class Solution {  private StringTokenizer st; private BufferedReader in; private PrintWriter out;  public void solve() throws IOException {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; ++i) {  a[i] = nextInt();  }  int[] b = a.clone();  Arrays.sort(b);  int diff = 0;  for (int i = 0; i < n; ++i) {  if (a[i] != b[i]) {   diff++;  }  }  out.println(diff <= 2 ? "YES" : "NO"); }  public void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  eat("");   solve();   out.close(); }  void eat(String s) {  st = new StringTokenizer(s); }  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()); }  long nextLong() throws IOException {  return Long.parseLong(next()); }  double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static void main(String[] args) throws IOException {  Locale.setDefault(Locale.US);  new Solution().run(); }  }
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	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));    }   }  }  long mp(long b, long e, long mod) {   b %= mod;   long r = 1;   while(e > 0) {    if((e & 1) == 1) {     r *= b; r %= mod;    }    b *= b; b %= mod;    e >>= 1;   }   return r;  }     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;  }   char nc() { return (char)skip(); }  String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!isSpaceChar(b)) { sb.appendCodePoint(b); b = readByte(); }   return sb.toString();  }  String nLine() {   int b = skip();   StringBuilder sb = new StringBuilder();   while( !(isSpaceChar(b) && 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;  }  double nd() { return Double.parseDouble(ns()); }  float nf() { return Float.parseFloat(ns()); }  int[] na(int n) {   int a[] = new int[n];   for(int i = 0; i < n; i++) { a[i] = ni(); }   return a;  }  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);  } }
0	public class program{ public static void main(String args[]) throws Exception{  Scanner sc=new Scanner(System.in);  int n=sc.nextInt();  if(n==0){  System.out.println("0 0 0");  return;  }  else if(n==1){  System.out.println("0 0 1");  return;  }  else if(n==2){  System.out.println("0 1 1");  return;  }  else{  int ppp=0;  int pp=1;  int c=2;  while(true){   if(ppp+pp+c==n){   System.out.println(ppp+" "+pp+" "+c);   return;   }   else{   c=c+pp+ppp;   int temp=pp;   pp=pp+ppp;   ppp=temp;   }  }  } } }
0	public class Subtractions {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int tests = scan.nextInt();  while (tests > 0) {   tests--;   int first = scan.nextInt();  int second = scan.nextInt();   int count = 0;  while (first > 0 && second > 0) {     if (first < second) {    count += second / first;   second = second % first;   } else {      count += first / second;   first = first % second;   }  }    System.out.println(count);  } } }
3	public class Main implements Runnable { static final double time = 1e9; static final int MOD = (int) 1e9 + 7; static final long mh = Long.MAX_VALUE; static final Reader in = new Reader(); static final PrintWriter out = new PrintWriter(System.out); StringBuilder answer = new StringBuilder(); long start = System.nanoTime();   public static void main(String[] args) {  new Thread(null, new Main(), "persefone", 1 << 28).start(); }  @Override public void run() {   solve();   printf();  long elapsed = System.nanoTime() - start;   close();  }    void solve() {  int n = in.nextInt();  int[] a = in.nextIntArray(n);  int invertions = 0;  for (int i = 1; i < n; i++) {  for (int j = i - 1; j > -1; j--) {   if (a[j] > a[i])   invertions++;  }  }  invertions %= 2;  for (int q = in.nextInt(); q > 0; q--) {  int l = in.nextInt();  int r = in.nextInt();   int k = r - l + 1;  k = (k * (k - 1) >> 1) % 2;  if (invertions == k) {   invertions = 0;   add("even", '\n');  } else {   invertions = 1;   add("odd", '\n');  }  }  }   void printf() {  out.print(answer); }  void close() {  out.close(); }  void printf(Stream<?> str) {  str.forEach(o -> add(o, " "));  add("\n"); }   void printf(Object... obj) {  printf(false, obj); }  void printfWithDescription(Object... obj) {  printf(true, obj); }    private void printf(boolean b, Object... obj) {  if (obj.length > 1) {  for (int i = 0; i < obj.length; i++) {   if (b) add(obj[i].getClass().getSimpleName(), " - ");   if (obj[i] instanceof Collection<?>) {   printf((Collection<?>) obj[i]);   } else if (obj[i] instanceof int[][]) {   printf((int[][])obj[i]);   } else if (obj[i] instanceof long[][]) {   printf((long[][])obj[i]);   } else if (obj[i] instanceof double[][]) {   printf((double[][])obj[i]);   } else printf(obj[i]);  }  return;  }  if (b) add(obj[0].getClass().getSimpleName(), " - ");  printf(obj[0]); }  void printf(Object o) {  if (o instanceof int[])  printf(Arrays.stream((int[]) o).boxed());  else if (o instanceof char[])  printf(new String((char[]) o));  else if (o instanceof long[])  printf(Arrays.stream((long[]) o).boxed());  else if (o instanceof double[])  printf(Arrays.stream((double[]) o).boxed());  else if (o instanceof boolean[]) {  for (boolean b : (boolean[]) o) add(b, " ");  add("\n");  }  else   add(o, "\n"); }  void printf(int[]... obj) {  for (int i = 0; i < obj.length; i++) printf(obj[i]); }  void printf(long[]... obj) {  for (int i = 0; i < obj.length; i++) printf(obj[i]); }  void printf(double[]... obj) {  for (int i = 0; i < obj.length; i++) printf(obj[i]); }  void printf(boolean[]... obj) {  for (int i = 0; i < obj.length; i++) printf(obj[i]); }  void printf(Collection<?> col) {  printf(col.stream()); }  <T, K> void add(T t, K k) {  if (t instanceof Collection<?>) {  ((Collection<?>) t).forEach(i -> add(i, " "));  } else if (t instanceof Object[]) {  Arrays.stream((Object[]) t).forEach(i -> add(i, " "));  } else  add(t);  add(k); }    <T> void add(T t) {  answer.append(t); }  @SuppressWarnings("unchecked") <T extends Comparable<? super T>> T min(T... t) {  if (t.length == 0)  return null;  T m = t[0];  for (int i = 1; i < t.length; i++)  if (t[i].compareTo(m) < 0)   m = t[i];  return m; }  @SuppressWarnings("unchecked") <T extends Comparable<? super T>> T max(T... t) {  if (t.length == 0)  return null;  T m = t[0];  for (int i = 1; i < t.length; i++)  if (t[i].compareTo(m) > 0)   m = t[i];  return m; }  int gcd(int a, int b) {  return (b == 0) ? a : gcd(b, a % b); }  long gcd(long a, long b) {  return (b == 0) ? a : gcd(b, a % b); }   int[] ext_gcd(int a, int b) {  if (b == 0) return new int[] {a, 1, 0 };  int[] vals = ext_gcd(b, a % b);  int d = vals[0];   int p = vals[2];  int q = vals[1] - (a / b) * vals[2];  return new int[] { d, p, q };  }   boolean find_any_solution(int a, int b, int c, int[] root) {  int[] vals = ext_gcd(Math.abs(a), Math.abs(b));  if (c % vals[0] != 0) return false;  printf(vals);  root[0] = c * vals[1] / vals[0];  root[1] = c * vals[2] / vals[0];  if (a < 0) root[0] *= -1;  if (b < 0) root[1] *= -1;  return true; }  int mod(int x) { return x % MOD; }  int mod(int x, int y) { return mod(mod(x) + mod(y)); }  long mod(long x) { return x % MOD; }  long mod (long x, long y) { return mod(mod(x) + mod(y)); }  int lw(long[] f, int l, int r, long k) {  int R = r, m = 0;  while (l <= r) {  m = l + r >> 1;   if (m == R) return m;   if (f[m] >= k) r = m - 1; else l = m + 1;  }  return l; }  int up(long[] f, int l, int r, long k) {  int R = r, m = 0;  while (l <= r) {  m = l + r >> 1;   if (m == R) return m;   if (f[m] > k) r = m - 1; else l = m + 1;  }  return l; }  int lw(int[] f, int l, int r, int k) {  int R = r, m = 0;  while (l <= r) {  m = l + r >> 1;   if (m == R) return m;   if (f[m] >= k) r = m - 1; else l = m + 1;  }  return l; }  int up(int[] f, int l, int r, int k) {  int R = r, m = 0;  while (l <= r) {  m = l + r >> 1;   if (m == R) return m;   if (f[m] > k) r = m - 1; else l = m + 1;  }  return l; }  <K extends Comparable<K>> int lw(List<K> li, int l, int r, K k) {  int R = r, m = 0;  while (l <= r) {  m = l + r >> 1;   if (m == R) return m;   if (li.get(m).compareTo(k) >= 0)    r = m - 1;   else    l = m + 1;  }  return l; }  <K extends Comparable<K>> int up(List<K> li, int l, int r, K k) {  int R = r, m = 0;  while (l <= r) {  m = l + r >> 1;   if (m == R) return m;   if (li.get(m).compareTo(k) > 0)    r = m - 1;   else    l = m + 1;  }  return l; }   <K extends Comparable<K>> int bs(List<K> li, int l, int r, K k) {  while (l <= r) {  int m = l + r >> 1;   if (li.get(m) == k) return m;   else if (li.get(m).compareTo(k) < 0)   l = m + 1;   else    r = m - 1;  }  return -1; }  long calc(int base, int exponent) {  if (exponent == 0) return 1;  if (exponent == 1) return base % MOD;  long m = calc(base, exponent / 2);  if (exponent % 2 == 0) return (m * m) % MOD;  return (base * ((m * m) % MOD)) % MOD; }  long calc(int base, long exponent) {  if (exponent == 0) return 1;  if (exponent == 1) return base % MOD;  long m = calc(base, exponent / 2);  if (exponent % 2 == 0) return (m * m) % MOD;  return (base * ((m * m) % MOD)) % MOD; }  long calc(long base, long exponent) {  if (exponent == 0) return 1;  if (exponent == 1) return base % MOD;  long m = calc(base, exponent / 2);  if (exponent % 2 == 0) return (m * m) % MOD;  return (base * (m * m % MOD)) % MOD; }  long power(int base, int exponent) {  if (exponent == 0) return 1;  long m = power(base, exponent / 2);  if (exponent % 2 == 0) return m * m;  return base * m * m; }  void swap(int[] a, int i, int j) {  a[i] ^= a[j];  a[j] ^= a[i];  a[i] ^= a[j]; }  void swap(long[] a, int i, int j) {  long tmp = a[i];  a[i] = a[j];  a[j] = tmp; }  static class Pair<K extends Comparable<? super K>, V extends Comparable<? super V>>  implements Comparable<Pair<K, V>> {  private K k;  private V v;  Pair() {}  Pair(K k, V v) {  this.k = k;  this.v = v;  }  K getK() { return k; }  V getV() { return v; }  void setK(K k) { this.k = k; }  void setV(V v) { this.v = v; }  void setKV(K k, V v) {  this.k = k;  this.v = v;  }  @SuppressWarnings("unchecked")  @Override  public boolean equals(Object o) {  if (this == o) return true;  if (o == null || !(o instanceof Pair)) return false;  Pair<K, V> p = (Pair<K, V>) o;  return k.compareTo(p.k) == 0 && v.compareTo(p.v) == 0;  }  @Override  public int hashCode() {  int hash = 31;  hash = hash * 89 + k.hashCode();  hash = hash * 89 + v.hashCode();  return hash;  }  @Override  public int compareTo(Pair<K, V> pair) {  return k.compareTo(pair.k) == 0 ? v.compareTo(pair.v) : k.compareTo(pair.k);  }  @Override  public Pair<K, V> clone() {  return new Pair<K, V>(this.k, this.v);  }  @Override  public String toString() {  return String.valueOf(k).concat(" ").concat(String.valueOf(v)).concat("\n");  } }  static class Reader {  private BufferedReader br;  private StringTokenizer st;  Reader() {  br = new BufferedReader(new InputStreamReader(System.in));  }  String next() {  try {   while (st == null || !st.hasMoreTokens()) {   st = new StringTokenizer(br.readLine());   }  } catch (IOException e) {   e.printStackTrace();  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  int[] nextIntArray(int n) {  int[] arr = new int[n];  for (int i = 0; i < n; i++)   arr[i] = nextInt();  return arr;  }  long nextLong() {  return Long.parseLong(next());  }   double nextDouble() {  return Double.parseDouble(next());  }  String nextLine() {  String s = "";  try {   s = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return s;  } } }
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 long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String next() {    int c = read();    while (isSpaceChar(c)) c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   public String nextLine() {    int c = read();    while (isEndline(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isEndline(c));    return res.toString();   }  } }
6	public class C8 { static int[] mem; static int[] bag; static int[][] items; static int[] close; static PrintWriter pw; static int n; public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  pw = new PrintWriter(System.out);   bag = new int[2];  bag[0] = sc.nextInt();  bag[1] = sc.nextInt();   n = sc.nextInt();  items = new int[n][2];   for(int i = 0;i<n;i++)  {  items[i][0] = sc.nextInt();  items[i][1] = sc.nextInt();  }        mem = new int[1<<n];   Arrays.fill(mem, -1);   pw.println(dp(0));  trace(0);  pw.print(0);   pw.flush(); } static int dp(int mask){  if(mask==(1<<n)-1)  return 0;   if(mem[mask]!=-1)  return mem[mask];   int ans = (int)1e9;  for(int i = 0;i<n;i++)  if((1<<i&mask)==0)  {   ans = getDisBag(i)*2+dp(mask|1<<i);        for(int j = i+1;j<n;j++)   if((1<<j&mask)==0)    ans = Math.min(ans, getDisBag(i)+getDis(i,j)+getDisBag(j)+dp(mask|1<<i|1<<j));     break;  }   return mem[mask] = ans; } static int getDis(int i, int j){  return (items[i][0]-items[j][0])*(items[i][0]-items[j][0])+(items[i][1]-items[j][1])*(items[i][1]-items[j][1]); } static int getDisBag(int i){  return (items[i][0]-bag[0])*(items[i][0]-bag[0])+(items[i][1]-bag[1])*(items[i][1]-bag[1]); } static int getClosest(int i, int mask){  int ret = -1;  for(int j = 0;j<n;j++)  if(i!=j&&(mask&1<<j)==0)   if(ret==-1||getDis(i, j)<getDis(i, ret))   ret = j;  return ret; } static void trace(int mask){  if(mask==(1<<n)-1)  return;   int ans = (int)1e9;  for(int i = 0;i<n;i++)  if((1<<i&mask)==0)  {   ans = getDisBag(i)*2+dp(mask|1<<i);   if(mem[mask]==ans)   {   pw.print(0+" "+(i+1)+" ");   trace(mask|1<<i);   return;   }     for(int j = i+1;j<n;j++)   if((1<<j&mask)==0)    if(mem[mask] == getDisBag(i)+getDis(i,j)+getDisBag(j)+dp(mask|1<<i|1<<j))    {    pw.print(0+" "+(i+1)+" "+(j+1)+" ");    trace(mask|1<<i|1<<j);    return;    }   }   } 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 long nextLong() throws IOException {return Long.parseLong(next());}  public String nextLine() throws IOException {return br.readLine();}  public double nextDouble() throws IOException  {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if(x.charAt(0) == '-')  {   neg = true;   start++;  }  for(int i = start; i < x.length(); i++)   if(x.charAt(i) == '.')   {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   }   else   {   sb.append(x.charAt(i));   if(dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg?-1:1);  }  public boolean ready() throws IOException {return br.ready();}  } }
3	public class D {  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[]a = new int[n+1];  for (int i = 1; i <= n; i++) {  a[i] = nextInt();  }  int inv = 0;  for (int i = 1; i <= n; i++) {  for (int j = 1; j < i; j++) {   if (a[j] > a[i])   inv++;  }  }  int m = nextInt();  boolean odd = inv % 2==1;  for (int i = 0; i < m; i++) {  int left = nextInt();  int right = nextInt();  long k = right-left+1;  if (k*(k-1)/2 % 2==1)   odd = !odd;  if (odd)   pw.println("odd");  else   pw.println("even");  }  pw.close(); } private static int nextInt() throws IOException {  return Integer.parseInt(next()); } private static long nextLong() throws IOException {  return Long.parseLong(next()); } private static double nextDouble() throws IOException {  return Double.parseDouble(next()); } private static String next() throws IOException {  while (st==null || !st.hasMoreTokens())  st = new StringTokenizer(br.readLine());  return st.nextToken(); } }
1	public class IQ {  public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  ArrayList<Integer> e=new ArrayList<Integer>();  ArrayList<Integer> o=new ArrayList<Integer>();  int size=sc.nextInt();  for(int w=0;w<size;w++)  {  int x=sc.nextInt();  if(x%2==0)e.add(w+1);  else o.add(w+1);  }  if(e.size()==1)System.out.println(e.get(0));  else System.out.println(o.get(0));  } }
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());   }   long nextLong()   {    return Long.parseLong(next());   }   double nextDouble()   {    return Double.parseDouble(next());   }   String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  } }
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 void writeInt(int a) {this.out.print(a);this.out.print(' ');}  public void writeWord(String s){   this.out.print(s);  }  public void writeIntArray(int[] a, int k, String separator) {   StringBuilder sb = new StringBuilder();   for (int i = 0; i < k; i++) {    if (i > 0) sb.append(separator);    sb.append(a[i]);   }   this.writeLine(sb.toString());  }  public void writeLongArray(long[] a, int k, String separator) {   StringBuilder sb = new StringBuilder();   for (int i = 0; i < k; i++) {    if (i > 0) sb.append(separator);    sb.append(a[i]);   }   this.writeLine(sb.toString());  }  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 long[] readLongArray() {   String[]n=this.readLine().trim().split("\\s+");long[]r=new long[n.length];   for(int i=0;i<n.length;i++)r[i]=Long.parseLong(n[i]);   return r;  }  public int[] readIntArray() {   String[]n=this.readLine().trim().split("\\s+");int[]r=new int[n.length];   for(int i=0;i<n.length;i++)r[i]=Integer.parseInt(n[i]);   return r;  }  public int[] readIntArray(int n) {   int[] res = new int[n];   char[] all = this.readLine().toCharArray();   int cur = 0;boolean have = false;   int k = 0;   boolean neg = false;   for(int i = 0;i<all.length;i++){    if(all[i]>='0' && all[i]<='9'){     cur = cur*10+all[i]-'0';     have = true;    }else if(all[i]=='-') {     neg = true;    }    else if(have){     res[k++] = neg?-cur:cur;     cur = 0;     have = false;     neg = false;    }   }   if(have)res[k++] = neg?-cur:cur;   return res;  }  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;   }  }  public String readWord() {   try {    boolean start = false;    StringBuilder sb = new StringBuilder();    while (true) {     int c = br.read();     if (c!= ' ' && c!= '\r' && c!='\n' && c!='\t') {      sb.append((char)c);      start = true;     } else if (start || c == -1) return sb.toString();    }   } catch (Exception ex) {    return "";   }  }  public char readSymbol() {   try {    while (true) {     int c = br.read();     if (c != ' ' && c != '\r' && c != '\n' && c != '\t') {      return (char) c;     }    }   } catch (Exception ex) {    return 0;   }  } } class Pair {  public Pair(int a, int b) {this.a = a;this.b = b;}  public int a;  public int b; } class PairLL {  public PairLL(long a, long b) {this.a = a;this.b = b;}  public long a;  public long b; } class Triple {  public Triple(int a, int b, int c) {this.a = a;this.b = b;this.c = c;}  public int a;  public int b;  public int c; }
0	public class Problem1 {   public static void main(String[] args) {   Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  if (n < 0) {    int first = n / 10;  int second = (n / 100)*10 + (n % 10);  if (first > second)   System.out.println(first);  else   System.out.println(second);  } else {  System.out.println(n);  } } }
3	public class task1 {  static void print(Object... a) {   for (Object aa : a) {    System.out.println(aa.toString());   }  }  static Map<Character, Integer> stringToCharsMap(String str) {   Map<Character, Integer> charcount = new HashMap<Character, Integer>();   for (Character c : str.toCharArray()) {    if (charcount.containsKey(c)) {     charcount.put(c, charcount.get(c) + 1);    } else {     charcount.put(c, 1);    }   }   return charcount;  }  static Set<Character> stringToCharsSet(String str) {   Set<Character> chars = new HashSet<>();   for (Character c : str.toCharArray()) {    chars.add(c);   }   return chars;  }  static int[] readArrayOfInt() {   Scanner sc = new Scanner(System.in);   int a = sc.nextInt();   int array[] = new int[a];   for (int i = 0; i < a; i++) {    array[i] = sc.nextInt();   }   return array;  }  static class Point {   double x;   double y;   Point(double x, double y) {    this.x = x;    this.y = y;   }   double distance(Point p) {    return Math.sqrt((this.x - p.x) * (this.x - p.x) + (this.y - p.y) * (this.y - p.y));   }   double distance(Line l) {    return Math.abs(l.a * this.x + l.b * this.y + l.c) / Math.sqrt(l.a * l.a + l.b * l.b);   }  }  static class Line {   double a;   double b;   double c;   double EPS = 1e-6;   Line(int a, int b, int c) {    this.a = a;    this.b = b;    this.c = c;   }   Line(Point f, Point s) {    this.a = f.y - s.y;    this.b = s.x - f.x;    this.c = -this.a * f.x - this.b * f.y;   }   double distance(Point p) {    return Math.abs(this.a * p.x + this.b * p.y + this.c) / Math.sqrt(this.a * this.a + this.b * this.b);   }   boolean isPointOnLine(Point p) {    return p.x * this.a + p.y * this.b + this.c < EPS;   }   Point linesIntersection(Line a) {    double x = -(this.c * a.b - a.c * this.b) / (this.a * a.b - a.a * this.b);    double y = -(this.a * a.c - a.a * this.c) / (this.a * a.b - a.a * this.b);    return new Point(x, y);   }  }  static HashMap<Integer, Integer> getDels(int a) {   HashMap<Integer, Integer> h = new HashMap<>();   int i = 2;   while (a != 1) {    if (a % i == 0) {     if (h.containsKey(i)) {      h.put(i, h.get(i) + 1);     } else {      h.put(i, 1);     }     a = a / i;    } else {     i++;    }   }   return h;  }  static class Rect {   Point fcorner;   Point scorner;   Rect(Point f, Point s) {    fcorner = f;    scorner = s;   }   double volume() {    return Math.abs((fcorner.x - scorner.x) * (fcorner.y - scorner.y));   }  }  public static void main(String args[]) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int arr[] = new int[n];   int c[] = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = sc.nextInt();   }   Arrays.sort(arr);   int count = 1;   c[0] = 1;   for (int i = 1; i < arr.length; i++) {    for (int j = 0; j < i; j++) {     if (arr[i] % arr[j] == 0) {      c[i] = c[j];      break;     }    }    if (c[i] == 0) {     c[i] = count + 1;     count++;    }   }   System.out.println(count);  } }
4	public class A23 {  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   String s = br.readLine();   for(int length = s.length(); length > 0; length--)  {    for(int start = 0; start + length <= s.length(); start++)  {     String test = s.substring(start, start+length);     if(s.indexOf(test) != s.lastIndexOf(test)) {      System.out.println(length);      return;     }    }   }   System.out.println(0);  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   inputClass in = new inputClass(inputStream);   PrintWriter out = new PrintWriter(outputStream);   F2SameSumBlocksHard solver = new F2SameSumBlocksHard();   solver.solve(1, in, out);   out.close();  }  static class F2SameSumBlocksHard {   public void solve(int testNumber, inputClass sc, PrintWriter out) {    int n = sc.nextInt();    int[] tab = new int[n];    int[] s = new int[n];    for (int i = 0; i < n; i++) {     tab[i] = sc.nextInt();     if (i > 0)      s[i] = s[i - 1] + tab[i];     else      s[0] = tab[0];    }    HashMap<Integer, F2SameSumBlocksHard.Pair> sums = new HashMap<>();    F2SameSumBlocksHard.Pair p;    for (int i = 0; i < n; i++) {     for (int j = 0; j <= i; j++) {      if (j > 0) {       if (sums.get(s[i] - s[j - 1]) != null) {        if (sums.get(s[i] - s[j - 1]).last < j) {         sums.get(s[i] - s[j - 1]).sum++;         sums.get(s[i] - s[j - 1]).last = i;        }       } else {        p = new F2SameSumBlocksHard.Pair();        p.sum = 1;        p.last = i;        sums.put(s[i] - s[j - 1], p);       }      } else {       if (sums.get(s[i]) != null) {        if (sums.get(s[i]).last < j) {         sums.get(s[i]).sum++;         sums.get(s[i]).last = i;        }       } else {        p = new F2SameSumBlocksHard.Pair();        p.sum = 1;        p.last = i;        sums.put(s[i], p);       }      }     }    }    Iterator<Map.Entry<Integer, F2SameSumBlocksHard.Pair>> it = sums.entrySet().iterator();    Map.Entry<Integer, F2SameSumBlocksHard.Pair> t;    int maxsum = 0;    int cnt = 0;    while (it.hasNext()) {     t = it.next();     if (t.getValue().sum > cnt) {      maxsum = t.getKey();      cnt = t.getValue().sum;     }    }    out.println(cnt);    int start = 0;    for (int i = 0; i < n; i++) {     for (int j = start; j <= i; j++) {      if (j > 0) {       if (s[i] - s[j - 1] == maxsum) {        out.println((j + 1) + " " + (i + 1));        start = i + 1;        break;       }      } else {       if (s[i] == maxsum) {        out.println((j + 1) + " " + (i + 1));        start = i + 1;        break;       }      }     }    }    }   static class Pair {    int sum;    int last;   }  }  static class inputClass {   BufferedReader br;   StringTokenizer st;   public inputClass(InputStream in) {    br = new BufferedReader(new InputStreamReader(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());   }  } }
2	public class B {  final String filename = new String("B").toLowerCase();  int n; int r, c;  void solve() throws Exception {  n = nextInt();  r = nextInt() - 1;  c = nextInt() - 1;  long count = nextLong();  long left = -1, right = n * 2L;  while (left < right - 1) {  long mid = (left + right) / 2;   if (getSq(n, r, c, mid) >= count) {   right = mid;  } else {   left = mid;  }  }      out.println(right); }  long getSq(int n, int x, int y, long size) {  long cur = (size + 1) * (size + 1) + size * size;   cur -= get(x + size - (n - 1));  cur -= get(y + size - (n - 1));  cur -= get(-(x - size));  cur -= get(-(y - size));   cur += getCorner((x + 1) + (y + 1) - (size + 1));  cur += getCorner((x + 1) + (n - y) - (size + 1));  cur += getCorner((n - x) + (y + 1) - (size + 1));  cur += getCorner((n - x) + (n - y) - (size + 1));   return cur; }  private long getCorner(long min) {  if (min >= 0) {  return 0;  }  min = -min;  return min * (min + 1) / 2; }  long get(long a) {  if (a <= 0) {  return 0;  }  return a * a; }  void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);       solve();   out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  BufferedReader in; StringTokenizer st; PrintWriter out;  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()); }  long nextLong() throws Exception {  return Long.parseLong(nextToken()); }  double nextDouble() throws Exception {  return Double.parseDouble(nextToken()); }  public static void main(String[] args) {  new B().run(); } }
4	public class Prob023A {  public static void main( String[] Args )  {   Scanner scan = new Scanner( System.in );   String s = scan.next();   all: for ( int x = s.length() - 1; x >= 0; x-- )    for ( int y = 0; x + y <= s.length(); y++ )    {     String sub = s.substring( y, y + x );     if ( s.indexOf( sub, y + 1 ) >= 0 )     {      System.out.println( x );      break all;     }    }  } }
1	public class ChainReaction {  public static void main(String [] args) {  Scanner kb = new Scanner(System.in);  int num = kb.nextInt();   int[] beacons = new int[1000002];  for (int i=0; i<num; i++) {  beacons[kb.nextInt()] = kb.nextInt();  }   int [] dp = new int[1000002];  int max = 0;  if (beacons[0] != 0)  dp[0] = 1;   for (int i=1; i<dp.length; i++) {  if (beacons[i] == 0) {   dp[i] = dp[i-1];  } else {   int index = i-1-beacons[i];   if (index<0)   dp[i] = 1;   else   dp[i] = 1 + dp[index];  }  max = Math.max(max, dp[i]);      }   System.out.println(num-max); } }
5	public class Main {  public static void main(String[] argv) {  new Main().run(); }  void run() {  in = new Scanner(System.in);  out = new PrintWriter(System.out);  try {  solve();  } finally {  out.close();  } }  PrintWriter out; Scanner in;  class Pair {  int x;  int y;  Pair(int x, int y) {  this.x = x;  this.y = y;  }  @Override  public String toString() {  return x + " " + y;  } }  int[] readArr(int size) {  int[] a = new int[size];  for (int i = 0; i < size; i++) {  a[i] = in.nextInt();  }  return a; }  void solve() {  int n = in.nextInt();  int k = in.nextInt();  Pair[] a = new Pair[n];  for (int i = 0; i < n; i++) {  a[i] = new Pair(in.nextInt(), in.nextInt());  }  Arrays.sort(a, new Comparator<Pair>() {   @Override  public int compare(Pair p1, Pair p2) {   if (p2.x != p1.x) {   return p2.x - p1.x;   }   return p1.y - p2.y;  }  });  int cnt = 1;  int ans = 0;  int[] res = new int[n];  res[0] = 1;  for (int i = 1; i < n; i++) {  if (!(a[i].x == a[i - 1].x && a[i].y == a[i - 1].y)) {   cnt++;  }  res[i] = cnt;    }  int el = res[k - 1];  for (int i = 0; i < n; i++) {  if (res[i] == el) {   ans++;  }  }  out.println(ans);  } }
2	public class B {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   long n = sc.nextLong();   long k = sc.nextLong();   if (n == 1) {    System.out.println(0);   } else if (n <= k) {    System.out.println(1);   } else {    n--;    k--;    BigInteger K = BigInteger.valueOf(k);    BigInteger N = BigInteger.valueOf(n);    BigInteger high = BigInteger.valueOf(k + 1);    BigInteger low = BigInteger.valueOf(1);    BigInteger mid;    while (low.compareTo(high) < 0) {     mid = low.add(high.subtract(low).shiftRight(1));     BigInteger elemCnt = K.subtract(mid).add(BigInteger.ONE);     BigInteger sum = elemCnt.multiply(       mid.shiftLeft(1).add(elemCnt.subtract(BigInteger.ONE)))       .shiftRight(1);     if (sum.compareTo(N) > 0) {      low = mid.add(BigInteger.valueOf(1));     } else {      high = mid;     }    }    BigInteger elemCnt = K.subtract(low).add(BigInteger.ONE);    BigInteger sum = elemCnt.multiply(      low.shiftLeft(1).add(elemCnt.subtract(BigInteger.ONE)))      .shiftRight(1);    BigInteger rem = N.subtract(sum);    if (rem.equals(BigInteger.ZERO)) {     System.out.println(elemCnt);    } else if (rem.compareTo(low) < 0) {     System.out.println(elemCnt.add(BigInteger.ONE));    } else {     System.out.println(-1);    }   }  } }
5	public class a { static long mod = 1000000007; static boolean[][] blacks; public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(new PrintStream(System.out));    int n = input.nextInt(), t = input.nextInt(); int res = 2; Cottage[] data = new Cottage[n]; int[] xs = new int[n], as = new int[n]; for(int i = 0; i<n; i++) {  data[i] = new Cottage(input.nextInt(), input.nextInt()); } Arrays.sort(data); for(int i = 0; i<n; i++) {  xs[i] = data[i].x;  as[i] = data[i].a; } for(int i = 0; i<n-1; i++) {  if(2*(xs[i+1]-xs[i]) == 2*t+as[i]+as[i+1]) res++;  else if(2*(xs[i+1]-xs[i]) > 2*t+as[i]+as[i+1]) res+=2; } out.println(res);  out.close(); } static class Cottage implements Comparable<Cottage> {   int x, a; public Cottage(int xx, int aa) {  x = xx; a = aa; } @Override public int compareTo(Cottage o) {   return this.x - o.x; } } static long pow(long a, long p) { if(p==0) return 1; if((p&1) == 0) {  long sqrt = pow(a, p/2);  return (sqrt*sqrt)%mod; } else  return (a*pow(a,p-1))%mod; } static class input { static BufferedReader reader; static StringTokenizer tokenizer;   static void init(InputStream input) {  reader = new BufferedReader(      new InputStreamReader(input) );  tokenizer = new StringTokenizer(""); }   static String next() throws IOException {  while ( ! tokenizer.hasMoreTokens() ) {      tokenizer = new StringTokenizer(     reader.readLine() );  }  return tokenizer.nextToken(); }  static int nextInt() throws IOException {  return Integer.parseInt( next() ); } static long nextLong() throws IOException {  return Long.parseLong( next() ); }  static double nextDouble() throws IOException {  return Double.parseDouble( next() ); } static String nextLine() throws IOException {  return reader.readLine(); } } }
3	public class Solution {   public static void main(String[] args) {    Scanner s=new Scanner(System.in);  int n=s.nextInt();  char[] seq=new char[n];  for(int i=0;i<n;i++){  seq[i]=s.next().charAt(0);  }  long mod=(long)Math.pow(10,9)+7;  long[][] arr=new long[n][n];  arr[0][0]=1;  for(int i=1;i<n;i++){  if(seq[i-1]=='f'){   for(int j=1;j<n;j++){   arr[i][j]=arr[i-1][j-1];   }  }else{   long sum=0;   for(int j=n-1;j>=0;j--){   sum=(sum+arr[i-1][j])%mod;   arr[i][j]=sum;   }  }  }  long ans=0;  for(int i=0;i<n;i++){  ans=(ans+arr[n-1][i])%mod;  }  System.out.println(ans); } }
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;   } }
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); } }
3	public class Main {   public static void main(String[] args) {   Scanner scanner = new Scanner(System.in);   int n = scanner.nextInt();   int[] colors = new int[n];   for (int i = 0; i < n; i++) {    colors[i] = scanner.nextInt();   }   Arrays.sort(colors);   int amountOfColors = 0;   for (int i = 0; i < n; i++) {    if (colors[i] != 0){     amountOfColors++;     int color = colors[i];     for (int j = i; j < n; j++) {      if (colors[j] % color == 0){       colors[j] = 0;      }     }    }   }   System.out.println(amountOfColors);  } }
1	public class B { 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]);  int k = i(arr[1]);  int[] A = new int[n];  arr = in.readLine().split(" ");  for(int i=0; i<n; i++)  A[i] = i(arr[i]);   int st = 0;  int cnt = 0;  int[] cnts = new int[100*100*10+1];  for(int i=0; i<n; i++) {  cnts[A[i]]++;  if(cnts[A[i]] == 1) cnt++;  else while(cnts[A[st]] > 1) {   cnts[A[st]]--;   st++;  }  if(cnt == k) {   System.out.println((st+1)+" "+(i+1));   return;  }  }  System.out.println(-1+" "+-1); } }
1	public class q1 { public static void main(String[] args)  {  Scanner s=new Scanner(System.in);  int n=s.nextInt();  int[] arr1=new int[9];  int[] arr2=new int[9];  String ss;  s.nextLine();  for(int i=0;i<n;i++)  {  ss=s.nextLine();  if(ss.equals("M"))   arr1[0]++;  else if(ss.equals("S"))   arr1[1]++;  else if(ss.equals("L"))   arr1[2]++;  else if(ss.equals("XS"))   arr1[3]++;  else if(ss.equals("XL"))   arr1[4]++;  else if(ss.equals("XXS"))   arr1[5]++;  else if(ss.equals("XXL"))   arr1[6]++;  else if(ss.equals("XXXS"))   arr1[7]++;  else if(ss.equals("XXXL"))   arr1[8]++;  }  for(int i=0;i<n;i++)  {  ss=s.nextLine();  if(ss.equals("M"))   arr2[0]++;  else if(ss.equals("S"))   arr2[1]++;  else if(ss.equals("L"))   arr2[2]++;  else if(ss.equals("XS"))   arr2[3]++;  else if(ss.equals("XL"))   arr2[4]++;  else if(ss.equals("XXS"))   arr2[5]++;  else if(ss.equals("XXL"))   arr2[6]++;  else if(ss.equals("XXXS"))   arr2[7]++;  else if(ss.equals("XXXL"))   arr2[8]++;  }  int min;  for(int i=0;i<9;i++)  {  if(arr1[i]<arr2[i])   min=arr1[i];  else   min=arr2[i];  arr1[i]-=min;  arr2[i]-=min;  }  int sum=0;  for(int i=0;i<9;i++)  {  sum+=arr1[i];  }  System.out.println(sum);   } }
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);   rest :   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);  } }
1	public class A {  String fileName = "<name>";  public TreeSet<Integer> set = new TreeSet<>();  public int getLowerDist(int x) {   Integer higher = set.higher(x);   Integer lower = set.lower(x);   if (higher == null)    return lower;   if (lower == null)    return higher;   if (Math.abs(x - higher) < Math.abs(x - lower)) {    return higher;   } else {    return lower;   }  }  public void solve() throws IOException {   int n = nextInt();   int d = nextInt();   int[] a = new int[n];   Set<Integer> ans = new HashSet<>((int) 1e6, 1f);   for (int i = 0; i < n; i++) {    a[i] = nextInt();    set.add(a[i]);   }   for (int i = 0; i < n; i++) {    int pos1 = a[i] + d;    int pos2 = a[i] - d;    if (!set.contains(pos1) && Math.abs(pos1 - getLowerDist(pos1)) == d) {     ans.add(pos1);    }    if (!set.contains(pos2) && Math.abs(pos2 - getLowerDist(pos2)) == d) {     ans.add(pos2);    }   }   out.print(ans.size());  }  public void run() {   try {    br = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();    out.close();   } catch (IOException e) {    e.printStackTrace();    System.exit(1);   }  }  BufferedReader br;  StringTokenizer in;  PrintWriter 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());  }  public double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  public long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);   new A().run();  } }
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());   }   public long nextLong()   {    return Long.parseLong(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>  {   public int compare(card o1,card o2)   {    if(o1.l!=o2.l)     return (int)(o1.l-o2.l);    else     return (int)(o1.r-o2.r);   }  }  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);  }     static boolean valid(int i,int j,int n,int m)  {   if(i<n && i>=0 && j<m && j>=0)    return true;   else    return false;  }  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);  } }
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))); } }
6	public class Main implements Runnable { public static void main(String [] args) throws IOException {  new Thread(null, new Main(), "", 1 << 20).start(); }  String file = "input"; BufferedReader input; PrintWriter out;  public void run()  {  try  {    input = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new BufferedOutputStream(System.out));  solve();  input.close();  out.close();  }  catch(Exception e)  {  e.printStackTrace();  System.exit(1);  } } int[] x = new int[25]; int[] y = new int[25]; int[][] dist = new int[25][25]; int[] single = new int[25]; int[] c = new int[25]; int INF = 1 << 30; void solve() throws IOException {  StringTokenizer st = tokens();  x[0] = nextInt(st);  y[0] = nextInt(st);  int n = nextInt();  for(int i = 1; i <= n; i++)  {  st = tokens();  x[i] = nextInt(st);  y[i] = nextInt(st);  }  for(int i = 1; i <= n; i++)  single[i] = 2 * ((x[i] - x[0]) * (x[i] - x[0]) + (y[i] - y[0]) * (y[i] - y[0]));  for(int i = 1; i <= n; i++)  for(int j = 1; j <= n; j++)   dist[i][j] = single[i] / 2 + single[j] / 2 + (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);  int[] dp = new int[1 << n];  int[] prev = new int[1 << n];  fill(dp, INF);  dp[0] = 0;  for(int i = 1; i < 1 << n; i++)  {  for(int j = 0; j < n; j++)  {   if((i >> j & 1) != 0)   {   if(dp[i] > dp[i ^ (1 << j)] + single[j + 1])   {    dp[i] = dp[i ^ (1 << j)] + single[j + 1];    prev[i] = j + 1;   }     for(int k = j + 1; k < n; k++)    if((i >> k & 1) != 0)    {    if(dp[i] > dp[i ^ (1 << j) ^ (1 << k)] + dist[j + 1][k + 1])    {     dp[i] = dp[i ^ (1 << j) ^ (1 << k)] + dist[j + 1][k + 1];     prev[i] = (j + 1) * 100 + (k + 1);    }    }   break;   }  }  }  out.println(dp[(1 << n) - 1]);  out.print("0 ");  int mask = (1 << n) - 1;  while(mask > 0)  {  int s = prev[mask];  int x = s / 100;  int y = s % 100;  if(x == 0)  {   out.print(y + " " + 0 + " ");   mask -= 1 << (y - 1);  }  else  {   out.print(x + " " + y + " " + 0 + " ");   mask -= 1 << (y - 1);   mask -= 1 << (x - 1);  }  } }  StringTokenizer tokens() throws IOException {  return new StringTokenizer(input.readLine()); }  String next(StringTokenizer st) {  return st.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(input.readLine()); }  int nextInt(StringTokenizer st) {  return Integer.parseInt(st.nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(input.readLine()); }  double nextDouble(StringTokenizer st) {  return Double.parseDouble(st.nextToken()); }  void print(Object... o) {  out.println(deepToString(o)); } }
3	public class template { public static void main(String[] args) throws Exception {  FastScanner sc = new FastScanner();  PrintWriter pw = new PrintWriter(System.out);  int n = sc.nextInt();  Integer[] arr = new Integer[n];  for(int i=0;i<n;i++) {  arr[i]=sc.nextInt();  }  Arrays.sort(arr);  int ct = 0;  boolean[] ar = new boolean[n];  for(int i=0;i<n;i++) {  if(!ar[i]) {   ar[i]=true;   ct++;   int x = arr[i];   for(int j=0;j<n;j++) {   if(arr[j]%x==0) {    ar[j]=true;   }   }  }  }   pw.println(ct);  pw.close(); } } @SuppressWarnings("all") class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner(BufferedReader d) {   br=d;  }  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());  }   long nextLong() {   return Long.parseLong(nextToken());  }   double nextDouble() {   return Double.parseDouble(nextToken());  } }
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;  } 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 Fish();  } }
4	public class Def {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);  int t = s.nextInt();  while (t-->0) {    int n = s.nextInt();  int[] arr = new int[n];  for (int i=0; i<n; i++) {   arr[i] = s.nextInt();  }    List<Integer> al = new ArrayList<>();  al.add(1);  System.out.println(1);  for(int i=1; i<n;i++) {   int len = al.size();     if (arr[i] == 1) {   for(int j=0; j<len; j++) {    System.out.print(al.get(j)+".");   }   System.out.println(1);   al.add(1);   }else if (arr[i] == arr[i-1] && arr[i]==1) {      for(int j=0; j<len; j++) {    System.out.print(al.get(j)+".");   }   System.out.println(1);   al.add(1);   }else {   for (int j=len-1; j>-1; j--) {    if (al.get(j)+1 == arr[i]) {    for(int k=0; k<j; k++) {     System.out.print(al.get(k)+".");    }    System.out.println(arr[i]);    al.set(j, al.get(j)+1);    al.subList(j+1, len).clear();    break;    }   }   }  }    }  s.close();   } }
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))));   }    } }
0	public class Main {  Reader in = new Reader(System.in);  PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {   new Main().run();  }  int a, v;  int l, d, w;  void run() throws IOException {   a = in.nextInt();   v = in.nextInt();   l = in.nextInt();   d = in.nextInt();   w = in.nextInt();   double totalTime = 0.0;   if (v >= w) {    if (w*w >= 2*a*d) {     double x = Math.sqrt(2*a*d);     totalTime = x / a;     if ((v*v-x*x) >= 2*a*(l-d))      totalTime += (-2*x+Math.sqrt(4*x*x+8*a*(l-d))) / (2*a);     else      totalTime += (v-x)/(1.0*a) + (l-d-(v*v-x*x)/(2.0*a))/v;    } else {     if (2*v*v-w*w <= 2*a*d) {      totalTime = v / (1.0*a) + (v-w) / (1.0*a) + (d-(2*v*v-w*w)/(2.0*a)) / v;     } else {      double x = Math.sqrt((2*a*d+w*w)/2.0);      totalTime = x / a + (x-w) / a;     }     if ((v*v-w*w) >= 2*a*(l-d))      totalTime += (-2*w+Math.sqrt(4*w*w+8*a*(l-d))) / (2*a);     else      totalTime += (v-w)/(1.0*a) + (l-d-(v*v-w*w)/(2.0*a))/v;    }   } else {    if (v*v >= 2*a*l)     totalTime = Math.sqrt(l*2.0/a);    else     totalTime = v / (1.0*a) + (l-v*v/(2.0*a)) / v;   }   out.printf("%.10f", totalTime);   out.flush();  }  void solve() throws IOException {  }  static class Reader {   BufferedReader reader;   StringTokenizer tokenizer;   public Reader(InputStream input) {    reader = new BufferedReader(new InputStreamReader(input));    tokenizer = new StringTokenizer("");   }      String nextToken() throws IOException {    while ( ! tokenizer.hasMoreTokens() ) {         tokenizer = new StringTokenizer( reader.readLine() );    }    return tokenizer.nextToken();   }   String readLine() throws IOException {    return reader.readLine();   }   char nextChar() throws IOException {    return (char)reader.read();   }   int nextInt() throws IOException {    return Integer.parseInt( nextToken() );   }   long nextLong() throws IOException {    return Long.parseLong( nextToken() );   }   double nextDouble() throws IOException {    return Double.parseDouble( nextToken() );   }  } }
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());  }  }
1	public class A {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   while (s.hasNext()) {    int n = s.nextInt();    int[] a = new int[n];    int odd = 0;    int even = 0;    int po = -1;    int ev = -1;    for(int i=0;i<n;i++){     a[i] = s.nextInt();     if(a[i] % 2 == 0) {      even ++;      ev = i + 1;     } else {      odd++;      po = i + 1;     }    }    if(odd == 1) {     System.out.println(po);    }else{     System.out.println(ev);    }   }  } }
3	public class newProgram5 {  public static void main(String[] args) throws IOException {     FastIO in = new FastIO();   int n = in.ni();   int a[] = in.gia(n);   int freq[] = new int[100 + 1];   for (int i = 0; i < n; i++) {    freq[a[i]]++;   }   int k = 0;   for (int i = 1; i <= 100; i++) {    if (freq[i] > 0) {     for (int j = i; j <= 100; j += i) {      freq[j] = 0;     }     k++;        }   }   System.out.println(k);   in.bw.flush();  }  static class FastIO {   private final BufferedReader br;   private final BufferedWriter bw;   private String s[];   private int index;   private final StringBuilder sb;   public FastIO() throws IOException {    br = new BufferedReader(new InputStreamReader(System.in));    bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));    s = br.readLine().split(" ");    sb = new StringBuilder();    index = 0;   }   public int ni() throws IOException {    return Integer.parseInt(nextToken());   }   public double nd() throws IOException {    return Double.parseDouble(nextToken());   }   public long nl() throws IOException {    return Long.parseLong(nextToken());   }   public String next() throws IOException {    return nextToken();   }   public String nli() throws IOException {    try {     return br.readLine();    } catch (IOException ex) {    }    return null;   }   public int[] gia(int n) throws IOException {    int a[] = new int[n];    for (int i = 0; i < n; i++) {     a[i] = ni();    }    return a;   }   public int[] gia(int n, int start, int end) throws IOException {    validate(n, start, end);    int a[] = new int[n];    for (int i = start; i < end; i++) {     a[i] = ni();    }    return a;   }   public double[] gda(int n) throws IOException {    double a[] = new double[n];    for (int i = 0; i < n; i++) {     a[i] = nd();    }    return a;   }   public double[] gda(int n, int start, int end) throws IOException {    validate(n, start, end);    double a[] = new double[n];    for (int i = start; i < end; i++) {     a[i] = nd();    }    return a;   }   public long[] gla(int n) throws IOException {    long a[] = new long[n];    for (int i = 0; i < n; i++) {     a[i] = nl();    }    return a;   }   public long[] gla(int n, int start, int end) throws IOException {    validate(n, start, end);    long a[] = new long[n];    for (int i = start; i < end; i++) {     a[i] = nl();    }    return a;   }   public int[][][] gwtree(int n) throws IOException {    int m = n - 1;    int adja[][] = new int[n + 1][];    int weight[][] = new int[n + 1][];    int from[] = new int[m];    int to[] = new int[m];    int count[] = new int[n + 1];    int cost[] = new int[n + 1];    for (int i = 0; i < m; i++) {     from[i] = i + 1;     to[i] = ni();     cost[i] = ni();     count[from[i]]++;     count[to[i]]++;    }    for (int i = 0; i <= n; i++) {     adja[i] = new int[count[i]];     weight[i] = new int[count[i]];    }    for (int i = 0; i < m; i++) {     adja[from[i]][count[from[i]] - 1] = to[i];     adja[to[i]][count[to[i]] - 1] = from[i];     weight[from[i]][count[from[i]] - 1] = cost[i];     weight[to[i]][count[to[i]] - 1] = cost[i];     count[from[i]]--;     count[to[i]]--;    }    return new int[][][] { adja, weight };   }   public int[][][] gwg(int n, int m) throws IOException {    int adja[][] = new int[n + 1][];    int weight[][] = new int[n + 1][];    int from[] = new int[m];    int to[] = new int[m];    int count[] = new int[n + 1];    int cost[] = new int[n + 1];    for (int i = 0; i < m; i++) {     from[i] = ni();     to[i] = ni();     cost[i] = ni();     count[from[i]]++;     count[to[i]]++;    }    for (int i = 0; i <= n; i++) {     adja[i] = new int[count[i]];     weight[i] = new int[count[i]];    }    for (int i = 0; i < m; i++) {     adja[from[i]][count[from[i]] - 1] = to[i];     adja[to[i]][count[to[i]] - 1] = from[i];     weight[from[i]][count[from[i]] - 1] = cost[i];     weight[to[i]][count[to[i]] - 1] = cost[i];     count[from[i]]--;     count[to[i]]--;    }    return new int[][][] { adja, weight };   }   public int[][] gtree(int n) throws IOException {    int adja[][] = new int[n + 1][];    int from[] = new int[n - 1];    int to[] = new int[n - 1];    int count[] = new int[n + 1];    for (int i = 0; i < n - 1; i++) {     from[i] = i + 1;     to[i] = ni();     count[from[i]]++;     count[to[i]]++;    }    for (int i = 0; i <= n; i++) {     adja[i] = new int[count[i]];    }    for (int i = 0; i < n - 1; i++) {     adja[from[i]][--count[from[i]]] = to[i];     adja[to[i]][--count[to[i]]] = from[i];    }    return adja;   }   public int[][] gg(int n, int m) throws IOException {    int adja[][] = new int[n + 1][];    int from[] = new int[m];    int to[] = new int[m];    int count[] = new int[n + 1];    for (int i = 0; i < m; i++) {     from[i] = ni();     to[i] = ni();     count[from[i]]++;     count[to[i]]++;    }    for (int i = 0; i <= n; i++) {     adja[i] = new int[count[i]];    }    for (int i = 0; i < m; i++) {     adja[from[i]][--count[from[i]]] = to[i];     adja[to[i]][--count[to[i]]] = from[i];    }    return adja;   }   public void print(String s) throws IOException {    bw.write(s);   }   public void println(String s) throws IOException {    bw.write(s);    bw.newLine();   }   public void print(int s) throws IOException {    bw.write(s + "");   }   public void println(int s) throws IOException {    bw.write(s + "");    bw.newLine();   }   public void print(long s) throws IOException {    bw.write(s + "");   }   public void println(long s) throws IOException {    bw.write(s + "");    bw.newLine();   }   public void print(double s) throws IOException {    bw.write(s + "");   }   public void println(double s) throws IOException {    bw.write(s + "");    bw.newLine();   }   private String nextToken() throws IndexOutOfBoundsException, IOException {    if (index == s.length) {     s = br.readLine().split(" ");     index = 0;    }    return s[index++];   }   private void validate(int n, int start, int end) {    if (start < 0 || end >= n) {     throw new IllegalArgumentException();    }   }  }  static class Data implements Comparable<Data> {   int a, b;   public Data(int a, int b) {    this.a = a;    this.b = b;   }   @Override   public int compareTo(Data o) {    if (a == o.a) {     return Integer.compare(b, o.b);    }    return Integer.compare(a, o.a);   }   public static void sort(int a[]) {    Data d[] = new Data[a.length];    for (int i = 0; i < a.length; i++) {     d[i] = new Data(a[i], 0);    }    Arrays.sort(d);    for (int i = 0; i < a.length; i++) {     a[i] = d[i].a;    }   }  } }
3	public class C {  static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) {  int n = in.nextInt();  int[] sol = new int[n];  sol[0] = 1;  int mod = 1000000007;  int maxind = 0;  boolean f = true;  for (int i = 0; i < n; i++) {  if (!f) {     for (int j = 1; j <= maxind; j++) {   sol[j] += sol[j-1];   sol[j] %= mod;   }     }  if (in.next().equals("f")) {   maxind++;   f = true;  }  else {   f = false;  }  }  int ans = 0;  for (int i = 0; i <= maxind; i++) {  ans += sol[i];  ans %= mod;  }  out.println(ans);  finish(); }  public static void finish() {  out.close();  in.close();  System.exit(0); }  static class InputReader implements Iterator<String>, Closeable {     private BufferedReader r;  private String line;  private StringTokenizer st;  private String token;  public InputReader(InputStream i) {  r = new BufferedReader(new InputStreamReader(i));  }  public boolean hasNext() {  return peekToken() != null;  }  public int nextInt() {  return Integer.parseInt(nextToken());  }  public double nextDouble() {  return Double.parseDouble(nextToken());  }  public long nextLong() {  return Long.parseLong(nextToken());  }  public String next() {  return nextToken();  }   public String nextLine() {  try {   line = r.readLine();  } catch (IOException e) {   line = null;  }  token = null;  st = null;  return line;  }   public void close() {  try {   r.close();  } catch (IOException e) {  }  }  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;  }   } }
0	public class Solution {  public static void main(String[] args){   Scanner cin=new Scanner(System.in);   int n=cin.nextInt();   if(n%4==0 || n%7==0 || n%44==0 || n%47==0 || n%74==0 || n%77==0 || n%444==0 || n%447==0 || n%474==0 ||     n%477==0 || n%744==0 || n%747==0 || n%774==0 ||n%777==0) System.out.print("YES");   else System.out.print("NO");  } }
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()); } long nl() { return Long.parseLong(in.next()); } double nd() { return Double.parseDouble(in.next()); } boolean oj = System.getProperty("ONLINE_JUDGE") != null; void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
3	public class A {  public static void main(String[] args) throws Exception {  new A().run(); }  public void run() throws Exception {  FastIO file = new FastIO();  int n = file.nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) a[i] = file.nextInt();  Arrays.sort(a);  boolean[] used = new boolean[n];  int count = 0;  for (int i = 0; i < n; i++) {  if (!used[i]) {   count++;   for (int j = i; j < n; j++) {   if (a[j] % a[i] == 0) {    used[j] = true;   }   }  }  }  System.out.println(count); }  public static class FastIO {  BufferedReader br;  StringTokenizer st;  public FastIO() {  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());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  } }  public static long pow(long n, long p, long mod) {  if (p == 0)  return 1;  if (p == 1)  return n % mod;  if (p % 2 == 0) {  long temp = pow(n, p / 2, mod);  return (temp * temp) % mod;  } else {  long temp = pow(n, (p - 1) / 2, mod);  temp = (temp * temp) % mod;  return (temp * n) % mod;  } }  public static long pow(long n, long p) {  if (p == 0)  return 1;  if (p == 1)  return n;  if (p % 2 == 0) {  long temp = pow(n, p / 2);  return (temp * temp);  } else {  long temp = pow(n, (p - 1) / 2);  temp = (temp * temp);  return (temp * n);  } }  public static long gcd(long x, long y) {  if (x == 0)  return y;  else  return gcd(y % x, x); }  public static boolean isPrime(int n) {  if (n <= 1)  return false;  if (n <= 3)  return true;  if (n % 2 == 0 || n % 3 == 0)  return false;  for (int i = 5; i * i <= n; i = i + 6)  if (n % i == 0 || n % (i + 2) == 0)   return false;  return true; } }
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 GetMin(int[] ar) {    int min = Integer.MAX_VALUE;    for (int a : ar) {     min = Math.min(min, a);    }    return min;   }   static long GetSum(int[] ar) {    long s = 0;    for (int a : ar) s += a;    return s;   }   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;   }   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(), " \t\n\r\f,");      } catch (IOException e) {       throw new RuntimeException(e);      }     }     return tokenizer.nextToken();    }    int NextInt() {     return Integer.parseInt(Next());    }    long NextLong() {     return Long.parseLong(Next());    }    double NextDouble() {     return Double.parseDouble(Next());    }    int[] NextIntArray(int n) {     return NextIntArray(n, 0);    }    int[] NextIntArray(int n, int offset) {     int[] a = new int[n];     for (int i = 0; i < n; i++) {      a[i] = NextInt() - offset;     }     return a;    }    int[][] NextIntMatrix(int n, int m) {     return NextIntMatrix(n, m, 0);    }    int[][] NextIntMatrix(int n, int m, int offset) {     int[][] a = new int[n][m];     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       a[i][j] = NextInt() - offset;      }     }     return a;    }   }  } }
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);   Nas solver = new Nas();   solver.solve(1, in, out);   out.close();  }  static class Nas {   public void solve(int testNumber, FastReader in, PrintWriter out) {    long x = in.nextLong();    if (x == 0) {     out.println(0);     return;    }    BigInteger n1 = BigInteger.valueOf(x);    BigInteger n2 = BigInteger.valueOf(in.nextLong());    BigInteger mod = BigInteger.valueOf(1000000007);    BigInteger a = BigInteger.valueOf(2).modPow(n2.add(BigInteger.ONE), mod);    a = a.multiply(n1);    a = a.mod(mod);    BigInteger b = BigInteger.valueOf(2).modPow(n2, mod).subtract(BigInteger.ONE);    a = a.subtract(b);    a = a.add(mod);    a = a.mod(mod);    out.println(a);   }  }  static class FastReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private FastReader.SpaceCharFilter filter;   public FastReader(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() {    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 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<>();    inner: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());  } }   }
2	public class Solution {  long sum(long n){  long sm = 0;   while(n!=0){  sm+=(n%10);  n/=10;  }   return sm;   }  void solve() throws IOException{   long n = in.nextLong();  long s = in.nextLong();   long l = 0;  long h = n+1;  long ans = -1;   while(l<h){   long mid = (l + h)/2;     long sum = sum(mid);     if(mid - sum >= s){   ans = mid;   h = mid;   }   else   l = mid+1;             }      if(ans==-1)  out.println("0");  else  out.println(n+1-ans);                  }  class FastScanner{  BufferedReader br;  StringTokenizer st;   public FastScanner() {  br = new BufferedReader(new InputStreamReader(System.in));  st = new StringTokenizer("");  }   public int nextInt() throws IOException{   if(st.hasMoreTokens())   return Integer.parseInt(st.nextToken());  else{   st = new StringTokenizer(br.readLine());   return nextInt();  }   }   public long nextLong() throws IOException{   if(st.hasMoreTokens())   return Long.parseLong(st.nextToken());  else{   st = new StringTokenizer(br.readLine());   return nextLong();  }   }   public String readLine() throws IOException{  return br.readLine();  } }  FastScanner in = new FastScanner(); static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));    public static void main(String args[])throws IOException{  new Solution().solve();  out.close(); } }
1	public class Main {   public static void main(String[] args) {     var sc = new Scanner(System.in);   var pw = new PrintWriter(System.out);     int T = Integer.parseInt(sc.next());   for(int t = 0; t < T; t++){    int n = Integer.parseInt(sc.next());    boolean ok = false;    if(n%2 == 0){     int a = n/2;     int b = (int) Math.sqrt(a);     if(b*b == a){      ok = true;     }    }    if(n%4 == 0){     int a = n/4;     int b = (int) Math.sqrt(a);     if(b*b == a){      ok = true;     }    }    if(ok){     pw.println("YES");    }else{     pw.println("NO");    }   }   pw.flush();  } }
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<>();      }     }         boolean BellmanFord(boolean check){      d[0] = 0;      for(int i = 0; i < N - 1; i++){       for(int j = 0; j < N; j++){        for(Edge e : ja[j]){         if(e.flow == 0)continue;         d[e.u] = Math.min(d[e.u] , d[j] + e.cost);        }       }      }      if(check){       for(int j = 0; j < N; j++){        for(Edge e : ja[j]){         if(e.flow == 0)continue;         if(d[j] + e.cost < d[e.u]) return false;        }       }       }return true;     }     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 o;        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];       }      }     }     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.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());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }  } }
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 {  private static 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();  }  } }
6	public class CFContest {  public static void main(String[] args) throws Exception {   boolean local = System.getProperty("ONLINE_JUDGE") == 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) 1e9 + 2;   BitOperator bitOperator = new BitOperator();   Modular modular = new Modular((int) 1e9 + 7);   public Task(FastIO io, Debug debug) {    this.io = io;    this.debug = debug;   }   @Override   public void run() {    solve();   }   int[][][] f;   int n;   int t;   int[] songTimes;   int[] songTypes;   int mask;   public void solve() {    n = io.readInt();    t = io.readInt();    mask = 1 << n;    f = new int[4][mask][t + 1];    for (int i = 0; i < 4; i++) {     for (int j = 0; j < mask; j++) {      for (int k = 0; k <= t; k++) {       f[i][j][k] = -1;      }     }    }    songTimes = new int[n + 1];    songTypes = new int[n + 1];    for (int i = 1; i <= n; i++) {     songTimes[i] = io.readInt();     songTypes[i] = io.readInt();    }    int ans = 0;    for (int i = 0; i < 4; i++) {     for (int j = 0; j < mask; j++) {      ans = modular.plus(ans, f(i, j, t));     }    }    io.cache.append(ans);   }   int f(int i, int j, int k) {    if (j == 0) {     return k == 0 && i == 0 ? 1 : 0;    }    if (k < 0) {     return 0;    }    if (f[i][j][k] == -1) {     f[i][j][k] = 0;     for (int x = 1; x <= n; x++) {      if (songTypes[x] != i || bitOperator.bitAt(j, x - 1) == 0) {       continue;      }      for (int y = 0; y < 4; y++) {       if (y == i) {        continue;       }       f[i][j][k] = modular.plus(f[i][j][k], f(y, bitOperator.setBit(j, x - 1, false), k - songTimes[x]));      }     }    }    return f[i][j][k];   }  }    public static class Modular {   int m;   public Modular(int m) {    this.m = m;   }   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);   }   @Override   public String toString() {    return "mod " + m;   }  }  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 boolean subset(long x, long y) {    return intersect(x, y) == x;   }      public long merge(long x, long y) {    return x | y;   }   public long intersect(long x, long y) {    return x & y;   }   public long differ(long x, long y) {    return x - intersect(x, y);   }  }  public static class Randomized {   static Random random = new Random();   public static double nextDouble(double min, double max) {    return random.nextDouble() * (max - min) + min;   }   public static void randomizedArray(int[] data, int from, int to) {    to--;    for (int i = from; i <= to; i++) {     int s = nextInt(i, to);     int tmp = data[i];     data[i] = data[s];     data[s] = tmp;    }   }   public static void randomizedArray(long[] data, int from, int to) {    to--;    for (int i = from; i <= to; i++) {     int s = nextInt(i, to);     long tmp = data[i];     data[i] = data[s];     data[s] = tmp;    }   }   public static void randomizedArray(double[] data, int from, int to) {    to--;    for (int i = from; i <= to; i++) {     int s = nextInt(i, to);     double tmp = data[i];     data[i] = data[s];     data[s] = tmp;    }   }   public static void randomizedArray(float[] data, int from, int to) {    to--;    for (int i = from; i <= to; i++) {     int s = nextInt(i, to);     float tmp = data[i];     data[i] = data[s];     data[s] = tmp;    }   }   public static <T> void randomizedArray(T[] data, int from, int to) {    to--;    for (int i = from; i <= to; i++) {     int s = nextInt(i, to);     T tmp = data[i];     data[i] = data[s];     data[s] = tmp;    }   }   public static int nextInt(int l, int r) {    return random.nextInt(r - l + 1) + l;   }  }   public static class Splay implements Cloneable {   public static final Splay NIL = new Splay();   static {    NIL.left = NIL;    NIL.right = NIL;    NIL.father = NIL;    NIL.size = 0;    NIL.key = Integer.MIN_VALUE;    NIL.sum = 0;   }   Splay left = NIL;   Splay right = NIL;   Splay father = NIL;   int size = 1;   int key;   long sum;   public static void splay(Splay x) {    if (x == NIL) {     return;    }    Splay y, z;    while ((y = x.father) != NIL) {     if ((z = y.father) == NIL) {      y.pushDown();      x.pushDown();      if (x == y.left) {       zig(x);      } else {       zag(x);      }     } else {      z.pushDown();      y.pushDown();      x.pushDown();      if (x == y.left) {       if (y == z.left) {        zig(y);        zig(x);       } else {        zig(x);        zag(x);       }      } else {       if (y == z.left) {        zag(x);        zig(x);       } else {        zag(y);        zag(x);       }      }     }    }    x.pushDown();    x.pushUp();   }   public static void zig(Splay x) {    Splay y = x.father;    Splay z = y.father;    Splay b = x.right;    y.setLeft(b);    x.setRight(y);    z.changeChild(y, x);    y.pushUp();   }   public static void zag(Splay x) {    Splay y = x.father;    Splay z = y.father;    Splay b = x.left;    y.setRight(b);    x.setLeft(y);    z.changeChild(y, x);    y.pushUp();   }   public void setLeft(Splay x) {    left = x;    x.father = this;   }   public void setRight(Splay x) {    right = x;    x.father = this;   }   public void changeChild(Splay y, Splay x) {    if (left == y) {     setLeft(x);    } else {     setRight(x);    }   }   public void pushUp() {    if (this == NIL) {     return;    }    size = left.size + right.size + 1;    sum = left.sum + right.sum + key;   }   public void pushDown() {   }   public static int toArray(Splay root, int[] data, int offset) {    if (root == NIL) {     return offset;    }    offset = toArray(root.left, data, offset);    data[offset++] = root.key;    offset = toArray(root.right, data, offset);    return offset;   }   public static void toString(Splay root, StringBuilder builder) {    if (root == NIL) {     return;    }    root.pushDown();    toString(root.left, builder);    builder.append(root.key).append(',');    toString(root.right, builder);   }   public Splay clone() {    try {     return (Splay) super.clone();    } catch (CloneNotSupportedException e) {     throw new RuntimeException(e);    }   }   public static Splay cloneTree(Splay splay) {    if (splay == NIL) {     return NIL;    }    splay = splay.clone();    splay.left = cloneTree(splay.left);    splay.right = cloneTree(splay.right);    return splay;   }   public static Splay add(Splay root, Splay node) {    if (root == NIL) {     return node;    }    Splay p = root;    while (root != NIL) {     p = root;     root.pushDown();     if (root.key < node.key) {      root = root.right;     } else {      root = root.left;     }    }    if (p.key < node.key) {     p.setRight(node);    } else {     p.setLeft(node);    }    p.pushUp();    splay(node);    return node;   }      public static Splay selectMinAsRoot(Splay root) {    if (root == NIL) {     return root;    }    root.pushDown();    while (root.left != NIL) {     root = root.left;     root.pushDown();    }    splay(root);    return root;   }      public static Splay selectMaxAsRoot(Splay root) {    if (root == NIL) {     return root;    }    root.pushDown();    while (root.right != NIL) {     root = root.right;     root.pushDown();    }    splay(root);    return root;   }      public static Splay deleteRoot(Splay root) {    root.pushDown();    Splay left = splitLeft(root);    Splay right = splitRight(root);    return merge(left, right);   }      public static Splay splitLeft(Splay root) {    root.pushDown();    Splay left = root.left;    left.father = NIL;    root.setLeft(NIL);    root.pushUp();    return left;   }      public static Splay splitRight(Splay root) {    root.pushDown();    Splay right = root.right;    right.father = NIL;    root.setRight(NIL);    root.pushUp();    return right;   }    public static Splay merge(Splay a, Splay b) {    if (a == NIL) {     return b;    }    if (b == NIL) {     return a;    }    a = selectMaxAsRoot(a);    a.setRight(b);    a.pushUp();    return a;   }   public static Splay selectKthAsRoot(Splay root, int k) {    if (root == NIL) {     return NIL;    }    Splay trace = root;    Splay father = NIL;    while (trace != NIL) {     father = trace;     trace.pushDown();     if (trace.left.size >= k) {      trace = trace.left;     } else {      k -= trace.left.size + 1;      if (k == 0) {       break;      } else {       trace = trace.right;      }     }    }    splay(father);    return father;   }   public static Splay selectKeyAsRoot(Splay root, int k) {    if (root == NIL) {     return NIL;    }    Splay trace = root;    Splay father = NIL;    Splay find = NIL;    while (trace != NIL) {     father = trace;     trace.pushDown();     if (trace.key > k) {      trace = trace.left;     } else {      if (trace.key == k) {       find = trace;       trace = trace.left;      } else {       trace = trace.right;      }     }    }    splay(father);    if (find != NIL) {     splay(find);     return find;    }    return father;   }   public static Splay bruteForceMerge(Splay a, Splay b) {    if (a == NIL) {     return b;    } else if (b == NIL) {     return a;    }    if (a.size < b.size) {     Splay tmp = a;     a = b;     b = tmp;    }    a = selectMaxAsRoot(a);    int k = a.key;    while (b != NIL) {     b = selectMinAsRoot(b);     if (b.key >= k) {      break;     }     Splay kickedOut = b;     b = deleteRoot(b);     a = add(a, kickedOut);    }    return merge(a, b);   }   public static Splay[] split(Splay root, int key) {    if (root == NIL) {     return new Splay[]{NIL, NIL};    }    Splay p = root;    while (root != NIL) {     p = root;     root.pushDown();     if (root.key > key) {      root = root.left;     } else {      root = root.right;     }    }    splay(p);    if (p.key <= key) {     return new Splay[]{p, splitRight(p)};    } else {     return new Splay[]{splitLeft(p), p};    }   }   @Override   public String toString() {    StringBuilder builder = new StringBuilder().append(key).append(":");    toString(cloneTree(this), builder);    return builder.toString();   }  }  public static class FastIO {   public final StringBuilder cache = new StringBuilder();   private final InputStream is;   private final OutputStream os;   private final Charset charset;   private StringBuilder defaultStringBuf = new StringBuilder(1 << 8);   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 long readLong() {    int sign = 1;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+' ? 1 : -1;     next = read();    }    long 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 double readDouble() {    boolean sign = true;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+';     next = read();    }    long val = 0;    while (next >= '0' && next <= '9') {     val = val * 10 + next - '0';     next = read();    }    if (next != '.') {     return sign ? val : -val;    }    next = read();    long radix = 1;    long point = 0;    while (next >= '0' && next <= '9') {     point = point * 10 + next - '0';     radix = radix * 10;     next = read();    }    double result = val + (double) point / radix;    return sign ? result : -result;   }   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 readLine(char[] data, int offset) {    int originalOffset = offset;    while (next != -1 && next != '\n') {     data[offset++] = (char) next;     next = read();    }    return offset - originalOffset;   }   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 char readChar() {    skipBlank();    char c = (char) next;    next = read();    return c;   }   public void flush() {    try {     os.write(cache.toString().getBytes(charset));     os.flush();     cache.setLength(0);    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public boolean hasMore() {    skipBlank();    return next != -1;   }  }  public static class Debug {   private boolean allowDebug;   public Debug(boolean allowDebug) {    this.allowDebug = allowDebug;   }   public void assertTrue(boolean flag) {    if (!allowDebug) {     return;    }    if (!flag) {     fail();    }   }   public void fail() {    throw new RuntimeException();   }   public void assertFalse(boolean flag) {    if (!allowDebug) {     return;    }    if (flag) {     fail();    }   }   private void outputName(String name) {    System.out.print(name + " = ");   }   public void debug(String name, int x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, long x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, double x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, int[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, long[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, double[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, Object x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, Object... x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.deepToString(x));   }  } }
2	public class Main {  private static StringTokenizer st;  private static BufferedReader br;  public static long MOD = 1000000007;  public static void print(Object x) {   System.out.println(x + "");  }  public static String join(Collection<?> x, String space) {   if (x.size() == 0) return "";   StringBuilder sb = new StringBuilder();   boolean first = true;   for (Object elt : x) {    if (first) first = false;    else sb.append(space);    sb.append(elt);   }   return sb.toString();  }  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();  } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, InputReader in, PrintWriter out) {    long x = in.nextLong();    long k = in.nextLong();    long max2 = (((x % 1_000_000_007) * (pb(k))) % 1_000_000_007) % 1_000_000_007;    long min2 = ((((x - 1) % 1_000_000_007) * pb(k)) % 1_000_000_007 + 1) % 1_000_000_007;    if (x == 0) min2 = 0;    out.println((max2 + min2) % 1_000_000_007);   }   long pb(long a) {    if (a == 0) return 1;    if (a == 1) return 2;    long tmp = pb(a / 2);    if (a % 2 == 0) return (tmp * tmp) % 1_000_000_007;    return (((tmp * tmp) % 1_000_000_007) * 2) % 1_000_000_007;   }  }  static class InputReader {   private StringTokenizer tokenizer;   private BufferedReader reader;   public InputReader(InputStream inputStream) {    reader = new BufferedReader(new InputStreamReader(inputStream));   }   private void fillTokenizer() {    if (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (Exception e) {      throw new RuntimeException(e);     }    }   }   public String next() {    fillTokenizer();    return tokenizer.nextToken();   }   public long nextLong() {    return Long.parseLong(next());   }  } }
5	public class Main {  private static Parser in;  private static PrintWriter out;   public static void main(String[] args) {   in = new Parser(System.in);   out = new PrintWriter(System.out);     int n= in.nextInt();   int min = 101;   boolean b = false;   int pmin = 101;   int t= 0 ;   for(int i=0; i<n; i++){    t = in.nextInt();       if (t<min){if(min != pmin)b=true; if(b) pmin = min; min = t; continue;}    if (t>min && t<pmin){b=true; pmin = t; continue;}    if (t>min && !b){b=true; pmin = t; continue;}             }   if (b) System.out.println(pmin); else System.out.println("NO");    } }  class Parser {  final private int BUFFER_SIZE = 1 << 16;  private DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;   public Parser(InputStream in) {    din = new DataInputStream(in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;  }  public String nextString(int size) {   byte[] ch = new byte[size];   int point = 0;   try {    byte c = read();    while (c == ' ' || c == '\n' || c=='\r')     c = read();    while (c != ' ' && c != '\n' && c!='\r') {     ch[point++] = c;     c = read();    }   } catch (Exception e) {}   return new String(ch,0,point);   }  public int nextInt() {  int ret = 0;  boolean neg;  try {   byte c = read();   while (c <= ' ')    c = read();   neg = c == '-';   if (neg)    c = read();   do {    ret = ret * 10 + c - '0';    c = read();   } while (c > ' ');   if (neg) return -ret;  } catch (Exception e) {}  return ret;  }  public long nextLong() {   long ret = 0;   boolean neg;   try {    byte c = read();    while (c <= ' ')     c = read();    neg = c == '-';    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';     c = read();    } while (c > ' ');     if (neg) return -ret;   } catch (Exception e) {}   return ret;   }  private void fillBuffer() {   try {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);   } catch (Exception e) {}   if (bytesRead == -1) buffer[0] = -1;  }   private byte read() {   if (bufferPointer == bytesRead) fillBuffer();   return buffer[bufferPointer++];  } }
3	public class MyClass {  static class Pair implements Comparable<Pair>{   int x,y;   Pair(int x,int y){    this.x=x; this.y=y;   }   public int compareTo(Pair p){    return Integer.compare(this.y,p.y);   }  }  public static void main(String args[]) {  Scanner in =new Scanner(System.in);  HashMap<Long,ArrayList<Pair>> hm=new HashMap<Long,ArrayList<Pair>>();  int n=in.nextInt();  int a[]=new int[n];  long sum[]=new long[n];  long s=0;  for(int i=0;i<n;i++){ a[i]=in.nextInt(); s+=a[i]; sum[i]=s; }  for(int i=0;i<n;i++){   for(int j=i;j<n;j++){    long x=sum[j]-sum[i]+a[i];    ArrayList<Pair> temp=new ArrayList<Pair>();    if(hm.containsKey(x)) { temp=hm.get(x); }    temp.add(new Pair(i+1,j+1));    hm.put(x,temp);   }  }  ArrayList<Pair> ans=new ArrayList<Pair>();  for(Map.Entry em:hm.entrySet()){   ArrayList<Pair> array=hm.get(em.getKey());   Collections.sort(array);   int prev=0;   ArrayList<Pair> temp=new ArrayList<Pair>();   for(int i=0;i<array.size();i++){    if(array.get(i).x>prev){ temp.add(new Pair(array.get(i).x,array.get(i).y)); prev=array.get(i).y; }   }      if(temp.size()>ans.size()){    ans=(ArrayList<Pair>)temp.clone();   }  }  long g=-5;  System.out.println(ans.size());   for(int i=0;i<ans.size();i++){   System.out.println(ans.get(i).x+" "+ans.get(i).y);  }  } }
6	public class l {               static long mod = (int) (1e9 + 7);  static int n;  static StringBuilder sol;  static class pair implements Comparable<pair> {   int L,R;   public pair( int x,int y) {    L=x;R=y;   }    public int compareTo(pair o) {    if (L!=o.L)return L-o.L;    return o.R-R;   }   public String toString(){    return L+" "+R;   }  }  static boolean is;  static int [][][]memo;  static int[]val,gen;  static int dp(int last,int rem,int msk){   if (rem==0)return 1;   if (memo[last][rem][msk]!=-1)return memo[last][rem][msk];   int ans =0;   for (int i =0;i<n;i++){    if ((msk&1<<i)==0){     if (gen[i]!=last&&val[i]<=rem){      ans+=dp(gen[i],rem-val[i],msk|1<<i);      ans%=mod;     }    }   }   return memo[last][rem][msk]=ans;  }  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);     PrintWriter pw = new PrintWriter(System.out);   n = sc.nextInt();   int t = sc.nextInt();   gen= new int[n];   val= new int[n];   for (int i =0;i<n;i++){    val[i]=sc.nextInt();    gen[i]=sc.nextInt();   }   memo= new int[4][t+1][1<<n];   for (int[][]x:memo)for (int[]a:x)Arrays.fill(a,-1);   pw.println(dp(0,t,0));   pw.flush();  }  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() 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 String nextLine() throws IOException {    return br.readLine();   }   public double nextDouble() throws IOException {    String x = next();    StringBuilder sb = new StringBuilder("0");    double res = 0, f = 1;    boolean dec = false, neg = false;    int start = 0;    if (x.charAt(0) == '-') {     neg = true;     start++;    }    for (int i = start; i < x.length(); i++)     if (x.charAt(i) == '.') {      res = Long.parseLong(sb.toString());      sb = new StringBuilder("0");      dec = true;     } else {      sb.append(x.charAt(i));      if (dec)       f *= 10;     }    res += Long.parseLong(sb.toString()) / f;    return res * (neg ? -1 : 1);   }   public boolean ready() throws IOException {    return br.ready();   }  } }
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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
0	public class CodeForces {  public static void main(String[] args) throws IOException,NumberFormatException{  try {  FastScanner sc=new FastScanner();  int t=sc.nextInt();  while(t-->0) {   int a=sc.nextInt(),b=sc.nextInt();   int count=0;   while(a!=0&&b!=0) {   if(a>b) {    int temp=a;    a=b;    b=temp;   }    count+=(b/a);    b=b%a;   }   System.out.println(count);  }     }  catch(Exception e) {  return ;  }  }   public 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) {}  return st.nextToken();  }   int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }   } }
5	public class A2 { static Scanner in; static int next() throws Exception {return in.nextInt();};  static PrintWriter out;  public static void main(String[] args) throws Exception {  in = new Scanner(System.in);   out = new PrintWriter(System.out);   int n = next(), a = next(), b = next();   int h[] = new int[n];   for (int i = 0;i < n;i++) h[i] = next();   Arrays.sort(h);   int res = h[b] - h[b-1];   out.println(res);   out.println();  out.close(); } }
3	public class Main { long MOD = 1000000007; InputReader in; BufferedReader br; PrintWriter out;  public static void main(String[] args) throws java.lang.Exception {  Main solver = new Main();  solver.in = new InputReader(System.in);  solver.br = new BufferedReader(new InputStreamReader(System.in));  solver.out = new PrintWriter(System.out);  solver.solve();  solver.out.flush();  solver.out.close(); }  int[] A; int N;  public void solve() {  int tc = 1;  for (int cas = 1; cas <= tc; cas++) {  N = in.readInt();  A = new int[N];   for(int i =0;i<A.length;i++){   String str = in.readString();   if(str.equals("f"))   A[i] = 1;  }    long[][] dp = new long[N+1][N+1];    for(int i=0;i<N;i++){   if(i==0){   dp[i][0] = 1;   }   else if(A[i-1]!=1){   dp[i][N] = dp[i-1][N];   for(int j=N-1;j>=0;j--){       dp[i][j] = (dp[i-1][j] + dp[i][j+1])%MOD;   }   }   else{   for(int j=1;j<=N;j++){    dp[i][j] = dp[i-1][j-1]%MOD;   }   }  }    long res = 0;  for(int i=0;i<=N;i++){   res = (res + dp[N-1][i])%MOD;  }  out.println(res);  }  } } 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 void readInt(int[] A) {  for (int i = 0; i < A.length; i++)  A[i] = readInt(); }  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 void readLong(long[] A) {  for (int i = 0; i < A.length; i++)  A[i] = readLong(); }  public double readDouble() {  int c = read();  while (isSpaceChar(c))  c = read();  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.') {  if (c == 'e' || c == 'E')   return res * Math.pow(10, readInt());  if (c < '0' || c > '9')   throw new InputMismatchException();  res *= 10;  res += c - '0';  c = read();  }  if (c == '.') {  c = read();  double m = 1;  while (!isSpaceChar(c)) {   if (c == 'e' || c == 'E')   return res * Math.pow(10, readInt());   if (c < '0' || c > '9')   throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();  }  }  return res * sgn; }  public char[] readCharA() {  return readString().toCharArray(); }  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 test{              public static void main(String[] args) throws Exception, IOException{     Reader sc = new Reader(System.in);   int n=sc.nextInt(),m=sc.nextInt(),a[]=new int[n];  int b[]=new int[100000+1], r=n+1; for(int i=0;i<n;i++)a[i]=sc.nextInt();    int s=0,t=-1, sum=0;  int as=0,at=0; for(;;){  while(t<n-1 && sum<m){  t++;  if( b[ a[t] ]<1 ){sum++; }   b[a[t]]++; }  db(s,t,sum);  if( sum<m )break;  as=s;at=t;  r=min(r,t-s+1);  if( b[ a[s] ]==1 ){sum--; }   b[a[s]]--;  s++; }  if( n<r )System.out.println("-1 -1"); else System.out.println(as+1+" "+(at+1)); } static void db(Object... os){  System.err.println(Arrays.deepToString(os)); } }  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()); } public long nextLong() throws IOException {  return Long.parseLong(nextString()); } public double nextDouble() throws IOException {  return Double.parseDouble(nextString()); } }
1	public class Array {  void run() {   try {    BufferedReader bfd = new BufferedReader(new InputStreamReader(      System.in));    StringTokenizer tk = new StringTokenizer(bfd.readLine());    int n = Integer.parseInt(tk.nextToken());    int k = Integer.parseInt(tk.nextToken()), i;    int arr[] = new int[n];    tk = new StringTokenizer(bfd.readLine());    for(i=0;i<n;++i)     arr[i] = Integer.parseInt(tk.nextToken());    int dist=0,l=0,r=0;    HashSet<Integer> hs = new HashSet<Integer>();    for(i=0; i<n; ++i) {     if(!hs.contains(arr[i])){      hs.add(arr[i]);      dist++;     }     if(dist==k) break;     r++;    }    int freq[] = new int[100010];    if(hs.size()<k) System.out.println("-1 -1");    else {     while(l<arr.length-1 && l<r && arr[l]==arr[l+1])      ++l;     while(r>=1 && r>l && arr[r]==arr[r-1])      --r;     for(i=l;i<=r;++i)      freq[arr[i]]++;     while(freq[arr[l]]>1){      freq[arr[l]]--;      l++;     }     while(freq[arr[r]]>1){      freq[arr[r]]--;      r--;     }     System.out.println((l+1)+" " +(r+1));    }   } catch (Exception e) {   }  }  public static void main(String[] args) {   new Array().run();  } }
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 char nextChar() {  return next().charAt(0);  }    public int nextInt() {  return Integer.parseInt(next());  }   public long nextLong() {  return Long.parseLong(next());  }   public double nextDouble() {  return Double.parseDouble(next());  }   public String nextLine() {  line = null;  return readLine();  }   public String [] nextStrings() {  line = null;  return readLine().split(" ");  }   public char [] nextChars() {  return next().toCharArray();  }  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 cprint(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); }  void NO() {  throw new Error("NO!"); }    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(); } }
1	public class B {  public static void main(String[] args) throws Exception  {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   int i,N;   int T=Integer.parseInt(br.readLine().trim());   StringBuilder sb=new StringBuilder();   while (T-->0)   {    N=Integer.parseInt(br.readLine().trim());    boolean flag=false;    int sqrt=(int) Math.sqrt(N/2);    if(sqrt*sqrt==N/2&&N%2==0) flag = true;    sqrt=(int) Math.sqrt(N/4);    if(sqrt*sqrt==N/4&&N%4==0) flag = true;    sb.append(flag?"YES\n":"NO\n");   }   System.out.println(sb);  } }
0	public class a {  public static long mod = (long) Math.pow(10, 9) + 7;  private static class node implements Comparable<node> {  int x;  int y;  node(int x, int c) {  this.x = x;  this.y = c;  }  @Override  public int compareTo(node o) {  if (o.x < x)   return 1;  else if (o.x > x)   return -1;  else if (o.y < y)   return 1;  else if (o.y > y)   return -1;  else   return 0;  }  }  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) throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringBuilder qq = new StringBuilder();  PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));    String y[] = in.readLine().split(" ");  long n = Long.parseLong(y[0]);  long m = Long.parseLong(y[1]);  if (m - n < 2) {  System.out.println(-1);  } else if (m - n == 2) {   if (gcd(n, m) != 1)   System.out.println(n + " " + (n + 1) + " " + (n + 2));   else   System.out.println(-1);  } else {  if (n % 2 == 0)   System.out.println(n + " " + (n + 1) + " " + (n + 2));  else   System.out.println((n + 1) + " " + (n + 2) + " " + (n + 3));  }  out.close();  } }
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 String nextLine();  public int nextInt();  public long nextLong();  public double nextDouble(); } static class StdIn implements Input {  final private 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 String nextLine() {  int c;  while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));  StringBuilder s = new StringBuilder();  while (c != -1)  {   if (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 int[] readIntArray(int n) {  int[] ar = new int[n];  for(int i=0; i<n; ++i)   ar[i]=nextInt();  return ar;  }  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;  }  public long[] readLongArray(int n) {  long[] ar = new long[n];  for(int i=0; i<n; ++i)   ar[i]=nextLong();  return ar;  }  public double nextDouble() {  double ret = 0, div = 1;  byte c = read();  while (c <= ' ')   c = read();  boolean neg = (c == '-');  if (neg)   c = read();  do   ret = ret * 10 + c - '0';  while ((c = read()) >= '0' && c <= '9');  if (c == '.')   while ((c = read()) >= '0' && c <= '9')   ret += (c - '0') / (div *= 10);  if (neg)   return -ret;  return ret;  }  private void fillBuffer() throws IOException {  bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);  if (bytesRead == -1)   buffer[0] = -1;  }  private byte read() {  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();  } } }
0	public class Contest200C {  public static void main(String[] args) throws Exception {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(in.readLine());  long a = Long.parseLong(st.nextToken());  long b = Long.parseLong(st.nextToken());   System.out.println(min(a,b)); }  static long min(long a, long b) {  if (a <= 0 || b <= 0) return 0;  return a/b+min(b,a%b); } }
5	public class TaskA { BufferedReader br; PrintWriter out; StringTokenizer stok;  String nextToken() throws IOException {  while (stok == null || !stok.hasMoreTokens()) {  String s = br.readLine();  if (s == null) {   return "-1";  }  stok = new StringTokenizer(s);  }  return stok.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  char nextChar() throws IOException {  return (char) (br.read()); }  String nextLine() throws IOException {  return br.readLine(); }  void solve() throws IOException {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  Arrays.sort(a);  a[n - 1] = a[n - 1] == 1 ? 2 : 1;  Arrays.sort(a);  for (int i = 0; i < n; i++) {  out.print(a[i]);  out.print(' ');  } }  void run() throws IOException {        br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  br.close();  out.close(); }  public static void main(String[] args) throws IOException {   new TaskA().run(); } }
4	public class Main{ public static void main( String[] args ){  Scanner cin = new Scanner( System.in );  String s = cin.next();  int n = s.length();  char[] ss = new char[ n ];  ss = s.toCharArray();   int ans = 0;   for (int i=0; i<n; i++)  for (int j=i+1; j<n; j++){   int k = 0;   while ( i+k<n && j+k<n && ss[i+k] == ss[j+k] ) k++;     ans = Math.max( ans, k );  }   System.out.println( ans ); } }
0	public class HelloWorld {  InputReader input;  PrintWriter output;  BufferedReader inp;  void run(){   output = new PrintWriter(new OutputStreamWriter(System.out));   input = new InputReader(System.in);   inp = new BufferedReader(new InputStreamReader(System.in));   solve();   output.flush();  }  public static void main(String[] args){   new HelloWorld().run();  }   long stps;   long gcd(long a, long b) {   if(b == 0 || a == 0) {    return 0;   }   return a/b + gcd(b, a%b);  }   void solve() {   long a = input.readLong();   long b = input.readLong();   stps = gcd(a, b);   output.println(stps);  }      class node implements Comparable<node>{   int destination;   int direction;   int distance;     public node(int destination, int distance, int direction) {    this.direction = direction;    this.distance = distance;    this.destination = destination;   }     public int compareTo(node b) {    return this.distance - b.distance;   }  }   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 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();    StringBuffer res = new StringBuffer();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   public Long readLong() {    return Long.parseLong(readString());   }   public Double readDouble() {    return Double.parseDouble(readString());   }   public boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  }  }
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))]);  } }
3	public class A{ InputStream is; PrintWriter out; String INPUT = "";  public void solve(){  int n=ni();  int ans=0;  int[] arr=na(n);  for(int i=0;i<n;i++){  for(int j=i+1; j<n; j++){   if(arr[i] > arr[j]){   ans^=1;   }  }  }  int m=ni();  while(m-->0){  int a=ni(), b=ni();  int diff=Math.abs(a-b)+1;  ans = ans ^ ((((diff-1)*diff)/2)%2);  out.println(ans==0 ? "even" : "odd");  } }  void print(int n, long[][] memo){  for(int i=0;i<n;i++){  for(int j=0;j<n;j++){   out.print(memo[i][j]+" ");  }  out.println();  } }  void run(){  is = new DataInputStream(System.in);  out = new PrintWriter(System.out);  int t=1;while(t-->0)solve();  out.flush(); } 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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); } private String ns(){  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); } private char[] ns(int n){  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); } private char[][] nm(int n, int m){  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; } private int[] na(int n){  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; } private int ni(){  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } } private long nl(){  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } } static int i(long x){return (int)Math.round(x);} static class Pair implements Comparable<Pair>{  long fs,sc;  Pair(long a,long b){  fs=a;sc=b;  }  public int compareTo(Pair p){  if(this.fs>p.fs)return 1;  else if(this.fs<p.fs)return -1;  else{   return i(this.sc-p.sc);  }    }  public String toString(){  return "("+fs+","+sc+")";  }  }  }
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());  }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    try {     return reader.readLine();        } catch (IOException e) {    }    return null;   }  } }
1	public class primes { public static void main(String [] args){ ArrayList<Integer> numb=new ArrayList<Integer>(); Scanner br1 = new Scanner(System.in); int n=br1.nextInt(); int steps=br1.nextInt(); if(n>=3)numb.add(3); for(int j=4;j<=n;j++){ if(chekprime(j)==0){ numb.add(j); } } int counter =0; for(int give=0;give<numb.size();give++) {if("YES".equals(sumup(numb, 2, numb.get(give)))){ counter++;  }  }  if(counter>=steps)System.out.println("YES"); else System.out.println("NO");  } public static String sumup(ArrayList<Integer> list,int number,int NUM){ String ret="NO";  ArrayList<Integer> result=new ArrayList<Integer>(); ArrayList<Integer>[] arList=new ArrayList[number]; for(int i=0;i<number;i++){ arList[i]=new ArrayList<Integer>(); arList[i]=(ArrayList<Integer>)list.clone(); for(int k=0;k<i;k++){ arList[i].add(0,arList[i].remove(arList[i].size()-1)); } }   int [] temp=new int[list.size()];  for(int z=0;z<list.size();z++){  for(int count=0;count<number;count++){   temp[z]+=arList[count].get(z);  } result.add(temp[z]); } if(result.contains(NUM-1)) {  ret="YES"; } return ret; }  public static int chekprime(int n){ int flag=0; for(int i=2;i<=Math.sqrt(n)+1;i++) { if(n%i==0){ flag=1; break; } }  return flag; } }
5	public class div168C { public static void main(String[] args) throws Exception{    div168C a=new div168C();   Parserdoubt pd=a.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);   }  class Parserdoubt {  final private 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 char nextChar() throws Exception  {   byte c=read();   while(c<=' ') c= read();   return (char)c;  }  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++];  } }     }
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 testloop;    }    }   }   }  }  } }  public static void query(int x1, int x2, int y1, int y2) {  System.out.println("? " + x1 + " " + y1 + " " + x2 + " " + y2);  System.out.flush();     }  public static void set(int[] t, int i, int value) {  i += t.length / 2;  t[i] = value;  for (; i > 1; i >>= 1)  t[i >> 1] = Math.max(t[i], t[i ^ 1]); }   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; }  public static int[] generateDivisorTable(int n) {  int[] divisor = new int[n + 1];  for (int i = 1; i <= n; i++)  divisor[i] = i;  for (int i = 2; i * i <= n; i++)  if (divisor[i] == i)   for (int j = i * i; j <= n; j += i)   if (divisor[j] == j)    divisor[j] = i;  return divisor; }  public static long pow(long x, long n, long mod) {  long res = 1;  for (long p = x; n > 0; n >>= 1, p = (p * p) % mod) {  if ((n & 1) != 0) {   res = (res * p % mod);  }  }  return res; }  static long gcd(long n1, long n2) {  long r;  while (n2 != 0) {  r = n1 % n2;  n1 = n2;  n2 = r;  }  return n1; }  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 String nextLine() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isEndOfLine(c));  return res.toString();  }  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) {  int[] arr = new int[n];  for (int i = 0; i < n; i++) {   arr[i] = 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;  }  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;  } } }
4	public class Main {  static Scanner in = new Scanner(System.in);  public static  void main(String[] args)  {   String s = in.nextLine();   int k, ans = 0;   for(int i = 0; i < s.length(); i++)    for(int j = i + 1; j < s.length(); j++)    {     for(k = 0; j + k < s.length(); k++)     {      if(s.charAt(i + k) != s.charAt(j + k)) break;     }     if(ans < k) ans = k;    }   System.out.println(ans);  } }
5	public class p15a {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int t = in.nextInt();   if(n == 1) {    System.out.println(2);    return;   }   house[] all = new house[n];   for (int i = 0; i < all.length; i++) {    all[i] = new house(in.nextInt(),in.nextInt());   }   Arrays.sort(all);     int count = 0;   for (int i = 0; i < all.length; i++) {    double left = all[i].center - (all[i].side*1.0/2);    double right = all[i].center + (all[i].side*1.0/2);    if(i == 0) {     count++;     double left2 = all[i+1].center - (all[i+1].side*1.0/2);     if(right+t<left2) {      count++;     }     continue;        }    if(i == all.length-1) {     count++;     double right2 = all[i-1].center + (all[i-1].side*1.0/2);     if(left-t>= right2) {      count++;     }     continue;    }    double left2 = all[i+1].center - (all[i+1].side*1.0/2);    double right2 = all[i-1].center + (all[i-1].side*1.0/2);       if(right+t<left2) {     count++;    }    if(left-t>=right2)     count++;   }   System.out.println(count);    } } class house implements Comparable<house>{  int center;  int side;  public house(int a , int b) {   center = a;   side = b;  }  public int compareTo(house o) {   return center-o.center;  } }
1	public class Main {  FastScanner in;  PrintWriter out;  static final String FILE = "";  public void solve() {   int n = in.nextInt();   TreeMap<Character, Integer> map = new TreeMap<>();   ArrayList<Integer> list = new ArrayList<>();   String s = in.next();   for (int i = 0; i < n; i++) {    char ch = s.charAt(i);    if (!map.containsKey(ch))     map.put(ch, map.size());    list.add(map.get(ch));   }   int l = 0;   int ans = Integer.MAX_VALUE;   int nad = map.size();   int cnt[] = new int[n];   for (int i = 0; i < list.size(); i++) {    if (cnt[list.get(i)] == 0)     nad--;    cnt[list.get(i)]++;    if (nad == 0) {     ans = min(ans, i - l + 1);     while (true) {      if (cnt[list.get(l)] == 1) {       ans = min(ans, i - l + 1);       cnt[list.get(l)]--;       l++;       nad++;       break;      } else {       cnt[list.get(l)]--;       l++;      }     }    }   }   out.print(ans);  }  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 String nextLine() {    st = null;    try {     return br.readLine();    } catch (IOException e) {     e.printStackTrace();     return "";    }   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public float nextFloat() {    return Float.parseFloat(next());   }  }  class Pair<A extends Comparable<A>, B extends Comparable<B>>    implements Comparable<Pair<A, B>> {   public A a;   public B b;   public Pair(A a, B b) {    this.a = a;    this.b = b;   }   @Override   public int compareTo(Pair<A, B> o) {    if (o == null || o.getClass() != getClass())     return 1;    int cmp = a.compareTo(o.a);    if (cmp == 0)     return b.compareTo(o.b);    return cmp;   }   @Override   public boolean equals(Object o) {    if (this == o) return true;    if (o == null || getClass() != o.getClass()) return false;    Pair<?, ?> pair = (Pair<?, ?>) o;    if (a != null ? !a.equals(pair.a) : pair.a != null) return      false;    return !(b != null ? !b.equals(pair.b) : pair.b != null);   }  }  class PairInt extends Pair<Integer, Integer> {   public PairInt(Integer u, Integer v) {    super(u, v);   }  }  class PairLong extends Pair<Long, Long> {   public PairLong(Long u, Long v) {    super(u, v);   }  } }
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);   TaskF2 solver = new TaskF2();   solver.solve(1, in, out);   out.close();  }  static class TaskF2 {   public void solve(int testNumber, Scanner in, PrintWriter out) {    int n = in.nextInt();    int[] arr = new int[n];    for (int i = 0; i < n; i++) {     arr[i] = in.nextInt();    }    Map<Long, List<Pair>> map = new HashMap<>();    for (int r = 0; r < n; r++) {     long sum = 0;     for (int l = r; l >= 0; l--) {      sum += arr[l];      if (map.containsKey(sum)) {       map.get(sum).add(new Pair(l, r));      } else {       map.put(sum, new ArrayList<>());       map.get(sum).add(new Pair(l, r));      }     }    }    int ans = -1;    List<Pair> ansPairs = new ArrayList<>();    for (long sum : map.keySet()) {     List<Pair> pairs = map.get(sum);     int count = 0;     int idx = -1;     List<Pair> tempPairs = new ArrayList<>();     for (Pair pair : pairs) {      if (pair.i > idx) {       idx = pair.j;       tempPairs.add(pair);       count++;      }     }     if (ans < count) {      ans = count;      ansPairs = tempPairs;     }    }    out.println(ans);    for (Pair pair : ansPairs) {     out.print((pair.i + 1) + " " + (pair.j + 1));     out.println();    }   }   class Pair {    int i;    int j;    Pair(int p, int q) {     i = p;     j = q;    }   }  } }
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[] a = new int[n];   for(int i = 0; i < n; i++){    a[i] = ni();   }   long ans = 0;   for(int i = 0; i < n; i++){    for(int j = i+1; j < n; j++){     if(a[j]<a[i]) ans++;    }   }   if(ans%2==0) ans = 0;   else ans = 1;   int m = ni();   for(int i = 0; i < m; i++){    long s = nl();    long g = nl();    long sub = g-s;    long res = sub*(sub+1)/2;    if(res%2==1) ans = 1 - ans;    if(ans==0) out.println("even");    else out.println("odd");   }  }       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 double nd() { return Double.parseDouble(ns()); }  private char nc() { return (char)skip(); }   private String ns()  {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b) && b != ' ')){    sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }   private char[] ns(int n)  {   char[] buf = new char[n];   int b = skip(), p = 0;   while(p < n && !(isSpaceChar(b))){    buf[p++] = (char)b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }   private char[][] nm(int n, int m)  {   char[][] map = new char[n][];   for(int i = 0;i < n;i++)map[i] = ns(m);   return map;  }   private int[] na(int n)  {   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = ni();   return a;  }   private int ni()  {   int num = 0, b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }     while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }   private long nl()  {   long num = 0;   int b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }     while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }   private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }  }
4	public class D{  static void sort(int[] A){   int n = A.length;   Random rnd = new Random();   for(int i=0; i<n; ++i){    int tmp = A[i];    int randomPos = i + rnd.nextInt(n-i);    A[i] = A[randomPos];    A[randomPos] = tmp;   }   Arrays.sort(A);  }  public static void main(String args[])  {   Scanner sc=new Scanner(System.in);        {    int n = sc.nextInt();    int m=sc.nextInt();    int steps=sc.nextInt();    long arr[][][] = new long[n][m][5];    for(int j=0;j<n;j++)    {     for(int k=0;k<m-1;k++)     {      long num=sc.nextLong();      arr[j][k][1]=num;      arr[j][k+1][3]=num;     }    }    for(int j=0;j<n-1;j++)    {     for(int k=0;k<m;k++)     {      long num=sc.nextLong();      arr[j][k][2]=num;      arr[j+1][k][4]=num;     }    }    long temp[][]=new long[n][m];    long ans[][]=new long[n][m];    for(int i=0;i<steps/2;i++)    {     for(int j=0;j<n;j++)     {      for(int k=0;k<m;k++)      {       long min=Long.MAX_VALUE;       if(k>0)       {        long f=arr[j][k][3]+ans[j][k-1];        min=Math.min(min,f);       }       if(k<m-1)       {        long f=arr[j][k][1]+ans[j][k+1];        min=Math.min(min,f);       }       if(j>0)       {        long f=arr[j][k][4]+ans[j-1][k];        min=Math.min(min,f);       }       if(j<n-1)       {        long f=arr[j][k][2]+ans[j+1][k];        min=Math.min(min,f);       }       temp[j][k]=min;      }     }     for(int j=0;j<n;j++)     {      for(int k=0;k<m;k++)      {       ans[j][k]=temp[j][k];      }     }    }     StringBuilder p=new StringBuilder();    for(int j=0;j<n;j++)    {     for(int k=0;k<m;k++)     {      if(steps%2!=0)      {       p.append(-1+" ");      }      else      {      p.append(2*ans[j][k]+" ");}     }     p.append("\n");    }     System.out.println(p);   }  } }
0	public class A { public static void main(String[] args) {  System.out.println(new java.util.Scanner(System.in).nextInt() / 2 * 3); } }
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 double nextDouble() {    return Double.parseDouble(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));    }   }  } }
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;  } } }
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;  }    public void remove() {   throw new UnsupportedOperationException();  }   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;  }  } } }
4	public class C { public static void main(String[] args) throws Exception {  File in = new File("input.txt"), out = new File("output.txt");  Scanner s;  PrintWriter pw;  if (in.exists()) {  s = new Scanner(in);  pw = new PrintWriter(out);  } else {  s = new Scanner(System.in);  pw = new PrintWriter(System.out);  }  int n = s.nextInt(), m = s.nextInt();  int k = s.nextInt();  List<int[]> list = new ArrayList<int[]>();  for (int t = 0; t < k; ++t) {  list.add(new int[] { s.nextInt() - 1, s.nextInt() - 1 });  }  int max = 0, mi = 1, mj = 1;  for (int i = 0; i < n; ++i) {  for (int j = 0; j < m; ++j) {   int min = Integer.MAX_VALUE;   for (int[] p : list) {   min = Math.min(min, Math.abs(i - p[0]) + Math.abs(j - p[1]));   }   if (min > max) {   max = Math.max(max, min);   mi = i + 1;   mj = j + 1;   }  }  }  pw.println(mi + " " + mj);  pw.close(); } }
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);   APaintTheNumbers solver = new APaintTheNumbers();   solver.solve(1, in, out);   out.close();  }  static class APaintTheNumbers {   public void solve(int testNumber, FastReader s, PrintWriter w) {    int n = s.nextInt();    boolean[] b = new boolean[n];    int[] a = new int[n];    int ans = 0;    for (int i = 0; i < n; i++) {     a[i] = s.nextInt();    }    func.sort(a);    for (int i = 0; i < n; i++) {     if (!b[i]) {      ans++;      b[i] = true;      for (int j = i + 1; j < n; j++) {             if (a[j] % a[i] == 0) {        b[j] = true;       }      }     }    }    w.println(ans);   }  }  static class FastReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private FastReader.SpaceCharFilter filter;   public FastReader(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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  static class func {   public static void sort(int[] arr) {    int n = arr.length, mid, h, s, l, i, j, k;    int[] res = new int[n];    for (s = 1; s < n; s <<= 1) {     for (l = 0; l < n - 1; l += (s << 1)) {      h = Math.min(l + (s << 1) - 1, n - 1);      mid = Math.min(l + s - 1, n - 1);      i = l;      j = mid + 1;      k = l;      while (i <= mid && j <= h) res[k++] = (arr[i] <= arr[j] ? arr[i++] : arr[j++]);      while (i <= mid) res[k++] = arr[i++];      while (j <= h) res[k++] = arr[j++];      for (k = l; k <= h; k++) arr[k] = res[k];     }    }   }  } }
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 run() {   try {    in = new FastScanner(new File("CF.in"));    out = new PrintWriter(new File("CF.out"));    solve();    out.close();   } catch (FileNotFoundException e) {    e.printStackTrace();   }  }  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;   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }  }  public static void main(String[] args) {   new CF().runIO();  } }
4	public class A {  static { final Locale us = Locale.US; if (!Locale.getDefault().equals(us)) {  Locale.setDefault(us); }  }  static boolean file = false;  static Scanner in;  static { try {  in = new Scanner(file ? new FileInputStream("f:\\var\\tmp\\in.txt")   : System.in); } catch (final FileNotFoundException e) {  e.printStackTrace(); }  }  static PrintWriter out;  static { try {  out = file ? new PrintWriter(   new FileWriter("f:\\var\\tmp\\out.txt")) : new PrintWriter(   System.out); } catch (final IOException e) {  e.printStackTrace(); }  }    public static void main(final String[] args) { try {   solve();  if (file) {  System.out.flush();  }  if (!file) {  out.flush();  }  } finally {  in.close();  out.close(); }  }  private static void solve() { final String s = in.next();  int ans = 0; for (int l = 0; l < s.length(); ++l) {  for (int r = l; r < s.length(); ++r) {  for (int p = l + 1; p - l + r < s.length(); ++p) {   boolean ok = true;   for (int q = l, qq = p; q <= r; ++q, ++qq) {  if (s.charAt(q) != s.charAt(qq)) {   ok = false;  }   }   if (ok) {  ans = Math.max(ans, r - l + 1);   }  }  } }  out.println(ans);  } }
2	public class Problem2 implements Runnable {  public void run() {   Scanner scanner = new Scanner(System.in);   PrintWriter writer = new PrintWriter(System.out);   long n = scanner.nextLong();   long k = scanner.nextLong();   long count = 1;    if (n == 1) {    writer.println(0);    writer.close();    return;   }   if (k >= n) {    writer.println(1);    writer.close();    return;   }   long answer = 0;   while (k > 1) {    if (k > 2000) {     if (count + k <= n) {      if (count + (k - 1 + k - 1000) * 500 <= n) {       count += (k - 1 + k - 1000) * 500;       k -= 1000;       answer += 1000;      }     }    }    if ((count + k - 1) <= n) {      count += (k - 1);      answer++;    }    if (count + k - 100000000000000000l > n) {     k -= 99999999999999999l;    }    if (count + k - 10000000000000000l > n) {     k -= 9999999999999999l;    }    if (count + k - 1000000000000000l > n) {     k -= 999999999999999l;    }    if (count + k - 100000000000000l > n) {     k -= 99999999999999l;    }    if (count + k - 10000000000000l > n) {     k -= 9999999999999l;    }    if (count + k - 1000000000000l > n) {     k -= 999999999999l;    }    if (count + k - 100000000000l > n) {     k -= 99999999999l;    }    if (count + k - 10000000000l > n) {     k -= 9999999999l;    }    if (count + k - 1000000000l > n) {     k -= 999999999l;    }    if (count + k - 100000000l > n) {     k -= 99999999l;    }    if (count + k - 10000000l > n) {     k -= 9999999l;    }    if (count + k - 1000000l > n) {     k -= 999999l;    }    if (count + k - 100000l > n) {     k -= 99999l;    }    if (count + k - 10000l > n) {     k -= 9999l;    }    if (count + k - 1000l > n) {     k -= 999l;    }    if (count + k - 100l > n) {     k -= 99l;    }     if (n - count + 1 < k) {     k = n - count + 1;    } else {     k--;    }   }    if (count == n) {    writer.println(answer);   } else {    writer.println(-1);   }   writer.close();  }  public static void main(String[] args) {   new Problem2().run();  } }
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 nextLine() {    try {     return reader.readLine();    } catch (IOException e) {         e.printStackTrace();     return 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());   }  } }
4	public class C {  static int ar[]; static HashMap<String, ArrayList<String>> map; static int location = 0; static StringBuilder sb; static int N;  public static void main(String[] args) throws NumberFormatException, IOException {    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));  int t = Integer.parseInt(br.readLine());   while(t --> 0) {    int n = Integer.parseInt(br.readLine());  ar = new int[n];  location = 0;  map = new HashMap<String, ArrayList<String>>();  sb = new StringBuilder();  N = n;      for(int i = 0; i < n; i++) {     ar[i] = Integer.parseInt(br.readLine());     }    int idx = 2;  location = 1;    sb.append("1\n");    while(location < n) {     if(ar[location] == 1) {      nl((idx-1)+".");      }else {      sb.append(idx+"\n");   idx++;   location++;      }     }    System.out.println(sb);    }   }  public static void nl(String l) {   int idx = 1;     while(location < N) {      if(idx == ar[location]) {     sb.append(l + idx + "\n");   idx++;   location++;     }else if(ar[location] == 1) {     nl(l + (idx-1) + ".");     }else {     return;     }    }   } }
2	public class Main {  public static long power(long a, long b, long c){  if(b == 0){  return 1;  }  a %= c;  if(b % 2 == 0){  return power((a % c * a % c) % c, b / 2, c);  }else{  return (a % c * power((a % c * a % c) % c, b / 2, c) % c) % c;  } }  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  long x = s.nextLong(), k = s.nextLong() + 1, mod = (long)Math.pow(10, 9) + 7;  long ans;  if(x == 0){  System.out.println(0);  return;  }   ans = ((power(2, k % (mod - 1), mod) % mod) * (x % mod)) % mod;  ans = (ans - power(2, (k - 1) % (mod - 1), mod) % mod + 2 * mod) % mod;  System.out.println((ans + 1) % mod);  } }
1	public class SpreadSheet {  public void run() {  try {  Scanner s = new Scanner(System.in);  int tests = s.nextInt();  for (int i = 0; i < tests; i++) {   String line = s.next();   String regex = "R[\\d]+C[\\d]+";   Pattern pattern = Pattern.compile(regex);   Matcher matcher = pattern.matcher(line);     if (matcher.matches()){   int r = Integer.parseInt(line.substring(1, line.indexOf("C")));   int c = Integer.parseInt(line.substring(line.indexOf("C") +1));   System.out.println(toFormula(r, c));   }   else {   int index = -1;   for (int j = 0; j < line.length(); j++) {    if (line.charAt(j) >= '0' && line.charAt(j) <= '9') {    index = j;    break;    }   }   String c = line.substring(0, index);   int r = Integer.parseInt(line.substring(index));   System.out.println(fromFormula(c, r));   }  }  } catch (Exception e) {  e.printStackTrace();  } }  private String toFormula(int r, int c) {  StringBuffer buff = new StringBuffer();     char ch;     while (c != 0) {       int m = c%26;       if(m==0)       {         ch = 'Z';         c = c/26 - 1;       }       else       {         ch = (char)(m+'A'-1);         c /= 26;       }       buff.append(ch);           }     return buff.reverse().toString() + r;        }  private String fromFormula(String c, int r) {  int ret = 0;  int power = 1;  for (int i = c.length()-1; i >= 0; i--) {  ret += ((c.charAt(i) - 'A' + 1) * power);  power *= 26;  }  return "R" + r + "C" + ret; }  public static void main(String[] args) {  new SpreadSheet().run(); } }
1	public class Main {  public static void main(String[] args) {   Scanner scanner = new Scanner(System.in);   int n = scanner.nextInt();   int[] P = new int[n];   int[] check=new int[n];   for (int i = 1; i < n; i++) {    P[i] = scanner.nextInt();    P[i]--;    check[P[i]]++;   }   int[] leaves = new int[n];    for (int i=0;i<n;i++) {    if(check[i]==0){     leaves[P[i]]++;    }   }    for (int i = 0; i < n; i++) {    if (check[i]>0&&leaves[i]<3) {     System.out.println("No");     return;    }   }   System.out.println("Yes");  } }
5	public class Split {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n= sc.nextInt();  int k= sc.nextInt();  int a[] = new int[n];  int d[] = new int[n-1];  for(int i=0;i<n;i++) {  a[i] = sc.nextInt();  if(i>0)   d[i-1] = a[i-1] - a[i];  }  Arrays.sort(d);  int t = 0;  for(int i=0;i<k-1;i++)  t += d[i];  System.out.println(a[n-1]-a[0]+t); } }
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;   private static int pos;   private static int readLen;   private static final char[] buffer = new char[1024 * 8];   private static char[] str = new char[500 * 8 * 2];   private static boolean[] isDigit = new boolean[256];   private static boolean[] isSpace = new boolean[256];   private static boolean[] isLineSep = new boolean[256];   static {    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;   }   static class EndOfFileRuntimeException extends RuntimeException {   }  } }
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 void run() {   try {    solve();   } catch (Throwable e) {    System.err.println(e.getMessage());    e.printStackTrace();    System.exit(666);   } finally {    output.flush();    output.close();   }  }   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());  }  private long nextLong() throws IOException {   return Long.parseLong(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; }
6	public class LookingForOrder { static int[][] pos; static int[] dp; static int[] nextstate; static int[][] dist; static int r; static int v;  static void print(int mask) {  if (mask < v) {  int c = 0;  int x = mask ^ nextstate[mask];  for (int i = 0; i < dist.length - 1; i++) {   if((x & (1<<i))>0) {   System.out.print(i+1 + " ");   c++;   }  }  System.out.print("0 ");  print(nextstate[mask]);  } }  static int distace(int x1, int x2, int y1, int y2) {  return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); }  static int solve(int mask) {  if (mask == v) {  nextstate[mask] = r;   return 0;  }  if (nextstate[mask] != 0) {  return dp[mask];  }  dp[mask] = (int) 1e9;  for (int i = 1; i < pos.length; i++) {  int u = (1 << (i - 1));  int z = mask | u;  if ((mask & u) == 0) {   int x = 2 * dist[i][0] + solve(z);   if (dp[mask] > x) {   dp[mask] = x;   nextstate[mask] = z;   }   for (int j = 1; j < pos.length; j++) {   int m = (1 << j - 1);   int y = z | m;   if ((z & m) == 0) {    x = dist[i][0] + solve(y) + dist[i][j] + dist[j][0];    if (dp[mask] > x) {    dp[mask] = x;    nextstate[mask]= y;    }    }   }   break;  }  }  return dp[mask]; }  public static void main(String[] args) {  InputReader0 in = new InputReader0(System.in);  int x = in.nextInt(), y = in.nextInt();  int n = in.nextInt();  r = 1 << n;  v = r - 1;  dp = new int[r];  nextstate = new int[r];  pos = new int[n + 1][2];  pos[0][0] = x;  pos[0][1] = y;  for (int i = 1; i < pos.length; i++) {  pos[i][0] = in.nextInt();  pos[i][1] = in.nextInt();  }  dist = new int[n + 1][n + 1];  for (int i = 0; i < dist.length; i++) {  for (int j = i + 1; j < dist.length; j++) {   dist[i][j] = dist[j][i] = distace(pos[i][0], pos[j][0], pos[i][1], pos[j][1]);  }  }  System.out.println(solve(0));  System.out.print("0 ");  print(0); } } class InputReader0 { BufferedReader reader; StringTokenizer tokenizer;  public InputReader0(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()); }  public 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);   G1PlaylistForPolycarpEasyVersion solver = new G1PlaylistForPolycarpEasyVersion();   solver.solve(1, in, out);   out.close();  }  static class G1PlaylistForPolycarpEasyVersion {   final long mod = 1000000007;   PrintWriter out;   InputReader in;   int n;   int time;   int[][] arr;   long[][][] dp;   long go(int last, int t, int mask) {    if (t > time)     return 0;    if (t == time) {     return 1l;    }    if (mask == (1 << n) - 1)     return 0;    if (dp[last][t][mask] != -1)     return dp[last][t][mask];    long cnt = 0;    int i = 0, j = 0;    for (i = 0; i < n; i++) {     if ((mask & (1 << i)) == 0 && arr[i][1] != last) {      cnt += go(arr[i][1], t + arr[i][0], mask | (1 << i));      cnt %= mod;     }    }    dp[last][t][mask] = cnt;    return cnt;   }   public void solve(int testNumber, InputReader in, PrintWriter out) {    this.out = out;    this.in = in;    n = ni();    time = ni();    arr = new int[n][2];    int i = 0;    for (i = 0; i < n; i++) {     arr[i][0] = ni();     arr[i][1] = ni() - 1;    }    dp = new long[3][time + 1][1 << n];    for (i = 0; i < 3; i++) {     for (int j = 0; j <= time; j++)      Arrays.fill(dp[i][j], -1);    }    long ans = (((go(0, 0, 0) + go(1, 0, 0)) % mod + go(2, 0, 0)) % mod);    ans *= modPow(2, mod - 2);    ans %= mod;    pn(ans);   }   int ni() {    return in.nextInt();   }   void pn(Object o) {    out.println(o);   }   long modPow(long a, long p) {    long o = 1;    while (p > 0) {     if ((p & 1) == 1) o = mul(o, a);     a = mul(a, a);     p >>= 1;    }    return o;   }   long mul(long a, long b) {    if (a >= mod) a %= mod;    if (b >= mod) b %= mod;    a *= b;    if (a >= mod) a %= mod;    return a;   }  }  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;   }  } }
3	public class ProblemF {  private static boolean debug = false;  private static int N;  private static int[] A;  private static void solveProblem(InputStream instr) throws Exception {   InputReader sc = new InputReader(instr);   int testCount = 1;   if (debug) {    testCount = sc.nextInt();   }   for (int t = 1; t <= testCount; t++) {    printDebug("------ " + t + " ------");    N = sc.nextInt();    A = readInts(sc, N);    Object result = solveTestCase();    System.out.println(result);   }  }  private static Object solveTestCase() {   int sum[] = new int[N];   sum[0] = A[0];   for (int i = 1; i < N; i++) {    sum[i] = sum[i - 1] + A[i];   }   TreeMap<Integer, List<int[]>> map = new TreeMap<>();   for (int i = 0; i < N; i++) {    for (int j = i; j < N; j++) {     int groupSum = sum[j] - (i == 0 ? 0 : sum[i - 1]);     map.putIfAbsent(groupSum, new ArrayList<>());     map.get(groupSum).add(new int[]{i, j});    }   }   int max = -1;   List<int[]> maxAnswer = null;   for (Map.Entry<Integer, List<int[]>> entry : map.entrySet()) {    List<int[]> values = entry.getValue();    if (values.size() <= max) {     continue;    }    List<int[]> curr = findMax(values);    if (curr.size() > max) {     max = curr.size();     maxAnswer = curr;    }   }   List<String> answer = new ArrayList<>();   for (int[] value : maxAnswer) {    answer.add((value[0] + 1) + " " + (value[1] + 1));   }   return max + "\n" + joinValues(answer, "\n");  }  private static List<int[]> findMax(List<int[]> values) {   values.sort(new Comparator<int[]>() {    @Override    public int compare(int[] o1, int[] o2) {     return o1[1] - o2[1];    }   });   List<int[]> answer = new ArrayList<>();   int right = -1;   for (int i = 0; i < values.size(); i++) {    int[] value = values.get(i);    if (value[0] > right) {     answer.add(value);     right = value[1];    }   }   return answer;  }  private static int[] readInts(InputReader sc, int N) throws Exception {   int[] arr = new int[N];   for (int i = 0; i < N; i++) {    arr[i] = sc.nextInt();   }   return arr;  }  private static String joinValues(List<? extends Object> list, String delim) {   return list.stream().map(Object::toString).collect(Collectors.joining(delim));  }  private static String joinValues(int[] arr, String delim) {   List<Object> list = new ArrayList<>();   for (Object value : arr) {    list.add(value);   }   return list.stream().map(Object::toString).collect(Collectors.joining(delim));  }  public static void printDebug(Object str) {   if (debug) {    System.out.println("DEBUG: " + str);   }  }  private static final class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[1024];   private int curChar;   private int Chars;   public InputReader(InputStream stream) {    this.stream = stream;   }   private int read() throws Exception {    if (curChar >= Chars) {     curChar = 0;     Chars = stream.read(buf);     if (Chars <= 0)      return -1;    }    return buf[curChar++];   }   public final int nextInt() throws Exception {    return (int)nextLong();   }   public final long nextLong() throws Exception {    int c = read();    while (isSpaceChar(c)) {     c = read();     if (c == -1)      throw new IOException();    }    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 final int[] nextIntBrray(int size) throws Exception {    int[] arr = new int[size];    for (int i = 0; i < size; i++)     arr[i] = nextInt();    return arr;   }   public final String next() throws Exception {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.append((char)c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   public final String nextLine() throws Exception {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.append((char)c);     c = read();    } while (c != '\n' && c != -1);    return res.toString();   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  }  public static void main(String[] args) throws Exception {   long currTime = System.currentTimeMillis();   if (debug) {    solveProblem(new FileInputStream(new File("input.in")));    System.out.println("Time: " + (System.currentTimeMillis() - currTime));   } else {    solveProblem(System.in);   }  } }
2	public class Main {  static int inf = (int) 1e9;  public static void main(String[] args) throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));   pw = new PrintWriter(System.out);   int n = nextInt();   int k = nextInt();   long l = -1;   long r = 100000;   while(l != r - 1) {    long mid = (l + r) / 2;    if (mid * (mid + 1) / 2 - (n - mid) > k) r = mid;    else l = mid;   }   pw.println(n - l);   pw.close();  }  static BufferedReader br;  static StringTokenizer st = new StringTokenizer("");  static PrintWriter pw;  static String next() throws IOException {   while (!st.hasMoreTokens()) st = new StringTokenizer(br.readLine());   return st.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt(next());  }  static long nextLong() throws IOException {   return Long.parseLong(next());  }  static Double nextDouble() throws IOException {   return Double.parseDouble(next());  } }
0	public final class FollowTrafficRules {  private static double[] acce(double i, double a, double v) {   double[] r = new double[2];   r[0] = (v - i)/a;   r[1] = 1d/2d * a * pow(r[0], 2) + i * r[0];   return r;  }  private static double solve(double i, double a, double l) {   double e = sqrt(pow(i, 2) + 2d * a * l);   e = a > 0 ? e : -1d * e;   return (e - i)/a;  }  private static double time(double i, double a, double v, double l) {   double[] r = acce(i, a, v);   if (r[1] >= l) return solve(i, a, l);   return r[0] + (l - r[1])/v;  }  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   double a = sc.nextDouble();   double v = sc.nextDouble();   double l = sc.nextDouble();   double d = sc.nextDouble();   double w = sc.nextDouble();   double t = 0d;   double[] r = acce(0, a, w);   if (v <= w || r[1] >= d) t = time(0, a, v, l);   else {    t += r[0];    t += 2d * time(w, a, v, (d - r[1])/2d);    t += time(w, a, v, l - d);   }   System.out.println(t);  } }
1	public class ProblemB {  public static void main(String[] args) {   InputReader in = new InputReader(System.in);   PrintWriter out = new PrintWriter(System.out);   int n = in.nextInt();   long a = in.nextLong();   long b = in.nextLong();   long[] x = new long[n];   for (int i = 0; i < n; i++) {    x[i] = in.nextLong();   }   Map<Long,Integer> idxmap = new HashMap<>();   for (int i = 0; i < n; i++) {    idxmap.put(x[i], i);   }   if (a == b) {    solve1(x, a, idxmap, out);    return;   }   int[] mark = new int[n];   Arrays.fill(mark, -1);   boolean isok = true;   for (int i = 0 ; i < n ; i++) {    if (mark[i] != -1) {     continue;    }    long w = x[i];    long aw = a - w;    long bw = b - w;    if (idxmap.containsKey(aw) && idxmap.containsKey(bw)) {     continue;    } else if (idxmap.containsKey(bw)) {     long w1 = w;     long w2 = bw;     while (true) {      if (!idxmap.containsKey(w1) || !idxmap.containsKey(w2)) {       break;      }      int i1 = idxmap.get(w1);      int i2 = idxmap.get(w2);      if (mark[i1] == 0 || mark[i2] == 0) {       isok = false;      }      mark[i1] = 1;      mark[i2] = 1;      if (w1 + a - b == w2) {       break;      }      w1 += (a - b);      w2 += (b - a);     }    } else if (idxmap.containsKey(aw)){     long w1 = w;     long w2 = aw;     while (true) {      if (!idxmap.containsKey(w1) || !idxmap.containsKey(w2)) {       break;      }      int i1 = idxmap.get(w1);      int i2 = idxmap.get(w2);      if (mark[i1] == 1 || mark[i2] == 1) {       isok = false;      }      mark[i1] = 0;      mark[i2] = 0;      if (w1 + b - a == w2) {       break;      }      w1 += (b - a);      w2 += (a - b);     }    }   }   for (int i = 0 ; i < n ; i++) {    if (mark[i] == -1) {     isok = false;     break;    }   }   if (isok) {    printAnswer(mark, out);   } else {    out.println("NO");   }   out.flush();  }  private static void printAnswer(int[] mark, PrintWriter out) {   out.println("YES");   StringBuilder ln = new StringBuilder();   for (int m : mark) {    ln.append(' ').append(m);   }   out.println(ln.substring(1));  }  private static void solve1(long[] x, long a, Map<Long, Integer> idxmap, PrintWriter out) {   int[] mark = new int[x.length];   for (int i = 0 ; i < x.length ; i++) {    if (mark[i] == 1) {     continue;    }    long w = x[i];    long wp = a - w;    if (idxmap.containsKey(wp)) {     mark[i] = mark[idxmap.get(wp)] = 1;    }   }   boolean isok = true;   for (int i = 0 ; i < x.length ; i++) {    if (mark[i] == 0) {     isok = false;     break;    }   }   if (isok) {    printAnswer(mark, out);   } else {    out.println("NO");   }   out.flush();  }  public static void debug(Object... o) {   System.err.println(Arrays.deepToString(o));  }   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 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 long nextLong() {    int c = next();    while (isSpaceChar(c))     c = next();    long sgn = 1;    if (c == '-') {     sgn = -1;     c = next();    }    long 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) {    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);   }  } }
2	public class B {  private static long MOD=1000000007;  private static BigInteger m=new BigInteger(1000000007+"");   private static long pow(long x, long a)  {   if(a==0)   return 1;     long ans=pow(x,a/2);     ans=(ans*ans)%MOD;     if(a%2==1)   ans=(ans*x)%MOD;     return ans%MOD;  }  public static void main(String args[]) throws IOException  {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));     long N,K,ans;        String s[]=br.readLine().trim().split(" ");     N=Long.parseLong(s[0]);   K=Long.parseLong(s[1]);     BigInteger bi=new BigInteger(N+"");   BigInteger a=new BigInteger(N+"");   BigInteger two=new BigInteger(2+"");     if(N==0)   {    System.out.println(0);    System.exit(0);   }   if(K==0)   {    a=a.multiply(two);    a=a.mod(m);       System.out.println(a);    System.exit(0);   }     long p=pow(2,K);     BigInteger p2=new BigInteger(p+"");   BigInteger tmp=p2.subtract(BigInteger.ONE);   tmp=tmp.mod(m);     p2=p2.multiply(two);   p2=p2.mod(m);     a=a.multiply(p2);   a=a.mod(m);     a=a.subtract(tmp);   a=a.mod(m);     if(!(a.signum()==1)&&!(a.signum()==0))   a.add(m);     System.out.println(a);  } }
4	public class P023A {  public static void main(String[] args) {   Scanner inScanner = new Scanner(System.in);   String string = inScanner.next();   int n = string.length();   for (int l = n - 1; l > 0; l--) {    Set<String> seen = new HashSet<String>();    for (int i = 0; i < n - l + 1; i++) {     String subString = string.substring(i, i + l);     if (seen.contains(subString)) {      System.out.println(l);      return;     }     seen.add(subString);    }   }   System.out.println("0");  } }
3	public class Main {  static Scanner console; public static void main(String[] args) {  console = new Scanner(System.in);  int n = console.nextInt();  List<Integer> arr= new ArrayList<>();   for(int i = 0; i < n; i++) arr.add( console.nextInt());  Collections.sort(arr);  List<Integer> groups = new ArrayList<>();  for(int i = 0; i < arr.size() - 1; i++) {  int j = i+1;  groups.add(arr.get(i));   while(j < arr.size()) {   if(arr.get(j) % arr.get(i) == 0) {   arr.remove(j);      }   else {    j++;   }  }  }  System.out.println(arr.size()); } }
1	public final class round_364_c {  static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static FastScanner sc=new FastScanner(br);  static PrintWriter out=new PrintWriter(System.out);  public static void main(String args[]) throws Exception {  int n=sc.nextInt();char[] arr=sc.next().toCharArray();int[] sum=new int[123];int[][] pre=new int[123][n+1];  char[] a=new char[n+1];  for(int i=1;i<=n;i++)  {  a[i]=arr[i-1];  }  boolean[] v=new boolean[123];  for(int i=1;i<=n;i++)  {  sum[a[i]]++;v[a[i]]=true;  for(int j=65;j<=90;j++)  {   pre[j][i]=sum[j];  }  for(int j=97;j<=122;j++)  {   pre[j][i]=sum[j];  }  }  long min=Integer.MAX_VALUE;  for(int i=1;i<=n;i++)  {  int low=0,high=n-i+1;boolean got=false;  while(low<high)  {   int mid=(low+high)>>1;   boolean curr=true;   for(int j=65;j<=90;j++)   {   if(v[j])   {    if(pre[j][i+mid]-pre[j][i-1]<=0)    {    curr=false;    break;    }   }   }   for(int j=97;j<=122;j++)   {   if(v[j])   {    if(pre[j][i+mid]-pre[j][i-1]<=0)    {    curr=false;    break;    }   }   }   if(curr)   {   got=true;   high=mid;   }   else   {   low=mid+1;   }  }  if(got)  {   min=Math.min(min,(i+low)-i+1);  }  }  out.println(min);  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 String next() throws Exception {  return nextToken().toString(); }   public int nextInt() throws Exception {   return Integer.parseInt(nextToken());  }  public long nextLong() throws Exception {   return Long.parseLong(nextToken());  }  public double nextDouble() throws Exception {   return Double.parseDouble(nextToken());  } }
5	public class A15 {  static StreamTokenizer in; static PrintWriter out;  static int nextInt() throws IOException {  in.nextToken();  return (int)in.nval; }  static String nextString() throws IOException {  in.nextToken();  return in.sval; }  public static void main(String[] args) throws IOException {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(System.out);   int n = nextInt(), t = nextInt();   int[] x = new int[n];  int[] a = new int[n];  for (int i = 0; i < n; i++) {  x[i] = nextInt();  a[i] = nextInt();  }   int ans = 0;  for (int i = 0; i < n; i++) {  boolean left = true, right = true;  for (int j = 0; j < n; j++)   if (x[j] < x[i] && a[i] + 2*t + a[j] >= 2*Math.abs(x[i] - x[j])) left = false;   else if (x[j] > x[i] && a[i] + 2*t + a[j] > 2*Math.abs(x[i] - x[j])) right = false;  if (left) ans++;  if (right) ans++;  }   out.println(ans);   out.flush(); } }
1	public class A {  public static void main(String[] args) {  new A().run(); }  private void run() {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int ce = 0;  int co = 0;  int le = 0;  int lo = 0;  for (int i = 0; i < n; i++) {  int x = sc.nextInt();  if (x % 2 == 0) {   ce++;   le = i + 1;  } else {   co++;   lo = i + 1;  }  }  System.out.println(ce == 1 ? le : lo); } }
2	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   long n = in.nextLong();   long k = in.nextLong();   long disc = (long)(Math.sqrt(9 - 4 * (-2 * n - 2 * k)));   long x = (-3 + disc) / 2;   System.out.println(n - x);  } }
5	public class A implements Runnable {  final boolean LOCAL = System.getProperty("ONLINE_JUDGE") == null;  BufferedReader in; PrintWriter out; StringTokenizer tok;  public static void main(String[] args) {  new Thread(null, new A(), "", 256*1024*1024).start(); }  public void run() {  try {  long t1 = 0, t2 = 0, m1 = 0, m2 = 0;  if (LOCAL) {   t1 = System.currentTimeMillis();   m1 = Runtime.getRuntime().freeMemory();  }  Locale.setDefault(Locale.US);  if (LOCAL) {   in = new BufferedReader(new FileReader("input.txt"));   out = new PrintWriter("output.txt");  } else {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);  }  tok = new StringTokenizer("");  solve();  in.close();  out.close();  if (LOCAL) {   t2 = System.currentTimeMillis();   m2 = Runtime.getRuntime().freeMemory();   System.err.println("Time = " + (t2 - t1) + " ms.");   System.err.println("Memory = " + ((m1 - m2) / 1024) + " KB.");  }  } catch (Throwable e) {  e.printStackTrace(System.err);  throw new RuntimeException();  } }  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()); }  double readDouble() throws IOException {  return Double.parseDouble(readString()); }  static class Mergesort {  private Mergesort() {}  public static void sort(int[] a) {  mergesort(a, 0, a.length - 1);  }  public static void sort(long[] a) {  mergesort(a, 0, a.length - 1);  }  public static void sort(double[] a) {  mergesort(a, 0, a.length - 1);  }  private static final int MAGIC_VALUE = 42;  private static void mergesort(int[] a, int leftIndex, int rightIndex) {  if (leftIndex < rightIndex) {   if (rightIndex - leftIndex <= MAGIC_VALUE) {   insertionSort(a, leftIndex, rightIndex);   } else {   int middleIndex = (leftIndex + rightIndex) / 2;   mergesort(a, leftIndex, middleIndex);   mergesort(a, middleIndex + 1, rightIndex);   merge(a, leftIndex, middleIndex, rightIndex);   }  }  }  private static void mergesort(long[] a, int leftIndex, int rightIndex) {  if (leftIndex < rightIndex) {   if (rightIndex - leftIndex <= MAGIC_VALUE) {   insertionSort(a, leftIndex, rightIndex);   } else {   int middleIndex = (leftIndex + rightIndex) / 2;   mergesort(a, leftIndex, middleIndex);   mergesort(a, middleIndex + 1, rightIndex);   merge(a, leftIndex, middleIndex, rightIndex);   }  }  }  private static void mergesort(double[] a, int leftIndex, int rightIndex) {  if (leftIndex < rightIndex) {   if (rightIndex - leftIndex <= MAGIC_VALUE) {   insertionSort(a, leftIndex, rightIndex);   } else {   int middleIndex = (leftIndex + rightIndex) / 2;   mergesort(a, leftIndex, middleIndex);   mergesort(a, middleIndex + 1, rightIndex);   merge(a, leftIndex, middleIndex, rightIndex);   }  }  }  private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {  int length1 = middleIndex - leftIndex + 1;  int length2 = rightIndex - middleIndex;  int[] leftArray = new int[length1];  int[] rightArray = new int[length2];  System.arraycopy(a, leftIndex, leftArray, 0, length1);  System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);  for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {   if (i == length1) {   a[k] = rightArray[j++];   } else if (j == length2) {   a[k] = leftArray[i++];   } else {   a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];   }  }  }  private static void merge(long[] a, int leftIndex, int middleIndex, int rightIndex) {  int length1 = middleIndex - leftIndex + 1;  int length2 = rightIndex - middleIndex;  long[] leftArray = new long[length1];  long[] rightArray = new long[length2];  System.arraycopy(a, leftIndex, leftArray, 0, length1);  System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);  for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {   if (i == length1) {   a[k] = rightArray[j++];   } else if (j == length2) {   a[k] = leftArray[i++];   } else {   a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];   }  }  }  private static void merge(double[] a, int leftIndex, int middleIndex, int rightIndex) {  int length1 = middleIndex - leftIndex + 1;  int length2 = rightIndex - middleIndex;  double[] leftArray = new double[length1];  double[] rightArray = new double[length2];  System.arraycopy(a, leftIndex, leftArray, 0, length1);  System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);  for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {   if (i == length1) {   a[k] = rightArray[j++];   } else if (j == length2) {   a[k] = leftArray[i++];   } else {   a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];   }  }  }  private static void insertionSort(int[] a, int leftIndex, int rightIndex) {  for (int i = leftIndex + 1; i <= rightIndex; i++) {   int current = a[i];   int j = i - 1;   while (j >= leftIndex && a[j] > current) {   a[j + 1] = a[j];   j--;   }   a[j + 1] = current;  }  }  private static void insertionSort(long[] a, int leftIndex, int rightIndex) {  for (int i = leftIndex + 1; i <= rightIndex; i++) {   long current = a[i];   int j = i - 1;   while (j >= leftIndex && a[j] > current) {   a[j + 1] = a[j];   j--;   }   a[j + 1] = current;  }  }  private static void insertionSort(double[] a, int leftIndex, int rightIndex) {  for (int i = leftIndex + 1; i <= rightIndex; i++) {   double current = a[i];   int j = i - 1;   while (j >= leftIndex && a[j] > current) {   a[j + 1] = a[j];   j--;   }   a[j + 1] = current;  }  }  }  void debug(Object... o) {  if (LOCAL) {  System.err.println(Arrays.deepToString(o));  } }    void solve() throws IOException {  int n = readInt();  int m = readInt();  int k = readInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = readInt();  }  Mergesort.sort(a);  for (int need = 0; need <= n; need++) {  int cnt = k;  for (int i = 0; i < need; i++) {   cnt += a[n - i - 1] - 1;  }  if (cnt >= m) {   out.println(need);   return;  }  }  out.println(-1); }  }
2	public class submitting { public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  StringTokenizer st = new StringTokenizer(sc.nextLine());  long n = Integer.parseInt(st.nextToken());  long k = Integer.parseInt(st.nextToken());  long put = n / 2;  long lower = 0;  long upper = n;  while (put * (put + 1) / 2 - (n - put) != k) {  if (put * (put + 1) / 2 - (n - put) > k) {   upper = put - 1;   put = (lower + upper) / 2;  } else {   lower = put + 1;   put = (lower + upper) / 2;  }  }  System.out.println(n - put);  sc.close(); } }
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);   G1PlaylistForPolycarpEasyVersion solver = new G1PlaylistForPolycarpEasyVersion();   solver.solve(1, in, out);   out.close();  }  static class G1PlaylistForPolycarpEasyVersion {   public static final int GENRES_COUNT = 3;   private int songsCount;   private int totalDuration;   private Song[] songs;   private int[][][] mem;   static final int mod = 1000000007;   public void solve(int testNumber, InputReader in, PrintWriter out) {    songsCount = in.nextInt();    totalDuration = in.nextInt();    songs = new Song[songsCount];    for (int i = 0; i < songsCount; i++) {     songs[i] = new Song(in.nextInt(), in.nextInt() - 1);    }    long ret = 0;    int chosenSongs = 0;    mem = new int[GENRES_COUNT + 1][][];    for (int i = 0; i < GENRES_COUNT; i++) {     mem[i] = new int[totalDuration + 1][];     for (int j = 0; j <= totalDuration; j++) {      mem[i][j] = new int[1 << songsCount];      for (int k = 0; k < 1 << songsCount; k++) {       mem[i][j][k] = -1;      }     }    }    for (int i = 0; i < songsCount; i++) {     chosenSongs = 1 << i;     ret += search(totalDuration - songs[i].duration, songs[i].genre, chosenSongs);    }    out.println(ret % mod);   }   private long search(int timeLeft, int lastGenre, int chosen) {    if (timeLeft < 0) {     return 0;    }    if (timeLeft == 0) {     return 1;    }    if (mem[lastGenre][timeLeft][chosen] != -1) {     return mem[lastGenre][timeLeft][chosen];    }    long ret = 0;    for (int i = 0; i < songsCount; i++) {     if (((1 << i) & chosen) == 0 && songs[i].genre != lastGenre) {      ret += search(timeLeft - songs[i].duration, songs[i].genre, chosen | 1 << i);      if (ret > mod) {       ret = ret % mod;      }     }    }    mem[lastGenre][timeLeft][chosen] = (int) (ret % mod);    return mem[lastGenre][timeLeft][chosen];   }   class Song {    public int duration;    public int genre;    public Song(int duration, int genre) {     this.duration = duration;     this.genre = genre;    }   }  }  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 Codeforces {  private static boolean greater(long mid, long s) {   int sum = 0;   long num = mid;   while (num != 0) {    sum += (num % 10);    num /= 10;   }   return mid - sum >= s;  }  static class pair {   int first;   int second;   pair(int f, int s) {    first = f;    second = s;   }   pair() {   }  }  public static void main(String[] args) throws Exception {     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   long n, s;   String arr[] = br.readLine().split(" ");   n = Long.parseLong(arr[0]);   s = Long.parseLong(arr[1]);   long l = 1;   long h = n;   while (l < h) {    long mid = (l + h) / 2;    if (greater(mid, s)) {     h = mid;    } else {     l = mid + 1;    }   }   System.out.println(greater(h, s) ? n - h + 1 : 0);  } }
6	public class ASimpleTask {     private static void solve(FastScanner s1, PrintWriter out){  int V = s1.nextInt();  int E = s1.nextInt();  int graph[] = new int[V];  long DP[][] = new long[1 << V][V];  while(E-->0) {  int u = s1.nextInt() - 1;  int v = s1.nextInt() - 1;  graph[u] |= (1 << v);  graph[v] |= (1 << u);  }  for(int i=0;i<V;i++)  DP[1 << i][i] = 1;  for(int mask = 1 , end = 1 << V;mask < end;mask++) {  for(int set = mask;Integer.bitCount(set) > 1;set ^= Integer.highestOneBit(set)) {   int u = Integer.numberOfTrailingZeros(Integer.highestOneBit(set));   for(int fromSet = mask ^ (1 << u);fromSet > 0; fromSet ^= Integer.lowestOneBit(fromSet)) {   int v = Integer.numberOfTrailingZeros(fromSet);      if((graph[u] & (1 << v)) != 0)    DP[mask][u] += DP[mask ^ (1 << u)][v];      }  }  }  long totalCycles = 0;  for(int mask = 1 , end = 1 << V;mask < end;mask++) {  if(Integer.bitCount(mask) >= 3) {   int start = Integer.numberOfTrailingZeros(mask);   for(int set = mask;Integer.bitCount(set) > 1;set ^= Integer.highestOneBit(set)) {   int u = Integer.numberOfTrailingZeros(Integer.highestOneBit(set));   if((graph[u] & (1 << start)) != 0)    totalCycles += DP[mask][u];   }  }  }  totalCycles /= 2;  out.println(totalCycles); }        public static void main(String []args) throws IOException {  FastScanner in = new FastScanner(System.in);  PrintWriter out =   new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);  solve(in, out);  in.close();  out.close(); }   static class FastScanner{  BufferedReader reader;  StringTokenizer st;  FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}  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();}  String nextLine() {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}     int nextInt() {return Integer.parseInt(next());}  long nextLong() {return Long.parseLong(next());}   double nextDouble(){return Double.parseDouble(next());}  char nextChar() {return next().charAt(0);}  int[] nextIntArray(int n)   {int[] a= new int[n]; int i=0;while(i<n){a[i++]=nextInt();} return a;}  long[] nextLongArray(int n)  {long[]a= new long[n]; int i=0;while(i<n){a[i++]=nextLong();} return a;}  int[] nextIntArrayOneBased(int n) {int[] a= new int[n+1]; int i=1;while(i<=n){a[i++]=nextInt();} return a;}    long[] nextLongArrayOneBased(int n){long[]a= new long[n+1];int i=1;while(i<=n){a[i++]=nextLong();}return a;}    void close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}   }  }
5	public class CFTest6 {  static BufferedReader br;  public static void main(String[] args) {  br = new BufferedReader(new InputStreamReader(System.in));  try {   int[] a1 = readIntArr();  int[] a2 = readIntArr();  br.close();  int f = a1[0];  int d = a1[1];  int s = a1[2];  Arrays.sort(a2);   if (d <= s)   System.out.println(0);   else {   int cur = d - s + 1;      int num=0;   for(int i=0;i<f;i++){   num++;   cur-=a2[f-i-1];   if(cur<=0)break;   cur++;   }   if (cur > 0)   System.out.println(-1);   else{         System.out.println(num);   }  }  } catch (IOException e) {  e.printStackTrace();  }  }  static public String readLine() throws IOException {  return br.readLine();  }  static public String readString() throws IOException {  return br.readLine();  }  static public long readlong() throws IOException {  return Long.parseLong(br.readLine()); }  static public int readInt() throws IOException {  return Integer.parseInt(br.readLine()); }  static public int[] readIntArr() throws IOException {  String[] str = br.readLine().split(" ");  int arr[] = new int[str.length];  for (int i = 0; i < arr.length; i++)  arr[i] = Integer.parseInt(str[i]);  return arr; }  static public double[] readDoubleArr() throws IOException {  String[] str = br.readLine().split(" ");  double arr[] = new double[str.length];  for (int i = 0; i < arr.length; i++)  arr[i] = Double.parseDouble(str[i]);  return arr; }  static public long[] readLongArr() throws IOException {  String[] str = br.readLine().split(" ");  long arr[] = new long[str.length];  for (int i = 0; i < arr.length; i++)  arr[i] = Long.parseLong(str[i]);  return arr; }  static public double readDouble() throws IOException {  return Double.parseDouble(br.readLine()); } }
4	public class Main {  static int[][] l,r,u,d;  static int[][][]dist;  static int inf=Integer.MAX_VALUE;  static class Node{   int x,y,len,dis;   Node(int x,int y,int len,int dis){    this.x=x;this.y=y;this.len=len;this.dis=dis;   }  }  public static void process()throws IOException  {   int n=ni();   int m=ni();   int k=ni();   dist=new int[n][m][k/2+1];   l=new int[n][m];   r=new int[n][m];   for(int i=0;i<n;i++)    for(int j=0;j<m-1;j++)     l[i][j]=r[i][j+1]=ni();   u=new int[n][m];   d=new int[n][m];   for(int i=0;i<n-1;i++)    for(int j=0;j<m;j++)     d[i][j]=u[i+1][j]=ni();   if(k%2==1)   {    for(int i=0;i<n;i++)    {     for(int j=0;j<m;j++)      p("-1 ");     pn("");    }    return;   }   k/=2;   for(int kk=1;kk<=k;kk++)   for(int i=0;i<n;i++)   {    for(int j=0;j<m;j++)    {     dist[i][j][kk]=inf;     if(i!=0)      dist[i][j][kk]=Math.min(dist[i][j][kk],dist[i-1][j][kk-1]+u[i][j]);     if(i!=n-1)      dist[i][j][kk]=Math.min(dist[i][j][kk],dist[i+1][j][kk-1]+d[i][j]);     if(j!=0)      dist[i][j][kk]=Math.min(dist[i][j][kk],dist[i][j-1][kk-1]+r[i][j]);     if(j!=m-1)      dist[i][j][kk]=Math.min(dist[i][j][kk],dist[i][j+1][kk-1]+l[i][j]);    }   }   for(int i=0;i<n;i++)   {    for(int j=0;j<m;j++)     p(2*dist[i][j][k]+" ");    pn("");   }  }  static AnotherReader sc;  static PrintWriter out;  public static void main(String[]args)throws IOException  {   boolean oj = System.getProperty("ONLINE_JUDGE") != null;   if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}   else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}   int t=1;     while(t-->0) {process();}   out.flush();out.close();  }  static void pn(Object o){out.println(o);}  static void p(Object o){out.print(o);}  static void pni(Object o){out.println(o);out.flush();}  static int ni()throws IOException{return sc.nextInt();}  static long nl()throws IOException{return sc.nextLong();}  static double nd()throws IOException{return sc.nextDouble();}  static String nln()throws IOException{return sc.nextLine();}  static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}  static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}  static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}  static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}  static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}   static class AnotherReader{BufferedReader br; StringTokenizer st;  AnotherReader()throws FileNotFoundException{  br=new BufferedReader(new InputStreamReader(System.in));}  AnotherReader(int a)throws FileNotFoundException{  br = new BufferedReader(new FileReader("input.txt"));}  String next()throws IOException{  while (st == null || !st.hasMoreElements()) {try{  st = new StringTokenizer(br.readLine());}  catch (IOException e){ e.printStackTrace(); }}  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()); }  String nextLine() throws IOException{ String str = ""; try{  str = br.readLine();} catch (IOException e){  e.printStackTrace();} return str;}}   }
4	public class B{ static int[][] hor; static int[][] ver; static int n; static int m; static int k; static long[][][] dp;  static long dist(int row, int col) {  if(k%2==1)return Integer.MAX_VALUE;  return 2*make(row,col,k/2); }  static long make(int row, int col, int moves) {  if(moves == 0)  {  return 0;  }   if(dp[row][col][moves]!=-1)return dp[row][col][moves];   long ans = Long.MAX_VALUE;   if(col-1>=0)  {  ans = Math.min(ans, hor[row][col-1]+make(row,col-1,moves-1));  }  if(col+1<m)  {  ans = Math.min(ans, hor[row][col]+make(row,col+1,moves-1));  }  if(row-1>=0)  {  ans = Math.min(ans, ver[row-1][col]+make(row-1,col,moves-1));  }  if(row+1<n)  {  ans = Math.min(ans, ver[row][col]+make(row+1,col,moves-1));  }  dp[row][col][moves] = ans;  return ans; }  public static void main(String[] args) {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  n = fs.nextInt(); m = fs.nextInt(); k = fs.nextInt();  hor = new int[n][m]; ver = new int[n][m];  dp = new long[505][505][24];  for(int i=0;i<505;i++)for(int j=0;j<505;j++)for(int k=0;k<24;k++)dp[i][j][k] = -1;  for(int i=0;i<n;i++)  {  for(int j=0;j<m-1;j++)  {   int a = fs.nextInt();   hor[i][j] = a;  }  }   for(int row=0;row<n-1;row++)  {  for(int col =0;col<m;col++)  {   int a = fs.nextInt();   ver[row][col] = a;  }  }    for(int row=0;row<n;row++)  {  for(int col=0;col<m;col++)  {   long d = dist(row,col);   if(d<Integer.MAX_VALUE)   {   out.print(d+" ");   }   else out.print("-1 ");  }  out.println();  }  out.close(); } 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());  }  int[] readArray(int n) {  int[] a=new int[n];  for (int i=0; i<n; i++) a[i]=nextInt();  return a;  }  long nextLong() {  return Long.parseLong(next());  } } public static int[] sort(int[] arr) {  List<Integer> temp = new ArrayList();  for(int i:arr)temp.add(i);  Collections.sort(temp);  int start = 0;  for(int i:temp)arr[start++]=i;  return arr; } }
5	public class Main {    public static void main(String[] args) {   Scanner in=new Scanner(new InputStreamReader(System.in));   PrintWriter out=new PrintWriter(System.out);   int n=in.nextInt();   Vector<Integer> mas=new Vector<Integer>();   Vector<Integer> mas2=new Vector<Integer>();   int index=-1;   boolean res=false;   for(int i=0; i<n; i++){    mas.add(in.nextInt());    if(i!=0 && mas.get(i)<mas.get(i-1)){     index=i-1;     break;    }   }   if(index==-1) res=true;   else{    int min=mas.get(index+1);    int minIndex=index+1;    for(int i=index+2; i<n; i++){     mas.add(in.nextInt());     if(mas.get(i)<=min){      min=mas.get(i);      minIndex=i;          }    }       mas2.addAll(mas);    mas.set(minIndex, mas.get(index));    mas.set(index, min);    int o=mas.hashCode();    Collections.sort(mas);    int nw=mas.hashCode();    res=nw==o;   }   if(!res){    mas=mas2;    for(int i=n-1; i>=0; i--){     if(i!=n-1 && mas.get(i)>mas.get(i+1)){      index=i+1;      break;     }    }    if(index==-1) res=true;    else{     int max=mas.get(index-1);     int maxIndex=index-1;     for(int i=index-1; i>=0; i--){      if(mas.get(i)>=max){       max=mas.get(i);       maxIndex=i;      }     }     mas.set(maxIndex, mas.get(index));     mas.set(index, max);     int o=mas.hashCode();     Collections.sort(mas);     int nw=mas.hashCode();     res=res||nw==o;    }   }   if(res) out.println("YES");   else out.println("NO");   out.close();  } }
2	public class B { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  long n = sc.nextLong();  long k = sc.nextLong();  if ((k - 1) * k / 2 + 1 < n) {  System.out.println(-1);  return;  }  long left = 0;  long right = k;  while (left < right) {  long m = (left + right) / 2;  if (k * (k - 1)/2 - (k - m) * (k - m - 1) / 2 +1 < n)   left = m + 1;  else   right = m;  }  System.out.println(left); } }
4	public class MainF {  public static void main(String[]args) throws IOException{   BufferedReader br = new BufferedReader(new FileReader(new File("input.txt")));   BufferedWriter bw = new BufferedWriter(new FileWriter(new File("output.txt")));   String S = br.readLine();   String[]J = S.split(" ");   int N = Integer.parseInt(J[0]);   int M = Integer.parseInt(J[1]);   int K = Integer.parseInt(br.readLine());   int[]x = new int[K];   int[]y = new int[K];   S = br.readLine();   J = S.split(" ");     for(int i = 0; i<2*K; i = i + 2){    x[i/2] = Integer.parseInt(J[i]);    y[i/2] = Integer.parseInt(J[i+1]);   }     int ans = -1;   int ansX = -1;   int ansY = -1;     for (int i = 1; i<=N; i++){    for (int j = 1; j<=M; j++){     int W = M + N;     for (int k = 0; k<K; k++){      W = Math.min(W, Math.abs(i-x[k]) + Math.abs(j-y[k]));     }     if (W < ans)continue;     ans = W;     ansX = i;     ansY = j;        }   }   bw.write(Integer.toString(ansX)+" "+Integer.toString(ansY));   br.close();   bw.close();   } }
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());   }  } }
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);  } }
1	public class GFG { public static void main (String[] args) {  Scanner sc = new Scanner (System.in);  int n = sc.nextInt();  int a = sc.nextInt();  int b = sc.nextInt();  int c = sc.nextInt();  int ans = 0;  int t= sc.nextInt();  int arr[] = new int[n];  for(int i=0;i<n;i++){   int nn = sc.nextInt();   ans+=a;   if(b<c){    ans += (t-nn) * (c - b);   }  }  System.out.println(ans); } }
3	public class Main {  private static Scanner scanner = new Scanner(System.in);  public static void main(String[] args) {   int n = scanInt();   List<Integer> a = scanList(n);   int m = scanInt();   List<Integer> left = new ArrayList<>();   List<Integer> right = new ArrayList<>();   for (int i = 0; i < m; i++) {    left.add(scanInt());    right.add(scanInt());   }   String even = "even";   String odd = "odd";   int inversions = 0;   for (int i = 0; i < a.size(); i++) {    for (int j = i; j < a.size(); j++) {     if (a.get(i) > a.get(j)) {      ++inversions;     }    }   }   inversions = inversions % 2;   for (int i = 0; i < m; i++) {    inversions = (inversions + (right.get(i) - left.get(i) + 1) / 2 % 2) % 2;    println(inversions % 2 == 0 ? even : odd);   }   }  private static Integer get(int digit, List<Integer> numbers) {   Integer toReturn = null;   for (Integer number : numbers     ) {    if (number <= digit) {     toReturn = number;     break;    }   }   return toReturn;  }  private static List<Integer> toList(char[] chars) {   List<Integer> integers = new ArrayList<>();   for (int i = 0; i < chars.length; i++) {    integers.add(Integer.parseInt(String.valueOf(chars[i])));   }   return integers;  }  private static List<Pair<Integer, Integer>> scanPairs(int amount) {   List<Pair<Integer, Integer>> list = new ArrayList<>();   for (int i = 0; i < amount; i++) {    list.add(new Pair<>(scanInt(), scanInt()));   }   return list;  }  private static int[] scanArray(int length) {   int array[] = new int[length];   for (int i = 0; i < length; i++) {    array[i] = scanner.nextInt();   }   return array;  }  private static List<Integer> scanList(int length) {   List<Integer> integers = new ArrayList<>();   for (int i = 0; i < length; i++) {    integers.add(scanner.nextInt());   }   return integers;  }  public static String scanString() {   return scanner.next();  }  private static int scanInt() {   return scanner.nextInt();  }  private static void println(int n) {   System.out.println(n);  }  private static void print(int n) {   System.out.print(n);  }  private static void println(String s) {   System.out.println(s);  }  private static void print(String s) {   System.out.print(s);  }  private static void print(int a[]) {   for (int i = 0; i < a.length; i++) {    System.out.print(a[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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, InputReader in, PrintWriter out) {    TreeSet<Integer> set = new TreeSet<>();    int n = in.nextInt();    for (int i = 0; i < n; i++) {     int x = in.nextInt();     set.add(x);    }    int ans = 0;    while (!set.isEmpty()) {     ans++;     int minimal = set.first();     int cur = minimal;     while (cur <= 100) {      set.remove(cur);      cur += minimal;     }    }    out.println(ans);   }  }  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;   }  } }
1	public class Main { static HashMap<Integer,Integer> hm; static int[] array; static boolean marked[]; static int a , b ;  static int[] ans ;   public static void main( String args[]) {  Scanner sc = new Scanner(System.in);  int n ;    n = sc.nextInt();  a = sc.nextInt();  b = sc.nextInt();   hm = new HashMap<Integer,Integer>();  array = new int[n];  marked = new boolean[n];   for( int i = 0 ; i < n ; ++i )  {  array[i] = sc.nextInt();  hm.put( array[i] , i );  }   if( a == b)  {  boolean flag = true ;  for( int i = 0 ; i < n ; ++i )   if( !hm.containsKey( a - array[i]))   flag = false;     if( !flag)   System.out.println( "NO");  else  {   System.out.println("YES");   for( int i = 0 ; i < n ; ++i)   System.out.print("0 ");  }  }   else  {    ans = new int[n];    for( int i = 0 ; i < n ; ++i )  if( marked[i] ) continue;     else   {   if( hm.containsKey(a - array[i]) && !hm.containsKey(b - array[i]))   {   propagateA(i);   }     else if( !hm.containsKey(a - array[i]) && hm.containsKey(b - array[i]))   {      propagateB(i);   }     else if(!hm.containsKey(a - array[i]) && !hm.containsKey(b - array[i]))   {   System.out.println("NO");   System.exit(0);   }  }        for( int i = 0 ; i < n ; ++i )   if( marked[i] ) continue;      else   {    start(i);   }    System.out.println("YES");  for( int i = 0 ; i < n; ++i)   System.out.print(ans[i] + " ");  System.exit(0);  }       }  static void propagateA(int index) {   int i = index;   while( !marked[i])  {       if( hm.containsKey( a - array[i]) && !marked[ hm.get( a - array[i])])   {    marked[i] = true ;    ans [i] = 0 ;           i = hm.get( a - array[i]);    marked[i] = true ;    ans [i] = 0 ;           if( hm.containsKey( b - array[i]) && !marked[ hm.get( b - array[i])])    {    i = hm.get( b - array[i]);    }    }      else   {    System.out.println("NO");    System.exit(0);   }    }   }  static void propagateB(int index) {   int i = index;   while( !marked[i])  {       if( hm.containsKey( b - array[i]) && !marked[ hm.get( b - array[i])])   {    marked[i] = true ;    ans [i] = 1 ;             i = hm.get( b - array[i]);    marked[i] = true ;    ans [i] = 1 ;           if( hm.containsKey( a - array[i]) && !marked[ hm.get( a - array[i])])    {    i = hm.get( a - array[i]);    }    }      else   {    System.out.println("NO");    System.exit(0);   }    }   }  static void start(int index) {    int i = index ;    while( !marked[i] )  {    if(!marked[ hm.get( a - array[i])])  {   marked[i] = true ;   ans [i] = 0 ;           i = hm.get( a - array[i]);   marked[i] = true ;   ans [i] = 0 ;        i = hm.get( b - array[i]);     }      } }  }
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[m][n];     int[] bestMask = new int[1 << n];     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       a[j][i] = in.nextInt();      }     }     int[] dp = new int[1 << n];     for (int i = 0; i < m; i++) {      int[] array = a[i];      for (int j = 0; j < n; j++) {       int val = array[j];       for (int mask = 0; mask < 1 << n; mask++) {        if ((mask & (1 << j)) == 0) {         dp[mask | (1 << j)] = Math.max(dp[mask | (1 << j)], dp[mask] + val);        }       }      }      for (int mask = 0; mask < 1 << n; mask++) {       int best = 0;       int cur = mask;       for (int j = 0; j < n; j++) {        best = Math.max(best, dp[cur]);        cur = (cur >> 1) | ((cur & 1) << (n - 1));       }       for (int j = 0; j < n; j++) {        dp[cur] = best;        cur = (cur >> 1) | ((cur & 1) << (n - 1));       }      }     }     out.println(dp[(1 << n) - 1]);    }   }  }  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 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;  } }
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 count = in.readInt();   int[] array = IOUtils.readIntArray(in, count);   int[] sorted = array.clone();   ArrayUtils.sort(sorted, IntComparator.DEFAULT);   int differs = 0;   for (int i = 0; i < count; i++) {    if (array[i] != sorted[i])     differs++;   }   if (differs <= 2)    out.printLine("YES");   else    out.printLine("NO");  } } 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 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 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 IOUtils {  public static int[] readIntArray(InputReader in, int size) {   int[] array = new int[size];   for (int i = 0; i < size; i++)    array[i] = in.readInt();   return array;  }  } class ArrayUtils {  private static int[] tempInt = new int[0];  public static int[] sort(int[] array, IntComparator comparator) {   return sort(array, 0, array.length, comparator);  }  public static int[] sort(int[] array, int from, int to, IntComparator comparator) {   ensureCapacityInt(to - from);   System.arraycopy(array, from, tempInt, 0, to - from);   sortImpl(array, from, to, tempInt, 0, to - from, comparator);   return array;  }  private static void ensureCapacityInt(int size) {   if (tempInt.length >= size)    return;   size = Math.max(size, tempInt.length << 1);   tempInt = new int[size];  }  private static void sortImpl(int[] array, int from, int to, int[] temp, int fromTemp, int toTemp, IntComparator comparator) {   if (to - from <= 1)    return;   int middle = (to - from) >> 1;   int tempMiddle = fromTemp + middle;   sortImpl(temp, fromTemp, tempMiddle, array, from, from + middle, comparator);   sortImpl(temp, tempMiddle, toTemp, array, from + middle, to, comparator);   int index = from;   int index1 = fromTemp;   int index2 = tempMiddle;   while (index1 < tempMiddle && index2 < toTemp) {    if (comparator.compare(temp[index1], temp[index2]) <= 0)     array[index++] = temp[index1++];    else     array[index++] = temp[index2++];   }   if (index1 != tempMiddle)    System.arraycopy(temp, index1, array, index, tempMiddle - index1);   if (index2 != toTemp)    System.arraycopy(temp, index2, array, index, toTemp - index2);  }  } interface IntComparator {  public static final IntComparator DEFAULT = new IntComparator() {   public int compare(int first, int second) {    if (first < second)     return -1;    if (first > second)     return 1;    return 0;   }  };  public int compare(int first, int second); }
2	public class C{  static long s; public static void main(String[] args)throws IOException {  Reader.init(System.in);  long n=Reader.nextLong();  s=Reader.nextLong();  long lo=1,hi=n,mid;  while(lo<hi){  mid=(lo+hi)/2;  if(diff(mid)>=s)   hi=mid;  else   lo=mid+1;  }  if(diff(lo)>=s)  System.out.println(n-lo+1);  else  System.out.println(0); }  static long diff(long n){  String s=String.valueOf(n);  int sum=0;   for(int i=0;i<s.length();i++){    sum+=Integer.parseInt(s.valueOf(s.charAt(i)));  }  return (n-sum); }    }    class Reader {  static BufferedReader reader;  static StringTokenizer tokenizer;    static void init(InputStream input) {   reader = new BufferedReader(      new InputStreamReader(input) );   tokenizer = new StringTokenizer("");  }    static String next() throws IOException {   while ( ! tokenizer.hasMoreTokens() ) {       tokenizer = new StringTokenizer(      reader.readLine() );   }   return tokenizer.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt( next() );  }   static long nextLong() throws IOException {   return Long.parseLong( next() );  }   static double nextDouble() throws IOException {   return Double.parseDouble( next() );  } }
3	public class C455 { static int N; static final int mod = 1_000_000_007; static int[][] memo; static int[] list; public static void main(String[] args) {  FS scan = new FS(System.in);   N = scan.nextInt();  list = new int[N];  for(int i=0;i<N;i++) {  list[i] = scan.next().equals("s")?0:1;  }  if(list[N-1] == 1) {  System.out.println(0);  return;  }  memo = new int[N+1][N+2];  Arrays.fill(memo[N], 1);  int[] sum = new int[N+2];   for(int i=N-1;i>=0;i--) {  sum[0] = memo[i+1][0];  for(int j=1;j<sum.length;j++) {   sum[j] = sum[j-1] + memo[i+1][j];   sum[j] %= mod;  }  for(int j=0;j<=N;j++) {   if (list[i]==1 && (i==0 || list[i-1]==1))   memo[i][j] = memo[i+1][j+1];   else if(i==0 || list[i-1] == 1)   memo[i][j] = memo[i+1][j];   else if (list[i]==1){     memo[i][j] = sum[j+1] - sum[0] + mod;   memo[i][j] %= mod;      }   else if (list[i]==0) {   memo[i][j] = sum[j];   }  }  }       System.out.println(memo[0][0]); }  private static class FS {  BufferedReader br;  StringTokenizer st;  public FS(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());}  double nextDouble() { return Double.parseDouble(next());} } }
0	public class j { public static void main(String aa[])throws IOException { BufferedReader b=new BufferedReader(new InputStreamReader(System.in)); int i=0,m=0,p=0,n=0,k=0,j=0; String s,r; s=b.readLine(); r=s; n=Integer.parseInt(s); s=s.substring(0,s.length()-2); s+=r.charAt(r.length()-1); r=r.substring(0,r.length()-1); m=Integer.parseInt(s); p=Integer.parseInt(r); System.out.print((long)Math.max(Math.max(m,n),p)); } }
3	public class Codeshefcode{ public static void main(String[] args) throws IOException{      new Thread(null,new Runnable(){  public void run(){   Solver Machine = new Solver() ;   try{   Machine.Solve() ;   Machine.Finish() ;   }catch(Exception e){   e.printStackTrace() ;   System.out.flush() ;   System.exit(-1) ;   }catch(Error e){   e.printStackTrace() ;   System.out.flush() ;   System.exit(-1) ;   }  }  },"Solver",1l<<27).start() ; } } class Mod{ static long mod=1000000007 ; static long d(long a,long b){ return (a*MI(b))%mod ; } static long m(long a,long b){ return (a*b)%mod ; } static private long MI(long a){ return pow(a,mod-2) ; } static long pow(long a,long b){  if(b<0) return pow(MI(a),-b) ;  long val=a ; long ans=1 ;  while(b!=0){  if((b&1)==1) ans = (ans*val)%mod ;   val = (val*val)%mod ;   b/=2 ;  }  return ans ; } } class pair implements Comparable<pair>{ int x ; int y ;  pair(int x,int y){ this.x=x ; this.y=y ;}  public int compareTo(pair p){  return (this.x<p.x ? -1 : (this.x>p.x ? 1 : (this.y<p.y ? -1 : (this.y>p.y ? 1 : 0)))) ; } } class Solver{ Reader ip = new Reader(System.in) ;  PrintWriter op = new PrintWriter(System.out) ; public void Solve() throws IOException{  int n = ip.i() ;  int a[] = new int[n] ;  for(int i=0 ; i<n ; i++) a[i] = ip.i() ;  int num=0 ;  for(int i=0 ; i<n ; i++)  for(int j=(i+1) ; j<n ; j++)   if(a[i]>a[j])   num++ ;  num%=2 ;  int m = ip.i() ;  while(m--!=0){  int l = ip.i() ;  int r = ip.i() ;  int d = (r-l+1) ;  int mod = d%4 ;  int bit ;  if(mod<=1) bit=0 ; else bit=1 ;  num+=bit ;  num%=2 ;  pln(num==1 ? "odd" : "even") ;  } } void Finish(){  op.flush();  op.close(); } void p(Object o){  op.print(o) ; } void pln(Object o){  op.println(o) ; }  } class mylist extends ArrayList<Integer>{} class myset extends TreeSet<Integer>{} class mystack extends Stack<Integer>{} class mymap extends TreeMap<Long,Integer>{} 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()) ; } long l() throws IOException{  return Long.parseLong(s()) ; } double d() throws IOException {  return Double.parseDouble(s()) ; } }
5	public class A { 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);  }  catch (NullPointerException e)  {  line=null;    }   }  int NextInt() {  String n = inputParser.nextToken();  int val = Integer.parseInt(n);     return val; }  long NextLong() {  String n = inputParser.nextToken();  long val = Long.parseLong(n);     return val; }  String NextString() {  String n = inputParser.nextToken();  return n; }  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 A(filePath); }  public void readFInput() {  for(;;)  {  try  {   readNextLine();   FInput+=line+" ";  }  catch(Exception e)  {   break;  }  }  inputParser = new StringTokenizer(FInput, " "); }   public A(String inputFile) {  openInput(inputFile);  readNextLine();  int N=NextInt(), M=NextInt(), K=NextInt();  int [] v = new int[N];  readNextLine();  for(int i=0; i<N; i++)  {    v[i]=NextInt();    }  Arrays.sort(v);  M-=(K-1);  int id=N-1;  int ret=0;  while(M>1&&id>=0)  {  M++;  M-=v[id--];  ret++;  }  if(id<0&&M>1)ret=-1;  System.out.println(ret);  closeInput();   }   public static void out(Object s) {  try  {   FileWriter fstream = new FileWriter("output.txt");  BufferedWriter out = new BufferedWriter(fstream);  out.write(s.toString());  out.close();  }catch (Exception e){  System.err.println("Error: " + e.getMessage());  } }  }
4	public class R023A { String str; int n;  public R023A() {  Scanner scanner = new Scanner(System.in);  str = scanner.next();  n = str.length(); }  private void process() {  int length = -1;  for(int i=1; i<n; i++) {  Set<String> set = new HashSet<String>();  length = n - i;  for(int j=0; j<=i; j++) {   String sub = str.substring(j, j+length);   set.add(sub);  }  if(set.size() < i+1) {   System.out.println(length);   return;  }  }  System.out.println(0); }  public static void main(String[] args) {  new R023A().process(); } }
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);  }    private 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());   }   float nf() {    return Float.parseFloat(next());   }   long nl() {    return Long.parseLong(next());   }   double nd() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
1	public class TestClass11 {   public static void main(String[] args) {   InputReader in=new InputReader(System.in);  OutputWriter out=new OutputWriter(System.out);  int n=in.readInt();  String s=in.readString();  int low[]=new int[26];  int upper[]=new int[26];  boolean islow[]=new boolean[26];  boolean isupper[]=new boolean[26];  Arrays.fill(low,Integer.MAX_VALUE);  Arrays.fill(upper, Integer.MAX_VALUE);   int ans[]=new int[n];  int finalsans=Integer.MAX_VALUE;  for(int i=0;i<n;i++){  int c=s.charAt(i);  if(c>='a'&&c<='z'){   islow[c-'a']=true;  }  else{   isupper[c-'A']=true;  }    }     for(int i=n-1;i>=0;i--){  int c=s.charAt(i);    if(c>='a'&&c<='z'){   low[c-'a']=i;  }  else{   upper[c-'A']=i;  }      for(int j=0;j<26;j++){   if(islow[j]==true){   ans[i]=Math.max(ans[i], low[j]);   }  }   for(int j=0;j<26;j++){    if(isupper[j]==true){    ans[i]=Math.max(ans[i], upper[j]);   }  }      finalsans=Math.min(ans[i]-i+1, finalsans);  }    System.out.println(finalsans);    } } 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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  public String next() {  return readString(); }  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 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(); }  }  class IOUtils {  public static int[] readIntArray(InputReader in, int size) {  int[] array = new int[size];  for (int i = 0; i < size; i++)  array[i] = in.readInt();  return array; }  }
6	public class G extends PrintWriter {  void run() {   long mod = 1_000_000_000 + 7;   int n = nextInt();   int m = nextInt();   int[] t = new int[n];   int[] g = new int[n];   for (int i = 0; i < n; i++) {    t[i] = nextInt();    g[i] = nextInt() - 1;   }   int k = 1 << n;   long[][] dp = new long[k][n];   for (int i = 0; i < n; i++) {    dp[1 << i][i] = 1;   }   for (int mask = 0; mask < k; mask++) {    if (Integer.bitCount(mask) <= 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 || g[i] == g[j]) {        continue;       }       dp[mask][i] = (dp[mask][i] + dp[mask ^ (1 << i)][j]) % mod;      }     }    }   }   long ans = 0;   for (int mask = 0; mask < k; mask++) {    int sum = 0;    for (int i = 0; i < n; i++) {     if ((mask & (1 << i)) != 0) {      sum += t[i];     }    }    if (sum == m) {     for (int i = 0; i < n; i++) {      if ((mask & (1 << i)) != 0) {       ans = (ans + dp[mask][i]) % mod;      }     }    }   }   println(ans);  }  boolean skip() {   while (hasNext()) {    next();   }   return true;  }  int[][] nextMatrix(int n, int m) {   int[][] matrix = new int[n][m];   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     matrix[i][j] = nextInt();   return matrix;  }  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;  }  long[] nextLongArray(int n) {   long[] array = new long[n];   for (int i = 0; i < n; i++) {    array[i] = nextLong();   }   return array;  }  int nextInt() {   return Integer.parseInt(next());  }  long nextLong() {   return Long.parseLong(next());  }  double nextDouble() {   return Double.parseDouble(next());  }  String nextLine() {   try {    return reader.readLine();   } catch (IOException err) {    return null;   }  }  public G(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;   G solution = new G(System.out);   if (OJ) {    reader = new BufferedReader(new InputStreamReader(System.in));    solution.run();   } else {    reader = new BufferedReader(new FileReader(new File(G.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();  } }
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 Main {  static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out);  static int oo = (int)1e9; static int mod = 1000000007;  public static void main(String[] args) throws IOException {   int n = in.nextInt();  int[] a = in.nextIntArray(n);  Arrays.sort(a);  boolean[] color = new boolean[n];  int cnt = 0;  for(int i = 0; i < n; ++i) {  if(!color[i]) {   cnt++;   for(int j = i; j < n; j++) {   if(a[j] % a[i] == 0)    color[j] = true;   }  }  }  System.out.println(cnt);   out.close(); }   static class SegmentTree {  int n;  long[] a, seg;  int DEFAULT_VALUE = 0;   public SegmentTree(long[] a, int n) {  super();  this.a = a;  this.n = n;  seg = new long[n * 4 + 1];  build(1, 0, n-1);  }   private long build(int node, int i, int j) {  if(i == j)   return seg[node] = a[i];  long first = build(node * 2, i, (i+j) / 2);  long second = build(node * 2 + 1, (i+j) / 2 + 1, j);  return seg[node] = combine(first, second);  }   long update(int k, long value) {  return update(1, 0, n-1, k, value);  }   private long update(int node, int i, int j, int k, long value) {  if(k < i || k > j)   return seg[node];  if(i == j && j == k) {   a[k] = value;   seg[node] = value;   return value;  }    int m = (i + j) / 2;  long first = update(node * 2, i, m, k, value);  long second = update(node * 2 + 1, m + 1, j, k, value);  return seg[node] = combine(first, second);  }   long query(int l, int r) {  return query(1, 0, n-1, l, r);  }   private long query(int node, int i, int j, int l, int r) {  if(l <= i && j <= r)   return seg[node];  if(j < l || i > r)   return DEFAULT_VALUE;  int m = (i + j) / 2;  long first = query(node * 2, i, m, l, r);  long second = query(node * 2 + 1, m+1, j, l, r);  return combine(first, second);  }   private long combine(long a, long b) {  return a + b;  } }  static class DisjointSet {  int n;  int[] g;  int[] h;  public DisjointSet(int n) {  super();  this.n = n;  g = new int[n];  h = new int[n];  for(int i = 0; i < n; ++i) {   g[i] = i;   h[i] = 1;  }  }  int find(int x) {  if(g[x] == x)   return x;  return g[x] = find(g[x]);  }  void union(int x, int y) {  x = find(x); y = find(y);  if(x == y)   return;  if(h[x] >= h[y]) {   g[y] = x;   if(h[x] == h[y])   h[x]++;  }  else {   g[x] = y;  }  } }   static int[] getPi(char[] a) {  int m = a.length;  int j = 0;  int[] pi = new int[m];  for(int i = 1; i < m; ++i) {  while(j > 0 && a[i] != a[j])   j = pi[j-1];  if(a[i] == a[j]) {   pi[i] = j + 1;   j++;  }  }  return pi; }  static long lcm(long a, long b) {  return a * b / gcd(a, b); }  static boolean nextPermutation(int[] a) {  for(int i = a.length - 2; i >= 0; --i) {  if(a[i] < a[i+1]) {   for(int j = a.length - 1; ; --j) {   if(a[i] < a[j]) {    int t = a[i];    a[i] = a[j];    a[j] = t;    for(i++, j = a.length - 1; i < j; ++i, --j) {    t = a[i];    a[i] = a[j];    a[j] = t;    }    return true;   }   }  }  }  return false; }   static void shuffle(int[] a) {  Random r = new Random();  for(int i = a.length - 1; i > 0; --i) {  int si = r.nextInt(i);  int t = a[si];  a[si] = a[i];  a[i] = t;  } }  static void shuffle(long[] a) {  Random r = new Random();  for(int i = a.length - 1; i > 0; --i) {  int si = r.nextInt(i);  long t = a[si];  a[si] = a[i];  a[i] = t;  } }  static int lower_bound(int[] a, int n, int k) {  int s = 0;  int e = n;  int m;  while (e - s > 0) {  m = (s + e) / 2;  if (a[m] < k)   s = m + 1;  else   e = m;  }  return e; } static int lower_bound(long[] a, int n, long k) {  int s = 0;  int e = n;  int m;  while (e - s > 0) {  m = (s + e) / 2;  if (a[m] < k)   s = m + 1;  else   e = m;  }  return e; }  static int gcd(int a, int b) {  return b == 0 ? a : gcd(b, a % b); } static long gcd(long a, long b) {  return b == 0 ? a : gcd(b, a % b); }  static class Pair implements Comparable<Pair> {  int first, second;   public Pair(int first, int second) {  super();  this.first = first;  this.second = second;  }   @Override  public int compareTo(Pair o) {  return this.first != o.first ? this.first - o.first : this.second - o.second;  }   @Override  public int hashCode() {  final int prime = 31;  int result = 1;  result = prime * result + first;  result = prime * result + second;  return result;  }   @Override  public boolean equals(Object obj) {  if (this == obj)   return true;  if (obj == null)   return false;  if (getClass() != obj.getClass())   return false;  Pair other = (Pair) obj;  if (first != other.first)   return false;  if (second != other.second)   return false;  return true;  } } }    class InputReader {  private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars;  public InputReader(InputStream st) {  this.stream = st; }  public int read() {  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 = read();  while (isSpaceChar(c)) {  c = read();  }  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  int res = 0;  do {  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 {  res *= 10;  res += c - '0';  c = read();  } while (!isSpaceChar(c));  return res * sgn; }  public int[] nextIntArray(int n) {  int a[] = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  return a; }  public String readString() {  int c = read();  while (isSpaceChar(c)) {  c = read();  }  StringBuilder res = new StringBuilder();  do {  res.appendCodePoint(c);  c = read();  } while (!isSpaceChar(c));  return res.toString(); }  public String nextLine() {  int c = read();  while (isSpaceChar(c))  c = read();  StringBuilder res = new StringBuilder();  do {  res.appendCodePoint(c);  c = read();  } while (!isEndOfLine(c));  return res.toString(); }  public 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 RespectTheRules {  private static final double E = 1E-10;  public static void main(String[] args) {   Scanner scanner = new Scanner(System.in);   double a = scanner.nextDouble();   double maxV = scanner.nextDouble();   double l = scanner.nextDouble();   double d = scanner.nextDouble();   double w = scanner.nextDouble();   double r = l - d;   w = Math.min(w, maxV);   List<WayPoint> wayPoints = new ArrayList<WayPoint>(256);   double t = 0;   wayPoints.add(new WayPoint(0));   double dW = dTo(w, 0, a);   if (leq(dW, d)) {    wayPoints.add(new WayPoint(w));    {     double v = v(w, a, (d - dW) / 2);     v = Math.min(v, maxV);     wayPoints.add(new WayPoint(v));     wayPoints.add(new WayPoint(w));     double dW_V = dTo(v, w, a);     double vDistance = d - dW - 2 * dW_V;     if (!eq(vDistance)) {      t += vDistance / maxV;     }    }    {     double dW_MaxV = dTo(maxV, w, a);     dW_MaxV = Math.min(dW_MaxV, r);     double v = v(w, a, dW_MaxV);     wayPoints.add(new WayPoint(v));     double dMaxV = r - dW_MaxV;     if (!eq(dMaxV)) {      t += dMaxV / maxV;     }    }   } else {    double dMaxV = dTo(maxV, 0, a);    dMaxV = Math.min(dMaxV, l);    double v = v(0, a, dMaxV);    wayPoints.add(new WayPoint(v));    double dv = l - dMaxV;    if (!eq(dMaxV)) {     t += dv / maxV;    }   }   for (int i = 1; i < wayPoints.size(); ++i) {    double v0 = wayPoints.get(i - 1).v;    double v = wayPoints.get(i).v;    t += Math.abs(tTo(v, v0, a));   }   System.out.println(t);  }  static double tTo(double v, double v0, double a) {   return (v - v0) / a;  }  static double dTo(double v, double v0, double a) {   return (v * v - v0 * v0) / (2 * a);  }  static double v(double v0, double a, double d) {   return Math.sqrt(2 * d * a + v0 * v0);  }  static boolean eq(double value) {   return Math.abs(value) <= E;  }  static boolean l(double v) {   return v < -E;  }  static boolean leq(double v) {   return l(v) || eq(v);  }  static boolean leq(double one, double another) {   return leq(one - another);  }  static class WayPoint {   double v;   WayPoint(double v) {    this.v = v;   }  } }
6	public class Main {  static int MOD = 1000000007;              void solve() throws IOException {   int[] nT = ril(2);   int n = nT[0];   int T = nT[1];   int[][] tg = new int[n][];   for (int i = 0; i < n; i++) tg[i] = ril(2);           int[][][] dp = new int[T+1][1 << n][3];   for (int ti = 1; ti <= T; ti++) {    for (int mask = 1; mask <= (1 << n); mask++) {              for (int j = 0; j < n; j++) {      if (((1 << j) & mask) == 0) continue;      int time = tg[j][0];      int genre = tg[j][1]-1;      if (ti - time < 0) continue;      long base = dp[ti][mask][genre];      long add = 0;      if (ti - time == 0) {                    add = 1;      } else {       for (int g = 0; g < 3; g++) add += dp[ti-time][mask ^ (1 << j)][g];       add -= dp[ti-time][mask ^ (1 << j)][genre];      }      dp[ti][mask][genre] = (int) ((base + add) % MOD);     }    }   }   long ans = 0;   for (int g = 0; g < 3; g++) ans += dp[T][(1 << n)-1][g];   pw.println(ans % MOD);  }       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter pw = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {   Main m = new Main();   m.solve();   m.close();  }  void close() throws IOException {   pw.flush();   pw.close();   br.close();  }  int ri() throws IOException {   return Integer.parseInt(br.readLine().trim());  }  long rl() throws IOException {   return Long.parseLong(br.readLine().trim());  }  int[] ril(int n) throws IOException {   int[] nums = new int[n];   int c = 0;   for (int i = 0; i < n; i++) {    int sign = 1;    c = br.read();    int x = 0;    if (c == '-') {     sign = -1;     c = br.read();    }    while (c >= '0' && c <= '9') {     x = x * 10 + c - '0';     c = br.read();    }    nums[i] = x * sign;   }   while (c != '\n' && c != -1) c = br.read();   return nums;  }  long[] rll(int n) throws IOException {   long[] nums = new long[n];   int c = 0;   for (int i = 0; i < n; i++) {    int sign = 1;    c = br.read();    long x = 0;    if (c == '-') {     sign = -1;     c = br.read();    }    while (c >= '0' && c <= '9') {     x = x * 10 + c - '0';     c = br.read();    }    nums[i] = x * sign;   }   while (c != '\n' && c != -1) c = br.read();   return nums;  }  int[] rkil() throws IOException {   int sign = 1;   int c = br.read();   int x = 0;   if (c == '-') {    sign = -1;    c = br.read();   }   while (c >= '0' && c <= '9') {    x = x * 10 + c - '0';    c = br.read();   }   return ril(x);  }  long[] rkll() throws IOException {   int sign = 1;   int c = br.read();   int x = 0;   if (c == '-') {    sign = -1;    c = br.read();   }   while (c >= '0' && c <= '9') {    x = x * 10 + c - '0';    c = br.read();   }   return rll(x);  }  char[] rs() throws IOException {   return br.readLine().toCharArray();  }  void sort(int[] A) {   Random r = new Random();   for (int i = A.length-1; i > 0; i--) {    int j = r.nextInt(i+1);    int temp = A[i];    A[i] = A[j];    A[j] = temp;   }   Arrays.sort(A);  }  void printDouble(double d) {   pw.printf("%.16f", d);  } }
3	public class SameSumBlocks {  public static void main(String[] args) throws Exception {   FastScanner sc = new FastScanner();   PrintWriter out = new PrintWriter(System.out);   int N = sc.nextInt();   int[] pre = new int[N + 1];   for (int i = 1; i <= N; i++) {    pre[i] = pre[i - 1] + sc.nextInt();   }   var sums = new ArrayList<Pair>();   for (int i = 1; i <= N; i++) {    for (int j = i; j <= N; j++) {     int sum = pre[j] - pre[i - 1];     sums.add(new Pair(i, j, sum));    }   }   Collections.sort(sums, (p1, p2) -> p1.sum - p2.sum != 0 ? p1.sum - p2.sum : p1.r - p2.r);   var ans = new ArrayList<Pair>();   int i = 0;   while (i < sums.size()) {    int j = i;    var group = new ArrayList(List.of(sums.get(i)));    int last = sums.get(i).r;    while (j + 1 < sums.size() && sums.get(j + 1).sum == sums.get(j).sum) {     if (sums.get(j + 1).l > last) {      group.add(sums.get(j + 1));      last = sums.get(j + 1).r;     }     j++;    }    if (group.size() > ans.size()) {     ans = group;    }    i = j + 1;   }   out.println(ans.size());   for (Pair p : ans) {    out.println(p);   }   out.close();  }  static class Pair {   int l, r, sum;   public Pair(int ll, int rr, int ss) {    l = ll; r = rr; sum = ss;   }   public String toString() {    return l + " " + r;   }  }  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 int[] nextInts(int N) {    int[] res = new int[N];    for (int i = 0; i < N; i++) {     res[i] = (int) nextLong();    }    return res;   }   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;   }   public String next() {    StringBuilder res = new StringBuilder();    while(c<=32)c=getChar();    while(c>32) {     res.append(c);     c=getChar();    }    return res.toString();   }   public String nextLine() {    StringBuilder res = new StringBuilder();    while(c<=32)c=getChar();    while(c!='\n') {     res.append(c);     c=getChar();    }    return res.toString();   }   public boolean hasNext() {    if(c>32)return true;    while(true) {     c=getChar();     if(c==NC)return false;     else if(c>32)return true;    }   }  } }
2	public class run{  public static void main(String args[]){   Scanner in = new Scanner(System.in);   long n = in.nextInt();   long k = in.nextInt();   long ans = (-3 + (long)Math.sqrt(9+8*(n+k)))/2;   System.out.println(n-ans);  } }
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();  } }
1	public class AMatchLists {   public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int N = in.nextInt();   HashMap<String, Integer> map = new HashMap<>();   for(int i=0; i<N; i++){    String str = in.next();    if(map.get(str)==null){     map.put(str, 0);    }    map.put(str, map.get(str)+1);   }   HashMap<String, Integer> map2 = new HashMap<>();   for(int i=0; i<N; i++){    String str = in.next();    if(map.get(str)!=null){     if(map.get(str)==1)      map.remove(str);     else      map.put(str, map.get(str)-1);    }    else{     if(map2.get(str)==null){      map2.put(str, 0);     }     map2.put(str, map2.get(str)+1);    }   }   int[] count= {0};   map2.forEach((key, value)->{     count[0] += value;     });   System.out.println(count[0]);     } }
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 int[][] packD(int n, int[] from, int[] to) {   int[][] g = new int[n][];   int[] p = new int[n];   for (int f : from) if(f != -1) p[f]++;   for (int i = 0; i < n; i++) g[i] = new int[p[i]];   for (int i = 0; i < from.length; i++) if(from[i] != -1) {g[from[i]][--p[from[i]]] = to[i];}   return g;  }  static void shuffle(int[] a)  {   int n = a.length;   for(int i = 0; i < n; i++)   {    int r = i + (int)(Math.random() * (n - i));    int tmp = a[i];    a[i] = a[r];    a[r] = tmp;   }  }  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 String nextLine() throws IOException {return br.readLine();}   public boolean ready() throws IOException {return br.ready();}  } }
1	public class Test5 {  public static void main(String[] z){   StreamTokenizer st = new StreamTokenizer(new InputStreamReader(System.in));   PrintWriter pw = new PrintWriter(System.out);   Scanner s = new Scanner(System.in);   int a = s.nextInt(), o=0;   String i = "";   ArrayList<String> l1 = new ArrayList<>(), l2 = new ArrayList<>();   for(int q=0; q<a; q++){    l1.add(s.next());   }   for(int q=0; q<a; q++){    i = s.next();    if(l1.contains(i)) l1.remove(i);    else l2.add(i);   }   Collections.sort(l1);   Collections.sort(l2);   for(int q=0; q<l1.size(); q++){    if(l1.get(q).charAt(l1.get(q).length()-1)!=l2.get(q).charAt(l2.get(q).length()-1)) o++;   }   System.out.println(o);   pw.flush();  }  static class PyraSort {   private static int heapSize;   public static void sort(int[] a) {    buildHeap(a);    while (heapSize > 1) {     swap(a, 0, heapSize - 1);     heapSize--;     heapify(a, 0);    }   }   private static void buildHeap(int[] a) {    heapSize = a.length;    for (int i = a.length / 2; i >= 0; i--) {     heapify(a, i);    }   }   private static void heapify(int[] a, int i) {    int l = 2 * i + 2;    int r = 2 * i + 1;    int largest = i;    if (l < heapSize && a[i] < a[l]) {     largest = l;    }    if (r < heapSize && a[largest] < a[r]) {     largest = r;    }    if (i != largest) {     swap(a, i, largest);     heapify(a, largest);    }   }   private static void swap(int[] a, int i, int j) {    a[i] ^= a[j] ^= a[i];    a[j] ^= a[i];   }  } }
4	public class A023 { public static void main(String[] args) {  System.out.println(f()); }  static int f() {  Scanner in = new Scanner(System.in);  String line = in.next();  for (int length = line.length(); length > 0; length--) {  for (int start = 0; start + length <= line.length(); start++) {   if(line.indexOf(line.substring(start,start+length),start+1)>=0) {   return length;   }  }  }  return 0; } }
2	public class C {  public static void main(String[] args) throws Exception {   BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));     PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));     StringTokenizer st = new StringTokenizer(bf.readLine());      long n = Long.parseLong(st.nextToken());   long k = Long.parseLong(st.nextToken());   int mod = 1000000007;   if(n == 0) {   out.println(0);   out.close(); System.exit(0);   }   n %= mod;   long ans = exp(2, (int)((k+1) % (mod-1)), mod);   ans = (1L*ans * n) % mod;   ans = ans + mod + 1 - exp(2, (int)((k) % (mod-1)), mod);   ans %= mod;   out.println(ans);      out.close(); System.exit(0);  }  public static int exp(int base, int e, int mod) {  if(e == 0) return 1;  if(e == 1) return base;  int val = exp(base, e/2, mod);  int ans = (int)(1L*val*val % mod);  if(e % 2 == 1)   ans = (int)(1L*ans*base % mod);  return ans;  } }
0	public class Main {  public static void main(String[] args) throws IOException {  new Main().run(); }  BufferedReader in; PrintWriter out; StringTokenizer st = new StringTokenizer("");  private void run() throws IOException {  if (new File("input.txt").exists())  in = new BufferedReader(new FileReader("input.txt"));  else  in = new BufferedReader(new InputStreamReader(System.in));  if (new File("output.txt").exists())  out = new PrintWriter("output.txt");  else  out = new PrintWriter(System.out);  solve();  in.close();  out.close(); }  void solve() throws IOException {  long l = nextLong();  long r = nextLong();  l += l % 2;  if (l + 2 > r)  out.println("-1");  else {  out.println(l + " " + (l + 1) + " " + (l + 2));  } }  String nextLine() throws IOException {  st = new StringTokenizer("");  return in.readLine(); }  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()); }  boolean EOF() throws IOException {  while (!st.hasMoreTokens()) {  String str = in.readLine();  if (str == null)   return true;  st = new StringTokenizer(str);  }  return false; } }
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]);  }  }
0	public class ElevatorOrStairs {  private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); private static final OutputStreamWriter writer = new OutputStreamWriter(System.out);  public static void main(String...strings) throws Exception {  String[] specs = reader.readLine().split(" ");   int x = Integer.parseInt(specs[0]);  int y = Integer.parseInt(specs[1]);  int z = Integer.parseInt(specs[2]);  int t1 = Integer.parseInt(specs[3]);  int t2 = Integer.parseInt(specs[4]);  int t3 = Integer.parseInt(specs[5]);   reader.close();  String ans = solve(x, y, z, t1, t2, t3);  writer.append(ans);  writer.flush();  writer.close(); }  private static String solve(int x, int y, int z, int t1, int t2, int t3) {  int time_using_stairs = Math.abs(x - y) * t1;  int elevator_time_between_floor = Math.abs(x - z) * t2;  int elevator_from_z_to_x = elevator_time_between_floor + 2*t3;    int time_using_elevator = elevator_from_z_to_x + (Math.abs(x - y) * t2) + t3;    if(time_using_elevator <= time_using_stairs) {   return "YES";  }  return "NO"; } }
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);   E1RotateColumnsEasyVersion solver = new E1RotateColumnsEasyVersion();   solver.solve(1, in, out);   out.close();  }  static class E1RotateColumnsEasyVersion {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int t = in.nextInt();    for (int i = 0; i < t; i++) {     solve(in, out);    }   }   private void solve(InputReader in, PrintWriter out) {    int n = in.nextInt(), m = in.nextInt();    int[][] a = new int[n][];    for (int i = 0; i < n; i++) {     a[i] = in.readIntArray(m);    }    out.println(solve(n, m, a));   }   private int solve(int n, int m, int[][] a) {    Cell[] cells = new Cell[n * m];    for (int i = 0, index = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      cells[index++] = new Cell(i, j, a[i][j]);      if (index == cells.length)       break;     }    }    Arrays.sort(cells, Comparator.comparingInt(cell -> -cell.x));    HashSet<Integer> colset = new HashSet<>();    for (int i = 0; colset.size() < n && colset.size() < m; i++) {     colset.add(cells[i].j);    }    ArrayList<Integer> cols = new ArrayList<>();    cols.addAll(colset);    int answer = 0;    for (long perm = 0; perm < pow(n, cols.size() - 1); perm++) {     long p = perm;     int[] offset = new int[cols.size()];     for (int col = 0; col < cols.size(); col++) {      offset[col] = (int) (p % n);      p /= n;     }     int sum = 0;     for (int row = 0; row < n; row++) {      int max = 0;      for (int col = 0; col < cols.size(); col++) {       int cur = a[(row + offset[col]) % n][cols.get(col)];       max = Math.max(max, cur);      }      sum += max;     }     answer = Math.max(answer, sum);    }    return answer;   }   private long pow(int base, int exponent) {    long p = 1;    for (int i = 0; i < exponent; i++) {     p *= base;    }    return p;   }   private class Cell {    final int i;    final int j;    final int x;    private Cell(int i, int j, int x) {     this.i = i;     this.j = j;     this.x = 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());   }   public int[] readIntArray(int n) {    int[] x = new int[n];    for (int i = 0; i < n; i++) {     x[i] = nextInt();    }    return x;   }  } }
2	public class Probram3 {  public static int get(long n) {  int sum = 0;  while(n != 0) {  sum += n % 10;  n = n / 10;  }  return sum; }  public static void main(String[] args) {  Scanner scanner = new Scanner(System.in);  long n = scanner.nextLong();  long s = scanner.nextLong();  long l = 1;  long r = Long.MAX_VALUE;  long index = 0;  while(l <= r) {  long mid = (l + r) / 2;  if(mid - get(mid) >= s) {   index = mid;   r = mid - 1;  }else{   l = mid + 1;  }  }  System.out.println(Math.max(0, n-index+1)); } }
0	public final class FollowTrafficRules {  private static double[] acce(double i, double a, double v) {   double[] r = new double[2];   r[0] = (v - i)/a;   r[1] = 1d/2d * a * pow(r[0], 2) + i * r[0];   return r;  }  private static double solve(double i, double a, double l) {   double e = sqrt(pow(i, 2) + 2d * a * l);   e = a > 0 ? e : -1d * e;   return (e - i)/a;  }  private static double time(double i, double a, double v, double l) {   double[] r = acce(i, a, v);   if (r[1] >= l) return solve(i, a, l);   return r[0] + (l - r[1])/v;  }  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   double a = sc.nextDouble();   double v = sc.nextDouble();   double l = sc.nextDouble();   double d = sc.nextDouble();   double w = sc.nextDouble();   double t = 0d;   if (v <= w) t = time(0, a, v, l);   else {    double[] r = acce(0, a, w);    if (r[1] >= d) t = time(0, a, v, l);    else {     t += r[0];     t += 2d * time(w, a, v, (d - r[1])/2d);     t += time(w, a, v, l - d);    }   }   System.out.println(t);  } }
0	public class Mai {  public static void main(String[] args) throws IOException{  Scanner cin = new Scanner(System.in);   int t, n, m;   t = cin.nextInt();   while(t > 0) {  t--;  int sum = 0;  n = cin.nextInt();  m = cin.nextInt();  while(n > 0 && m > 0) {   if(n < m) {   int k = n;   n = m;   m = k;   }   sum += n / m; n %= m;  }    System.out.println(sum);  } } }
3	public class Main { public static class node implements Comparable<node> {  int l,r;  node(){}  node(int l,int r) {  this.l=l;  this.r=r;  }  @Override  public int compareTo(node rhs) {  return r-rhs.r;  } } public static void main(String[] args) throws IOException {  BufferedReader in=new BufferedReader(new InputStreamReader(System.in));  PrintWriter out=new PrintWriter(System.out);  StringTokenizer sa=new StringTokenizer(in.readLine());  int n=Integer.parseInt(sa.nextToken());  sa=new StringTokenizer(in.readLine());  int[] a=new int[n];  TreeMap<Integer,ArrayList<node>> mp=new TreeMap();  for (int i=0;i<n;++i) a[i]=Integer.parseInt(sa.nextToken());  for (int i=0;i<n;++i) {  int tmp=0;  for (int j=i;j<n;++j) {   tmp+=a[j];   if (!mp.containsKey(tmp)) {   ArrayList t=new ArrayList();   t.add(new node(i,j));   mp.put(tmp,t);   } else {   ArrayList<node> t=mp.get(tmp);   int left=0,right=t.size()-1,res=t.size();   while (left<=right) {    int mid=(left+right)>>1;    if (t.get(mid).r>=i) {    res=mid;    right=mid-1;    } else left=mid+1;   }   if (res==t.size()) t.add(new node(i,j));   else if (t.get(res).r>j) t.set(res,new node(i,j));   }  }  }  int res=0;  for (Entry<Integer,ArrayList<node>> entry:mp.entrySet())  res=Math.max(res,entry.getValue().size());  out.println(res);  for (Entry<Integer,ArrayList<node>> entry:mp.entrySet())  if (entry.getValue().size()==res) {   ArrayList<node> tmp=entry.getValue();   for (int i=0;i<tmp.size();++i)   out.printf("%d %d\n",tmp.get(i).l+1,tmp.get(i).r+1);   out.flush();   return;  } } }
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));   }  } }
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 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(); }  private static void A() throws IOException {  int t=ni();  while(t-->0) {   int n=ni(),w=ni();   a=nai(n);   int sum=0;   for(int i=0;i<n;i++)sum+=a[i];   if(sum==w) {ol("NO");continue;}   if(sum<w) {   ol("YES");   disp2(a);continue;   }   Arrays.sort(a);   int cur=0;   for(int i=n-1;i>=0;i--) {   if(cur==w) {    int tmp=a[i+1];    a[i+1]=a[i];    a[i]=tmp;    break;   }   cur+=a[i];   }   ol("YES");   disp2(a);     }    }  static void B() throws IOException {  int t=ni();  while(t-->0) {   long n=nl();   if(n%2==0) {   n/=2;   int sq=(int)Math.sqrt(n);   if(sq*sq==n&&sq!=0) {   ol("YES");continue;   }   }   if(n%2==0) {   n/=2;   int sq=(int)Math.sqrt(n);   if(sq*sq==n&&sq!=0) {   ol("YES");continue;   }   }   ol("NO");  }  }     static void C() throws IOException{   int t=ni();   while(t-->0) {   int n=ni(),m=ni(),x=ni();   int[][]a=new int[n][2];   int mx=0;   for(int i=0;i<n;i++) {   a[i][0]=ni();   a[i][1]=i;   mx=Math.max(mx, a[i][0]);   }   Arrays.sort(a,(u,v)->u[0]-v[0]);   PriorityQueue<int[]>vals=new PriorityQueue<int[]>((u,v)->u[0]-v[0]);   int[]ans=new int[n];     vals.add(new int[] {a[0][0],1});   ans[a[0][1]]=1;   for(int i=1;i<n;i++) {   if(vals.size()<m) {    ans[a[i][1]]=vals.size()+1;    vals.add(new int[] {a[i][0],vals.size()+1});    mx=Math.max(mx, a[i][0]);   }else {    int[]p=vals.poll();    vals.add(new int[] {p[0]+a[i][0],p[1]});    ans[a[i][1]]=p[1];    mx=Math.max(mx, a[i][0]+p[0]);   }   }   if(mx-vals.peek()[0]>x)ol("NO");   else {      ol("YES");   for(int i=0;i<n;i++) {    out.print(ans[i]+" ");   }   ol("");   }     }  }  private static 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 boolean isPrime(long n) {  if(n==2)return true;  if(n<2||n%2==0)return false;    for(long i=3L;i*i<n;i+=2l) {   long rem=(n%i);   if(rem==0)return false;  }  return true;  }  static void D() throws IOException {  int t=ni();  while(t-->0) {   int n=ni(),l=ni(),r=ni();   int[]occ1=new int[n+1];   a=nai(n);   for(int i=0;i<l;i++) {   occ1[a[i]]++;   }   int[]occ2=new int[n+1];   for(int i=l;i<n;i++) {   occ2[a[i]]++;   }   int base=Math.abs((n/2)-l);   int tk=0;   int[]lrg=l>r?occ1:occ2;   int[]sml=l<=r?occ1:occ2;   for(int i=0;i<=n&&tk<base;i++) {   int rem=base-tk;   int taken=Math.min(rem,     Math.max(0,(lrg[i]-sml[i])/2));   lrg[i]-=taken;   sml[i]+=taken;   tk+=taken;   }   for(int i=0;i<n&&tk<base;i++) {   if(lrg[i]<=sml[i])continue;   lrg[i]--;   sml[i]++;   tk++;   }   int c1=0,c2=0;   for(int i=0;i<=n;i++) {   if(lrg[i]>sml[i]) {    if(c1<0) {    int diff=Math.min(-c1, -sml[i]+lrg[i]);    lrg[i]-=diff;    c1+=diff;    }    int nd=lrg[i]-sml[i];    c2-=nd;    base+=nd;    sml[i]=lrg[i];   }else if(lrg[i]<sml[i]) {    if(c2<0) {    int diff=Math.min(-c2, sml[i]-lrg[i]);    sml[i]-=diff;    c2+=diff;    }    int nd=-lrg[i]+sml[i];    base+=nd;    c1-=nd;    lrg[i]=sml[i];   }   }   ol(base);  }  }  private static int bfs(int i, int j,int k) {  boolean [][]vis=new boolean[dist.length][dist[0].length];  Queue<int[]>q=new LinkedList<int[]>();  int mn=Integer.MAX_VALUE;  q.add(new int[] {i,j,0,0});  int[]dx=new int[] {-1,1,0,0};  int[]dy=new int[] {0,0,1,-1};  while(!q.isEmpty()) {   int []x=q.poll();   vis[x[0]][x[1]]=true;   int c=x[2];   if(c>k/2)continue;   if(c>0&&k%c==0&&(k/c)%2==0) {   mn=Math.min(mn,x[3]*k/c );   }   for(int a=0;a<4;a++) {   int nx=x[0]+dx[a];   int ny=x[1]+dy[a];   if(valid(nx,ny)&&!vis[nx][ny]) {    q.add(new int[] {nx,ny,c+1,x[3]+dist[x[0]][x[1]][a]});   }   }     }  return mn;  }  private static 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 void F() throws IOException {  int t=ni();  while(t-->0) {    } } static void CC() throws IOException {  for(int kk=2;kk<21;kk++) {  ol(kk+" -------");  int n=kk;  int k=n-2;  int msk=1<<k;  int[]a=new int[k];  for(int i=0;i<a.length;i++)a[i]=i+2;  int mx=1;  int ms=0;  for(int i=1;i<msk;i++) {  long prod=1;  int cnt=0;  for(int j=0;j<a.length;j++) {   if(((i>>j)&1)!=0) {   prod*=a[j];   cnt++;   }  }  if(cnt>=mx&&prod%n==1) {   mx=cnt;   ms=i;  }    }  ol(mx==1?mx:mx+1);  out.print(1+" ");  long pr=1;  for(int j=0;j<a.length;j++) {  if(((ms>>j)&1)!=0) {   out.print(a[j]+" ");   pr*=a[j];  }  }  ol("");  ol("Prod: "+pr);  ol(n+"*"+((pr-1)/n)+" + "+1);  } } static int ni() throws IOException {  return sc.nextInt(); } static double nd() throws IOException {  return sc.nextDouble(); } static long nl() throws IOException {  return sc.nextLong(); } static String ns() throws IOException {  return sc.next(); } 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 long[] nal(int n) throws IOException {  long[] a = new long[n];  for (int i = 0; i < n; i++)  a[i] = sc.nextLong();  return a; } static int[][] nmi(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]=sc.nextInt();  }  }  return a; }  static long[][] nml(int n,int m) throws IOException{  long[][]a=new long[n][m];  for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   a[i][j]=sc.nextLong();  }  }  return a; } static void o(String x) {  out.print(x); } static void ol(String x) {  out.println(x); } static void ol(int x) {  out.println(x); } static void disp1(int []a) {  for(int i=0;i<a.length;i++) {  out.print(a[i]+" ");  }  out.println(); } 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 boolean hasNext() {return st.hasMoreTokens();}  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 String nextLine() throws IOException {return br.readLine();}    public boolean ready() throws IOException {return br.ready(); }   } }
4	public class Main {  public static final DecimalFormat DF_3 = new DecimalFormat("0.000");  private static final long MOD = 1000000007;   static int[] readArray(int size, InputReader in, boolean subOne) {   int[] a = new int[size];   for (int i = 0; i < size; i++) {    a[i] = in.nextInt() + (subOne ? -1 : 0);   }   return a;  }  static long[] readLongArray(int size, InputReader in) {   long[] a = new long[size];   for (int i = 0; i < size; i++) {    a[i] = in.nextLong();   }   return a;  }  static void sortArray(int[] a) {   Random random = new Random();   for (int i = 0; i < a.length; i++) {    int randomPos = random.nextInt(a.length);    int t = a[i];    a[i] = a[randomPos];    a[randomPos] = t;   }   Arrays.sort(a);  }  private static 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;  }  private static long subMod(long x, long y, long mod) {   long res = x - y;   if (res < 0) {    return res + mod;   }   return res;  }  private static 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();  }  private static void outputArray(List<Long> ans, PrintWriter out, boolean addOne) {   StringBuilder str = new StringBuilder();   for (int j = 0; j < ans.size(); j++) {    long i = ans.get(j);    long an = i + (addOne ? 1 : 0);    str.append(an);    if (j < ans.size() - 1) {     str.append(' ');    }   }   out.println(str);  }  private 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 String nextString() {    try {     return reader.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public char nextChar() {    return next().charAt(0);   }   public String nextWord() {    return next();   }   private List<Integer>[] readTree(int n) {    return readGraph(n, n - 1);   }   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;   }  } }
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 C817 { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  long n = nl();  long s = nl();  long l = 1;  long r = n;  long ans = 0;  while(l<=r){  long mid = (l+r)/2;  long sum = 0;  long temp = mid;  while(temp!=0){   sum += temp%10;   temp/=10;  }  if(mid-sum<s){   ans = mid;   l = mid+1;  }else   r = mid - 1;  }  out.println(n-ans); }  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 Thread(null, new Runnable() {  public void run() {   try {   new C817().run();   } catch (Exception e) {   e.printStackTrace();   }  }  }, "1", 1 << 26).start(); }  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 double nd() {  return Double.parseDouble(ns()); }  private char nc() {  return (char) skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(isSpaceChar(b))) {        sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while (p < n && !(isSpaceChar(b))) {  buf[p++] = (char) b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)  map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))  ;  if (b == '-') {  minus = true;  b = readByte();  }  while (true) {  if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');  } else {   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))  ;  if (b == '-') {  minus = true;  b = readByte();  }  while (true) {  if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');  } else {   return minus ? -num : num;  }  b = readByte();  } }  private void tr(Object... o) {  System.out.println(Arrays.deepToString(o)); } }
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 long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public boolean ready() throws IOException {  return br.ready();  } } }
0	public class Main {    public static void main(String[] args) {   Scanner cin = new Scanner (System.in);   int n = cin.nextInt();   long res = 2;   long[] a = new long[4];   a[0] = 0;   a[1] = 1;   a[2] = 1;   a[3] = 2;   if (n == 1){    System.out.println("0 0 1");    return;   }   if (n == 2){    System.out.println("0 1 1");    return;   }   if (n == 0){    System.out.println("0 0 0");    return;   }     if (n == 3){    System.out.println("1 1 1");    return;   }   do{    a[3] = res;    res = a[2] + a[3];    if (res == n){     System.out.println (a[0] + " " + a[1] + " " + a[3]);     return;    }    a[0] = a[1];    a[1] = a[2];    a[2] = a[3];      }while (true);  } }
5	public class CottageVillage { public Scanner in = new Scanner(System.in); public PrintStream out = System.out;  public int n, t; public Pair[] v;  public void main() {  n = in.nextInt();  t = in.nextInt();   int i;  v = new Pair[n];  for(i=0;i<n;++i) v[i] = new Pair(in.nextInt() * 2, in.nextInt());   Arrays.sort(v);   int res = 2;  for(i=0;i+1<n;++i)  {  if(v[i].x + v[i].y + 2*t == v[i+1].x - v[i+1].y) ++res;  else if(v[i].x+v[i].y+2*t < v[i+1].x-v[i+1].y) res +=2;  }   out.println(res); }   private class Pair implements Comparable<Pair> {  public int x, y;  public Pair(int xx, int yy) { x = xx; y = yy; }  public int compareTo(Pair u)  {  if(x!=u.x) return x-u.x;  return y-u.y;  }  public String toString() { return "(" + x + "," + y + ")"; } }  public static void main(String[] args) {  (new CottageVillage()).main(); } }
6	public class CF_11D {  long[][] ways;  boolean[][] connect;  int n, m, lowestIndex, mask;   private static int HEAD_POINT_INDEX = 0;  public void solve() throws Exception {   int a, b;   long total = 0;   n = nextInt();   m = nextInt();   connect = new boolean[n][n];   ways = new long[1 << n][n];   for (int i = 0; i < m; i++) {    a = nextInt();    b = nextInt();    connect[a - 1][b - 1] = true;    connect[b - 1][a - 1] = true;   }   for (int i = 0; i < n; i++) {    ways[1 << i][i] = 1;   }   for (mask = 1; mask < 1 << n; mask++) {    int tmp = mask, cnt = 0;    while (tmp > 0) {     tmp = tmp & (tmp - 1);     cnt++;    }    lowestIndex = -1;    for (int endPointIndex = 0; endPointIndex < n; endPointIndex++) {     if ((mask & 1 << endPointIndex) != 0) {      if (lowestIndex < 0) {       lowestIndex = endPointIndex;      } else if (lowestIndex != endPointIndex) {       for (int i = lowestIndex; i < n; i++)        if (connect[i][endPointIndex]) {         ways[mask][endPointIndex] += ways[mask & ~(1 << endPointIndex)][i];        }       if (connect[endPointIndex][lowestIndex] && cnt > 2) {        total += ways[mask][endPointIndex];       }      }     }    }   }   writer.println(total / 2);  }  public static void main(String[] args) {   new CF_11D().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 Main {  public static void main(String[] args) throws Exception {     in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);     int n = nextInt(), k = nextInt();   int[] primes = new int[n + 1];   for (int i = 2; i <= n; i++) {    if (primes[i] == 0) {     primes[i] = 1;     for (int j = i * 2; j <= n; j += i)      primes[j] = 2;    }   }   ArrayList<Integer> res = new ArrayList<Integer>();   HashSet<Integer> p = new HashSet<Integer>(), v = new HashSet<Integer>();   for (int i = 2; i <= n; i++) {    if (primes[i] == 1) {     res.add(i);     p.add(i);    }   }   int c = 0;   if (res.size() >= 3) {    for (int i = 2; i < res.size(); i++) {     int zz = res.get(i - 2) + res.get(i - 1) + 1;     if (p.contains(zz))      v.add(zz);    }    c = v.size();   }   if (c >= k) {    out.println("YES");   } else {    out.println("NO");   }   in.close();   out.close();  }  static BufferedReader in;  static PrintWriter out;  static StringTokenizer st;  static String nextString() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  static int nextInt() throws NumberFormatException, IOException {   return Integer.parseInt(nextString());  }  static double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextString());  } }
6	public class Main {  static class Reader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;   public Reader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public Reader(String file_name) throws IOException   {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public String readLine() throws IOException   {    byte[] buf = new byte[64];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }   public int nextInt() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do    {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (c == '.')    {     while ((c = read()) >= '0' && c <= '9')     {      ret += (c - '0') / (div *= 10);     }    }    if (neg)     return -ret;    return ret;   }   private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }   private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }   public void close() throws IOException   {    if (din == null)     return;    din.close();   }  }   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[i]) + " " + (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]);   }  } }
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)));  } }
4	public class C { public static void main(String[] args) throws Exception {  final int fuck = 2001;  Scanner in = new Scanner(new File("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  int n = in.nextInt(), m = in.nextInt();  int[] D = new int[ fuck*fuck ], Q = new int[ fuck*(fuck + 1) ],  dx = new int[] { 1, -1, 0, 0},  dy = new int[] { 0, 0, -1, 1};  Arrays.fill(D, -1);  int H = -1, T = 0;  int k = in.nextInt(), ans = 0;  for(int i = 0; i < k; ++i) {  int x = in.nextInt(), y = in.nextInt();  D[x * fuck + y] = 0;   ++H; H %= Q.length;  ans = Q[H] = x * fuck + y;  }   while(H >= T) {  int idx = Q[T++]; T %= Q.length;  int x = idx / fuck, y = idx % fuck;  for(int i = 0; i < 4; ++i) {   int wtf = (dx[i] + x) * fuck + (dy[i] + y);   if(dx[i] + x <= n && dx[i] + x >= 1 && dy[i] + y <= m && dy[i] + y >= 1 && D[wtf] == -1) {   D[wtf] = D[idx] + 1;   ++H; H %= Q.length;   Q[H] = wtf;    if(D[wtf] >= D[ans])    ans = wtf;   }  }  }  out.println((ans / fuck) + " " + (ans % fuck));  out.close();  in.close(); } }
0	public class rgb {   public static void main(String[] args) throws IOException {   System.out.print(25);   return ;  } }
0	public class cf2 { static final double EPS = 1e-9;  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);    int xr1=sc.nextInt(), yr1=sc.nextInt(), xr2=sc.nextInt(),yr2=sc.nextInt();  int xr3=sc.nextInt(), yr3=sc.nextInt(), xr4=sc.nextInt(),yr4=sc.nextInt();   Point pr1 = new Point(xr1, yr1);  Point pr2 = new Point(xr2, yr2);  Point pr3 = new Point(xr3, yr3);  Point pr4 = new Point(xr4, yr4);   LineSegment lr1 = new LineSegment(pr1, pr2);  LineSegment lr2 = new LineSegment(pr2, pr3);  LineSegment lr3 = new LineSegment(pr3, pr4);  LineSegment lr4 = new LineSegment(pr4, pr1);     int xd1=sc.nextInt(), yd1=sc.nextInt(), xd2=sc.nextInt(),yd2=sc.nextInt();  int xd3=sc.nextInt(), yd3=sc.nextInt(), xd4=sc.nextInt(),yd4=sc.nextInt();   Point p1 = new Point(xd1, yd1);  Point p2 = new Point(xd2, yd2);  Point p3 = new Point(xd3, yd3);  Point p4 = new Point(xd4, yd4);   Point [] pt = new Point [5];  pt[0]=p1; pt[1]=p2; pt[2]=p3; pt[3]=p4; pt[4]=p1;  Polygon pg = new Polygon(pt);   if(pg.inside(pr1)||pg.inside(pr2)||pg.inside(pr3)||pg.inside(pr4)) {  System.out.println("YES");  return;  }    LineSegment ld1 = new LineSegment(p1, p2);  LineSegment ld2 = new LineSegment(p2, p3);  LineSegment ld3 = new LineSegment(p3, p4);  LineSegment ld4 = new LineSegment(p4, p1);   Rectangle rec = new Rectangle(new Point(Math.min(Math.min(xr3,xr4),Math.min(xr1,xr2)), Math.min(Math.min(yr3,yr4),Math.min(yr1,yr2))),   new Point(Math.max(Math.max(xr3,xr4),Math.max(xr1,xr2)), Math.max(Math.max(yr3,yr4),Math.max(yr1,yr2))) );   if(rec.contains(p1)||rec.contains(p2)||rec.contains(p3)||rec.contains(p4)) {  System.out.println("YES");   return;  }   if(ld1.intersect(lr1)||ld1.intersect(lr3)||ld1.intersect(lr3)||ld1.intersect(lr4)) {  System.out.println("YES");   return;  }   if(ld2.intersect(lr1)||ld2.intersect(lr3)||ld2.intersect(lr3)||ld2.intersect(lr4)) {  System.out.println("YES");   return;  }   if(ld3.intersect(lr1)||ld3.intersect(lr3)||ld3.intersect(lr3)||ld3.intersect(lr4)) {  System.out.println("YES");   return;  }   if(ld4.intersect(lr1)||ld4.intersect(lr3)||ld4.intersect(lr3)||ld4.intersect(lr4)) {  System.out.println("YES");   return;  }   System.out.println("NO");       }  public static class Polygon {    static final double EPS = 1e-9;   Point[] g;     Polygon(Point[] o) { g = o; }  double perimeter()  {  double sum = 0.0;  for(int i = 0; i < g.length - 1; ++i)   sum += g[i].dist(g[i+1]);  return sum;  }   double area()   {  double area = 0.0;  for(int i = 0; i < g.length - 1; ++i)   area += g[i].x * g[i+1].y - g[i].y * g[i+1].x;  return Math.abs(area) / 2.0;   }     boolean inside(Point p)  {  double sum = 0.0;  for(int i = 0; i < g.length - 1; ++i)  {   double angle = Point.angle(g[i], p, g[i+1]);   if((Math.abs(angle) < EPS || Math.abs(angle - Math.PI) < EPS) && p.between(g[i], g[i+1]))   return true;   if(Point.ccw(p, g[i], g[i+1]))   sum += angle;   else   sum -= angle;  }   return Math.abs(2 * Math.PI - Math.abs(sum)) < EPS;   }        Point centroid()   {  double cx = 0.0, cy = 0.0;  for(int i = 0; i < g.length - 1; i++)  {   double x1 = g[i].x, y1 = g[i].y;   double x2 = g[i+1].x, y2 = g[i+1].y;   double f = x1 * y2 - x2 * y1;   cx += (x1 + x2) * f;   cy += (y1 + y2) * f;  }  double area = area();   cx /= 6.0 * area;  cy /= 6.0 * area;  return new Point(cx, cy);  } }   static class LineSegment {  Point p, q;   LineSegment(Point a, Point b) { p = a; q = b; }    boolean intersect(LineSegment ls)  {  Line l1 = new Line(p, q), l2 = new Line(ls.p, ls.q);  if(l1.parallel(l2))  {   if(l1.same(l2))   return p.between(ls.p, ls.q) || q.between(ls.p, ls.q) || ls.p.between(p, q) || ls.q.between(p, q);   return false;  }  Point c = l1.intersect(l2);  return c.between(p, q) && c.between(ls.p, ls.q);  }  }   static class Rectangle {  static final double EPS = 1e-9;   Point ll, ur;  Rectangle(Point a, Point b) { ll = a; ur = b; }  double area() { return (ur.x - ll.x) * (ur.y - ll.y); }  boolean contains(Point p)  {  return p.x <= ur.x + EPS && p.x + EPS >= ll.x && p.y <= ur.y + EPS && p.y + EPS >= ll.y;  }  Rectangle intersect(Rectangle r)  {  Point ll = new Point(Math.max(this.ll.x, r.ll.x), Math.max(this.ll.y, r.ll.y));  Point ur = new Point(Math.min(this.ur.x, r.ur.x), Math.min(this.ur.y, r.ur.y));  if(Math.abs(ur.x - ll.x) > EPS && Math.abs(ur.y - ll.y) > EPS && this.contains(ll) && this.contains(ur) && r.contains(ll) && r.contains(ur))   return new Rectangle(ll, ur);  return null;  }  }  static class Line {  static final double INF = 1e9, EPS = 1e-9;   double a, b, c;   Line(Point p, Point q)  {  if(Math.abs(p.x - q.x) < EPS) { a = 1; b = 0; c = -p.x; }  else  {   a = (p.y - q.y) / (q.x - p.x);   b = 1.0;   c = -(a * p.x + p.y);  }     }   Line(Point p, double m) { a = -m; b = 1; c = -(a * p.x + p.y); }    boolean parallel(Line l) { return Math.abs(a - l.a) < EPS && Math.abs(b - l.b) < EPS; }   boolean same(Line l) { return parallel(l) && Math.abs(c - l.c) < EPS; }   Point intersect(Line l)  {  if(parallel(l))   return null;  double x = (b * l.c - c * l.b) / (a * l.b - b * l.a);  double y;  if(Math.abs(b) < EPS)   y = -l.a * x - l.c;  else   y = -a * x - c;    return new Point(x, y);  }   Point closestPoint(Point p)  {  if(Math.abs(b) < EPS) return new Point(-c, p.y);  if(Math.abs(a) < EPS) return new Point(p.x, -c);  return intersect(new Line(p, 1 / a));  }    }  public static class Vector {  double x, y;   Vector(double a, double b) { x = a; y = b; }  Vector(Point a, Point b) { this(b.x - a.x, b.y - a.y); }  Vector scale(double s) { return new Vector(x * s, y * s); }      double dot(Vector v) { return (x * v.x + y * v.y); }  double cross(Vector v) { return x * v.y - y * v.x; }  double norm2() { return x * x + y * y; }  Vector reverse() { return new Vector(-x, -y); }  Vector normalize()  {   double d = Math.sqrt(norm2());  return scale(1 / d);  }  }   static class Point implements Comparable<Point>{  static final double EPS = 1e-9;  double x, y;       Point(double a, double b) { x = a; y = b; }    public int compareTo(Point p)  {  if(Math.abs(x - p.x) > EPS) return x > p.x ? 1 : -1;  if(Math.abs(y - p.y) > EPS) return y > p.y ? 1 : -1;  return 0;  }  static double angle(Point a, Point o, Point b)  {  Vector oa = new Vector(o, a), ob = new Vector(o, b);  return Math.acos(oa.dot(ob) / Math.sqrt(oa.norm2() * ob.norm2()));  }  static boolean ccw(Point p, Point q, Point r)  {  return new Vector(p, q).cross(new Vector(p, r)) > 0;  }   public double dist(Point p) { return Math.sqrt(sq(x - p.x) + sq(y - p.y)); }   static double sq(double x) { return x * x; }   Point rotate(double angle)  {  double c = Math.cos(angle), s = Math.sin(angle);  return new Point(x * c - y * s, x * s + y * c);  }       boolean between(Point p, Point q)  {  return x < Math.max(p.x, q.x) + EPS && x + EPS > Math.min(p.x, q.x)   && y < Math.max(p.y, q.y) + EPS && y + EPS > Math.min(p.y, q.y);  }        }  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 Scanner(String file) throws FileNotFoundException {  br = new BufferedReader(new FileReader(file));  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public long nextlong() throws IOException {  String x = next();  StringBuilder sb = new StringBuilder("0");  long res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-') {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.') {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public boolean ready() throws IOException {  return br.ready();  }  } }
6	public class Solution {   static StringTokenizer st; static BufferedReader reader; public static void main(String[] args) throws IOException {  reader = new BufferedReader(new InputStreamReader(System.in));  int xs = NextInt();  int ys = NextInt();  int n = NextInt();   int x[] = new int[n];  int y[] = new int[n];  int single[] = new int[n];  int pair[][] = new int[n][n];  for (int i = 0; i < n; ++i) {  x[i] = NextInt();  y[i] = NextInt();  }  for (int i = 0; i < n; ++i)   single[i] = 2 * dist(xs, ys, x[i], y[i]);  for (int i = 0; i < n; ++i)  for (int j = 0; j < n; ++j)   pair[i][j] = dist(xs, ys, x[i], y[i]) +     dist(x[i], y[i], x[j], y[j]) +     dist(x[j], y[j], xs, ys);  int dp[] = new int[1 << n];  int prev[] = new int[1 << n];  for (int mask = 0; mask < (1 << n); ++mask) {  int p = -1;  for (int i = 0; i < n; ++i)   if (((mask >> i) & 1) != 0) {   p = i;   break;   }  if (p == -1) continue;  dp[mask] = dp[mask ^ (1 << p)] + single[p];  prev[mask] = p;  for (int j = p + 1; j < n; ++j) {   if (((mask >> j) & 1) != 0) {   int res = pair[p][j] + dp[mask ^ (1 << p) ^ (1 << j)];   if (res < dp[mask]) {    dp[mask] = res;    prev[mask] = p + 100 * j;   }   }  }  }  int cur = (1 << n) - 1;  System.out.printf("%d\n0 ", dp[cur]);  while(cur != 0) {  if (prev[cur] < 100) {   System.out.printf("%d %d ", prev[cur] + 1, 0);   cur ^= (1 << prev[cur]);  } else {   int i = prev[cur] / 100;   int j = prev[cur] % 100;   System.out.printf("%d %d %d ", i + 1, j + 1, 0);   cur = cur ^ (1 << i) ^ (1 << j);  }  } } static int dist(int x0, int y0, int x1, int y1) {  return (x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1);  } static int NextInt() throws NumberFormatException, IOException {  return Integer.parseInt(NextToken()); } static String NextToken() throws IOException {  while(st == null || !st.hasMoreTokens()) {  st = new StringTokenizer(reader.readLine());  }  return st.nextToken(); } }
1	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 {  public void solve(int testNumber, InputReader in, PrintWriter out) {   int n=in.nextInt();   int k=in.nextInt();   int arr[]=new int[n];   in.getArray(arr);   int ansl=-1;   int ansr=n;   int occ[]=new int[100100];   boolean f[]=new boolean[n];   Arrays.fill(occ,0);   Arrays.fill(f,true);   int pk=0;   for (int l=0,r=0;r<n&&l<n;){    int num=arr[r];    if(f[r]){     f[r]=false;     occ[num]++;     if(occ[num]==1){      pk++;     }    }       if(pk<k){     r++;    }    else if (pk==k){     if((r-l)<=(ansr-ansl)){      ansl=l+1;      ansr=r+1;     }     num=arr[l];     occ[num]--;     if(occ[num]==0){      pk--;     }     l++;    }    else {     num=arr[l];     occ[num]--;     if(occ[num]==0){      pk--;     }     l++;    }   }   if(ansl==-1){    ansr=-1;   }   out.println(ansl+" "+ansr);  } } 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());  }  public void getArray(int arr[]){   for(int i=0;i<arr.length;i++){    arr[i]=nextInt();   }  }  }
0	public class MainA {   static StringTokenizer ST;  static BufferedReader IN;  static BufferedWriter OUT;  static {   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 void ll() throws IOException { ST = new StringTokenizer(nlnt()); }  static void ll(String del) throws IOException { ST = new StringTokenizer(nlnt(), del); }  static void ll(String s, String del) throws IOException { ST = new StringTokenizer(s, del); }  static void ll(String s, char c) throws IOException { ST = new StringTokenizer(s); }   static int tlen() { return ST.countTokens(); }  static boolean hn() { return ST.hasMoreTokens(); }  static String n() throws IOException { return ST.nextToken(); }  static String nln() throws IOException {   String l;   while((l = IN.readLine()) != null && l.trim().length() == 0) {}   return l;  }  static String nlnt() throws IOException {   String l;   while((l = IN.readLine()) != null && (l = l.trim()).length() == 0) {}   return l;  }  static boolean nbl() throws IOException { return Boolean.parseBoolean(ST.nextToken()); }  static byte nb() throws IOException { return Byte.parseByte(ST.nextToken()); }  static byte nb(int radix) throws IOException { return Byte.parseByte(ST.nextToken(), radix); }  static double nd() throws IOException { return Double.parseDouble(ST.nextToken()); }  static float nf() throws IOException { return Float.parseFloat(ST.nextToken()); }  static int ni() throws IOException { return Integer.parseInt(ST.nextToken()); }  static int ni(int radix) throws IOException { return Integer.parseInt(ST.nextToken(), radix); }  static long nl() throws IOException { return Long.parseLong(ST.nextToken()); }  static long nl(int radix) throws IOException { return Long.parseLong(ST.nextToken(), radix); }  static short ns() throws IOException { return Short.parseShort(ST.nextToken()); }  static short ns(int radix) throws IOException { return Short.parseShort(ST.nextToken(), radix); }   static void p(String s) throws IOException { OUT.write(s); }  static void p(char c) throws IOException { OUT.write(c); }  static void p(char s[]) throws IOException { OUT.write(s); }  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(); }  }
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 {   @Override   public void run() {    InputStream inputStream = System.in;    OutputStream outputStream = System.out;    FastInput in = new FastInput(inputStream);    FastOutput out = new FastOutput(outputStream);    DExplorerSpace solver = new DExplorerSpace();    solver.solve(1, in, out);    out.close();   }  }  static class DExplorerSpace {   public void solve(int testNumber, FastInput in, FastOutput out) {    int n = in.ri();    int m = in.ri();    int k = in.ri();    int[][] lr = new int[n][m - 1];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m - 1; j++) {      lr[i][j] = in.ri();     }    }    int[][] ud = new int[n - 1][m];    for (int i = 0; i < n - 1; i++) {     for (int j = 0; j < m; j++) {      ud[i][j] = in.ri();     }    }    if (k % 2 == 1) {     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       out.append(-1).append(' ');      }      out.println();     }     return;    }    k /= 2;    int inf = (int) 1e9;    int[][][] dp = new int[k + 1][n][m];    for (int i = 1; i <= k; i++) {     for (int j = 0; j < n; j++) {      for (int t = 0; t < m; t++) {       dp[i][j][t] = inf;             if (t > 0) {        dp[i][j][t] = Math.min(dp[i][j][t], dp[i - 1][j][t - 1] + lr[j][t - 1]);       }             if (t + 1 < m) {        dp[i][j][t] = Math.min(dp[i][j][t], dp[i - 1][j][t + 1] + lr[j][t]);       }             if (j + 1 < n) {        dp[i][j][t] = Math.min(dp[i][j][t], dp[i - 1][j + 1][t] + ud[j][t]);       }             if (j > 0) {        dp[i][j][t] = Math.min(dp[i][j][t], dp[i - 1][j - 1][t] + ud[j - 1][t]);       }      }     }    }    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      out.append(dp[k][i][j] * 2).append(' ');     }     out.println();    }   }  }  static class FastOutput implements AutoCloseable, Closeable, Appendable {   private static 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 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;   }  } }
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());  }  public double nextDouble() {   return Double.parseDouble(nextBlock());  }  public long nextLong() {   return Long.parseLong(nextBlock());  } }
2	public class Main implements Runnable {  private BufferedReader br;  private StringTokenizer tok;  private PrintWriter out;  static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  int[] a;  int[] b;  int[] p;  int getCeils(int id, int step) {   if (step > a[id] + b[id] - 1) {    return 0;   }   if (a[id] < b[id]) {    if (step < a[id]) {     return step;    }    if (step >= a[id] && step <= b[id]) {     return a[id];    }    ++p[id];    return a[id] - p[id];   } else {    if (step < b[id]) {     return step;    }    if (step >= b[id] && step <= a[id]) {     return b[id];    }    ++p[id];    return b[id] - p[id];   }  }  void solve() throws IOException {   int n = nextInt(), x = nextInt(), y = nextInt(), c = nextInt();   long s = 1;   int step = 0;   a = new int[4];   b = new int[4];   p = new int[4];   a[0] = x - 1; b[0] = n - y;   a[1] = x - 1; b[1] = y - 1;   a[2] = n - x; b[2] = y - 1;   a[3] = n - x; b[3] = n - y;   int xf = x + 1, xb = x - 1, yf = y + 1, yb = y - 1;   while (s < c) {    ++step;    if (xf <= n) {     ++s;     ++xf;    }    if (xb > 0) {     ++s;     --xb;    }    if (yf <= n) {     ++s;     ++yf;    }    if (yb > 0) {     ++s;     --yb;    }    if (step == 1) {     continue;    }    for (int i = 0; i < 4; ++i) {     s += getCeils(i, step - 1);    }   }   out.println(step);  }  public void run() {   try {    if (ONLINE_JUDGE) {     br = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);    } else {     br = new BufferedReader(new FileReader(new File("input.txt")));     out = new PrintWriter(new File("output.txt"));    }    solve();    br.close();    out.close();   } catch (IOException e) {    e.printStackTrace();    System.exit(1);   }  }  public static void main(String[] args) {   new Main().run();  }  String nextToken() throws IOException {   while (tok == null || !tok.hasMoreTokens())    tok = new StringTokenizer(br.readLine());   return tok.nextToken();  }  String nextString() throws IOException {   return 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());  }  BigInteger nextBigInteger() throws IOException {   return new BigInteger(nextToken());  } }
0	public class A {  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter out;   public void solve() throws IOException {    int N = nextInt();  if( N >= 0) {  out.println(N);  return;  }   int ans = N/10;  int ans2 = N/100*10 + N%10;  out.println( Math.max(ans, ans2));   }   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());  }  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();  } }
5	public class Main implements Runnable {  class Segment {  int l, r;  Segment(int l, int r) {  this.l = l;  this.r = r;  }  @Override  public boolean equals(Object obj) {  Segment o = (Segment)obj;  return l == o.l && r == o.r;  }  @Override  public int hashCode() {  return 1000 * l + r;  } }  public void _main() throws IOException {  int n = nextInt();  int t = nextInt();  int[] x = new int[n];  int[] a = new int[n];  for (int i = 0; i < n; i++) {  x[i] = nextInt();  a[i] = nextInt();  }   Set<Segment> set = new HashSet<Segment>();  for (int i = 0; i < n; i++) {  int l = 2 * x[i] + a[i];  int r = 2 * x[i] + a[i] + 2 * t;  boolean ok = true;  for (int j = 0; j < n; j++) {   if (i == j) continue;   int L = Math.max(l, 2 * x[j] - a[j]);   int R = Math.min(r, 2 * x[j] + a[j]);     if (L < R) {   ok = false;   break;   }  }  if (ok)   set.add(new Segment(l, r));    l = 2 * x[i] - a[i] - 2 * t;  r = 2 * x[i] - a[i];    ok = true;  for (int j = 0; j < n; j++) {   if (i == j) continue;   int L = Math.max(l, 2 * x[j] - a[j]);   int R = Math.min(r, 2 * x[j] + a[j]);   if (L < R) {   ok = false;   break;   }  }  if (ok)   set.add(new Segment(l, r));  }  out.print(set.size()); }  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 int nextInt() throws IOException {  return Integer.parseInt(next()); }  private long nextLong() throws IOException {  return Long.parseLong(next()); }  private double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static void main(String[] args) {  new Thread(new Main()).start(); }  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   _main();   out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(202);  } } }
5	public class Abra {  public static void main(String[] args) throws IOException {   new Abra().run();  }  StreamTokenizer in;  PrintWriter out;  boolean oj;  void init() throws IOException {   oj = System.getProperty("ONLINE_JUDGE") != null;   Reader reader = oj ? new InputStreamReader(System.in) : new FileReader(     "input.txt");   Writer writer = oj ? new OutputStreamWriter(System.out)     : new FileWriter("output.txt");     in = new StreamTokenizer(new BufferedReader(reader));   out = new PrintWriter(writer);  }  void run() throws IOException {   long beginTime = System.currentTimeMillis();   init();   solve();   out.flush();  }  void printMem() {   if (!oj) {    System.out.println("Memory used = "      + (Runtime.getRuntime().totalMemory() - Runtime        .getRuntime().freeMemory()));   }  }  int nextInt() throws IOException {   in.nextToken();   return (int) in.nval;  }  long nextLong() throws IOException {   in.nextToken();   return (long) in.nval;  }  String nextString() throws IOException {   in.nextToken();   return in.sval;  }  double nextDouble() throws IOException {   in.nextToken();   return in.nval;  }  long deg(long x, long y) {   long a = x;   for (long i = 2; i <= y; i++) {    a *= x;   }   return a;  }  long fact(long x) {   long a = 1;   for (long i = 2; i <= x; i++) {    a *= i;   }   return a;  }  long digitSum(String x) {   long a = 0;   for (int i = 0; i < x.length(); i++) {    a += x.codePointAt(i) - 48;   }   return a;  }  long digitSum(long x) {   long a = 0;   while (x > 0) {    a += x % 10;    x /= 10;   }   return a;  }  long digitMul(long x) {   long a = 1;   while (x > 0) {    a *= x % 10;    x /= 10;   }   return a;  }  double pif(double ax, double ay, double bx, double by) {   return Math.sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));  }  double getPosPart(double x) {   if (x <= 0)    return 0;   else    return x;  }  double max(double x, double y) {   if (x > y)    return x;   else    return y;  }  long gcd(long a, long b) {   if (a < b) {    long c = b;    b = a;    a = c;   }   while (a % b != 0) {    a = a % b;    if (a < b) {     long c = b;     b = a;     a = c;    }   }   return b;  }  int gcd(int a, int b) {   if (a < b) {    int c = b;    b = a;    a = c;   }   while (a % b != 0) {    a = a % b;    if (a < b) {     int c = b;     b = a;     a = c;    }   }   return b;  }  long lcm(long a, long b) throws IOException {   return a * b / gcd(a, b);  }  int lcm(int a, int b) throws IOException {   return a * b / gcd(a, b);  }  int countOccurences(String x, String y) {   int a = 0, i = 0;   while (true) {    i = y.indexOf(x);    if (i == -1)     break;    a++;    y = y.substring(i + 1);   }   return a;  }  int[] primes;  int findPrimes(int x) {   boolean[] forErato = new boolean[x];   primes = new int[x];   int l = 0, j = 0;   for (int i = 2; i < x; i++) {    if (forErato[i])     continue;    l++;    primes[l] = i;    j = i * 2;    while (j < x) {     forErato[j] = true;     j += i;    }   }   return l;  }  int rev(int x) {   int a = 0;   while (x > 0) {    a = a * 10 + x % 10;    x /= 10;   }   return a;  }  class myDate {   int d, m, y;   public myDate(int da, int ma, int ya) {    d = da;    m = ma;    y = ya;   }   int[] ml = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };   void inc() {    if ((d == 31) && (m == 12)) {     y++;     d = 1;     m = 1;    } else {     if (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)) {      ml[1] = 29;     }     if (d == ml[m - 1]) {      m++;      d = 1;     } else      d++;    }   }  }  int partition(int n, int l, int m) {     if (n < l)    return 0;   if (n < l + 2)    return 1;   if (l == 1)    return 1;   int c = 0;   for (int i = Math.min(n - l + 1, m); i >= (n + l - 1) / l; i--) {    c += partition(n - i, l - 1, i);   }   return c;  }  void solve() throws IOException {   int n = nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = nextInt();   }   Arrays.sort(a);   int min = a[0];   for (int i = 1; i < n; i++) {    if (a[i] != min) {     out.print(a[i]);     return;    }   }   out.print("NO");  } }
1	public class A_IQTest {  static int n;  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   n = s.nextInt();     int[] nums = new int[n];     for (int i = 0; i < n; i++) {    nums[i] = s.nextInt();   }        int ei = -1;   int oi = -1;   int ecnt = 0;   int ocnt = 0;   for (int i = 0; i < n; i++) {    if(nums[i] % 2 == 0){     ei = i;     ecnt++;    }else{     oi = i;     ocnt++;    }   }   if(ecnt == 1){    System.out.println(ei+1);   }else{    System.out.println(oi+1);   }  } }
6	public class F  {  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());   int M = Integer.parseInt(st.nextToken());   int[][] grid = new int[N][M];   for(int i=0; i < N; i++)    grid[i] = readArr(M, infile, st);   int[][] mindiff = new int[N][N];   for(int a=0; a < N; a++)    for(int b=a+1; b < N; b++)    {     int val = Integer.MAX_VALUE;     for(int i=0; i < M; i++)     val = Math.min(val, Math.abs(grid[a][i]-grid[b][i]));     mindiff[a][b] = mindiff[b][a] = val;    }   int res = 0;   for(int start=0; start < N; start++)   {    int[][] dp = new int[1<<N][N];    Arrays.fill(dp[0], Integer.MAX_VALUE);    for(int mask=0; mask < (1<<N); mask++)    {     if(Integer.bitCount(mask) == 1 && mask != (1<<start))     continue;     for(int prev=0; prev < N; prev++)     if((mask&(1<<prev)) > 0 || mask == 0)     {      for(int b=0; b < N; b++)       if((mask&(1<<b)) == 0)       {        int submask = mask|(1<<b);        if(mask == 0)        dp[submask][b] = Integer.MAX_VALUE;        else        dp[submask][b] = Math.max(dp[submask][b], Math.min(dp[mask][prev], mindiff[prev][b]));       }     }    }    for(int b=0; b < N; b++)    {     int temp = dp[(1<<N)-1][b];     for(int i=0; i < M-1; i++)     temp = Math.min(temp, Math.abs(grid[b][i]-grid[start][i+1]));     res = Math.max(res, temp);    }   }   System.out.println(res);  }  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;  }  }
0	public class Main {  private static final double EPS = 1e-11;  public static void main(String[] args) throws IOException {   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);     double a = nextDouble();   double v = nextDouble();   double l = nextDouble();   double d = nextDouble();   double w = nextDouble();     double ans = 0.0;     if (v < w + EPS || sqr(w) / 2 / a > d - EPS) {    double t1 = sqrt(2 * l / a);    double t2 = v / a;       if (t1 < t2 + EPS) {     ans = t1;    } else {     ans = t2 + (l - a * sqr(t2) / 2) / v;    }   } else {    double t1 = v / a;    double t2 = (v - w) / a;    double s12 = a * sqr(t1) / 2 + w * t2 + a * sqr(t2) / 2;       if (s12 < d + EPS) {     ans += t1 + t2 + (d - s12) / v;    } else {     double ta = sqrt(d / a + sqr(w / a) / 2);     double tb = ta - w / a;     ans += ta + tb;    }       double r = l - d;    double tm = (v - w) / a;    double tx = (sqrt(sqr(w) + 2 * a * r) - w) / a;       if (tx < tm + EPS) {     ans += tx;    } else {     ans += tm + (r - w * tm - a * sqr(tm) / 2) / v;    }   }        out.printf(Locale.US, "%.12f%n", ans);   out.close();  }   double sqr(double x) {   return x * x;  }   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());  } }
0	public class palin { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(System.out);  Scanner scan = new Scanner(System.in);  TaskC solver = new TaskC();  solver.solve(1, in, out);  out.close(); } } class TaskC { public void solve(int testNumber, InputReader in, PrintWriter out) {  int n = in.nextInt();  if (n >= 0) {  out.print(n);  return;  }  if (n / 10 >= (n / 100) * 10 + n % 10) {  out.print(n / 10);  return;  }  out.print((n / 100) * 10 + n % 10); } } 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()); }  public double nextDouble() {  return Double.parseDouble(next()); } }
3	public class A961_Tetris {  public static void main(String[] args) {   Scanner input = new Scanner(System.in);  int platforms = input.nextInt();  int in = input.nextInt();  int[] cols = new int[platforms];  int[] squares = new int[in];   for (int i = 0; i < in; i ++) {  squares[i] = input.nextInt();  }   boolean hi = false;  int score = 0;   for (int i = 0; i < in; i ++) {  cols[squares[i] - 1] ++;  hi = checkscore(cols);  if (hi == true) {   hi = false;   score ++;   for (int j = 0; j < cols.length; j ++) {   cols[j] --;   }     }    }   System.out.println(score);   }  public static boolean checkscore(int[] cols) {  for (int i = 0; i < cols.length; i ++) {  if (cols[i] == 0) {   return false;  }    }   return true;   } }
1	public class a {  public static long mod = (long) Math.pow(10, 9) + 7; public static int k = 0;  private static class node implements Comparable<node> {  int l;  int r;  int index;  int index2;  int buffer;  node(int l, int r, int i, int b, int i2) {  this.l = l;  this.r = r;  index = i;  buffer = b;  index2 = i2;  }  @Override  public int compareTo(node o) {  if (k == 0) {   if (o.l < l)   return 1;   else if (o.l > l)   return -1;   else if (o.buffer != -1) {   return 1;   } else   return -1;  } else if (k == 1) {   if (r != o.r)   return r - o.r;   return o.index - index;  } else if (k == 2) {   return r - o.r;  } else {   if (o.index < index)   return 1;   else   return -1;  }  } }                              public static class point implements Comparable<point> {  long x;  long y;  point(long x, long y) {  this.x = x;  this.y = y;  }  @Override  public int compareTo(point o) {  return (int) (x - o.x);  } }  public static int ch(long y) {  int r = Long.bitCount(y);  return r; }  public static int gcd(int x, int y) {  if (y == 0)  return x;  return gcd(y, x % y); }  public static int min[]; public static int max[];  public static void build(int s, int e, int p, int a[]) {  if (s == e) {  min[p] = a[s];  max[p] = a[s];  return;  }  int mid = (s + e) / 2;  build(s, mid, p * 2, a);  build(mid + 1, e, p * 2 + 1, a);  min[p] = Math.min(min[p * 2], min[p * 2 + 1]);  max[p] = Math.max(max[p * 2], max[p * 2 + 1]); }  public static int getMin(int s, int e, int p, int from, int to) {  if (s > to || e < from)  return Integer.MAX_VALUE;  if (s >= from && e <= to)  return min[p];  int mid = (s + e) / 2;  int a = getMin(s, mid, p * 2, from, to);  int b = getMin(mid + 1, e, p * 2 + 1, from, to);  return Math.min(a, b);  }  public static int getMax(int s, int e, int p, int from, int to) {  if (s > to || e < from)  return Integer.MIN_VALUE;  if (s >= from && e <= to)  return max[p];  int mid = (s + e) / 2;  int a = getMax(s, mid, p * 2, from, to);  int b = getMax(mid + 1, e, p * 2 + 1, from, to);  return Math.max(a, b);  }  public static boolean ch[]; public static ArrayList<Integer> prime; public static Queue<Integer> pp;  public static void sieve(int k) {  ch[0] = ch[1] = true;  for (int i = 2; i <= k; i++) {  if (!ch[i]) {   prime.add(i);   pp.add(i);   for (int j = i + i; j <= k; j += i) {   ch[j] = true;   }  }  }  }  public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringBuilder qq = new StringBuilder();  PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));  String y[] = in.readLine().split(" ");  int n = Integer.parseInt(y[0]);  int a = Integer.parseInt(y[1]);  int b = Integer.parseInt(y[2]);  int arr[] = new int[n];  HashMap<Integer, Integer> mp = new HashMap();  y = in.readLine().split(" ");  boolean flag = true;  for (int i = 0; i < n; i++) {  arr[i] = Integer.parseInt(y[i]);  if (arr[i] >= a && arr[i] >= b) {   flag = false;  }  mp.put(arr[i], i);  }  if (!flag) {  System.out.println("NO");  return;  }  boolean ch[] = new boolean[n];  int ans[] = new int[n];  for (int i = 0; i < n; i++) {  int k = i;   while (true&&!ch[k]) {     if (mp.containsKey(a - arr[k]) && !ch[mp.get(a - arr[k])]    && mp.containsKey(b - arr[k])    && !ch[mp.get(b - arr[k])]) {   break;   } else if (mp.containsKey(a - arr[k])    && !ch[mp.get(a - arr[k])]) {      ch[k] = true;   ans[k] = 0;   ch[mp.get(a - arr[k])] = true;   ans[mp.get(a - arr[k])] = 0;   int s = b - (a - arr[k]);   if (mp.containsKey(s)) {    k = mp.get(s);   } else    break;      } else if (mp.containsKey(b - arr[k])    && !ch[mp.get(b - arr[k])]) {   ans[k] = 1;   ans[mp.get(b - arr[k])] = 1;   ch[k] = true;   ch[mp.get(b - arr[k])] = true;    int s = a - (b - arr[k]);   if (mp.containsKey(s)) {    k = mp.get(s);   } else    break;   } else {      System.out.println("NO");   return;   }  }  }  qq.append("YES\n");  for (int i = 0; i < ans.length; i++) {  qq.append(ans[i] + " ");  }  System.out.println(qq);  } }
1	public class TwoSets {  static ArrayList<Integer> g[]; static boolean visited[]; static int ans[],p[],orig[]; static int n,a,b;  @SuppressWarnings("unchecked") public static void main(String args[] ) throws Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter w = new PrintWriter(System.out);     StringTokenizer st1 = new StringTokenizer(br.readLine());  n = ip(st1.nextToken());  a = ip(st1.nextToken());  b = ip(st1.nextToken());    g = new ArrayList[n];  visited = new boolean[n];  ans = new int[n];  p = new int[n];  orig = new int[n];    StringTokenizer st2 = new StringTokenizer(br.readLine());  for(int i=0;i<n;i++){   p[i] = ip(st2.nextToken());   orig[i] = p[i];   g[i] = new ArrayList<Integer>();  }    Arrays.sort(p);    boolean impossible = false;    for(int i=0;i<n;i++){   int i1 = Arrays.binarySearch(p, a-p[i]);   int i2 = Arrays.binarySearch(p, b-p[i]);   if(i1 < 0 || i1 >= n) i1 = -1;   if(i2 < 0 || i2 >= n) i2 = -1;     if(i1 == -1 && i2 != -1)    g[i].add(i2);     else if(i1 != -1 && i2 == -1)    g[i].add(i1);     else if(i1 != -1 && i2 != -1){    g[i].add(i1);   g[i].add(i2);   }   else{    impossible = true;   break;   }  }    if(impossible){   System.out.println("NO");   return;  }            LinkedList<Integer> q = new LinkedList();  for(int i=0;i<n;i++){     if(visited[i] == false){      ArrayList<Integer> curq = new ArrayList<Integer>();        curq.add(i);   q.add(i);   visited[i] = true;     while(!q.isEmpty()){    int curr = q.remove();    int s = g[curr].size();    for(int j=0;j<s;j++){    if(!visited[g[curr].get(j)]){     visited[g[curr].get(j)] = true;     curq.add(g[curr].get(j));     q.add(g[curr].get(j));    }    }   }     boolean found = true;      int s = curq.size();   int temp[] = new int[s];   for(int j=0;j<s;j++)    temp[j] = p[curq.get(j)];   Arrays.sort(temp);      int anss = -1;      for(int j=0;j<s;j++){    int i3 = Arrays.binarySearch(temp, a - temp[j]);    if(i3 < 0 || i3 >= n){     found = false;     break;    }    }       if(!found){    found = true;        for(int j=0;j<s;j++){    int i3 = Arrays.binarySearch(temp, b - temp[j]);     if(i3 < 0 || i3 >= n){     found = false;     break;     }    }       if(found)    anss = 1;    else{    impossible = true;    break;    }          }   else    anss = 0;      for(int j=0;j<s;j++)    ans[curq.get(j)] = anss;     }       }    if(!impossible){   w.println("YES");   for(int i=0;i<n;i++){   int i1 = Arrays.binarySearch(p, orig[i]);   if(ans[i1] == -1) ans[i1] = 1;   w.print(ans[i1] + " ");   }   w.println();  }  else   w.println("NO");    w.close();  }  public static int ip(String s){  return Integer.parseInt(s); } }
2	public class Main {  static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out);   public static void main(String[] args) {  long n = in.nextLong();  long s = in.nextLong();   if(diff(n) < s) {  System.out.println(0);  out.close();  return;  }   long lo = 1;  long hi = n;  while(lo < hi) {  long mid = lo + (hi - lo) / 2;  if(diff(mid) >= s)   hi = mid;  else   lo = mid + 1;  }  System.out.println(n - lo + 1);   out.close(); }  static long diff(long n) {  char[] ca = (n + "").toCharArray();  int sum = 0;  for(char c : ca)  sum += (c - '0');  return n - sum; } }  class InputReader {  private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars;  public InputReader(InputStream st) {  this.stream = st; }  public int read() {  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 = read();  while (isSpaceChar(c)) {  c = read();  }  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  int res = 0;  do {  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 {  res *= 10;  res += c - '0';  c = read();  } while (!isSpaceChar(c));  return res * sgn; }  public int[] nextIntArray(int n) {  int a[] = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  return a; }  public String readString() {  int c = read();  while (isSpaceChar(c)) {  c = read();  }  StringBuilder res = new StringBuilder();  do {  res.appendCodePoint(c);  c = read();  } while (!isSpaceChar(c));  return res.toString(); }  public String nextLine() {  int c = read();  while (isSpaceChar(c))  c = read();  StringBuilder res = new StringBuilder();  do {  res.appendCodePoint(c);  c = read();  } while (!isEndOfLine(c));  return res.toString(); }  public 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; } }
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(); }  public void run() {  try {  long t1 = 0, t2 = 0, m1 = 0, m2 = 0;  if (LOCAL) {   t1 = System.currentTimeMillis();   m1 = Runtime.getRuntime().freeMemory();  }  Locale.setDefault(Locale.US);  if (LOCAL) {   in = new BufferedReader(new FileReader("input.txt"));   out = new PrintWriter("output.txt");  } else {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);  }  tok = new StringTokenizer("");  solve();  in.close();  out.close();  if (LOCAL) {   t2 = System.currentTimeMillis();   m2 = Runtime.getRuntime().freeMemory();   System.err.println("Time = " + (t2 - t1) + " ms.");   System.err.println("Memory = " + ((m1 - m2) / 1024) + " KB.");  }  } catch (Throwable e) {  e.printStackTrace(System.err);  throw new RuntimeException();  } }  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()); }  double readDouble() throws IOException {  return Double.parseDouble(readString()); }  static class Mergesort {  private Mergesort() {}  public static void sort(int[] a) {  mergesort(a, 0, a.length - 1);  }  public static void sort(long[] a) {  mergesort(a, 0, a.length - 1);  }  public static void sort(double[] a) {  mergesort(a, 0, a.length - 1);  }  private static final int MAGIC_VALUE = 42;  private static void mergesort(int[] a, int leftIndex, int rightIndex) {  if (leftIndex < rightIndex) {   if (rightIndex - leftIndex <= MAGIC_VALUE) {   insertionSort(a, leftIndex, rightIndex);   } else {   int middleIndex = (leftIndex + rightIndex) / 2;   mergesort(a, leftIndex, middleIndex);   mergesort(a, middleIndex + 1, rightIndex);   merge(a, leftIndex, middleIndex, rightIndex);   }  }  }  private static void mergesort(long[] a, int leftIndex, int rightIndex) {  if (leftIndex < rightIndex) {   if (rightIndex - leftIndex <= MAGIC_VALUE) {   insertionSort(a, leftIndex, rightIndex);   } else {   int middleIndex = (leftIndex + rightIndex) / 2;   mergesort(a, leftIndex, middleIndex);   mergesort(a, middleIndex + 1, rightIndex);   merge(a, leftIndex, middleIndex, rightIndex);   }  }  }  private static void mergesort(double[] a, int leftIndex, int rightIndex) {  if (leftIndex < rightIndex) {   if (rightIndex - leftIndex <= MAGIC_VALUE) {   insertionSort(a, leftIndex, rightIndex);   } else {   int middleIndex = (leftIndex + rightIndex) / 2;   mergesort(a, leftIndex, middleIndex);   mergesort(a, middleIndex + 1, rightIndex);   merge(a, leftIndex, middleIndex, rightIndex);   }  }  }  private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {  int length1 = middleIndex - leftIndex + 1;  int length2 = rightIndex - middleIndex;  int[] leftArray = new int[length1];  int[] rightArray = new int[length2];  System.arraycopy(a, leftIndex, leftArray, 0, length1);  System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);  for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {   if (i == length1) {   a[k] = rightArray[j++];   } else if (j == length2) {   a[k] = leftArray[i++];   } else {   a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];   }  }  }  private static void merge(long[] a, int leftIndex, int middleIndex, int rightIndex) {  int length1 = middleIndex - leftIndex + 1;  int length2 = rightIndex - middleIndex;  long[] leftArray = new long[length1];  long[] rightArray = new long[length2];  System.arraycopy(a, leftIndex, leftArray, 0, length1);  System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);  for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {   if (i == length1) {   a[k] = rightArray[j++];   } else if (j == length2) {   a[k] = leftArray[i++];   } else {   a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];   }  }  }  private static void merge(double[] a, int leftIndex, int middleIndex, int rightIndex) {  int length1 = middleIndex - leftIndex + 1;  int length2 = rightIndex - middleIndex;  double[] leftArray = new double[length1];  double[] rightArray = new double[length2];  System.arraycopy(a, leftIndex, leftArray, 0, length1);  System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);  for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {   if (i == length1) {   a[k] = rightArray[j++];   } else if (j == length2) {   a[k] = leftArray[i++];   } else {   a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];   }  }  }  private static void insertionSort(int[] a, int leftIndex, int rightIndex) {  for (int i = leftIndex + 1; i <= rightIndex; i++) {   int current = a[i];   int j = i - 1;   while (j >= leftIndex && a[j] > current) {   a[j + 1] = a[j];   j--;   }   a[j + 1] = current;  }  }  private static void insertionSort(long[] a, int leftIndex, int rightIndex) {  for (int i = leftIndex + 1; i <= rightIndex; i++) {   long current = a[i];   int j = i - 1;   while (j >= leftIndex && a[j] > current) {   a[j + 1] = a[j];   j--;   }   a[j + 1] = current;  }  }  private static void insertionSort(double[] a, int leftIndex, int rightIndex) {  for (int i = leftIndex + 1; i <= rightIndex; i++) {   double current = a[i];   int j = i - 1;   while (j >= leftIndex && a[j] > current) {   a[j + 1] = a[j];   j--;   }   a[j + 1] = current;  }  }  }  void debug(Object... o) {  if (LOCAL) {  System.err.println(Arrays.deepToString(o));  } }  final static 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); }  }
3	public class Main implements Runnable {  boolean multiiple = false;  void solve() throws Exception  {   int n = sc.nextInt();   ArrayList<Integer> list = new ArrayList<>();   for (int i = 0; i < n; i++)    list.add(sc.nextInt());   Collections.sort(list);   int ans = 0;   while (!list.isEmpty())   {    ans++;    int next = list.get(0);    for (int i = list.size() - 1; i >= 1; i--)    {     if (list.get(i) % next == 0)      list.remove(i);    }    list.remove(0);   }   System.out.println(ans);  }  @Override  public void run()  {   try   {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    sc = new FastScanner(in);    if (multiiple)    {     int q = sc.nextInt();     for (int i = 0; i < q; i++)      solve();    }    else     solve();   }   catch (Throwable uncaught)   {    Main.uncaught = uncaught;   }   finally   {    out.close();   }  }  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());  }  public long nextLong() throws Exception {   return Long.parseLong(nextToken());  }  public double nextDouble() throws Exception {   return Double.parseDouble(nextToken());  } }
4	@SuppressWarnings("unused") public class C{  static long inf = (long)1e15;   public static void main(String[] args) throws IOException {      FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);    int tt = fs.nextInt();  outer:  while(tt-->0) {     int n = fs.nextInt();   int[] a = fs.readArray(n);     ArrayList<Integer>[] l = new ArrayList[n];   for(int i=0;i<n;i++) l[i] = new ArrayList<Integer>();     l[0].add(1);     for(int i=1;i<n;i++) {   if(a[i]==1) {    for(int j=0;j<l[i-1].size();j++) l[i].add(l[i-1].get(j));    l[i].add(1);   }   else {    int ind = -1;    for(int j=l[i-1].size()-1;j>=0;j--) {    if(l[i-1].get(j)+1==a[i]) {     ind = j; break;    }    }    for(int j=0;j<ind;j++) l[i].add(l[i-1].get(j));    l[i].add(a[i]);   }   }     for(int i=0;i<n;i++) {   out.print(l[i].get(0));   for(int j=1;j<l[i].size();j++) out.print("."+l[i].get(j));   out.println();   }            }    out.close();        }         static final Random random=new Random();   static <T> void shuffle(T[] arr) {  int n = arr.length;  for(int i=0;i<n;i++ ) {   int k = random.nextInt(n);   T temp = arr[k]; arr[k] = arr[i]; arr[i] = temp;  }  }     static void ruffleSort(int[] a) {  int n=a.length;  for (int i=0; i<n; i++) {   int oi=random.nextInt(n); int temp=a[oi];   a[oi]=a[i]; a[i]=temp;  }  Arrays.sort(a);  }   static void ruffleSort(long[] a) {  int n=a.length;  for (int i=0; i<n; i++) {   int oi=random.nextInt(n); long temp=a[oi];   a[oi]=a[i]; a[i]=temp;  }  Arrays.sort(a);  }      static void reverse(int[] arr, int l, int r) {  for(int i=l;i<l+(r-l)/2;i++){   int temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;  }  }   static void reverse(long[] arr, int l, int r) {  for(int i=l;i<l+(r-l)/2;i++){   long temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;  }  }     static <T> void reverse(T[] arr, int l, int r) {  for(int i=l;i<l+(r-l)/2;i++) {   T temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;  }  }      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 String nextLine() throws IOException {   return br.readLine();  }     public int nextInt(){   return Integer.parseInt(next());  }    public int[] readArray(int n){   int[] a = new int[n];   for(int i=0;i<n;i++)   a[i] = nextInt();   return a;  }     public long nextLong() {   return Long.parseLong(next());  }    public double nextDouble() {   return Double.parseDouble(next());  }     public char nextChar() {   return next().toCharArray()[0];  }      }   }
1	public class B { public static void main(String[] args) throws IOException {    Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));     int t = sc.nextInt();  for (int z = 0; z < t; ++z) {  int n = sc.nextInt();  if (n%2==1) {   System.out.println("NO");   continue;  }  n/=2;  int sqrt = (int)Math.sqrt(n);  if (sqrt*sqrt==n) {   System.out.println("YES");   continue;  }  if (n%2==1) {   System.out.println("NO");   continue;  }  n/=2;  sqrt = (int)Math.sqrt(n);  if (sqrt*sqrt==n) {   System.out.println("YES");   continue;  }  System.out.println("NO");  } } }
5	public class Solution {    private static StringTokenizer st;  private static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  private static long nextLong() {   return Long.parseLong(st.nextToken());  }  private static int nextInt() {   return Integer.parseInt(st.nextToken());  }  private static double nextDouble() {   return Double.parseDouble(st.nextToken());  }  private static short nextShort() {   return Short.parseShort(st.nextToken());  }  private static byte nextByte() {   return Byte.parseByte(st.nextToken());  }  private static void initTokenizer() throws Exception {   st = new StringTokenizer(reader.readLine());  }    public static void main(String[] args) throws Exception {   initTokenizer();   int n = nextInt();   int a = nextInt();   int b = nextInt();   int[] h = new int[n];   initTokenizer();   for (int i = 0; i < n; i++) {    h[i] = nextInt();   }   Arrays.sort(h);   System.out.print(h[b] - h[b - 1]);  } }
1	public class utkarsh {  InputStream is;  PrintWriter out;   long mod = (long) (1e9 + 7);  boolean SHOW_TIME;   void solve() {        int n = ni();   HashMap <String, Integer> mp = new HashMap<>();   mp.put("M", 0);   mp.put("S", 1); mp.put("XS", 2); mp.put("XXS", 3); mp.put("XXXS", 4);   mp.put("L", 5); mp.put("XL", 6); mp.put("XXL", 7); mp.put("XXXL", 8);   int a[] = new int[10];   for(int i = 0; i < n; i++) {    int j = mp.get(ns());    a[j]++;   }   for(int i = 0; i < n; i++) {    int j = mp.get(ns());    a[j]--;   }   int ans = 0;   for(int i = 0; i < 10; i++) {    if(a[i] > 0) ans += a[i];   }   out.println(ans);  }     public static void main(String[] args) { new utkarsh().run(); }  void run() {   is = System.in;   out = new PrintWriter(System.out);   long start = System.currentTimeMillis();   solve();   long end = System.currentTimeMillis();   if(SHOW_TIME) out.println("\n" + (end - start) + " ms");   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;  }   char nc() { return (char)skip(); }  String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!isSpaceChar(b)) { sb.appendCodePoint(b); b = readByte(); }   return sb.toString();  }  String nLine() {   int b = skip();   StringBuilder sb = new StringBuilder();   while( !(isSpaceChar(b) && 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;  }  double nd() { return Double.parseDouble(ns()); }  float nf() { return Float.parseFloat(ns()); }  int[] na(int n) {   int a[] = new int[n];   for(int i = 0; i < n; i++) { a[i] = ni(); }   return a;  }  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) throws IOException {   InputStreamReader r = new InputStreamReader(System.in);   BufferedReader f = new BufferedReader(r);   Scanner sc = new Scanner(System.in);   long n=sc.nextLong();   long m=sc.nextLong();   long sum=0;   if(n==1){   }else {    for (long i = 1; i <= n; i++) {     sum += i;     if (sum - (n - i) == m) {      sum = n - i;      break;     }    }   }   System.out.println(sum);   } }
3	public class P911d {  private static void solve() {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  int cnt = 0;  for (int i = 0; i < n; i++) {  for (int j = i + 1; j < n; j++) {   if (a[i] > a[j]) {   cnt++;   }  }  }  cnt %= 2;  int m = nextInt();  for (int i = 0; i < m; i++) {  int l = nextInt();  int r = nextInt();   int size = r - l + 1;  int sum = (size * (size - 1)) / 2;   sum %= 2;   cnt += sum;  cnt %= 2;   out.println(cnt == 0 ? "even" : "odd");  } }  private static void run() {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  out.close(); }  private static StringTokenizer st; private static BufferedReader br; private static PrintWriter out;  private static String next() {  while (st == null || !st.hasMoreElements()) {  String s;  try {   s = br.readLine();  } catch (IOException e) {   return null;  }  st = new StringTokenizer(s);  }  return st.nextToken(); }  private static int nextInt() {  return Integer.parseInt(next()); }  private static long nextLong() {  return Long.parseLong(next()); }  public static void main(String[] args) {  run(); } }
0	public class A { public static void main(String [] args) throws IOException {  Scanner in = new Scanner(System.in);  System.out.println(rec(in.nextLong(), in.nextLong()));  }  private static long rec(long a, long b) {  return b == 0 ? 0 : a/b + rec(b, a%b); } }
0	public class myTemplate {    public static void main(String[] args) throws Exception{     java.io.BufferedReader br = new java.io.BufferedReader(new      java.io.InputStreamReader(System.in));     int ch[],arr[];   int x,i,j,k,t,n=Integer.parseInt(br.readLine());        if(n>0)    System.out.println(n);   else   {           x= n/100;       x = x*10 + n%10;       if(n/10 > x)     System.out.println(n/10);    else    System.out.println(x);      }    } }
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);  } }
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 flush() {    super.flush();   }    public void close() {    super.close();   }  } }
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());  }  public int[] intarr(int n) throws IOException {  int[] res = new int[n];  for (int i = 0; i < n; i++)   res[i] = nextInt();  return res;  }  public long nextLong() throws IOException {   return Long.parseLong(next());  }  public double nextDouble() throws IOException {   return Double.parseDouble(next());  }  } }
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 double nd() { return Double.parseDouble(ns()); }  private char nc() { return (char)skip(); }  private String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b))){    sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }  private char[] ns(int n) {   char[] buf = new char[n];   int b = skip(), p = 0;   while(p < n && !(isSpaceChar(b))){    buf[p++] = (char)b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }  private char[][] nm(int n, int m) {   char[][] map = new char[n][];   for(int i = 0;i < n;i++)map[i] = ns(m);   return map;  }  private int[] na(int n) {   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = ni();   return a;  }  private int ni() {   int num = 0, b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private long nl() {   long num = 0;   int b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); } }
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 IOUtils {   public static int[] readIntArray(InputReader in, int size) {    int[] array = new int[size];    for (int i = 0; i < size; i++) {     array[i] = in.readInt();    }    return array;   }  }  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);   }  } }
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 + "").charAt(charToGet) + "";  }  System.out.print(finalResult);  scanner.close(); } }
4	public class Main { static int[][] to = { { 1, 0 }, { 0, 1 }, { -1, 0 }, { 0, -1 } };  public static void main(String[] args) throws FileNotFoundException {  InputReader in = new InputReader(System.in);      PrintWriter out = new PrintWriter(System.out);        int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();  int[][][] cost = new int[n][m][4];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m - 1; j++) {   int u = in.nextInt();   cost[i][j][1] = u;   cost[i][j + 1][3] = u;  }  }  for (int i = 0; i < n - 1; i++) {  for (int j = 0; j < m; j++) {   int u = in.nextInt();   cost[i][j][0] = u;   cost[i + 1][j][2] = u;  }  }  if (k % 2 == 0) {  k = k / 2;  int[][][] dp = new int[k + 1][n][m];   for (int i = 0; i <= k; i++) {   for (int x = 0; x < n; x++) {   for (int y = 0; y < m; y++) {    if (i == 0) {    dp[i][x][y] = 0;    } else {    int min = 1000000000;     for (int way = 0; way < to.length; way++) {     int nextx = x + to[way][0];     int nexty = y + to[way][1];     if (nextx >= 0 && nextx < n && nexty >= 0 && nexty < m) {     min = Math.min(min, dp[i - 1][nextx][nexty] + cost[x][y][way]);     }    }     dp[i][x][y] = min;    }   }   }  }   for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   if (j == m - 1) {    out.printf("%d\n", dp[k][i][j] * 2);   } else {    out.printf("%d ", dp[k][i][j] * 2);   }   }  }  } else {  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   if (j == m - 1) {    out.printf("-1\n");   } else {    out.printf("-1 ");   }   }  }  }  out.close(); }  static class InputReader {  BufferedReader br;  StringTokenizer st;  public InputReader(File f) {  try {   br = new BufferedReader(new FileReader(f));  } catch (FileNotFoundException e) {   e.printStackTrace();  }  }  public InputReader(InputStream in) {  br = new BufferedReader(new InputStreamReader(in));  }  public String next() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  }  return st.nextToken();  }  public boolean hasNext() {  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());  }  public long nextLong() {  return Long.parseLong(next());  }  public double nextDouble() {  return Double.parseDouble(next());  } } }
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 String nextLine() {  String line = "";  if(st.hasMoreTokens()) line = st.nextToken();  else try {return br.readLine();}catch(IOException e){e.printStackTrace();}  while(st.hasMoreTokens()) line += " "+st.nextToken();  return line;  }  public int[] nextIntArray(int n) {  int[] a = new int[n];  for(int i = 0; i < n; i++) a[i] = nextInt();  return a;  }  public long[] nextLongArray(int n){  long[] a = new long[n];  for(int i = 0; i < n; i++) a[i] = nextLong();  return a;  }  public double[] nextDoubleArray(int n){  double[] a = new double[n];  for(int i = 0; i < n; i++) a[i] = nextDouble();  return a;  }  public char[][] nextGrid(int n, int m){  char[][] grid = new char[n][m];  for(int i = 0; i < n; i++) grid[i] = next().toCharArray();  return grid;  } }  }
5	public class D {  public static void main(String[] args) throws FileNotFoundException {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[] a = new int[n];   int[] p = new int[n];   for (int i = 0; i < a.length; i++)    a[i] = p[i] = in.nextInt();   Arrays.sort(a);   int sum = 0;   int t = 0;   for (int i = 0; i < a.length; i++)    t += a[i];   int cnt = 0;   for (int i = a.length - 1; i >= 0; i--) {    cnt++;    sum += a[i];    if (t - sum < sum)     break;   }   System.out.println(cnt);  } }
5	public class d {   public static void main(String[] args) throws IOException {   FastScanner in = new FastScanner(System.in);   PrintWriter out = new PrintWriter(System.out);     int n = in.nextInt();   long[] arr = new long[n];   for (int i = 0; i < n; i++) {           arr[i] = in.nextLong();   }   long sum = 0;   long count = 0;     TreeSet<Long> ts = new TreeSet<>();   ts.add(1L);   long oo = 1000000000 + 100;   ts.add(oo);   for (long a : arr) {    a += 10;    ts.add(a);    ts.add(a - 2);    ts.add(a + 2);   }     long[] inds = new long[ts.size()];   int idx = 0;   for (long a : ts) {    inds[idx++] = a;   }     SuperBIT bit1 = new SuperBIT(inds);   SuperBIT bit2 = new SuperBIT(inds);   BigInteger ans = BigInteger.valueOf(0);     for (long a : arr) {    a += 10;       long countLess = bit1.queryCompr(1, a - 2);    long sumLess = bit2.queryCompr(1, a - 2);       long countMore = bit1.queryCompr(a + 2, oo);    long sumMore = bit2.queryCompr(a + 2, oo);           bit1.updateCompr(a, 1);    bit2.updateCompr(a, a);       long tmp = 0;    tmp += countLess * a - sumLess;    tmp -= sumMore - countMore * a;    ans = ans.add(BigInteger.valueOf(tmp));   }     out.println(ans);        out.close();  } static class SuperBIT { long[] dataMul, dataAdd; SuperBIT(int n) {  dataMul = new long[n];  dataAdd = new long[n]; } void update(int left, int right, long val) {  internalUpdate(left, val, -val * (left-1));  internalUpdate(right, -val, val * right); } void internalUpdate(int at, long mul, long add) {  while (at < dataMul.length) {  dataMul[at] += mul;  dataAdd[at] += add;  at |= (at + 1);  } } long query(int at) {  long mul = 0;  long add = 0;  int start = at;  while(at >= 0) {  mul += dataMul[at];  add += dataAdd[at];  at = (at & (at + 1)) -1;  }  return mul * start + add; } long query(int left, int right) {  if (left > right) {  int temp = left;  left = right;  right = temp;  }  return query(right) - (left > 0 ? query(left-1) : 0); } long[] indices;      public SuperBIT(long[] indices) {  this.indices = indices;  dataMul = new long[indices.length];  dataAdd = new long[indices.length]; }    int binSearch(long ind) {  int low = 0;  int high = dataMul.length-1;  while(low < high) {  int mid = (low + high+1)/2;  if(indices[mid] == ind)   return mid;  else if(indices[mid] < ind)   low = mid;  else if(indices[mid] > ind)   high = mid-1;  }  if(indices[low] > ind)  --low;  return low; }   long queryCompr(long index) {  return query(binSearch(index)); } long queryCompr(long left, long right) {  return query(binSearch(left), binSearch(right)); }   void updateCompr(long index, long val) {  int ind = binSearch(index);  update(ind, ind, val); } void updateCompr(long left, long right, long val) {  update(binSearch(left), binSearch(right), val); } }  static Random rand = new Random();  static void sort(int[] a) {   int n = a.length;   for (int i = a.length - 1; i > 0; i--) {    int j = rand.nextInt(i + 1);    int tmp = a[i];    a[i] = a[j];    a[j] = tmp;   }   Arrays.sort(a);  }  static void sort(long[] a) {   int n = a.length;   for (int i = a.length - 1; i > 0; i--) {    int j = rand.nextInt(i + 1);    long tmp = a[i];    a[i] = a[j];    a[j] = tmp;   }   Arrays.sort(a);  }  static void sort(double[] a) {   int n = a.length;   for (int i = a.length - 1; i > 0; i--) {    int j = rand.nextInt(i + 1);    double tmp = a[i];    a[i] = a[j];    a[j] = tmp;   }   Arrays.sort(a);  }  static long gcd(long a, long b) { return b == 0 ? a : gcd(b, a % b); }  static long lcm(long a, long b) { return a / gcd(a, b) * b; }  static long[] eEuclid(long a, long b) {   if (b == 0) return new long[] { a, 1, 0 };   long[] ans = eEuclid(b, a % b);   long temp = ans[1] - ans[2] * (a / b);   ans[1] = ans[2]; ans[2] = temp;   return ans;  }  static long modInverse(long a, long m) {   return ((eEuclid(a, m)[1] % m) + m) % m;  }  static class IntList {   static int[] EMPTY = {};   int[] a = EMPTY;   int n = 0;   void add(int v) {    if (n >= a.length)     a = Arrays.copyOf(a, (n << 2) + 8);    a[n++] = v;   }   int get(int idx) {    return a[idx];   }   int size() {    return n;   }  }  static class DisjointSet {   int[] s, r;  public DisjointSet(int n) {    s = new int[n]; r = new int[n];    for (int i = 0; i < n; i++) s[i] = i;   }   public int find(int i) { return s[i] == i ? i : (s[i] = find(s[i])); } public void union(int a, int b) {    if(r[a = find(a)] == r[b = find(b)]) r[a]++;    if(r[a] >= r[b]) s[b] = a; else s[a] = b;   }  }  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());   }   public long nextLong() throws IOException {    return Long.parseLong(next());   }   public double nextDouble() throws IOException {    return Double.parseDouble(next());   }   public int[] nextOffsetIntArray(int n) throws IOException {    int[] arr = new int[n];    for (int i = 0; i < n; i++)     arr[i] = nextInt() - 1;    return arr;   }   public int[] nextIntArray(int n) throws IOException {    int[] arr = new int[n];    for (int i = 0; i < n; i++)     arr[i] = nextInt();    return arr;   }   public int[][] nextIntArray(int n, int m) throws IOException {    int[][] arr = new int[n][m];    for (int i = 0; i < n; i++)     for (int j = 0; j < m; j++)      arr[i][j] = nextInt();    return arr;   }   public long[] nextLongArray(int n) throws IOException {    long[] arr = new long[n];    for (int i = 0; i < n; i++)     arr[i] = nextLong();    return arr;   }   public long[][] nextLongArray(int n, int m) throws IOException {    long[][] arr = new long[n][m];    for (int i = 0; i < n; i++)     for (int j = 0; j < m; j++)      arr[i][j] = nextLong();    return arr;   }   public double[] nextDoubleArray(int n) throws IOException {    double[] arr = new double[n];    for (int i = 0; i < n; i++)     arr[i] = nextDouble();    return arr;   }   public double[][] nextDoubleArray(int n, int m) throws IOException {    double[][] arr = new double[n][m];    for (int i = 0; i < n; i++)     for (int j = 0; j < m; j++)      arr[i][j] = nextDouble();    return arr;   }   public char[][] nextCharArray(int n, int m) throws IOException {    char[][] arr = new char[n][];    for (int i = 0; i < n; i++)     arr[i] = next().toCharArray();    return arr;   }  } }
1	public class Main {  private static 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);    }   }  }  private static void shuffleArray(int[] array) {   int index;   Random random = new Random();   for (int i = array.length - 1; i > 0; i--) {    index = random.nextInt(i + 1);    if (index != i) {     array[index] ^= array[i];     array[i] ^= array[index];     array[index] ^= array[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();  }  private static 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();   }   byte nextByte() {    return Byte.parseByte(next());   }   short nextShort() {    return Short.parseShort(next());   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   void close() {    try {     br.close();    } catch (IOException e) {     e.printStackTrace();    }   }  }  private static 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();    }   }  } }
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);  }  } class MathUtils {  public static long modpow(int b, int e, int m) {   if (e == 0) return 1%m;   else if (e == 1) return b%m;   long temp = modpow(b, e/2, m);   temp = (temp * temp) % m;   if (e % 2 == 1) temp = (temp * b) % m;   return temp;  }  }
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);   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();    int l, r, sum = 0;    int[] a = new int[n+5];    for (int i = 0; i < n; i++) a[i] = in.nextInt();    for (int i = 0; i < n; i++)     for (int j = i+1; j < n; j++)      if (a[i] > a[j]) sum++;    int q = in.nextInt();    while (q-- > 0){     l = in.nextInt();     r = in.nextInt();     sum += (r-l+1)/2;     if (sum % 2 == 1) out.println("odd");     else out.println("even");    }   }  }  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());   }  } }
3	public class AG1 {  public static void main(String[] Args){   FastReader scan=new FastReader();   int n=scan.nextInt();   int[] arr=new int[n];   for (int i = 0; i <n ; i++) {    arr[i]=scan.nextInt();   }   Arrays.sort(arr);   boolean[] done=new boolean[n];   int ans=0;   for(int i=0;i<n;i++){    if(!done[i]){     done[i]=true;     ans++;     for(int j=i+1;j<n;j++){      if(arr[j]%arr[i]==0){       done[j]=true;      }     }    }   }   System.out.println(ans);  }  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());   }   double nextDouble()   {    return Double.parseDouble(next());   }   String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  } }
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 m = in.nextInt();  int k = in.nextInt();  int[] fs = IOUtils.readIntArray(in, n);  Arrays.sort(fs);  int ptr = fs.length - 1;  int res = 0;  while (ptr >= 0 && k < m) {  k += fs[ptr--] - 1;  res++;  }  if (k < m) out.println(-1);  else out.println(res); } } class IOUtils {  public static int[] readIntArray(Scanner in, int size) {   int[] array = new int[size];   for (int i = 0; i < size; i++)    array[i] = in.nextInt();   return array;  }  }
1	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputUtil in = new InputUtil(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskB solver = new TaskB();  solver.solve(1, in, out);  out.close(); } } class TaskB {  HashMap<Integer, Integer> left = new HashMap<Integer, Integer>();  public void solve(int testNumber, InputUtil in, PrintWriter out) {   int n = in.nextInt();   int a = in.nextInt();   int b = in.nextInt();   int[] res = new int[n];   int[] arr = in.nextIntArray(n);   IntDeque[] adj = IntDeque.IntDeques(n);   boolean[] self = new boolean[n];   boolean[] assigned = new boolean[n];   for (int i = 0; i < n; i++) {    left.put(arr[i], i);   }   for (int i = 0; i < n; i++) {    int x = arr[i];    boolean canA = left.containsKey(a - x);    boolean canB = left.containsKey(b - x);    if (!canA && !canB) {     out.println("NO");     return;    }    if (left.containsKey(a - x)) {     self[i] |= x == a - x;     if (x != a - x) {      adj[i].add(left.get(a - x));     }    }    if (left.containsKey(b - x)) {     self[i] |= x == b - x;     if (x != b - x) {      adj[i].add(left.get(b - x));     }    }   }   if (a == b) {    out.println("YES");    out.println(IntArrayUtil.toString(res));    return;   }   for (int iter = 0; iter < 2; iter++) {    for (int i = 0; i < n; i++) {     if (!self[i] && !assigned[i] && (iter == 1 || adj[i].size() == 1)) {      int u = i;      DFS:      while (true) {       assigned[u] = true;       if (self[u] && arr[u] == b - arr[u]) {        res[u] = 1;        break;       }       for (int v : adj[u]) {        if (!assigned[v]) {         assigned[v] = true;         if (arr[u] == b - arr[v]) {          res[u] = res[v] = 1;         }         for (int newU : adj[v]) {          if (!assigned[newU]) {           u = newU;           continue DFS;          }         }         break DFS;        }       }       out.println("NO");       return;      }     }     else if (iter == 1 && !assigned[i] && adj[i].size() == 0 && arr[i] == b - arr[i]) {      res[i] = 1;     }    }   }   out.println("YES");   out.println(IntArrayUtil.toString(res));  }  } class InputUtil {  JoltyScanner in;  public InputUtil(InputStream istream) {   in = new JoltyScanner(istream);  }  public String next() {   return in.next();  }  public int nextInt() {   return Integer.parseInt(next());  }  public int[] nextIntArray (int size) {   int[] arr = new int[size];   for (int i = 0; i < size; i++) {    arr[i] = in.nextInt();   }   return arr;  } } class IntDeque implements Iterable<Integer> {  private int capacity;  private int size = 0;  private int front = 0;  private int back = 0;  private int[] deque;  public IntDeque() {   this(16);  }  public IntDeque(int capacity) {   this.capacity = capacity;   deque = new int[capacity];  }  public static IntDeque[] IntDeques(int length) {   IntDeque[] arr = new IntDeque[length];   for (int i = 0; i < length; i++) {    arr[i] = new IntDeque();   }   return arr;  }  public <T extends Iterable<Integer>>IntDeque(T intList) {   this(16);   addAll(intList);  }  public IntDeque(int[] intArr) {   this(16);   for (int i: intArr) {    addLast(i);   }  }  public void add(int x) {   addLast(x);  }  public <T extends Iterable<Integer>>void addAll(T intList) {   for (int i: intList) {    addLast(i);   }  }  public void addLast(int x) {   ensureCapacity();   size++;   deque[back++] = x;   if (back == capacity) {    back = 0;   }  }  public void ensureCapacity() {   if (size < capacity) {    return;   }   int[] newDeque = new int[capacity << 1];   for (int i = 0, j = front; i < size; i++, j++) {    if (j == capacity) {     j = 0;    }    newDeque[i] = deque[j];   }   deque = newDeque;   capacity <<= 1;   front = 0;   back = size;  }  public Iterator<Integer> iterator() {   return new Iterator<Integer>() {    int done = 0;    int curr = front;    public boolean hasNext() {     return done < size;    }    public Integer next() {     Integer res = deque[curr++];     if (curr == capacity) {      curr = 0;     }     done++;     return res;    }    public void remove() {     throw new UnsupportedOperationException();    }   };  }  public int size() {   return size;  }  public String toString() {   if (size == 0) {    return "";   }   StringBuilder res = new StringBuilder();   for (int i: this) {    res.append(i);    res.append(" ");   }   res.setLength(res.length() - 1);   return res.toString();  } } class IntArrayUtil {  public static String toString(int[] arr) {   return toString(arr, " ");  }  public static String toString(int[] arr, String delimiter) {   StringBuilder res = new StringBuilder();   for (int i: arr) {    res.append(i);    res.append(delimiter);   }   res.setLength(res.length() - delimiter.length());   return res.toString();  } } class JoltyScanner {  public static final int BUFFER_SIZE = 1 << 16; public static final char NULL_CHAR = (char) -1;  StringBuilder str = new StringBuilder(); byte[] buffer = new byte[BUFFER_SIZE]; boolean EOF_FLAG = false; int bufferIdx = 0, size = 0; char c = NULL_CHAR; BufferedInputStream in;  public JoltyScanner(InputStream in) {  this.in = new BufferedInputStream(in, BUFFER_SIZE); }  public int nextInt() {  long x = nextLong();  if (x > Integer.MAX_VALUE || x < Integer.MIN_VALUE) {  throw new ArithmeticException("Scanned value overflows integer");  }  return (int) x; }  public long nextLong() {  boolean negative = false;  if (c == NULL_CHAR) {  c = nextChar();  }  for (; !EOF_FLAG && (c < '0' || c > '9'); c = nextChar()) {  if (c == '-') {   negative = true;  }    }  checkEOF();  long res = 0;  for (; c >= '0' && c <= '9'; c = nextChar()) {  res = (res << 3) + (res << 1) + c - '0';  }  return negative ? -res : res; }  public String next() {  checkEOF();  if (c == NULL_CHAR) {  c = nextChar();  }  while (Character.isWhitespace(c)) {  c = nextChar();  checkEOF();  }  str.setLength(0);  for (; !EOF_FLAG && !Character.isWhitespace(c); c = nextChar()) {  str.append(c);  }  return str.toString(); }  public char nextChar() {  if (EOF_FLAG) {  return NULL_CHAR;  }  while (bufferIdx == size) {  try {   size = in.read(buffer);   if (size == -1) {   throw new Exception();   }  } catch (Exception e) {   EOF_FLAG = true;   return NULL_CHAR;  }  if (size == -1) {   size = BUFFER_SIZE;  }  bufferIdx = 0;  }  return (char) buffer[bufferIdx++]; }  public void checkEOF() {  if (EOF_FLAG) {  throw new EndOfFileException();  } }  public class EndOfFileException extends RuntimeException { } }
2	public class Q1 {  static ArrayList<Integer> adj[],adj2[]; static int color[],cc; static long mod=1000000007; static TreeSet<Integer> ts[]; static boolean b[],visited[],possible,ans1,ans2; static Stack<Integer> s; static int totalnodes,colored,min,minc; static int c[]; static long sum[]; static HashMap<Integer,Integer> hm; public static void main(String[] args) throws IOException {     in=new InputReader(System.in);  out=new PrintWriter(System.out);  String n1=in.readString();  String s1=in.readString();  long s=Long.parseLong(s1);  long n=Long.parseLong(n1);   long l=s-1;  long r=n+1;  HashSet<Long> hset=new HashSet<>();  long last=-1;  while(l<r)  {  long mid=(l+r)/2;  long sum=0;  if(hset.contains(mid))   break;  String d=String.valueOf(mid);  for(int i=0;i<d.length();i++)  {   sum=sum+(d.charAt(i)-'0');  }    hset.add(mid);    if(mid-sum>=s)  {   last=mid;   r=mid;  }  else  {   l=mid;  }  }  if(last==-1)  out.println("0");  else  {  out.println(n-last+1);  }  out.close();  }  static InputReader in; static PrintWriter out;  static void dfs(int i,int parent) {  if(color[i]!=cc)   ans1= false;  for(int j:adj[i])  {   if(j!=parent)   {   dfs(j,i);   }  }   }  static class Pair implements Comparable<Pair> {  int i;  int j;  int index;  public Pair(){    }  public Pair(int u, int v,int index) {  this.i = u;  this.j= v;  this.index=index;  }  public int compareTo(Pair other) {       return this.i-other.i;  }    } static class Node2{  Node2 left = null;  Node2 right = null;  Node2 parent = null;  int data; }   static class BinarySearchTree{  Node2 root = null;  int height = 0;  int max = 0;  int cnt = 1;  ArrayList<Integer> parent = new ArrayList<>();  HashMap<Integer, Integer> hm = new HashMap<>();  public void insert(int x){  Node2 n = new Node2();  n.data = x;  if(root==null){   root = n;  }  else{   Node2 temp = root,temp2 = null;   while(temp!=null){   temp2 = temp;   if(x>temp.data) temp = temp.right;   else temp = temp.left;   }   if(x>temp2.data) temp2.right = n;   else temp2.left = n;   n.parent = temp2;   parent.add(temp2.data);  }  }  public Node2 getSomething(int x, int y, Node2 n){  if(n.data==x || n.data==y) return n;  else if(n.data>x && n.data<y) return n;  else if(n.data<x && n.data<y) return getSomething(x,y,n.right);  else return getSomething(x,y,n.left);  }  public Node2 search(int x,Node2 n){  if(x==n.data){   max = Math.max(max, n.data);   return n;  }  if(x>n.data){   max = Math.max(max, n.data);   return search(x,n.right);  }  else{   max = Math.max(max, n.data);   return search(x,n.left);  }  }  public int getHeight(Node2 n){  if(n==null) return 0;  height = 1+ Math.max(getHeight(n.left), getHeight(n.right));  return height;  } } public static void debug(Object... o) { System.out.println(Arrays.deepToString(o)); } public static String rev(String s) { StringBuilder sb=new StringBuilder(s); sb.reverse(); return sb.toString(); } static long lcm(long a, long b) {  return a * (b / gcd(a, b)); } static long gcd(long a, long b) {  while (b > 0)  {   long temp = b;   b = a % b;   a = temp;  }  return a; } public static long max(long x, long y, long z){  if(x>=y && x>=z) return x;  if(y>=x && y>=z) return y;  return z; } static int[] sieve(int n,int[] arr) { for(int i=2;i*i<=n;i++) {  if(arr[i]==0)  {  for(int j=i*2;j<=n;j+=i)   arr[j]=1;  } } return arr; }   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 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; }  public String readString() { int c = snext(); while (isSpaceChar(c)) {  c = snext(); } StringBuilder res = new StringBuilder(); do {  res.appendCodePoint(c);  c = snext(); } while (!isSpaceChar(c)); return res.toString(); } public String nextLine() { int c = snext(); while (isSpaceChar(c))  c = snext(); StringBuilder res = new StringBuilder(); do {  res.appendCodePoint(c);  c = snext(); } while (!isEndOfLine(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; } private boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } }  }
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();  }  } class IntegerUtlis {  public static long pow(long x, long y, long mod) {   x %= mod;   long res = 1;   while (y > 0) {    if (y % 2 == 1) {     --y;     res = BigInteger.valueOf(res).multiply(BigInteger.valueOf(x)).mod(BigInteger.valueOf(mod)).longValue();    } else {     y /= 2;     x = BigInteger.valueOf(x).multiply(BigInteger.valueOf(x)).mod(BigInteger.valueOf(mod)).longValue();    }   }   return res % mod;  }  }
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());  } }
5	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();  int T = nextInt();  Pair[] p = new Pair [N];  for (int i = 0; i < N; i++)  p[i] = new Pair(nextInt(), nextInt());  sort(p);  int ans = 2;  for (int i = 1; i < N; i++) {  int dif = (2 * p[i].x - p[i].a) - (2 * p[i - 1].x + p[i - 1].a);  if (dif == 2 * T)   ans++;  else if (dif > 2 * T)   ans += 2;  }  out.println(ans);  out.close(); }  class Pair implements Comparable<Pair> {  int x, a;   public Pair(int xx, int aa) {  x = xx;  a = aa;  }   @Override  public int compareTo(Pair p) {  return x < p.x ? -1 : 1;  } }  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()); }  String nextLine() throws IOException {  st = new StringTokenizer("");  return in.readLine(); }  boolean EOF() throws IOException {  while (!st.hasMoreTokens()) {  String s = in.readLine();  if (s == null)   return true;  st = new StringTokenizer(s);  }  return false; } }
5	public class A {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int t = in.nextInt() * 2;   Point[] A = new Point[n];   for (int i = 0; i < n; i++) {    int center = in.nextInt() * 2;    int side = in.nextInt();    A[i] = new Point(center - side, center + side);   }   Arrays.sort(A, new Comparator<Point>() {    public int compare(Point x, Point y) {     return x.x - y.x;    }   });   int ans = 2;   for (int i = 1; i < n; i++) {    if (A[i].x - A[i - 1].y > t)     ans += 2;    else if (A[i].x - A[i - 1].y == t)     ans++;   }   System.out.println(ans);  } }
2	public class algo93 {  public static void main(String args[])  {   Scanner ex=new Scanner(System.in);   long x=ex.nextLong();   long k=ex.nextLong();   long mod=1000000007;   if(k==0)   System.out.println((2*x)%mod);   else if(x==0)   System.out.println("0");   else   {    long pow=power(2,k);    long pow1=(2*pow)%mod;    long ans=(pow1*(x%mod))-pow+1;    if(ans<0)    ans=ans+mod;    ans=ans%mod;    System.out.println(ans);   }  }  public static long power(long x,long y)  {   if (y == 0)   return 1;   long mod=1000000007;   long pow=power(x,y/2);   pow=(pow*pow)%mod;   if(y%2==0)   return pow;   else   return ((x%mod)*pow)%mod;  } }
4	public class C {  void run() throws IOException {  int n = ni(), m = ni(), k = ni(), q = n * m, h = 0, t = 0, inf = 123456;  int[] x = new int[q], y = new int[q];  int[][] d = new int[n][m];  for (int i = 0; i < n; i++)  for (int j = 0; j < m; j++)   d[i][j] = inf;  for (int i = 0; i < k; i++) {  int u = ni() - 1, v = ni() - 1;  d[u][v] = 0;  x[t] = u;  y[t] = v;  t++;  }  if (k < q)  while (t != h) {   int u = x[h], v = y[h];   int l = d[u][v] + 1;   h++;   if (u > 0 && d[u - 1][v] > l) {   d[u - 1][v] = l;   x[t] = u - 1;   y[t] = v;   t++;   }   if (u < n - 1 && d[u + 1][v] > l) {   d[u + 1][v] = l;   x[t] = u + 1;   y[t] = v;   t++;   }   if (v > 0 && d[u][v - 1] > l) {   d[u][v - 1] = l;   x[t] = u;   y[t] = v - 1;   t++;   }   if (v < m - 1 && d[u][v + 1] > l) {   d[u][v + 1] = l;   x[t] = u;   y[t] = v + 1;   t++;   }  }  int max = 0, tx = 0, ty = 0;  for (int i = 0; i < n; i++)  for (int j = 0; j < m; j++)   if (d[i][j] > max) {   max = d[i][j];   tx = i;   ty = j;   }  pw.print(1 + tx + " " + (1 + ty)); }  String next() throws IOException {  while (st == null || !st.hasMoreTokens())  st = new StringTokenizer(br.readLine());  return st.nextToken(); }  int ni() throws IOException {  return Integer.parseInt(next()); }  String nl() throws IOException {  return br.readLine(); }  PrintWriter pw; BufferedReader br; StringTokenizer st;  public static void main(String[] args) throws IOException {  BufferedReader _br = new BufferedReader(new FileReader(new File("input.txt")));  PrintWriter _pw = new PrintWriter(new FileWriter(new File("output.txt")));  new C(_br, _pw).run();  _br.close();  _pw.close(); }  public C(BufferedReader _br, PrintWriter _pw) {  br = _br;  pw = _pw; } }
1	public class D999 {  public static void main(String args[])throws IOException  {   Scanner sc=new Scanner(System.in);   int n=sc.nextInt();   int m=sc.nextInt();   int req=n/m;   int arr[]=new int[n+1];   int size[]=new int[m];   List<Integer> list[]=new ArrayList[m];   for(int i=0;i<m;i++)   {    list[i]=new ArrayList<>();   }   for(int i=1;i<=n;i++)   {    arr[i]=sc.nextInt();    size[arr[i]%m]++;    list[arr[i]%m].add(i);   }   long tot=0;int x=0,y=0;   List<Integer> idx=new ArrayList<>();   for(int i=0;i < 2*m;i++)   {       if(size[i%m]>req)    {     for(int j=0;j<size[i%m]-req;j++)     {      idx.add(list[i%m].get(j));      y++;          }     size[i%m]=req;        }    else if(size[i%m]<req)    {         while(x!=y && size[i%m]<req)     {      int num=arr[idx.get(x)];      int gg=i-num%m;      tot+=gg;      arr[idx.get(x)]+=gg;      x++;      size[i%m]++;     }    }   }   System.out.println(tot);   for(int i=1;i<=n;i++)   {    System.out.print(arr[i]+" ");   }  } }
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()); }  public long nextLong() {  return Long.parseLong(next()); } }
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; }  private static 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; }  private static 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; }  private static 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; }  private static 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 int countDispositionDivisors(int[] d) {  HashSet<Integer> div = new HashSet<Integer>();  for (int i = 1; i <= d.length; i++) {  for (int j = 0; j < d.length; j++) {   if ((j + 1) % i == 0 && d[j] % i == 0) {   div.add(j + 1);   break;   }  }  }  return div.size(); }  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; }  static long[] readLongArray() throws IOException {  String[] v = br.readLine().split(" ");  long[] ans = new long[v.length];  for (int i = 0; i < ans.length; i++) {  ans[i] = Long.valueOf(v[i]);  }  return ans; }  static <T> void print(List<T> v) {  StringBuilder sb = new StringBuilder();  for (int i = 0; i < v.size(); i++) {  if (sb.length() > 0) {   sb.append(' ');  }   sb.append(v.get(i));  }  System.out.println(sb); } }
5	public class P220A {  public static void main(String[] args)  {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[] a = new int[n];   List<Integer> b = new ArrayList<Integer>(n);   for (int i = 0; i < n; i++)   {    a[i] = sc.nextInt();    b.add(a[i]);   }   Collections.sort(b);   int c = 0;   for (int i = 0; i < n; i++)   {    if (a[i] != b.get(i)) c++;   }   if (c == 0 || c == 2)   {    System.out.println("YES");   }   else   {    System.out.println("NO");   }  } }
0	public class trafficerules {   public static void main(String[] args) throws Exception {  if ("Satayev".equals(System.getProperty("user.name"))) {  long start = System.nanoTime();  new trafficerules().solve(new FileInputStream("input"));  System.err.printf("Time elapsed: %d ms.\n", (System.nanoTime()-start)/1000000);  }  else  new trafficerules().solve(System.in);  }  void solve(InputStream is) throws Exception {  Scanner in = new Scanner(is);   double a = in.nextDouble(), maxv = in.nextDouble(), s = in.nextDouble(), d = in.nextDouble(), w = in.nextDouble();   if (maxv < w)  w = maxv;   double t = 0;      double t1 = w / a;  double s1 = a*t1*t1/2;  double v1 = w;  if ( s1 < d ) {  v1 = w;    if (v1 >= maxv)   t1 += (d-s1)/v1;  else {   double tt = (maxv - v1)/a;   double ss = v1*tt+a*tt*tt/2;   ss *= 2;   if (s1 + ss < d)   t1 += tt*2 + (d-s1-ss)/maxv;   else {   ss = (d-s1)/2;      double A = a/2;   double B = v1;   double C = -ss;   double D = B*B - 4 * A * C;   tt = (-B + Math.sqrt(D))/2/A;   t1 += tt*2;   }  }    s1 = d;  }  if (s1 > d) {  s1 = d;  t1 = Math.sqrt(2*s1/a);  v1 = a * t1;  }   t += t1;   double t2 = (maxv - v1) / a;  double s2 = v1*t2 + a*t2*t2/2;  double v2 = maxv;  if (s1 + s2 < s) {  v2 = maxv;  t2 += (s-s1-s2)/v2;  }  if (s1 + s2 > s) {  s -= s1;      double A = a/2;  double B = v1;  double C = -s;  double D = B*B - 4*A*C;    t2 = (-B + Math.sqrt(D))/2/A;  }   t += t2;   System.out.println(t);  } }
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 double nextDouble() {  return Double.parseDouble(next());  }  public long nextLong() {  return Long.parseLong(next());  }  public int nextInt() {  return Integer.parseInt(next());  } } }
0	public class BankAccount {   public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  String s = in.readLine();  int n = Integer.parseInt(s);  if (s.charAt(0) == '-')  if (Integer.parseInt(s.substring(0, s.length()-1))>Integer.parseInt(s.substring(0, s.length()-2)+s.charAt(s.length()-1)))   s=s.substring(0, s.length()-1);  else   s=s.substring(0, s.length()-2)+s.charAt(s.length()-1);  System.out.println(Integer.parseInt(s));  in.close(); } }
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; } }
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>() {     public int compare(E2RotateColumnsHardVersion.Column o1, E2RotateColumnsHardVersion.Column o2) {      return o2.max - o1.max;     }    });    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 Column {    int[] v;    int max;    public Column(int[] v) {     this.v = v;    }    void initMax() {     max = 0;     for (int vv : v) max = Math.max(max, vv);    }   }  }  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;   }  } }
4	public class _P023A{  Scanner sc=new Scanner(System.in);  int INF=1<<28;  double EPS=1e-9;  String s;  void run(){   s=sc.nextLine();   solve();  }  void solve(){   int n=s.length();   int max=0;   for(int i=0; i<n; i++){    for(int j=i+1; j<n; j++){     for(int k=0; j+k<n; k++){      if(s.charAt(i+k)!=s.charAt(j+k)){       break;      }else{       max=max(max, k+1);      }     }    }   }   println(max+"");  }  void println(String s){   System.out.println(s);  }  void print(String s){   System.out.print(s);  }  void debug(Object... os){   System.err.println(Arrays.deepToString(os));  }  public static void main(String[] args){   Locale.setDefault(Locale.US);   new _P023A().run();  } }
3	public class icpc {  public static void main(String[] args) throws IOException  {   Reader in = new Reader();   int n = in.nextInt();   boolean[] A = new boolean[n];   int count = 0;   int[] B = new int[n];   for (int i=0;i<n;i++)    B[i] = in.nextInt();   Arrays.sort(B);   for (int i=0;i<n;i++)   {    if (!A[i])    {     int gcd = B[i];     for (int j=0;j<n;j++)     {      if(!A[j])      {       gcd = gcd(B[j], gcd);       if(gcd == B[i])       {        A[j] = true;       }       else       {        gcd = B[i];       }      }     }     count++;     A[i] = true;    }   }   System.out.println(count);  }  public static int gcd(int a, int b)  {   if (b == 0)    return a;   return gcd(b, a % b);  } } class DSU {  int[] parent;  int[] size;   DSU(int n)  {   this.parent = new int[n];   this.size = new int[n];   Arrays.fill(parent, -1);  }  public void makeSet(int v)  {   parent[v] = v;   size[v] = 1;  }  public int findSet(int v)  {   if (v == parent[v]) return v;   return parent[v] = findSet(parent[v]);  }  public void unionSets(int a, int b)  {   a = findSet(a);   b = findSet(b);   if (a != b)   {    if (size[a] < size[b])    {     int temp = a;     a = b;     b = temp;    }    parent[b] = a;    size[a] += size[b];   }  } } class FastFourierTransform {  private void fft(double[] a, double[] b, boolean invert)  {   int count = a.length;   for (int i = 1, j = 0; i < count; i++)   {    int bit = count >> 1;    for (; j >= bit; bit >>= 1)     j -= bit;    j += bit;    if (i < j)    {     double temp = a[i];     a[i] = a[j];     a[j] = temp;     temp = b[i];     b[i] = b[j];     b[j] = temp;    }   }   for (int len = 2; len <= count; len <<= 1)   {    int halfLen = len >> 1;    double angle = 2 * Math.PI / len;    if (invert)     angle = -angle;    double wLenA = Math.cos(angle);    double wLenB = Math.sin(angle);    for (int i = 0; i < count; i += len)    {     double wA = 1;     double wB = 0;     for (int j = 0; j < halfLen; j++)     {      double uA = a[i + j];      double uB = b[i + j];      double vA = a[i + j + halfLen] * wA - b[i + j + halfLen] * wB;      double vB = a[i + j + halfLen] * wB + b[i + j + halfLen] * wA;      a[i + j] = uA + vA;      b[i + j] = uB + vB;      a[i + j + halfLen] = uA - vA;      b[i + j + halfLen] = uB - vB;      double nextWA = wA * wLenA - wB * wLenB;      wB = wA * wLenB + wB * wLenA;      wA = nextWA;     }    }   }   if (invert)   {    for (int i = 0; i < count; i++)    {     a[i] /= count;     b[i] /= count;    }   }  }  public long[] multiply(long[] a, long[] b)  {   int resultSize = Integer.highestOneBit(Math.max(a.length, b.length) - 1) << 2;   resultSize = Math.max(resultSize, 1);   double[] aReal = new double[resultSize];   double[] aImaginary = new double[resultSize];   double[] bReal = new double[resultSize];   double[] bImaginary = new double[resultSize];   for (int i = 0; i < a.length; i++)    aReal[i] = a[i];   for (int i = 0; i < b.length; i++)    bReal[i] = b[i];   fft(aReal, aImaginary, false);   fft(bReal, bImaginary, false);   for (int i = 0; i < resultSize; i++)   {    double real = aReal[i] * bReal[i] - aImaginary[i] * bImaginary[i];    aImaginary[i] = aImaginary[i] * bReal[i] + bImaginary[i] * aReal[i];    aReal[i] = real;   }   fft(aReal, aImaginary, true);   long[] result = new long[resultSize];   for (int i = 0; i < resultSize; i++)    result[i] = Math.round(aReal[i]);   return result;  } } class NumberTheory {  public boolean isPrime(long n)  {   if(n < 2)    return false;   for(long x = 2;x * x <= n;x++)   {    if(n % x == 0)     return false;   }   return true;  }  public ArrayList<Long> primeFactorisation(long n)  {   ArrayList<Long> f = new ArrayList<>();   for(long x=2;x * x <= n;x++)   {    while(n % x == 0)    {     f.add(x);     n /= x;    }   }   if(n > 1)    f.add(n);   return f;  }  public int[] sieveOfEratosthenes(int n)  {     int[] sieve = new int[n + 1];   for(int x=2;x * x <= n;x++)   {    if(sieve[x] != 0)     continue;    for(int u=x*x;u<=n;u+=x)    {     if(sieve[u] == 0)     {      sieve[u] = x;     }    }   }   return sieve;  }  public long gcd(long a, long b)  {   if(b == 0)    return a;   return gcd(b, a % b);  }  public long phi(long n)  {   double result = n;   for(long p=2;p*p<=n;p++)   {    if(n % p == 0)    {     while (n % p == 0)      n /= p;     result *= (1.0 - (1.0 / (double)p));    }   }   if(n > 1)    result *= (1.0 - (1.0 / (double)n));   return (long)result;  }  public Name extendedEuclid(long a, long b)  {   if(b == 0)    return new Name(a, 1, 0);   Name n1 = extendedEuclid(b, a % b);   Name n2 = new Name(n1.d, n1.y, n1.x - (long)Math.floor((double)a / b) * n1.y);   return n2;  }  public long modularExponentiation(long a, long b, long n)  {   long d = 1L;   String bString = Long.toBinaryString(b);   for(int i=0;i<bString.length();i++)   {    d = (d * d) % n;    if(bString.charAt(i) == '1')     d = (d * a) % n;   }   return d;  } } class Name {  long d;  long x;  long y;  public Name(long d, long x, long y)  {   this.d = d;   this.x = x;   this.y = y;  } } class SuffixArray {  int ALPHABET_SZ = 256, N;  int[] T, lcp, sa, sa2, rank, tmp, c;  public SuffixArray(String str)  {   this(toIntArray(str));  }  private static int[] toIntArray(String s)  {   int[] text = new int[s.length()];   for (int i = 0; i < s.length(); i++) text[i] = s.charAt(i);   return text;  }  public SuffixArray(int[] text)  {   T = text;   N = text.length;   sa = new int[N];   sa2 = new int[N];   rank = new int[N];   c = new int[Math.max(ALPHABET_SZ, N)];   construct();   kasai();  }  private void construct()  {   int i, p, r;   for (i = 0; i < N; ++i) c[rank[i] = T[i]]++;   for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];   for (i = N - 1; i >= 0; --i) sa[--c[T[i]]] = i;   for (p = 1; p < N; p <<= 1)   {    for (r = 0, i = N - p; i < N; ++i) sa2[r++] = i;    for (i = 0; i < N; ++i) if (sa[i] >= p) sa2[r++] = sa[i] - p;    Arrays.fill(c, 0, ALPHABET_SZ, 0);    for (i = 0; i < N; ++i) c[rank[i]]++;    for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];    for (i = N - 1; i >= 0; --i) sa[--c[rank[sa2[i]]]] = sa2[i];    for (sa2[sa[0]] = r = 0, i = 1; i < N; ++i)    {     if (!(rank[sa[i - 1]] == rank[sa[i]]       && sa[i - 1] + p < N       && sa[i] + p < N       && rank[sa[i - 1] + p] == rank[sa[i] + p])) r++;     sa2[sa[i]] = r;    }    tmp = rank;    rank = sa2;    sa2 = tmp;    if (r == N - 1) break;    ALPHABET_SZ = r + 1;   }  }  private void kasai()  {   lcp = new int[N];   int[] inv = new int[N];   for (int i = 0; i < N; i++) inv[sa[i]] = i;   for (int i = 0, len = 0; i < N; i++)   {    if (inv[i] > 0)    {     int k = sa[inv[i] - 1];     while ((i + len < N) && (k + len < N) && T[i + len] == T[k + len]) len++;     lcp[inv[i] - 1] = len;     if (len > 0) len--;    }   }  } } class ZAlgorithm {  public int[] calculateZ(char input[])  {   int Z[] = new int[input.length];   int left = 0;   int right = 0;   for(int k = 1; k < input.length; k++) {    if(k > right) {     left = right = k;     while(right < input.length && input[right] == input[right - left]) {      right++;     }     Z[k] = right - left;     right--;    } else {         int k1 = k - left;         if(Z[k1] < right - k + 1) {      Z[k] = Z[k1];     } else {      left = k;      while(right < input.length && input[right] == input[right - left]) {       right++;      }      Z[k] = right - left;      right--;     }    }   }   return Z;  }  public ArrayList<Integer> matchPattern(char text[], char pattern[])  {   char newString[] = new char[text.length + pattern.length + 1];   int i = 0;   for(char ch : pattern) {    newString[i] = ch;    i++;   }   newString[i] = '$';   i++;   for(char ch : text) {    newString[i] = ch;    i++;   }   ArrayList<Integer> result = new ArrayList<>();   int Z[] = calculateZ(newString);   for(i = 0; i < Z.length ; i++) {    if(Z[i] == pattern.length) {     result.add(i - pattern.length - 1);    }   }   return result;  } } class KMPAlgorithm {  public int[] computeTemporalArray(char[] pattern)  {   int[] lps = new int[pattern.length];   int index = 0;   for(int i=1;i<pattern.length;)   {    if(pattern[i] == pattern[index])    {     lps[i] = index + 1;     index++;     i++;    }    else    {     if(index != 0)     {      index = lps[index - 1];     }     else     {      lps[i] = 0;      i++;     }    }   }   return lps;  }  public ArrayList<Integer> KMPMatcher(char[] text, char[] pattern)  {   int[] lps = computeTemporalArray(pattern);   int j = 0;   int i = 0;   int n = text.length;   int m = pattern.length;   ArrayList<Integer> indices = new ArrayList<>();   while(i < n)   {    if(pattern[j] == text[i])    {     i++;     j++;    }    if(j == m)    {     indices.add(i - j);     j = lps[j - 1];    }    else if(i < n && pattern[j] != text[i])    {     if(j != 0)      j = lps[j - 1];     else      i = i + 1;    }   }   return indices;  } } class Hashing {  public long[] computePowers(long p, int n, long m)  {   long[] powers = new long[n];   powers[0] = 1;   for(int i=1;i<n;i++)   {    powers[i] = (powers[i - 1] * p) % m;   }   return powers;  }  public long computeHash(String s)  {   long p = 31;   long m = 1_000_000_009;   long hashValue = 0L;   long[] powers = computePowers(p, s.length(), m);   for(int i=0;i<s.length();i++)   {    char ch = s.charAt(i);    hashValue = (hashValue + (ch - 'a' + 1) * powers[i]) % m;   }   return hashValue;  } } class BasicFunctions {  public long min(long[] A)  {   long min = Long.MAX_VALUE;   for(int i=0;i<A.length;i++)   {    min = Math.min(min, A[i]);   }   return min;  }  public long max(long[] A)  {   long max = Long.MAX_VALUE;   for(int i=0;i<A.length;i++)   {    max = Math.max(max, A[i]);   }   return max;  } } class MergeSortInt {      void merge(int arr[], int l, int m, int r) {     int n1 = m - l + 1;   int n2 = r - m;      int L[] = new int[n1];   int R[] = new int[n2];      for (int i = 0; i < n1; ++i)    L[i] = arr[l + i];   for (int j = 0; j < n2; ++j)    R[j] = arr[m + 1 + j];         int i = 0, j = 0;      int k = l;   while (i < n1 && j < n2) {    if (L[i] <= R[j]) {     arr[k] = L[i];     i++;    } else {     arr[k] = R[j];     j++;    }    k++;   }      while (i < n1) {    arr[k] = L[i];    i++;    k++;   }      while (j < n2) {    arr[k] = R[j];    j++;    k++;   }  }     void sort(int arr[], int l, int r) {   if (l < r) {       int m = (l + r) / 2;        sort(arr, l, m);    sort(arr, m + 1, r);        merge(arr, l, m, r);   }  } } class MergeSortLong {      void merge(long arr[], int l, int m, int r) {     int n1 = m - l + 1;   int n2 = r - m;      long L[] = new long[n1];   long R[] = new long[n2];      for (int i = 0; i < n1; ++i)    L[i] = arr[l + i];   for (int j = 0; j < n2; ++j)    R[j] = arr[m + 1 + j];         int i = 0, j = 0;      int k = l;   while (i < n1 && j < n2) {    if (L[i] <= R[j]) {     arr[k] = L[i];     i++;    } else {     arr[k] = R[j];     j++;    }    k++;   }      while (i < n1) {    arr[k] = L[i];    i++;    k++;   }      while (j < n2) {    arr[k] = R[j];    j++;    k++;   }  }     void sort(long arr[], int l, int r) {   if (l < r) {       int m = (l + r) / 2;        sort(arr, l, m);    sort(arr, m + 1, r);        merge(arr, l, m, r);   }  } } class Node {  String s;  Node(String s)  {   this.s = s;  }  @Override  public boolean equals(Object ob)  {   if(ob == null)    return false;   if(!(ob instanceof Node))    return false;   if(ob == this)    return true;   Node obj = (Node)ob;   if(this.s.equals(obj.s))    return true;   return false;  }  @Override  public int hashCode()  {   return (int)this.s.length();  } } class Reader {  final private int BUFFER_SIZE = 1 << 16;  private DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;  public Reader()  {   din = new DataInputStream(System.in);   buffer = new byte[BUFFER_SIZE];   bufferPointer = bytesRead = 0;  }  public Reader(String file_name) throws IOException  {   din = new DataInputStream(new FileInputStream(file_name));   buffer = new byte[BUFFER_SIZE];   bufferPointer = bytesRead = 0;  }  public String readLine() throws IOException  {   byte[] buf = new byte[64];   int cnt = 0, c;   while ((c = read()) != -1)   {    if (c == '\n')     break;    buf[cnt++] = (byte) c;   }   return new String(buf, 0, cnt);  }  public int nextInt() throws IOException  {   int ret = 0;   byte c = read();   while (c <= ' ')    c = read();   boolean neg = (c == '-');   if (neg)    c = read();   do   {    ret = ret * 10 + c - '0';   } while ((c = read()) >= '0' && c <= '9');   if (neg)    return -ret;   return ret;  }  public long nextLong() throws IOException  {   long ret = 0;   byte c = read();   while (c <= ' ')    c = read();   boolean neg = (c == '-');   if (neg)    c = read();   do {    ret = ret * 10 + c - '0';   }   while ((c = read()) >= '0' && c <= '9');   if (neg)    return -ret;   return ret;  }  public double nextDouble() throws IOException  {   double ret = 0, div = 1;   byte c = read();   while (c <= ' ')    c = read();   boolean neg = (c == '-');   if (neg)    c = read();   do {    ret = ret * 10 + c - '0';   }   while ((c = read()) >= '0' && c <= '9');   if (c == '.')   {    while ((c = read()) >= '0' && c <= '9')    {     ret += (c - '0') / (div *= 10);    }   }   if (neg)    return -ret;   return ret;  }  private void fillBuffer() throws IOException  {   bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);   if (bytesRead == -1)    buffer[0] = -1;  }  private byte read() throws IOException  {   if (bufferPointer == bytesRead)    fillBuffer();   return buffer[bufferPointer++];  }  public void close() throws IOException  {   if (din == null)    return;   din.close();  } } class FenwickTree {  public void update(long[] fenwickTree,long delta,int index)  {   index += 1;   while(index < fenwickTree.length)   {    fenwickTree[index] += delta;    index = index + (index & (-index));   }  }  public long prefixSum(long[] fenwickTree,int index)  {   long sum = 0L;   index += 1;   while(index > 0)   {    sum += fenwickTree[index];    index -= (index & (-index));   }   return sum;  } } class SegmentTree {  public int nextPowerOfTwo(int num)  {   if(num == 0)    return 1;   if(num > 0 && (num & (num - 1)) == 0)    return num;   while((num &(num - 1)) > 0)   {    num = num & (num - 1);   }   return num << 1;  }  public int[] createSegmentTree(int[] input)  {   int np2 = nextPowerOfTwo(input.length);   int[] segmentTree = new int[np2 * 2 - 1];   for(int i=0;i<segmentTree.length;i++)    segmentTree[i] = Integer.MIN_VALUE;   constructSegmentTree(segmentTree,input,0,input.length-1,0);   return segmentTree;  }  private void constructSegmentTree(int[] segmentTree,int[] input,int low,int high,int pos)  {   if(low == high)   {    segmentTree[pos] = input[low];    return;   }   int mid = (low + high)/ 2;   constructSegmentTree(segmentTree,input,low,mid,2*pos + 1);   constructSegmentTree(segmentTree,input,mid+1,high,2*pos + 2);   segmentTree[pos] = Math.max(segmentTree[2*pos + 1],segmentTree[2*pos + 2]);  }  public int rangeMinimumQuery(int []segmentTree,int qlow,int qhigh,int len)  {   return rangeMinimumQuery(segmentTree,0,len-1,qlow,qhigh,0);  }  private int rangeMinimumQuery(int segmentTree[],int low,int high,int qlow,int qhigh,int pos)  {   if(qlow <= low && qhigh >= high){    return segmentTree[pos];   }   if(qlow > high || qhigh < low){    return Integer.MIN_VALUE;   }   int mid = (low+high)/2;   return Math.max(rangeMinimumQuery(segmentTree, low, mid, qlow, qhigh, 2 * pos + 1),     rangeMinimumQuery(segmentTree, mid + 1, high, qlow, qhigh, 2 * pos + 2));  } } class Trie {  private class TrieNode  {   Map<Character, TrieNode> children;   boolean endOfWord;   public TrieNode()   {    children = new HashMap<>();    endOfWord = false;   }  }  private final TrieNode root;  public Trie()  {   root = new TrieNode();  }  public void insert(String word)  {   TrieNode current = root;   for (int i = 0; i < word.length(); i++)   {    char ch = word.charAt(i);    TrieNode node = current.children.get(ch);    if (node == null)    {     node = new TrieNode();     current.children.put(ch, node);    }    current = node;   }   current.endOfWord = true;  }  public boolean search(String word)  {   TrieNode current = root;   for (int i = 0; i < word.length(); i++)   {    char ch = word.charAt(i);    TrieNode node = current.children.get(ch);    if (node == null)    {     return false;    }    current = node;   }   return current.endOfWord;  }  public void delete(String word)  {   delete(root, word, 0);  }  private boolean delete(TrieNode current, String word, int index)  {   if (index == word.length())   {    if (!current.endOfWord)    {     return false;    }    current.endOfWord = false;    return current.children.size() == 0;   }   char ch = word.charAt(index);   TrieNode node = current.children.get(ch);   if (node == null)   {    return false;   }   boolean shouldDeleteCurrentNode = delete(node, word, index + 1);   if (shouldDeleteCurrentNode)   {    current.children.remove(ch);    return current.children.size() == 0;   }   return false;  } } class SegmentTreeLazy {  public int nextPowerOfTwo(int num)  {   if(num == 0)    return 1;   if(num > 0 && (num & (num - 1)) == 0)    return num;   while((num &(num - 1)) > 0)   {    num = num & (num - 1);   }   return num << 1;  }  public int[] createSegmentTree(int input[])  {   int nextPowOfTwo = nextPowerOfTwo(input.length);   int segmentTree[] = new int[nextPowOfTwo*2 -1];   for(int i=0; i < segmentTree.length; i++){    segmentTree[i] = Integer.MAX_VALUE;   }   constructMinSegmentTree(segmentTree, input, 0, input.length - 1, 0);   return segmentTree;  }  private void constructMinSegmentTree(int segmentTree[], int input[], int low, int high,int pos)  {   if(low == high)   {    segmentTree[pos] = input[low];    return;   }   int mid = (low + high)/2;   constructMinSegmentTree(segmentTree, input, low, mid, 2 * pos + 1);   constructMinSegmentTree(segmentTree, input, mid + 1, high, 2 * pos + 2);   segmentTree[pos] = Math.min(segmentTree[2*pos+1], segmentTree[2*pos+2]);  }  public void updateSegmentTreeRangeLazy(int input[], int segmentTree[], int lazy[], int startRange, int endRange, int delta)  {   updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, 0, input.length - 1, 0);  }  private void updateSegmentTreeRangeLazy(int segmentTree[], int lazy[], int startRange, int endRange, int delta, int low, int high, int pos)  {   if(low > high)   {    return;   }   if (lazy[pos] != 0)   {    segmentTree[pos] += lazy[pos];    if (low != high)    {     lazy[2 * pos + 1] += lazy[pos];     lazy[2 * pos + 2] += lazy[pos];    }    lazy[pos] = 0;   }   if(startRange > high || endRange < low)   {    return;   }   if(startRange <= low && endRange >= high)   {    segmentTree[pos] += delta;    if(low != high) {     lazy[2*pos + 1] += delta;     lazy[2*pos + 2] += delta;    }    return;   }   int mid = (low + high)/2;   updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, low, mid, 2*pos+1);   updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, mid+1, high, 2*pos+2);   segmentTree[pos] = Math.min(segmentTree[2*pos + 1], segmentTree[2*pos + 2]);  }  public int rangeMinimumQueryLazy(int segmentTree[], int lazy[], int qlow, int qhigh, int len)  {   return rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, 0, len - 1, 0);  }  private int rangeMinimumQueryLazy(int segmentTree[], int lazy[], int qlow, int qhigh, int low, int high, int pos)  {   if(low > high)   {    return Integer.MAX_VALUE;   }   if (lazy[pos] != 0)   {    segmentTree[pos] += lazy[pos];    if (low != high)    {     lazy[2 * pos + 1] += lazy[pos];     lazy[2 * pos + 2] += lazy[pos];    }    lazy[pos] = 0;   }   if(qlow > high || qhigh < low)   {    return Integer.MAX_VALUE;   }   if(qlow <= low && qhigh >= high)   {    return segmentTree[pos];   }   int mid = (low+high)/2;   return Math.min(rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, low, mid, 2 * pos + 1), rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, mid + 1, high, 2 * pos + 2));  } }
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 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 {  private static BufferedReader bufferedReader;  private static 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());  }  }
0	public class D {  static Scanner in = new Scanner(new BufferedInputStream(System.in)); static PrintWriter out = new PrintWriter(System.out);  static double getTime(double v, double a, double l, double r) {  return (-v + Math.sqrt(v * v - 2 * a * (l - r))) / a; }  static double getVelocity(double v, double t, double l, double r) {  return t == 0 ? v : (2 * (r - l)) / t - v; }  public static void main(String[] args) throws IOException {  double a = in.nextDouble(), v = in.nextDouble(), l = in.nextDouble(),   d = in.nextDouble(), w = Math.min(v, in.nextDouble());  double x = v * v / (2 * a), y = d - (v * v - w * w) / (2 * a),   z = d + (v * v - w * w) / (2 * a);   double L, R, T = 0, V = 0, t;    L = 0;  R = x;  if (x > y && x < z) {  R = (x + y) / 2;  } else if (x > l) {  R = l;  }  t = getTime(V, a, L, R);  V = getVelocity(V, t, L, R);   T += t;    if (x < y) {  T += (y - x) / v;  }     L = y;  R = d;  if (x > y && x < z) {  L = (x + y) / 2;  } else if (x >= z) {  L = R;  }  t = getTime(V, -a, L, R);  V = getVelocity(V, t, L, R);  T += t;     L = d;  R = z;  if (x >= z) {  R = L;  } else if (z > l) {  R = l;  }  t = getTime(V, a, L, R);  V = getVelocity(V, t, L, R);  T += t;     L = z;  R = l;  if (x > z) {  L = x;  }  if (L < R) {  T += (R - L) / v;  }  out.format(Locale.US, "%.12f%n", T);  out.close(); } }
0	public class Main{ public static void main(String[]args){ Scanner input=new Scanner(System.in); int x=input.nextInt(); if(x%4==0||x%7==0||x%47==0||x%74==0||x%744==0||x%474==0||x%447==0||x%477==0||x%474==0) System.out.println("YES"); else System.out.println("NO"); } }
0	public class N72A {  StreamTokenizer in;  PrintWriter out;  int nextInt() throws IOException  {   in.nextToken();   return (int) in.nval;  }  double nextDouble() throws IOException  {   in.nextToken();   return 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();  } }
0	public class pregunta1 {  public static void main(String[] args) {  System.out.println("25"); } }
6	public class Main { static Scanner in = new Scanner(System.in); static Coor[] p; static Coor ori; static int n; static int dp[]; static Coor pre[]; public static void main(String[] args) {  ori = new Coor(in.nextInt(),in.nextInt());  n = in.nextInt();  p = new Coor[n];  dp = new int[1<<n];  pre = new Coor[1<<n];  for (int i = 0;i < n;i++) {  p[i] = new Coor(in.nextInt(),in.nextInt());  }  Arrays.fill(dp,-1);  dp[0] = 0;  System.out.println( getdp((1<<n)-1));   System.out.printf("%d",0);  trace((1<<n)-1);  System.out.println(); } static void trace(int mask) {  if (mask == 0) return;  if (pre[mask].y == -1) {  System.out.printf(" %d %d",pre[mask].x+1,0);  trace( mask - ( 1<< pre[mask].x ) );  } else {  System.out.printf(" %d %d %d",pre[mask].x+1,pre[mask].y+1,0);  trace( mask - ( 1<< pre[mask].x ) - (1<<pre[mask].y));  } } static int getdp(int mask) {  if (dp[mask] != -1)   return dp[mask];  int fr = 0;  for (int i = 0;i < n;i++)   if ( (mask & (1 << i)) != 0 ) {   fr = i;   break;  }  dp[mask] = getdp( mask - (1 << fr) ) + 2 * p[fr].dist(ori);  pre[mask] = new Coor(fr,-1);  for (int i = fr+1;i < n;i++) {  int to = i;  if ( (mask & (1 << i)) != 0) {   int tmp = getdp( mask - (1<<fr) - (1<<i) ) + p[fr].dist(ori) + p[to].dist(ori) + p[fr].dist(p[to]);   if (tmp < dp[mask]) {   dp[mask] = tmp;   pre[mask].y = i;   }  }  }  return dp[mask]; } } class Coor { int x,y; Coor(int _x,int _y) {  x = _x;y = _y; } int dist(Coor o) {  return ( (x-o.x) * (x-o.x) + (y-o.y) * (y-o.y) ); } }
4	public class C {  private static int[] dx = {1, -1, 0, 0}; private static int[] dy = {0, 0, -1, 1};  public static void main(String[] args) throws Exception{  Thread t = new Thread(null, null, "~", Runtime.getRuntime().maxMemory()){  @Override  public void run(){   try {   solve();   } catch(Exception e) {   System.err.println("ERROR");   }  }  };  t.start();  t.join();  }  public static void solve() throws Exception {  Scanner in = new Scanner(new File("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  int n = in.nextInt();  int m = in.nextInt();  int[][] time = new int[n][m];  for(int i = 0; i < n; ++i) {  Arrays.fill(time[i], Integer.MAX_VALUE);  }  int qq = in.nextInt();  int[] xs = new int[qq];  int[] ys = new int[qq];  for(int i = 0; i < qq; ++i){  xs[i] = in.nextInt() - 1;  ys[i] = in.nextInt() - 1;  }   for(int i = 0; i < n; ++i) {  for(int j = 0; j < m; ++j) {   for(int k = 0; k < qq; ++k) {   int dist = Math.abs(i - xs[k]) + Math.abs(j - ys[k]);   time[i][j] = Math.min(time[i][j], dist);   }  }  }  int max = -1;  int x = -1;  int y = -1;  for(int i = 0; i < n; ++i) {  for(int j = 0; j < m; ++j) if(max < time[i][j]) {   max = time[i][j];   x = i + 1;   y = j + 1;  }  }  out.println(x + " " + y);  out.flush();  out.close(); }  private static class Pair {  int f, s;  int time;  public Pair(int f, int s) {  this.f = f;  this.s = s;  }  public Pair(int f, int s, int time) {  this(f, s);  this.time = time;  }  } }
1	public class Main {  static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out);  static long oo = 1000000000000L;  public static void main(String[] args) throws IOException {   int n = in.nextInt();  int q = in.nextInt();   ArrayDeque<Integer> dq = new ArrayDeque<>();  int max = -1;  for(int i = 0; i < n; ++i) {  int x = in.nextInt();  dq.add(x);  max = Math.max(max, x);  }  ArrayList<Pair> ans = new ArrayList<>();  while(dq.peekFirst() != max) {  int a = dq.pollFirst();  int b = dq.pollFirst();  ans.add(new Pair(a, b));  if(a > b) {   dq.addFirst(a);   dq.addLast(b);  }  else {   dq.addFirst(b);   dq.addLast(a);  }  }  ArrayList<Integer> a = new ArrayList<>();  dq.pollFirst();  for(int x : dq)  a.add(x);  while(q --> 0) {  long m = in.nextLong() - 1;  if(m < ans.size()) {   System.out.println(ans.get((int)m).first + " " + ans.get((int)m).second);  }  else {   int idx = (int)((m - ans.size()) % a.size());   System.out.println(max + " " + a.get(idx));  }  }   out.close(); }    static long lcm(long a, long b) {  return a * b / gcd(a, b); }  static boolean nextPermutation(int[] a) {  for(int i = a.length - 2; i >= 0; --i) {  if(a[i] < a[i+1]) {   for(int j = a.length - 1; ; --j) {   if(a[i] < a[j]) {    int t = a[i];    a[i] = a[j];    a[j] = t;    for(i++, j = a.length - 1; i < j; ++i, --j) {    t = a[i];    a[i] = a[j];    a[j] = t;    }    return true;   }   }  }  }  return false; }   static void shuffle(int[] a) {  Random r = new Random();  for(int i = a.length - 1; i > 0; --i) {  int si = r.nextInt(i);  int t = a[si];  a[si] = a[i];  a[i] = t;  } }  static void shuffle(long[] a) {  Random r = new Random();  for(int i = a.length - 1; i > 0; --i) {  int si = r.nextInt(i);  long t = a[si];  a[si] = a[i];  a[i] = t;  } }  static int lower_bound(int[] a, int n, int k) {  int s = 0;  int e = n;  int m;  while (e - s > 0) {  m = (s + e) / 2;  if (a[m] < k)   s = m + 1;  else   e = m;  }  return e; } static int lower_bound(long[] a, int n, long k) {  int s = 0;  int e = n;  int m;  while (e - s > 0) {  m = (s + e) / 2;  if (a[m] < k)   s = m + 1;  else   e = m;  }  return e; }  static int gcd(int a, int b) {  return b == 0 ? a : gcd(b, a % b); } static long gcd(long a, long b) {  return b == 0 ? a : gcd(b, a % b); }  static class Pair implements Comparable<Pair> {  int first, second;   public Pair(int first, int second) {  super();  this.first = first;  this.second = second;  }   @Override  public int compareTo(Pair o) {  return this.first != o.first ? this.first - o.first : this.second - o.second;  }   @Override  public int hashCode() {  final int prime = 31;  int result = 1;  result = prime * result + first;  result = prime * result + second;  return result;  }   @Override  public boolean equals(Object obj) {  if (this == obj)   return true;  if (obj == null)   return false;  if (getClass() != obj.getClass())   return false;  Pair other = (Pair) obj;  if (first != other.first)   return false;  if (second != other.second)   return false;  return true;  } }   }    class InputReader {  private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars;  public InputReader(InputStream st) {  this.stream = st; }  public int read() {  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 = read();  while (isSpaceChar(c)) {  c = read();  }  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  int res = 0;  do {  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 {  res *= 10;  res += c - '0';  c = read();  } while (!isSpaceChar(c));  return res * sgn; }  public int[] nextIntArray(int n) {  int a[] = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  return a; }  public String readString() {  int c = read();  while (isSpaceChar(c)) {  c = read();  }  StringBuilder res = new StringBuilder();  do {  res.appendCodePoint(c);  c = read();  } while (!isSpaceChar(c));  return res.toString(); }  public String nextLine() {  int c = read();  while (isSpaceChar(c))  c = read();  StringBuilder res = new StringBuilder();  do {  res.appendCodePoint(c);  c = read();  } while (!isEndOfLine(c));  return res.toString(); }  public 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; }  }
1	public class A{  public static void main(String args[]){   FastScanner in = new FastScanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int n = in.nextInt();   int a = in.nextInt();   int b = in.nextInt();   boolean change = false;   if(a > b){    int t = a;    a = b;    b = t;    change = true;   }   boolean[] inb = new boolean[n];   int[] numbers = new int[n];   TreeMap<Integer, Integer> num = new TreeMap<Integer, Integer>();   for(int i = 0; i < n; i++){    num.put(in.nextInt(), i);   }   boolean hasAns = true;   while(!num.isEmpty()){    Entry<Integer, Integer> last = num.lastEntry();    int key = last.getKey();    if(num.containsKey(a - key)){     num.remove(key);     num.remove(a - key);    } else if(num.containsKey(b - key)){     inb[num.get(key)] = true;     inb[num.get(b - key)] = true;     num.remove(key);     num.remove(b - key);    } else{     hasAns = false;     break;    }   }   if(hasAns){    out.println("YES");    for(int i = 0; i < n && !change; i++){     if(inb[i]){      out.print("1");     } else{      out.print("0");     }     if(i != n - 1){      out.print(" ");     }    }    for(int i = 0; i < n && change; i++){     if(inb[i]){      out.print("0");     } else{      out.print("1");     }     if(i != n - 1){      out.print(" ");     }    }   } else{    out.println("NO");   }   out.close();  }  static class FastScanner{   private BufferedReader reader;   private StringTokenizer tokenizer;   public FastScanner(InputStream stream){    reader = new BufferedReader(new InputStreamReader(stream));    tokenizer = null;   }   public String nextLine(){    try{     return reader.readLine();    } catch(IOException e){     e.printStackTrace();     return 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 double nextDouble(){    return Double.parseDouble(next());   }  } }
1	public class IQTest {  public static void main(String[] args)  {   try   {    BufferedReader in = new BufferedReader(     new InputStreamReader(System.in));    String str = in.readLine();    int n = Integer.parseInt(str);    int odd = -1, even = -1, odds = 0, evens = 0;            str = in.readLine();     String[] numbers = str.split(" ");     int index = 1;     for (String number: numbers)     {      int i = Integer.parseInt(number);      if (i % 2 == 0)      {       ++evens;       if (even == -1)        even = index;      }      else      {       ++odds;       if (odd == -1)        odd = index;      }      ++index;     }           System.out.println((evens > odds ? odd : even));   }   catch (Exception e)   {    e.printStackTrace();   }  } }
2	public class Main { public static void main (String[] args) throws java.lang.Exception {   FastReader sc=new FastReader();  long n=sc.L();  long k=sc.L();  long x=8*(n+k);  x+=9;  x=(long)Math.sqrt(x)-3;  x/=2;   System.out.println(n-x);  }  static int binarysearch(int x,int[] b,int n)  {   int l=0,r=n-1,m=(l+r)/2;   if(x<b[0]||x>b[r])   return -1;   while(l<=r)   {    m=(l+r)/2;    if(b[m]==x)    return m;    if(b[m]>x)    r=m-1;    else    l=m+1;   }   return -1;  }  static int lower(int x,int b[],int n)  {   if(x<b[0])   return -1;   else if(x==b[0])   return 0;   if(x>=b[n-1])   return n-1;   int l=0,r=n-1,m=(l+r)/2;   while(l<=r)   {    m=(l+r)/2;    if(b[m]<=x&&b[m+1]>x)    return m;    else if(b[m]>x&&b[m-1]<=x)    return m-1;    if(b[m]>x)    r=m-1;    else if(b[m]<x)    l=m+1;   }   return -1;  }  static int upper(int x,int b[],int n)  {   if(x<=b[0])   return 0;   else if(x==b[n-1])   return n-1;   if(x>b[n-1])   return -1;   int l=0,r=n-1,m=(l+r)/2;   while(l<=r)   {    m=(l+r)/2;    if(b[m]<x&&b[m+1]>=x)    return m+1;    else if(b[m]>=x&&b[m-1]<x)    return m;    if(b[m]>x)    r=m-1;    else if(b[m]<x)    l=m+1;   }   return -1;  }   static long power(long x, long y, long p)  {      long res = 1;            x = x % p;     while (y > 0)   {           if((y & 1)==1)     res = (res * x) % p;             y = y >> 1;    x = (x * x) % p;   }   return res;  }  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 I()   {    return Integer.parseInt(next());   }    long L()   {    return Long.parseLong(next());   }    double D()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  }  static int gcd(int a,int b)  {   if(a%b==0)   return b;   return gcd(b,a%b);  } static float power(float x, int y)  {   float temp;   if( y == 0)    return 1;   temp = power(x, y/2);      if (y%2 == 0)    return temp*temp;   else   {    if(y > 0)     return x * temp * temp;    else     return (temp * temp) / x;   }  }  static long pow(int a,int b)  {   long result=1;   if(b==0)   return 1;   long x=a;   while(b>0)   {    if(b%2!=0)    result*=x;       x=x*x;    b=b/2;   }   return result;  }   static ArrayList<Integer> sieveOfEratosthenes(int n)  {   ArrayList<Integer> arr=new ArrayList<Integer>();   boolean prime[] = new boolean[n+1];   for(int i=2;i<n;i++)    prime[i] = true;      for(int p = 2; p*p <=n; p++)   {    if(prime[p] == true)    {     arr.add(p);     for(int i = p*p; i <= n; i += p)      prime[i] = false;    }   }   return arr;  } }
6	public class Main { static final boolean _DEBUG = false;  private static 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());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }  }  static MyScanner scan; static PrintWriter out;  static int debugCount = 0; static void debug(String msg) {  if (_DEBUG && debugCount < 200) {  out.println(msg);  out.flush();  debugCount++;  } }   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);  } }
0	public class A {  FastScanner in; PrintWriter out;  void solve() {  long a = in.nextLong(), b = in.nextLong();  long ans = 0;  while (true) {  long div = a / b;    ans += div;  a -= div * b;    if (a == 0) {   break;  }    long tmp = a;  a = b;  b = tmp;  }   out.println(ans); }   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));  }  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());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  } }  public static void main(String[] args) {  new A().run(); } }
5	public class A {  public static void main(String[] args) throws IOException {   new A().solveProblem();   out.close(); }  static Scanner in = new Scanner(new InputStreamReader(System.in));  static PrintStream out = new PrintStream(new BufferedOutputStream(System.out));   public void solveProblem() {   int n = in.nextInt() ;  E[] get = new E[n] ;  for( int i = 0 ; i < n ; i++ ){  get[i] = new E(i,in.nextInt()) ;  }   sort(get) ;    if( get[n-1].g == 1){  get[n-1].g = 2 ;  }else{  get[n-1].g = 1 ;    }  sort(get) ;  for( int i = 0 ; i < n - 1 ; i++ )  out.print(get[i].g +" " ) ;  out.println(get[n-1].g) ;   }  class E implements Comparable<E>{  int g ;  int index ;   public E( int index, int g){  this.g = g ;  this.index = index ;  }   public int compareTo( E e){  return g - e.g ;  } }  static int[] readGet( int n ){  int[] get = new int[n] ;  for( int i = 0 ; i < n ; i++ )   get[i] = in.nextInt();  return get ; }    }
2	public class TestClass {  static PrintWriter out = new PrintWriter(System.out);  public static void main(String args[] ) throws Exception {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  String s[] = in.readLine().split(" ");  long n = Long.parseLong(s[0]);  long k = Long.parseLong(s[1]);  long x = bs(n,k);  out.println(n-x+1);   out.close();  }  public static long bs(long n,long k)  {  long l=0,h=n;  while(l<=h)  {   long mid = l + (h-l)/2;   long x = mid - sum(mid);   if(x>=k)   {   h = mid-1;   }   else   {   l = mid+1;   }  }  return l;  }  public static long sum(long x)  {  long ans=0;  while(x>0)  {   ans += x%10;   x=x/10;  }  return ans;  } }
5	public class Main { public static void main (String[] args) throws IOException {  BufferedReader reader = new BufferedReader (new InputStreamReader (System.in));  String[] splitted = reader.readLine().split(" ");  int n = Integer.parseInt(splitted[0]);  int m = Integer.parseInt(splitted[1]);  int k = Integer.parseInt(splitted[2]);  PriorityQueue<Integer> queue = new PriorityQueue<Integer> (1000, Collections.reverseOrder());  splitted = reader.readLine().split(" ");  for (int ii = 0; ii < splitted.length; ii++) {  queue.add(Integer.parseInt(splitted[ii]));  }   int counter = 0;  int spot = k;  while (spot < m && !queue.isEmpty()) {  spot = spot + queue.poll() - 1;  counter++;  }  if (spot < m) {  System.out.println("-1");  } else {  System.out.println(counter);  } } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   int digitsum(long n) {    int ans = 0;    while (n > 0) {     ans += n % 10;     n /= 10;    }    return ans;   }   public void solve(int testNumber, InputReader in, PrintWriter out) {    long n = in.nextLong();    long s = in.nextLong();    if (s >= n) {     out.println(0);     return;    }    long ans = s;    while (ans < s + digitsum(ans)) {     ans++;    }    if (n >= ans) {     out.println(n - ans + 1);    } else {     out.println(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 long nextLong() {    return Long.parseLong(next());   }  } }
1	public class Main { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter; private PrintWriter pw; private long mod = 998244353;  private StringBuilder ans_sb; private int sqrt; private void soln() {  int n = nextInt();  int d = nextInt();  int[] arr = nextIntArray(n);  int cnt = 2;  for(int i=0;i<n-1;i++) {  int a1 = arr[i];  int a2 = arr[i+1];  a1 += d;  a2 -= d;  if(a1 < a2) {   cnt+=2;  }else if(a1==a2)   cnt++;  }  pw.println(cnt); } private class Pair implements Comparable<Pair>{  int x,i;  public Pair(int a, int b) {  x = a;  i = b;  }  @Override  public int compareTo(   Pair o)  {  return this.x - o.x;  } } private int cc = 0; private void dfs(int c, int p, LinkedList<Integer>[] tree, int[] t, int[] tin, int[] tout, int[] arr) {  t[cc] = arr[c]; tin[c] = cc++; Iterator<Integer> it = tree[c].listIterator(); while(it.hasNext()) {  int x = it.next();  if(x != p) {  dfs(x, c, tree,t,tin,tout,arr);  } } tout[c] = cc; } public class Segment {  private Node[] tree;  private int[] lazy;  private int size;  private int n;  private int[] base;  private class Node  {  private int on;  private int off;  }  public Segment(int n, int[] arr)  {  this.base=arr;  int x = (int) (Math.ceil(Math.log(n) / Math.log(2)));  size = 2 * (int) Math.pow(2, x) - 1;  tree = new Node[size];  lazy = new int[size];  this.n = n;    build(0, 0, n - 1);  }  public void build(int id, int l, int r)  {  if (l == r)  {   tree[id] = new Node();   if(base[l] == 1)   tree[id].on++;   else   tree[id].off++;   return;  }  int mid = ((l + r)>>1);  build((id<<1)|1, l, mid);  build((id<<1)+2, mid + 1, r);  tree[id] = merge(tree[(id<<1)|1], tree[(id<<1)+2]);    }  public Node merge(Node n1, Node n2) {  Node ret = new Node();  if(n1 == null && n2 == null)   return null;  else if(n1 == null) {   ret.on = n2.on;   ret.off = n2.off;  }  else if(n2 == null) {   ret.on = n1.on;   ret.off = n1.off;  }  else {   ret.on = n1.on+n2.on;   ret.off = n2.off + n1.off;  }  return ret;  }  public int query(int l, int r)  {  Node ret = queryUtil(l, r, 0, 0, n - 1);  if(ret == null) {   return 0;  }  else   return ret.on;  }  private Node queryUtil(int x, int y, int id, int l, int r)  {  if (l > y || x > r)   return null;  if (x <= l && r <= y)  {     return tree[id];  }  int mid = ((l + r)>>1);  shift(id,l,r);  Node q1 = queryUtil(x, y, (id<<1)|1, l, mid);  Node q2 = queryUtil(x, y, (id<<1)+2, mid + 1, r);  return merge(q1, q2);  }   public void update(int x, int y, int c) {  update1(x, y, c, 0, 0, n-1);  }   private void update1(int x, int y, int colour, int id, int l, int r)  {    if (x > r || y < l)   return;  if (x <= l && r <= y)  {   lazy[id]++;   switchNode(tree[id]);   return;  }  int mid = ((l + r)>>1);    if(y<=mid)   update1(x, y, colour, (id<<1)|1, l, mid);  else if(x>mid)   update1(x, y, colour, (id<<1)+2, mid + 1, r);  else {   update1(x, y, colour, (id<<1)|1, l, mid);   update1(x, y, colour, (id<<1)+2, mid + 1, r);  }  tree[id] = merge(tree[(id<<1)|1], tree[(id<<1)+2]);  }  private void shift(int id,int l, int r)  {  lazy[id] %= 2;  if(lazy[id] != 0) {   if(l != r) {   lazy[(id<<1)|1] += lazy[id];   lazy[(id<<1)+2] += lazy[id];   switchNode(tree[(id<<1)+2]);   switchNode(tree[(id<<1)|1]);   }     lazy[id] = 0;  }  }  private void switchNode(Node d) {  d.on ^= d.off;  d.off ^= d.on;  d.on ^= d.off;  } }  private void debug(Object... o) {  System.out.println(Arrays.deepToString(o)); } private long pow(long a, long b, long c) {  if (b == 0)  return 1;  long p = pow(a, b / 2, c);  p = (p * p) % c;  return (b % 2 == 0) ? p : (a * p) % c; }  private long gcd(long n, long l) {  if (l == 0)  return n;  return gcd(l, n % l); }  public static void main(String[] args) throws Exception {  new Thread(null, new Runnable() {  @Override  public void run() {   new Main().solve();  }  }, "1", 1 << 26).start();   }  public StringBuilder solve() {  InputReader(System.in);   pw = new PrintWriter(System.out);   soln();  pw.close();   return ans_sb; }  public void InputReader(InputStream stream1) {  stream = stream1; }  private boolean isWhitespace(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  private boolean isEndOfLine(int c) {  return c == '\n' || c == '\r' || 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++]; }  private 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 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; }  private String nextToken() {  int c = read();  while (isSpaceChar(c))  c = read();  StringBuilder res = new StringBuilder();  do {  res.appendCodePoint(c);  c = read();  } while (!isSpaceChar(c));  return res.toString(); }  private String nextLine() {  int c = read();  while (isSpaceChar(c))  c = read();  StringBuilder res = new StringBuilder();  do {  res.appendCodePoint(c);  c = read();  } while (!isEndOfLine(c));  return res.toString(); }  private int[] nextIntArray(int n) {  int[] arr = new int[n];  for (int i = 0; i < n; i++) {  arr[i] = nextInt();  }  return arr; }  private long[] nextLongArray(int n) {  long[] arr = new long[n];  for (int i = 0; i < n; i++) {  arr[i] = nextLong();  }  return arr; }  private void pArray(int[] arr) {  for (int i = 0; i < arr.length; i++) {  System.out.print(arr[i] + " ");  }  System.out.println();  return; }  private void pArray(long[] arr) {  for (int i = 0; i < arr.length; i++) {  System.out.print(arr[i] + " ");  }  System.out.println();  return; }  private boolean isSpaceChar(int c) {  if (filter != null)  return filter.isSpaceChar(c);  return isWhitespace(c); }  private char nextChar() {  int c = read();  while (isSpaceChar(c))  c = read();  char c1 = (char) c;  while (!isSpaceChar(c))  c = read();  return c1; }  private interface SpaceCharFilter {  public boolean isSpaceChar(int ch); } }
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 INF = 1000 * 1000 * 1000;   public void solve(int testNumber, InputReader in, OutputWriter out) {    int x0 = in.readInt();    int y0 = in.readInt();    int n = in.readInt();    int[] xs = new int[n + 1], ys = new int[n + 1];    xs[0] = x0;    ys[0] = y0;    for (int i = 1; i <= n; i++) {     xs[i] = in.readInt();     ys[i] = in.readInt();    }    int[] one = new int[n];    for (int i = 0; i < n; i++) one[i] = dist(0, i + 1, xs, ys) * 2;    int[][] two = new int[n][n];    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      two[i][j] = dist(0, i + 1, xs, ys) + dist(0, j + 1, xs, ys) + dist(i + 1, j + 1, xs, ys);     }    }    int[] dp = new int[(1 << n)];    Arrays.fill(dp, INF);    dp[0] = 0;    int[] prev = new int[(1 << n)];    for (int mask = 0; mask < (1 << n); mask++) {     for (int i = 0; i < n; i++) {      if (((mask >> i) & 1) != 0) continue;      ;      int nmask = mask | (1 << i);      int cost = one[i] + dp[mask];      if (cost < dp[nmask]) {       dp[nmask] = cost;       prev[nmask] = i;      }      for (int j = i + 1; j < n; j++) {       if (((mask >> j) & 1) != 0) continue;       int nnmask = nmask | (1 << j);       cost = two[i][j] + dp[mask];       if (cost < dp[nnmask]) {        dp[nnmask] = cost;        prev[nnmask] = n + i * n + j;       }      }      break;     }    }    int mask = (1 << n) - 1;    out.printLine(dp[mask]);    ArrayList<Integer> res = new ArrayList<>();    res.add(0);    while (mask > 0) {     if (prev[mask] < n) {      res.add(prev[mask] + 1);      mask &= ~(1 << prev[mask]);     } else {      int ii = (prev[mask] - n) / n;      int jj = (prev[mask] - n) % n;      int i = Math.max(ii, jj);      int j = Math.min(ii, jj);      res.add(i + 1);      res.add(j + 1);      mask &= ~(1 << i);      mask &= ~(1 << j);     }     res.add(0);    }    Collections.reverse(res);    for (int val : res) out.print(val + " ");    out.printLine();   }   int dist(int i, int j, int[] xs, int[] ys) {    return (xs[i] - xs[j]) * (xs[i] - xs[j]) + (ys[i] - ys[j]) * (ys[i] - ys[j]);   }  }  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);   }  }  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() {    writer.println();   }   public void close() {    writer.close();   }   public void printLine(int i) {    writer.println(i);   }  } }
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;   }  } }
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);  } }
5	public class round159A {  static BufferedReader br = new BufferedReader(new InputStreamReader(    System.in));  static StringTokenizer st = new StringTokenizer("");  static int nextInt() throws Exception {   return Integer.parseInt(next());  }  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 {   int n = nextInt();   int m = nextInt();   int k = nextInt();   int[] supply = new int[n];   for (int i = 0; i < n; ++i)    supply[i] = nextInt();   if (m <= k) {    System.out.println(0);   } else {    int have = k;    Arrays.sort(supply);    for(int i = n - 1 ; i >= 0 ; --i){     have--;     have += supply[i];     if(have >= m){      System.out.println(n - i);      return;     }    }    System.out.println(-1);   }  } }
3	public class Soln {  public static int[] io(int n) {  int[] d = new int[n];  for (int i=0;i<n;i++) d[i] = f.nextInt();  return d; } public static int binlog( int bits ){   int log = 0;   if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }   if( bits >= 256 ) { bits >>>= 8; log += 8; }   if( bits >= 16 ) { bits >>>= 4; log += 4; }   if( bits >= 4 ) { bits >>>= 2; log += 2; }   return log + ( bits >>> 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();   }    int nextInt()   {    return Integer.parseInt(next());   }    long nextLong()   {    return Long.parseLong(next());   }    double nextDouble()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  } public static final long mod = (long)Math.pow(10, 9) + 7; static FastReader f=new FastReader();  public static void main (String[] args) throws IOException{  int n = f.nextInt();  int[] a = io(n);  HashMap<Integer,ArrayList<ivl>> hm = new HashMap<>();  for (int i=0;i<n;i++) {  int sum = 0;  for (int j=i;j<n;j++) {   sum+=a[j];   if (hm.get(sum)==null) hm.put(sum,new ArrayList<ivl>());   hm.get(sum).add(new ivl(i,j));  }  }  HashSet<ivl> hs = new HashSet<ivl>();   for (ArrayList<ivl> arr : hm.values()) {  Collections.sort(arr,new comp());  HashSet<ivl> temp = new HashSet<ivl>();  temp.add(arr.get(0));  int lastr = arr.get(0).r;  int num = 1;  for (ivl curr:arr) {   if (curr.l>lastr) {   lastr = curr.r;   num++;   temp.add(curr);   }  }  if (temp.size()>hs.size()) hs = temp;  }   System.out.println(hs.size());  for (ivl curr:hs) {  System.out.println((curr.l+1)+" "+(curr.r+1));  }  }  static class ivl{  int l,r;  ivl(int l,int r){  this.l=l;this.r=r;  } }  static class comp implements Comparator<ivl>{  public int compare(ivl a,ivl b) {  if (a.r - b.r == 0) return a.l-b.l;  return a.r-b.r;  } } }
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 IOException, InterruptedException {   int n = reader.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = reader.nextString().charAt(0);   }   long[][] d = new long[n + 1][n + 1];   d[0][0] = 1;   long mod = 1_000_000_007;   for (int i = 1; i < n; i++) {    for (int j = n - 1; j >= 0; j--) {     if (a[i - 1] == 'f') {      d[i][j + 1] = d[i - 1][j];     } else {      d[i][j] = (d[i - 1][j] + d[i][j + 1]) % mod;     }    }   }   long ans = 0;   for (int i = 0; i <= n; i++) {    ans += d[n - 1][i];   }   writer.print(ans % mod);  }  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;   }   int[][] nextIntMatrix(int n, int m) throws IOException {    int[][] a = new int[n][0];    for (int j = 0; j < n; j++) {     a[j] = nextIntArray(m);    }    return a;   }   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;   }   long[] nextLongArray(int n) throws IOException {    long[] m = new long[n];    for (int i = 0; i < n; i++) {     m[i] = nextLong();    }    return m;   }   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();   }   String nextLine() throws IOException {    if (end) {     return null;    }    str.setLength(0);    int c = nextChar();    while (c != '\n' && c != '\r' && c != -1) {     str.append((char) c);     c = nextChar();    }    if (c == -1) {     end = true;     if (str.length() == 0) {      return null;     }    }    if (c == '\r') {     nextChar();    }    return str.toString();   }   char[] nextCharArray() throws IOException {    return nextString().toCharArray();   }   char[][] nextCharMatrix(int n) throws IOException {    char[][] a = new char[n][0];    for (int i = 0; i < n; i++) {     a[i] = nextCharArray();    }    return a;   }  }  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();   }  } }
1	public class Main {  static Reader scan;  static PrintWriter pw;  static int n,k,left[],right[],arr[];  static long MOD = 1000000007,count[],dp[];  public static void main(String[] args) {   new Thread(null,null,"BaZ",1<<25)   {    public void run()    {     try     {      solve();     }     catch(Exception e)     {      e.printStackTrace();      System.exit(1);     }    }   }.start();  }  static void solve() throws IOException  {   scan = new Reader();   pw = new PrintWriter(System.out,true);   StringBuilder sb = new StringBuilder();   n = ni();   k = ni();   int stack[] = new int[1000001];   int top = -1;   arr = new int[n];   left = new int[n];   right = new int[n];   for(int i=0;i<n;++i) {    arr[i] = ni();    while(top>=0 && arr[stack[top]]<=arr[i])     top--;    if(top==-1)     left[i] = 0;    else left[i] = stack[top]+1;    stack[++top] = i;   }   top = -1;   for(int i=n-1;i>=0;--i) {    while(top>=0 && arr[stack[top]]<arr[i])     top--;    if(top==-1)     right[i] = n-1;    else right[i] = stack[top]-1;    stack[++top] = i;   }        dp = new long[n+1];   for(int i=0;i<=n;++i) {    if(i<k)    continue;    dp[i] = dp[i-k+1] + (i-k+1);   }   count = new long[n];   long ans = 0;   for(int i=0;i<n;++i) {    int len = right[i]-left[i]+1;    int lef = i-left[i];    int rig = right[i]-i;    long count = dp[len] - dp[lef] - dp[rig];    if(count>=MOD)    count%=MOD;    ans += count*arr[i];    if(ans>=MOD)     ans%=MOD;   }   pl(ans);   pw.flush();   pw.close();  }  static int ni() throws IOException  {   return scan.nextInt();  }  static long nl() throws IOException  {   return scan.nextLong();  }  static double nd() throws IOException  {   return scan.nextDouble();  }  static void pl()  {   pw.println();  }  static void p(Object o)  {   pw.print(o+" ");  }  static void pl(Object o)  {   pw.println(o);  }  static void psb(StringBuilder sb)  {   pw.print(sb);  }  static void pa(String arrayName, Object arr[])  {   pl(arrayName+" : ");   for(Object o : arr)    p(o);   pl();  }  static void pa(String arrayName, int arr[])  {   pl(arrayName+" : ");   for(int o : arr)    p(o);   pl();  }  static void pa(String arrayName, long arr[])  {   pl(arrayName+" : ");   for(long o : arr)    p(o);   pl();  }  static void pa(String arrayName, double arr[])  {   pl(arrayName+" : ");   for(double o : arr)    p(o);   pl();  }  static void pa(String arrayName, char arr[])  {   pl(arrayName+" : ");   for(char o : arr)    p(o);   pl();  }  static void pa(String listName, List list)  {   pl(listName+" : ");   for(Object o : list)    p(o);   pl();  }  static void pa(String arrayName, Object[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(Object o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, int[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(int o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, long[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(long o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, char[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(char o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, double[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(double o : arr[i])     p(o);    pl();   }  }  static class Reader {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;   public Reader() {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public Reader(String file_name) throws IOException {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public String readLine() throws IOException {    byte[] buf = new byte[64];    int cnt = 0, c;    while ((c = read()) != -1) {     if (c == '\n') break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }   public int nextInt() throws IOException {    int ret = 0;    byte c = read();    while (c <= ' ') c = read();    boolean neg = (c == '-');    if (neg) c = read();    do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (neg) return -ret;    return ret;   }   public long nextLong() throws IOException {    long ret = 0;    byte c = read();    while (c <= ' ') c = read();    boolean neg = (c == '-');    if (neg) c = read();    do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (neg) return -ret;    return ret;   }   public double nextDouble() throws IOException {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ') c = read();    boolean neg = (c == '-');    if (neg) c = read();    do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);    if (neg) return -ret;    return ret;   }   private void fillBuffer() throws IOException {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1) buffer[0] = -1;   }   private byte read() throws IOException {    if (bufferPointer == bytesRead) fillBuffer();    return buffer[bufferPointer++];   }   public void close() throws IOException {    if (din == null) return;    din.close();   }  } }
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]+" ");  } }
5	public class Start {  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());  }  long readLong() throws IOException {   return Long.parseLong(readString());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  public static void main(String[] args) {   new Start().run();  }  public static void mergeSort(int[] a) {   mergeSort(a, 0, a.length - 1);  }  private static void mergeSort(int[] a, int levtIndex, int rightIndex) {   final int MAGIC_VALUE = 50;   if (levtIndex < rightIndex) {    if (rightIndex - levtIndex <= MAGIC_VALUE) {     insertionSort(a, levtIndex, rightIndex);    } else {     int middleIndex = (levtIndex + rightIndex) / 2;     mergeSort(a, levtIndex, middleIndex);     mergeSort(a, middleIndex + 1, rightIndex);     merge(a, levtIndex, middleIndex, rightIndex);    }   }  }  private static void merge(int[] a, int levtIndex, int middleIndex,    int rightIndex) {   int length1 = middleIndex - levtIndex + 1;   int length2 = rightIndex - middleIndex;   int[] levtArray = new int[length1];   int[] rightArray = new int[length2];   System.arraycopy(a, levtIndex, levtArray, 0, length1);   System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);   for (int k = levtIndex, i = 0, j = 0; k <= rightIndex; k++) {    if (i == length1) {     a[k] = rightArray[j++];    } else if (j == length2) {     a[k] = levtArray[i++];    } else {     a[k] = levtArray[i] <= rightArray[j] ? levtArray[i++]       : rightArray[j++];    }   }  }  private static void insertionSort(int[] a, int levtIndex, int rightIndex) {   for (int i = levtIndex + 1; i <= rightIndex; i++) {    int current = a[i];    int j = i - 1;    while (j >= levtIndex && a[j] > current) {     a[j + 1] = a[j];     j--;    }    a[j + 1] = current;   }  }  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);   }  }   class Lol implements Comparable<Lol>{   int x;   int y;      public Lol (int x , int y){     this.x = x;     this.y = y;    }    @Override    public int compareTo(Lol arg0) {     if (arg0.x == x) {      return y-arg0.y;     }     return arg0.x-x;    }    }  public void solve() throws IOException {     int n = readInt();   int k = readInt();   k--;   Lol [] a = new Lol [n];       for (int i = 0 ; i <n; i++){    int x = readInt();    int y = readInt();    a[i] = new Lol(x, y);   }   Arrays.sort(a);   int ans = 1;   for (int i =k+1; i>-1; i++){    if (i==n) break;    if (a[i].x==a[k].x && a[i].y == a[k].y){     ans++;    }    else break;   }   if (k!=0){    for (int i =k-1; i>=0; i--){     if (a[i].x==a[k].x && a[i].y == a[k].y){      ans++;     }     else break;    }   }   out.print(ans);         } }
4	@SuppressWarnings("unused") public class Fire35C {  InputStream is; PrintWriter out; String INPUT = "";  int mod = (int)(Math.pow(10,9)+7); int v = 0; int max = 0; StringBuilder st = new StringBuilder(); File outFile = new File("output.txt"); void solve() throws IOException {   int n = ni();  int m = ni();  boolean visited[][] = new boolean[n][m];  boolean inq[][] = new boolean[n][m];  Queue<Integer> x = new LinkedList<>();  Queue<Integer> y = new LinkedList<>();  Queue<Integer> lev = new LinkedList<>();  int a = -1 , b = -1 , max = 0;  int k = ni();  while(k-- > 0) {  int u = ni()-1;  int v = ni()-1;  x.add(u);  y.add(v);  lev.add(1);  inq[u][v] = true;  }  while(x.size() != 0) {   int u = x.poll();  int v = y.poll();  int l = lev.poll();  if(max < l) {   a = u;   b = v;   max = l;  }  visited[u][v] = true;  if(u-1 >= 0 && !visited[u-1][v] && !inq[u-1][v]) {   x.add(u-1);   y.add(v);   lev.add(l+1);   inq[u-1][v] = true;  }   if(u+1 < n && !visited[u+1][v] && !inq[u+1][v]) {   x.add(u+1);   y.add(v);   lev.add(l+1);   inq[u+1][v] = true;  }   if(v-1 >= 0 && !visited[u][v-1] && !inq[u][v-1]) {   x.add(u);   y.add(v-1);   lev.add(l+1);   inq[u][v-1] = true;  }   if(v+1 < m && !visited[u][v+1] && !inq[u][v+1]) {   x.add(u);   y.add(v+1);   lev.add(l+1);   inq[u][v+1] = true;  }    }  a++;  b++;  out.println(a+" "+b);  out.close(); }  void run() throws Exception {  is = INPUT.isEmpty() ? new FileInputStream(new File("input.txt")) : new ByteArrayInputStream(INPUT.getBytes());  out = new PrintWriter(new BufferedWriter(new FileWriter(outFile)));  long s = System.currentTimeMillis();  solve();  out.flush();  if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms"); }  public static void main(String[] args) throws Exception { new Fire35C().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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b) && b != ' ')){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int[][] na(int n , int m) {  int[][] a = new int[n][m];  for(int i = 0;i < n;i++)   for(int j = 0 ; j<m ; j++) a[i][j] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }  while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }  while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  void display2D(int a[][]) {  for(int i[] : a) {  for(int j : i) {   out.print(j+" ");  }  out.println();  } }  int[][] creategraph(int n , int m) {  int g[][] = new int[n+1][];  int from[] = new int[m];  int to[] = new int[m];  int ct[] = new int[n+1];  for(int i = 0 ; i<m; i++) {  from[i] = ni();  to[i] = ni();  ct[from[i]]++;  ct[to[i]]++;  }  int parent[] = new int[n+1];  for(int i = 0 ; i<n+1 ; i++) g[i] = new int[ct[i]];  for(int i = 0 ; i<m ; i++) {  g[from[i]][--ct[from[i]]] = to[i];  g[to[i]][--ct[to[i]]] = from[i];  }  return g; }  static long __gcd(long a, long b) {  if(b == 0)  {  return a;  }  else  {  return __gcd(b, a % b);  } }   static long power(long x, long y, long p) {    long res = 1;     x = x % p;  while (y > 0)  {       if (y % 2 == 1)   res = (res * x) % p;     y = y >> 1;  x = (x * x) % p;  }  return res; }     static long modInverse(long a, int m) {  if (__gcd(a, m) != 1) {    return -1;  }  else {           return power(a, m - 2, m);  } }  static long nCrModPFermat(int n, int r,  int p , long fac[]) {    if (r == 0)  return 1;       long t = (fac[n]* modInverse(fac[r], p))%p;  return ( (t* modInverse(fac[n-r], p))% p); }  private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); } }
4	public class C {  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());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  }  static FastReader s = new FastReader();  static PrintWriter out = new PrintWriter(System.out);  private static int[] rai(int n) {   int[] arr = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = s.nextInt();   }   return arr;  }  private static int[][] rai(int n, int m) {   int[][] arr = new int[n][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     arr[i][j] = s.nextInt();    }   }   return arr;  }  private static long[] ral(int n) {   long[] arr = new long[n];   for (int i = 0; i < n; i++) {    arr[i] = s.nextLong();   }   return arr;  }  private static long[][] ral(int n, int m) {   long[][] arr = new long[n][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     arr[i][j] = s.nextLong();    }   }   return arr;  }  private static int ri() {   return s.nextInt();  }  private static long rl() {   return s.nextLong();  }  private static String rs() {   return s.next();  }  static long gcd(long a,long b)  {   if(b==0)   {    return a;   }   return gcd(b,a%b);  }  static int gcd(int a,int b)  {   if(b==0)   {    return a;   }   return gcd(b,a%b);  }  static boolean isPrime(int n) {     if (n % 2 == 0) return false;     for (int i = 3; i <= Math.sqrt(n); i += 2) {    if (n % i == 0)     return false;   }   return true;  }  static int MOD=1000000007;  static long mpow(long base,long pow)  {   long res=1;   while(pow>0)   {    if(pow%2==1)    {     res=(res*base)%MOD;    }    pow>>=1;    base=(base*base)%MOD;   }   return res;  }  public static void main(String[] args) {   StringBuilder ans = new StringBuilder();   int t = ri();   while (t-- > 0)   {    int n=ri();    int[] arr=rai(n);    List<Integer> list = new ArrayList<>();    for(int i:arr)    {     if(i==1)     {      list.add(i);     }     else     {      int ind = list.size()-1;      while(list.size()>0 && list.get(ind)+1!=i )      {       list.remove(list.size()-1);       ind=list.size()-1;      }      if(list.size()>0)      {       list.remove(list.size()-1);      }      list.add(i);     }     for(int j=0;j<list.size()-1;j++)     {      ans.append(list.get(j)).append(".");     }     ans.append(list.get(list.size()-1)).append("\n");    }   }   out.print(ans.toString());   out.flush();  }  }
1	public class E17 {  static StreamTokenizer in; static PrintWriter out;  static int nextInt() throws IOException {  in.nextToken();  return (int)in.nval; }  static String nextString() throws IOException {  in.nextToken();  return in.sval; }  public static void main(String[] args) throws IOException {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(System.out);   int n = nextInt(), k = nextInt();  int MAX = n, nprimes = 0;  int[] primes = new int[MAX];  boolean[] isPrime = new boolean[MAX+1];  Arrays.fill(isPrime, true);  isPrime[0] = false;  isPrime[1] = false;  for (int i = 2; i <= MAX; i++) if (isPrime[i]) {  primes[nprimes++] = i;  for (int j = i + i; j <= MAX; j += i) isPrime[j] = false;  }  primes[nprimes] = Integer.MAX_VALUE;   HashSet<Integer> h = new HashSet<Integer>();  for (int i = 1; i < nprimes; i++) {  int x = primes[i-1] + primes[i] + 1;  if (x > n) break;  if (isPrime[x]) h.add(x);  }   out.println(h.size() >= k ? "YES" : "NO");   out.flush(); } }
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;  public void run() {  try {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);      solve();  br.close();  out.close();  } catch (IOException e) {  e.printStackTrace();  System.exit(123);  } }  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(); }  double nextDouble() throws IOException {  return Double.parseDouble(next()); }  int nextInt() throws IOException {  return Integer.parseInt(next()); }  long nextLong() throws IOException {  return Long.parseLong(next()); }  public static void main(String[] args) {  new Thread(new Main()).start(); } }
4	public class A_YoureGivenAString {     public static void main(String[] args) {   Scanner s = new Scanner(System.in);   String str = s.nextLine();     for (int l = str.length()-1; l >= 1; l--) {    for (int i = 0; i < str.length()-l+1; i++) {     String subs = str.substring(i, i+l);     if(str.lastIndexOf(subs) != i){      System.out.println(l);      return;     }    }   }   System.out.println(0);  } }
1	public class Main implements Runnable {  public void _main() throws IOException {  int n = nextInt();  int[] a = new int[n];  String s = next();  for (int i = 0; i < n; i++)  a[i] = s.charAt(i) == 'H' ? 1 : 0;  int res = 10 * n;  for (int i = 0; i < n; i++) {  int[] b = new int[n];  for (int j = 0; j < n; j++)   b[j] = a[(i + j) % n];  res = Math.min(res, solve(b, 0));  res = Math.min(res, solve(b, 1));  }  out.print(res); }  private int solve(int[] a, int x) {  int n = a.length;   int j;  for (j = n - 1; j >= 0; j--)  if (a[j] == x)   break;  if (a[j] != x) return 0;  int res = 0;  for (int i = 0; i < j; i++)  if (a[i] != x) {   --j;   while (j >= i && a[j] != x)   --j;   ++res;  }  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 int nextInt() throws IOException {  return Integer.parseInt(next()); }  private long nextLong() throws IOException {  return Long.parseLong(next()); }  private double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static void main(String[] args) {  Locale.setDefault(Locale.UK);  new Thread(new Main()).start(); }  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   _main();   out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(202);  } } }
1	public class C {  public static void main(String[] args) {   CIO io = new CIO();   try {    Csolver solver = new Csolver(io);    solver.solve();   } finally {    io.close();   }  } } class Csolver {  CIO io;  public Csolver(CIO io) {   this.io = io;  }  public void solve() {   int n = io.nextInt();   String input = io.next();   int[] count = new int[1000];   int pokemonsInRange = 0;   int answer = Integer.MAX_VALUE;   int a = 0;   int b = 0;   for (; b < n ; b++) {    char end = input.charAt(b);    if (count[end] == 0) {     pokemonsInRange++;     answer = Integer.MAX_VALUE;    }    count[end]++;    while (count[input.charAt(a)] > 1) {     count[input.charAt(a)]--;     a++;    }    answer = Math.min(answer, b-a+1);   }   io.println(answer);  }  private static class Pair implements Comparable<Pair> {   int id;   long val;   public Pair(long val, int id) {    this.val = val;    this.id = id;   }   @Override   public int compareTo(Pair o) {    if (this.val < o.val) return -1;    if (this.val > o.val) return 1;    return this.id - o.id;   }  }  private List<Integer>[] toGraph(CIO io, int n) {   List<Integer>[] g = new ArrayList[n+1];   for (int i=1; i<=n; i++) g[i] = new ArrayList<>();   for (int i=1; i<=n-1; i++) {    int a = io.nextInt();    int b = io.nextInt();    g[a].add(b);    g[b].add(a);   }   return g;  } } class CIO extends PrintWriter {  private InputStreamReader r;  private static final int BUFSIZE = 1 << 15;  private char[] buf;  private int bufc;  private int bufi;  private StringBuilder sb;  public CIO() {   super(new BufferedOutputStream(System.out));   r = new InputStreamReader(System.in);   buf = new char[BUFSIZE];   bufc = 0;   bufi = 0;   sb = new StringBuilder();  }  private void fillBuf() throws IOException {   bufi = 0;   bufc = 0;   while(bufc == 0) {    bufc = r.read(buf, 0, BUFSIZE);    if(bufc == -1) {     bufc = 0;     return;    }   }  }  private boolean pumpBuf() throws IOException {   if(bufi == bufc) {    fillBuf();   }   return bufc != 0;  }  private boolean isDelimiter(char c) {   return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f';  }  private void eatDelimiters() throws IOException {   while(true) {    if(bufi == bufc) {     fillBuf();     if(bufc == 0) throw new RuntimeException("IO: Out of input.");    }    if(!isDelimiter(buf[bufi])) break;    ++bufi;   }  }  public String next() {   try {    sb.setLength(0);    eatDelimiters();    int start = bufi;    while(true) {     if(bufi == bufc) {      sb.append(buf, start, bufi - start);      fillBuf();      start = 0;      if(bufc == 0) break;     }     if(isDelimiter(buf[bufi])) break;     ++bufi;    }    sb.append(buf, start, bufi - start);    return sb.toString();   } catch(IOException e) {    throw new RuntimeException("IO.next: Caught IOException.");   }  }  public int nextInt() {   try {    int ret = 0;    eatDelimiters();    boolean positive = true;    if(buf[bufi] == '-') {     ++bufi;     if(!pumpBuf()) throw new RuntimeException("IO.nextInt: Invalid int.");     positive = false;    }    boolean first = true;    while(true) {     if(!pumpBuf()) break;     if(isDelimiter(buf[bufi])) {      if(first) throw new RuntimeException("IO.nextInt: Invalid int.");      break;     }     first = false;     if(buf[bufi] >= '0' && buf[bufi] <= '9') {      if(ret < -214748364) throw new RuntimeException("IO.nextInt: Invalid int.");      ret *= 10;      ret -= (int)(buf[bufi] - '0');      if(ret > 0) throw new RuntimeException("IO.nextInt: Invalid int.");     } else {      throw new RuntimeException("IO.nextInt: Invalid int.");     }     ++bufi;    }    if(positive) {     if(ret == -2147483648) throw new RuntimeException("IO.nextInt: Invalid int.");     ret = -ret;    }    return ret;   } catch(IOException e) {    throw new RuntimeException("IO.nextInt: Caught IOException.");   }  }  public long nextLong() {   try {    long ret = 0;    eatDelimiters();    boolean positive = true;    if(buf[bufi] == '-') {     ++bufi;     if(!pumpBuf()) throw new RuntimeException("IO.nextLong: Invalid long.");     positive = false;    }    boolean first = true;    while(true) {     if(!pumpBuf()) break;     if(isDelimiter(buf[bufi])) {      if(first) throw new RuntimeException("IO.nextLong: Invalid long.");      break;     }     first = false;     if(buf[bufi] >= '0' && buf[bufi] <= '9') {      if(ret < -922337203685477580L) throw new RuntimeException("IO.nextLong: Invalid long.");      ret *= 10;      ret -= (long)(buf[bufi] - '0');      if(ret > 0) throw new RuntimeException("IO.nextLong: Invalid long.");     } else {      throw new RuntimeException("IO.nextLong: Invalid long.");     }     ++bufi;    }    if(positive) {     if(ret == -9223372036854775808L) throw new RuntimeException("IO.nextLong: Invalid long.");     ret = -ret;    }    return ret;   } catch(IOException e) {    throw new RuntimeException("IO.nextLong: Caught IOException.");   }  }  public double nextDouble() {   return Double.parseDouble(next());  } }
5	public class A implements Runnable {  private MyScanner in;  private PrintWriter out;  private void solve() {   int n = in.nextInt();   int[] a = new int[n];   int all = 0;   for (int i = 0; i < n; ++i) {    a[i] = in.nextInt();    all += a[i];   }   Arrays.sort(a);   int sum = 0, ans = 0;   for (int i = n - 1; i >= 0; --i) {    sum += a[i];    ++ans;    if (sum > all - sum) {     break;    }   }   out.println(ans);  }  @Override  public void run() {   in = new MyScanner();   out = new PrintWriter(System.out);   solve();   in.close();   out.close();  }  public static void main(String[] args) {   new A().run();  }  static class MyScanner {   private BufferedReader br;   private StringTokenizer st;   public MyScanner() {    br = new BufferedReader(new InputStreamReader(System.in));   }   public void close() {    try {     br.close();    } catch (IOException e) {     e.printStackTrace();    }   }   public String next() {    while (st == null || !st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();      return null;     }    }    return st.nextToken();   }   public String nextLine() {    try {     st = null;     return br.readLine();    } catch (IOException e) {     e.printStackTrace();     return null;    }   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public boolean hasNext() {    if (st != null && st.hasMoreTokens()) {     return true;    }    try {     while (br.ready()) {      st = new StringTokenizer(br.readLine());      if (st != null && st.hasMoreTokens()) {       return true;      }     }    } catch (IOException e) {     e.printStackTrace();    }    return false;   }  } }
5	public class A {  public static void main(String [] args){   try(Scanner s = new Scanner(System.in)){    final int n = s.nextInt();    final int m = s.nextInt();    final int k = s.nextInt();    final int [] a = new int [n];    for (int i = 0; i < a.length; ++i){     a[i] = s.nextInt();    }    Arrays.sort(a);    int i = a.length - 1;    int available = k;    int filters = 0;    while (available < m && i >= 0){     available -= 1;     available += a[i];     filters++;     i--;    }    if (available < m){     System.out.println(-1);    }else{     System.out.println(filters);    }   }  } }
3	public class D {  int[][] fast(int n, int m){   int[][] ans = new int[2][n * m];   int c = 0;   for (int left = 1, right = m; left < right; left++, right--) {    for (int l = 1, r = n; l <= n && r >= 1; l++, r--) {     ans[0][c] = l;     ans[1][c++] = left;     ans[0][c] = r;     ans[1][c++] = right;    }   }   if (m % 2 == 1) {    int x = m/2 + 1;    for(int l = 1, r = n;l < r;l++, r--){     ans[0][c] = l;     ans[1][c++] = x;     ans[0][c] = r;     ans[1][c++] = x;      if(n % 2 == 1 && l + 2 == r){       ans[0][c] = l+1;       ans[1][c++] = x;      }    }   }   if(n == 1 && m % 2 == 1){    ans[0][c] = 1;    ans[1][c] = m/2 + 1;   }   return ans;  }  void stress(){   for(int i = 3;i<=5;i++){    for(int j = 2;j<=5;j++){     int[][] ans = new int[2][];     try{      ans = fast(i, j);     }catch(Exception e){      out.println("ошибка");      out.print(i + " " + j);      return;     }     boolean[][] check = new boolean[i][j];     for(int c = 0;c<ans[0].length;c++){      int x = ans[0][c] - 1;      int y = ans[1][c] - 1;      check[x][y] = true;     }     for(int c = 0;c<i;c++){      for(int q = 0;q<j;q++){       if(!check[c][q]){        out.println(i + " " + j);        out.println("точки");        for(int w = 0;w<ans[0].length;w++){         out.println(ans[0][w] + " " + ans[1][w]);        }        return;       }      }     }     HashSet<String> set = new HashSet<>();     for(int c = 1;c<ans[0].length;c++){      int x = ans[0][c] - ans[0][c- 1];      int y = ans[1][c] - ans[1][c - 1];      set.add(x + " " + y);     }     if(set.size() < i * j - 1){      out.println(i + " " + j);      out.println("вектора");      for(int w = 0;w<ans[0].length;w++){       out.println(ans[0][w] + " " + ans[1][w]);      }      return;     }    }   }  }  void normal(){   int n =readInt();   int m = readInt();   int[][] ans = fast(n, m);   for(int i = 0;i<ans[0].length;i++){    out.println(ans[0][i] + " " + ans[1][i]);   }  }  boolean stress = false;  void solve(){   if(stress) stress();   else normal();  }  public static void main(String[] args) {   new D().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();  }  int readInt(){   return Integer.parseInt(readString());  }  long readLong(){   return Long.parseLong(readString());  }  double readDouble(){   return Double.parseDouble(readString());  } }
2	public class Main {   final static 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);   }  } }
2	public class Main {  static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));  static StringTokenizer tok;  static boolean hasNext()  {   while(tok==null||!tok.hasMoreTokens())    try{     tok=new StringTokenizer(in.readLine());    }    catch(Exception e){     return false;    }   return true;  }  static String next()  {   hasNext();   return tok.nextToken();  }  static long nextLong()  {   return Long.parseLong(next());  }  static int nextInt()  {   return Integer.parseInt(next());  }  static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));  public static void main(String args []){   long x = nextLong();   long a = 2, b = nextLong(), c = 1000000000+7;   long res = 1;   a %= c;   if (x==0){    out.println(0);    out.flush();    return;   }   for (; b != 0; b /= 2) {    if (b % 2 == 1)     res = (res * a) % c;    a = (a * a) % c;   }   BigInteger r = new BigInteger(String.valueOf(res));   BigInteger y = new BigInteger(String.valueOf(x));   BigInteger ans = y.multiply(new BigInteger("2")).subtract(new BigInteger("1")).multiply(r).add(new BigInteger("1")).mod(new BigInteger(String.valueOf(c)));   out.println(ans);   out.flush();  } }
2	public class ReallyBigNumbers {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);  long n = sc.nextLong();  long s = sc.nextLong();   long m = s;   while(m-digitAdd(m)<s && m<=n){  m++;  }  System.out.println(Math.max(n-m+1, 0)); }  private static int digitAdd(long s){  int sum = 0;   for(long i = 0,j=1L;i<(int)Math.log10(s)+1; i++,j*=10){  sum += (s/j)%10;  }   return sum; } }
5	public class Chores { public static void main(String args[])throws IOException  {  InputStreamReader isr = new InputStreamReader(System.in);  BufferedReader br = new BufferedReader(isr);  String[] line = br.readLine().split("\\W");  int n = Integer.parseInt(line[0]);  int a = Integer.parseInt(line[1]);  int b = Integer.parseInt(line[2]);  int[] num = new int[n];  line = br.readLine().split("\\W");  for(int i=0;i<n;i++) num[i] = Integer.parseInt(line[i]);  Arrays.sort(num);   System.out.println(num[b]-num[b-1]); } }
0	public class Main { public static void main(String[] args) throws IOException {  (new Main()).solve(); }  public void Main() { }  void solve() throws IOException {      MyReader in = new MyReader();  PrintWriter out = new PrintWriter(System.out);     int n = in.nextInt();  out.print("0 0 ");  out.print(n);  out.close(); } }; class MyReader { private BufferedReader in; String[] parsed; int index = 0;  public MyReader() {  in = new BufferedReader(new InputStreamReader(System.in)); }  public int nextInt() throws NumberFormatException, IOException {  if (parsed == null || parsed.length == index) {  read();  }  return Integer.parseInt(parsed[index++]); }  public long nextLong() throws NumberFormatException, IOException {  if (parsed == null || parsed.length == index) {  read();  }  return Long.parseLong(parsed[index++]); }  public String nextString() throws IOException {  if (parsed == null || parsed.length == index) {  read();  }  return parsed[index++]; }  private void read() throws IOException {  parsed = in.readLine().split(" ");  index = 0; }  public String readLine() throws IOException {  return in.readLine(); } };
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;   }  }  private static 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;  }  private static 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 void run() {   try {    solve();   } catch (Throwable e) {    System.err.println(e.getMessage());    e.printStackTrace();   } finally {    output.flush();    output.close();   }  }   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 double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  private long nextLong() throws IOException {   return Long.parseLong(nextToken());  }   private BufferedReader input;  private PrintWriter output;  private StringTokenizer tokens = null; }
0	public class A630 { public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  long n = scan.nextLong();  System.out.println(25); } }
4	public class FireAgain {  public static void main(String[] args) throws IOException  {   FileInputStream in = null;   FileOutputStream out = null;    try   {    in = new FileInputStream("input.txt");    out = new FileOutputStream("output.txt");       Scanner sc = new Scanner(in);     int h = sc.nextInt();  int w = sc.nextInt();   int k = sc.nextInt();   int[] xk = new int[k];  int[] yk = new int[k];   for(int i = 0; i < k; i++)  {  int y = sc.nextInt()-1;  int x = sc.nextInt()-1;    xk[i] = x;  yk[i] = y;  }  int best = -1;  int bestx = -1;  int besty = -1;  for(int x = 0; x < w; x++)  {  for(int y = 0; y < h; y++)  {   int cur = 99999;   for(int f = 0; f < k; f++)   {   cur = Math.min(cur, Math.abs(xk[f] - x)+Math.abs(yk[f] - y));   }     if(cur > best)   {   best = cur;   bestx = x;   besty = y;   }  }  }    String s = (besty+1) + " " + (bestx+1);  out.write(s.getBytes());    }finally   {    if (in != null)    {    in.close();    }    if (out != null)    {    out.close();    }   }  } }
5	public class Main {  public static void main(String[] args)throws IOException{   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[][] point = new int[n][];   for(int i=0;i<n;i++) point[i] = new int[]{sc.nextInt(),sc.nextInt()};   Arrays.sort(point,(a,b)->((a[0]-a[1])-(b[0]-b[1])));   TreeMap<Integer,Integer> tm = new TreeMap<>();   int ans = 0;   for(int i=n-1;i>=0;i--){    int x = point[i][0], w = point[i][1];    Map.Entry<Integer,Integer> cur = tm.ceilingEntry(x+w);    int curRes;    if(cur==null) curRes = 1;    else curRes = cur.getValue()+1;    ans = Math.max(ans,curRes);    Map.Entry<Integer,Integer> upper = tm.ceilingEntry(x-w);    if(upper==null||upper.getValue()<curRes) tm.put(x-w,curRes);      }   System.out.println(ans);  } }
5	public class CottageVillage {   public static void main(String... args) {   Scanner sc = new Scanner(System.in);     int n = sc.nextInt();   int k = sc.nextInt();     TreeMap<Integer, Integer> tm = new TreeMap<Integer, Integer>();   while (n-->0) {    tm.put(sc.nextInt(), sc.nextInt());   }     int cnt=2, x=0, a=0;   double diff=0;   for(Map.Entry<Integer, Integer> e : tm.entrySet()) {    if (x!=0 || a!=0) {     diff = Math.abs(e.getKey()-x-e.getValue()*0.5-a*0.5);     if (diff-k>0) cnt+=2;     else if (diff-k==0) cnt++;    }    x=e.getKey();    a=e.getValue();   }   System.out.println(cnt);  } }
4	public class Main { public static void main(String args[]) throws IOException  {  Scanner c = new Scanner(new FileReader("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  int N=c.nextInt();  int M=c.nextInt();  int A[][]=new int[N][M];  for(int i=0;i<N;i++)  Arrays.fill(A[i],Integer.MAX_VALUE/100);  int K=c.nextInt();  for(int i=0;i<K;i++)  {  int x=c.nextInt()-1;  int y=c.nextInt()-1;  for(int i1=0;i1<N;i1++)   {   for(int j1=0;j1<M;j1++)   A[i1][j1]=Math.min(A[i1][j1],Math.abs(i1-x)+Math.abs(j1-y));   }  }  int maxi=0;  int maxj=0;  for(int i=0;i<N;i++)  {  for(int j=0;j<M;j++)   {   if(A[i][j]>A[maxi][maxj])   {   maxi=i;   maxj=j;   }   }  }  out.println((maxi+1)+" "+(maxj+1));  out.close();  } }
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 {   @Override   public void run() {    InputStream inputStream = System.in;    OutputStream outputStream = System.out;    FastInput in = new FastInput(inputStream);    FastOutput out = new FastOutput(outputStream);    G2PlaylistForPolycarpHardVersion solver = new G2PlaylistForPolycarpHardVersion();    solver.solve(1, in, out);    out.close();   }  }  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;   }  } }
3	public class Main {  public static void main(String[] args) {  Scanner s=new Scanner(System.in);   int n=s.nextInt();   long[] arr=new long[n];   for(int i=0;i<n;i++)  {  arr[i]=s.nextInt();  }   long[] pre=new long[n];   pre[0]=arr[0];   for(int i=1;i<n;i++)  {  pre[i]=pre[i-1]+arr[i];  }   HashMap<Long,ArrayList<pair>> map=new HashMap<>();   for(int i=0;i<n;i++)  {  for(int j=i;j<n;j++)  {   long key=pre[j]-pre[i]+arr[i];     if(map.containsKey(key))   {   pair p=new pair(i+1,j+1);   ArrayList<pair> temp=map.get(key);   temp.add(p);      map.put(key,temp);   }   else   {   ArrayList<pair> list=new ArrayList<>();   pair p=new pair(i+1,j+1);   list.add(p);      map.put(key,list);   }  }  }   for(Map.Entry<Long,ArrayList<pair>> entry:map.entrySet())  {  ArrayList<pair> curr=entry.getValue();    Collections.sort(curr,new comp());  }   long ans=0;  long max=-1000000000000l;   for(Map.Entry<Long,ArrayList<pair>> entry:map.entrySet())  {  ArrayList<pair> curr=entry.getValue();    int count=1;  int l=curr.get(0).l;  int r=curr.get(0).r;    for(int i=1;i<curr.size();i++)  {   if(curr.get(i).l>r)   {   count++;   l=curr.get(i).l;   r=curr.get(i).r;   }  }    if(count>max)  {   max=count;   ans=entry.getKey();  }    }   System.out.println(max);   ArrayList<pair> list=map.get(ans);   System.out.println(list.get(0).l+" "+list.get(0).r);   int l=list.get(0).l;  int r=list.get(0).r;   for(int i=1;i<list.size();i++)  {  if(list.get(i).l>r)  {   System.out.println(list.get(i).l+" "+list.get(i).r);   l=list.get(i).l;   r=list.get(i).r;  }  }   }  } class pair { int l; int r;  public pair(int l,int r) {  this.l=l;  this.r=r; } } class comp implements Comparator<pair> { public int compare(pair a,pair b) {  if(a.r<b.r)  return -1;  else if(a.r==b.r)  {  return b.l-a.l;  }  else  return 1; } }
0	public class subtractionn {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);  int t;  t=in.nextInt();  while(t!=0)  {  int a=in.nextInt();  int b=in.nextInt();  int total=0,neww=0;  if(a%b==0)  {   System.out.println(a/b);  }  else if(b%a==0)  {   System.out.println(b/a);  }  else  {  while(a!=0 && b!=0)  {   if(a>b)   {   total=total+(a/b);   a=a%b;   if(a==0)   {    break;   }   }   else if(b>a)   {   total=total+(b/a);   b=b%a;   if(b==0)   {    break;   }   }   else   {   System.exit(0);   }  }  System.out.println(total);  }  t--;  } } }
1	public class CTask {   public static void main(String[] args) throws IOException {   MyInputReader in = new MyInputReader(System.in);   HashMap<Character, Integer> m = new HashMap<Character, Integer>();   int n = in.nextInt();   char[] s = in.next().toCharArray();   for (int i = 0; i < n; i++) {    m.put(s[i], 0);   }   int mx = m.size();   int start = 0;   int end = 0;   int min = Integer.MAX_VALUE;   int cur = 0;   while (end < n) {    while (end < n && cur != mx) {     int x = m.get(s[end]);     if (x == 0) {      cur += 1;     }     m.put(s[end], x + 1);     end += 1;    }    while (start <= end && cur == mx) {     int x = m.get(s[start]);     m.put(s[start], x - 1);     if (x - 1 == 0) {      cur -= 1;     }     start += 1;    }    min = Math.min(min, end - start + 1);   }   System.out.println(min);  }   static class Pair {   long x;   long y;   public Pair(long x, long y) {    this.x = x;    this.y = y;   }   @Override   public boolean equals(Object o) {    if (this == o) return true;    if (o == null || getClass() != o.getClass()) return false;    Pair pair = (Pair) o;    if (x != pair.x) return false;    return y == pair.y;   }   @Override   public int hashCode() {    int result = (int) (x ^ (x >>> 32));    result = 31 * result + (int) (y ^ (y >>> 32));    return result;   }  }  static class MyInputReader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public MyInputReader(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());   }  } }
6	public class D {  public void run(Scanner in, PrintWriter out) {   int n = in.nextInt();   int[][] graph = new int[n][n];   int m = in.nextInt();   for (int i = 0; i < m; i++) {    int x = in.nextInt() - 1;    int y = in.nextInt() - 1;    graph[x][y] = 1;    graph[y][x] = 1;   }   long[][] dyn = new long[1 << n][n];   for (int i = 0; i < n; i++) {    dyn[1 << i][i] = 1;   }   long answer = 0;   for (int mask = 1; mask < 1 << n; mask++) {    int start = Integer.numberOfTrailingZeros(mask);    for (int i = 0; i < n; i++) {     if ((mask & (1 << i)) == 0) continue;     for (int j = start + 1; j < n; j++) {      if (graph[i][j] > 0 && (mask & (1 << j)) == 0) {       dyn[mask + (1 << j)][j] += dyn[mask][i];      }     }     if (graph[i][start] > 0) {      answer += dyn[mask][i];     }    }   }   out.println((answer - m)/ 2);  }  public static void main(String[] args) {   try (Scanner in = new Scanner(System.in);    PrintWriter out = new PrintWriter(System.out)   ) {    new D().run(in, out);   } catch (Exception e) {    e.printStackTrace();   }  } }
6	public class C {  static int n, m, a[][]; static int[][] memo;  static int[] getCol(int col, int shift) {  int[] ans = new int[n];  for (int i = 0, j = shift; i < n; i++, j = (j + 1) % n) {  ans[i] = a[j][col];  }  return ans;  }  static int dp(int col, int msk) {  if (col == m)  return 0;  if (memo[msk][col] != -1)  return memo[msk][col];  int ans = 0;  for (int shift = 0; shift < n; shift++) {  int[] currCol = getCol(col, shift);  for (int nxtMsk = 0; nxtMsk < 1 << n; nxtMsk++) {   if ((nxtMsk & msk) != msk)   continue;   int curr = 0;   int diff = msk ^ nxtMsk;   for (int i = 0; i < n; i++)   if ((diff & 1 << i) != 0)    curr += currCol[i];   ans = Math.max(ans, dp(col + 1, nxtMsk) + curr);  }  }  return memo[msk][col] = ans; }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out);  int tc = sc.nextInt();  while (tc-- > 0) {  n = sc.nextInt();  m = sc.nextInt();  memo = new int[1 << n][m];  for (int[] x : memo)   Arrays.fill(x, -1);  a = new int[n][m];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++)   a[i][j] = sc.nextInt();  out.println(dp(0, 0));  }  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();  }  String nextLine() throws IOException {  return br.readLine();  }  int nextInt() throws IOException {  return Integer.parseInt(next());  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(next());  }  boolean ready() throws IOException {  return br.ready();  }  }  static void sort(int[] a) {  shuffle(a);  Arrays.sort(a); }  static void shuffle(int[] a) {  int n = a.length;  Random rand = new Random();  for (int i = 0; i < n; i++) {  int tmpIdx = rand.nextInt(n);  int tmp = a[i];  a[i] = a[tmpIdx];  a[tmpIdx] = tmp;  } } }
1	public class C { public static void main(String[] args) throws IOException {  File inputFile = new File("entradaC");  if (inputFile.exists())  System.setIn(new FileInputStream(inputFile));  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringBuilder out = new StringBuilder();  String line = "";  while ((line = in.readLine()) != null) {  int n = Integer.parseInt(line);  char[] p = in.readLine().toCharArray();  HashMap<Character, Integer> dif = new HashMap<>();  for (int i = 0; i < p.length; i++)   dif.put(p[i], 0);  int ndif = dif.size();  int head = 0, tail = 0, cnt = 0, ans = Integer.MAX_VALUE, cur;  while (head < n) {   cur = dif.get(p[head]);   if (cur == 0)   cnt++;   dif.put(p[head], cur + 1);   head++;   if (cnt == ndif)   ans = Math.min(ans, head - tail);   while (tail < head && cnt == ndif) {   cur = dif.get(p[tail]);   if (cur == 1)    cnt--;   dif.put(p[tail], cur - 1);   tail++;   if (cnt == ndif)    ans = Math.min(ans, head - tail);   }  }  if (ndif == 1)   ans = 1;  out.append(ans + "\n");  }  System.out.print(out); }  static int[] readInts(String line) {  StringTokenizer st = new StringTokenizer(line.trim());  int a[] = new int[st.countTokens()], index = 0;  while (st.hasMoreTokens())  a[index++] = Integer.parseInt(st.nextToken());  return a; }  static long[] readLongs(String line) {  StringTokenizer st = new StringTokenizer(line.trim());  long a[] = new long[st.countTokens()];  int index = 0;  while (st.hasMoreTokens())  a[index++] = Long.parseLong(st.nextToken());  return a; }  static double[] readDoubles(String line) {  StringTokenizer st = new StringTokenizer(line.trim());  double a[] = new double[st.countTokens()];  int index = 0;  while (st.hasMoreTokens())  a[index++] = Double.parseDouble(st.nextToken());  return a; } }
6	public class ASimpleTask {  static StreamTokenizer st;  static int nextInt() {  try {  st.nextToken();  } catch (IOException e) {    e.printStackTrace();  }  return (int) st.nval; }  static int[][] edges; static long[][] dp;  public static void main(String[] args) {  st = new StreamTokenizer(new BufferedReader(new InputStreamReader(   System.in)));  int n = nextInt();  int m = nextInt();  edges = new int[n][n];  for (int i = 0; i < m; i++) {  int from = nextInt() - 1;  int to = nextInt() - 1;  edges[from][to] = edges[to][from] = 1;  }  dp = new long[(1 << n) + 1][n + 1];  for (int mask = 1; mask < (1 << n); mask++) {  for (int i = 0; i < n; i++) {   if (Integer.bitCount(mask) == 1 && (mask & (1 << i)) != 0) {   dp[mask][i] = 1;   continue;   }   if (Integer.bitCount(mask) > 1 && (mask & (1 << i)) != 0    && first(mask, n) != i) {   for (int j = 0; j < n; j++) {    if (edges[i][j] == 1) {    dp[mask][i] += dp[mask ^ (1 << i)][j];    }   }   }  }  }  long count = 0;  for (int mask = 1; mask < (1 << n); mask++) {  for (int i = 0; i < n; i++) {   if (Integer.bitCount(mask) >= 3    && edges[i][first(mask, n)] != 0)   count += dp[mask][i];  }  }  System.out.println(count / 2);  }  static int first(int mask, int n) {  for (int i = 0; i < n; i++) {  if ((mask & (1 << i)) != 0)   return i;  }  return -1; } }
6	public class MaeDosDragoes { public static PrintWriter saida = new PrintWriter(System.out, false); public static class Escanear {   BufferedReader reader;   StringTokenizer tokenizer;  public Escanear() {    this(new InputStreamReader(System.in));   }  public Escanear(Reader in) {    reader = new BufferedReader(in);   }   String proximo() {    if (tokenizer == null || !tokenizer.hasMoreElements()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return tokenizer.nextToken();   }     int proximoNum() {    return Integer.parseInt(proximo());   }  }  public static void main(String[] args) {  Escanear escanear = new Escanear();  int proximoInt = escanear.proximoNum();   long[] aux = new long[proximoInt];   double proximoDouble = escanear.proximoNum();   for(Integer i = 0; i < proximoInt; i++) {    for(Integer j =0; j < proximoInt; j++) {     Integer val = escanear.proximoNum();     if (val.equals(1) || i.equals(j)) {   aux[i] |= 1L << j;   }    }   }   int esquerda = proximoInt/2;   int direita = proximoInt - esquerda;  int maiorMascara = 1 << esquerda;  int[] depois = new int[1 << esquerda];  Integer mascara = 1;  while (mascara < maiorMascara) {  int mascaraAtual = mascara;    for(int j = 0; j < esquerda; j++) {     if (((1 << j) & mascara) > 0) {      mascaraAtual &= aux[j + direita] >> direita;      depois[mascara] = Math.max(depois[mascara], depois[mascara ^ (1 << j)]);     }    }    if (mascara == mascaraAtual) {     depois[mascara] = Math.max(depois[mascara],Integer.bitCount(mascara));  }  mascara++;  }                                 int auxiliar = 0;   int mascaraMaxima = 1 << direita;   for(int masc = 0; masc < mascaraMaxima; masc++) {    int mascaraCorrente = masc;    int mascaraValor = maiorMascara -1;    for(int j = 0; j < direita; j++) {     if (((1 << j) & masc) > 0) {      mascaraCorrente &= (aux[j] & (mascaraMaxima-1));      mascaraValor &= aux[j] >> direita;     }    }    if (mascaraCorrente != masc) continue;    auxiliar = Math.max(auxiliar, Integer.bitCount(masc) + depois[mascaraValor]);   }   proximoDouble/=auxiliar;   saida.println(proximoDouble * proximoDouble * (auxiliar * (auxiliar-1))/2);   saida.flush();  } }
1	public class Main {  public static void main(String[] args)  {   Scanner stdin = new Scanner(System.in);     test(stdin);   stdin.close();  }  public static void test(Scanner stdin)  {  int n = stdin.nextInt();  int min = Integer.MAX_VALUE;  for(int i = 0; i < n; i++)  {   int a = stdin.nextInt();   if((int)((1.0)*a/(Math.max(i, n - i - 1))) < min)   { min = (int)((1.0)*a/(Math.max(i, n - i - 1))); }  }  System.out.println(min);  } }
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;  }  private static 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;  }  private static 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;  } }
1	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 {   public void solve(int testNumber, FastReader in, PrintWriter out) {    Debug debug = new Debug();    int n = in.nextInt();    int K = in.nextInt();    List<Integer>[] g = GraphUtils.nextU(in, n, n - 1, true);    int[] center = GraphUtils.getCenter(g);    if (center.length == 2) {     out.println("No");     return;    }    int[][] pars = GraphUtils.parents3(g, center[0]);    int[] par = pars[0], ord = pars[1], depth = pars[2];    int[] deg = new int[n];    for (int i = 0; i < n; ++i) deg[i] = g[i].size();    if (deg[center[0]] < 3) {     out.println("No");     return;    }        for (int i = 0; i < n; ++i) {     if (deg[i] == 1) {      if (depth[i] != K) {       out.println("No");       return;      }     } else if (i != center[0]) {      if (deg[i] < 4) {       out.println("No");       return;      }     }    }    out.println("Yes");   }  }  static class GraphUtils {   public static List<Integer>[] nextU(FastReader in, int n, int m, boolean oneIndexed) {    int diff = oneIndexed ? 1 : 0;    List<Integer>[] g = new List[n];    for (int i = 0; i < n; ++i) g[i] = new ArrayList<>();    for (int i = 0; i < m; ++i) {     int u = in.nextInt() - diff;     int v = in.nextInt() - diff;     g[u].add(v);     g[v].add(u);    }    return g;   }   public static int[][] parents3(List<Integer>[] g, int root) {    int n = g.length;    int[] par = new int[n];    ArrayUtils.fill(par, -1);    int[] depth = new int[n];    depth[0] = 0;    int[] q = new int[n];    q[0] = root;    for (int p = 0, r = 1; p < r; p++) {     int cur = q[p];     for (int nex : g[cur]) {      if (par[cur] != nex) {       q[r++] = nex;       par[nex] = cur;       depth[nex] = depth[cur] + 1;      }     }    }    return new int[][]{par, q, depth};   }   public static int[] getCenter(List<Integer>[] g) {    int n = g.length;    int[] q = new int[n];    int[] deg = new int[n];    int p = 0;    for (int i = 0; i < n; i++) {     deg[i] = g[i].size();     if (g[i].size() <= 1) {      q[p++] = i;     }    }    int bound = p == n ? 0 : p;    for (int z = 0; z < p; z++) {     if (bound == z && p < n) bound = p;     int cur = q[z];     deg[cur]--;     for (int e : g[cur]) {      if (--deg[e] == 1) q[p++] = e;     }    }    assert p == n;    assert bound >= n - 2 && bound < n;    if (bound == n - 2) {     return new int[]{q[n - 2], q[n - 1]};    } else {     return new int[]{q[n - 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 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;   }  }  static class ArrayUtils {   public static void fill(int[] array, int value) {    Arrays.fill(array, value);   }  }  static class Debug {   PrintWriter out;   boolean oj;   boolean system;   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();   }   public Debug() {    system = true;    oj = System.getProperty("ONLINE_JUDGE") != null;    OutputStream outputStream = System.out;    this.out = new PrintWriter(outputStream);    this.timeBegin = System.currentTimeMillis();    this.runtime = Runtime.getRuntime();   }  } }
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); } }
1	public class C {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   int len = s.nextInt();   s.nextLine();   String l = s.nextLine();   char[] ca = l.toCharArray();   int h = 0;   for (char c : ca)    h += A(c);   int cur = h;   int i;   for (i = 0; i < h; i++)    cur -= A(ca[i]);   int best = cur;   while (i != h + len) {    cur -= A(ca[i % len]);    cur += A(ca[(i - h) % len]);    best = best > cur ? cur : best;    i++;   }   System.out.println(best);  }  public static int A(char x) {   return x == 'H' ? 1 : 0;  } }
2	public class Main { private InputStream is; private PrintWriter out; int time = 0, dp[][], DP[][], start[], parent[], end[], val[], black[], MOD = (int)(1e9+7), arr[], arr1[]; int MAX = 10000000, N, K, p; ArrayList<Integer>[] amp, amp1; boolean b[], b1[]; Pair prr[]; char ch[][]; HashSet<Integer> hs = new HashSet<>();  public static void main(String[] args) throws Exception {  new Thread(null, new Runnable() {  public void run() {  try {    } catch (Exception e) {   System.out.println(e);  }  } }, "1", 1 << 26).start();  new Main().soln(); } void solve() {  long n = nl(), s = nl();  long low = 1, high = n+1;  long ans = high;  while(low<=high){  long mid = (high+low)/2;  if((mid - getSum(mid))>=s){   high = mid-1;   ans = mid;  }  else{   low = mid+1;  }  }  System.out.println(Math.max(0, n-ans+1)); } int getSum(long s){  String str = Long.toString(s);  int ans = 0;  for(char ch : str.toCharArray()) ans += (ch-'0');  return ans; } int recur(int x){   int ans = 0;  b[x] = true;  for(int i : amp[x]){  if(!b[i]){   b[i] = true;   ans = Math.max(recur(i), ans);   b[i] = false;  }  }  return 1+ans; } int max = 0; int getParent(int x){   if(parent[x]!=x){  parent[x] = getParent(parent[x]);  }  return parent[x]; } int bfs(int x){  b[x] = true;  Queue<Integer> q = new LinkedList<>();  q.add(x);  while(!q.isEmpty()){  int y = q.poll();  for(int i : amp[y]){   if(!b[i]){   b[i] = true;   val[i] = val[y]+1;   max = Math.max(val[i], max);   q.add(i);   }  }  }  return max; } class Pair implements Comparable<Pair>{  int u, v, r;  Pair(int u, int v){  this.u = u;  this.v = v;  }public int hashCode() {  return Objects.hash();  }  public boolean equals(Object o) {  Pair other = (Pair) o;  return ((u == other.u && v == other.v));  }  public int compareTo(Pair other) {    return Long.compare(u, other.u) != 0 ? (Long.compare(u, other.u)) : (Long.compare(other.v,v));  }  public String toString() {  return "[u=" + u + ", v=" + v + "]";  } } int min(int x,int y){  if(x<y) return x;  return y; } int max(int x,int y){  if(x>y) return x;  return y; } void dfs(int x){  b[x] = true;  for(int i : amp[x]){  if(!b[i]){   dfs(i);  }  } } void buildGraph(int m){  while(m-->0)  {  int x = ni()-1, y = ni()-1;  amp[x].add(y);  amp[y].add(x);  } } long modInverse(long a, long mOD2){   return power(a, mOD2-2, mOD2); } long power(long x, long y, long m) {  if (y == 0)  return 1; long p = power(x, y/2, m) % m; p = (p * p) % m;  return (y%2 == 0)? p : (x * p) % m; } boolean isPrime(int x){  for(int i = 2;i*1L*i<=x;i++) if(x%i==0) return false;  return true; } public long gcd(long a, long b){  if(b==0) return a;  return gcd(b,a%b); } void failFn(String str, int arr[]){  int len = 0;  arr[0] = 0;  int i = 1;  while(i<arr.length){  if(str.charAt(i)==str.charAt(len)){   arr[i++] = ++len;   continue;  }  if(len == 0){   arr[i] = len;   i++;   continue;  }  if(str.charAt(i)!=str.charAt(len)){   len = arr[len-1];  }  } } static class ST1{  int arr[], st[], size;  ST1(int a[]){  arr = a.clone();  size = 10*arr.length;  st = new int[size];  build(0,arr.length-1,1);  }  void build(int ss, int se, int si){  if(ss==se){   st[si] = arr[ss];   return;  }  int mid = (ss+se)/2;  int val = 2*si;  build(ss,mid,val); build(mid+1,se,val+1);  st[si] = (st[val]+ st[val+1]);  }  int get(int ss, int se, int l, int r, int si){  if(l>se || r<ss || l>r) return Integer.MAX_VALUE;  if(l<=ss && r>=se) return st[si];  int mid = (ss+se)/2;  int val = 2*si;  return (get(ss,mid,l,r,val)+ get(mid+1,se,l,r,val+1));  } } static class ST{  int arr[],lazy[],n;  ST(int a){  n = a;  arr = new int[10*n];  lazy = new int[10*n];  }  void up(int l,int r,int val){  update(0,n-1,0,l,r,val);  }  void update(int l,int r,int c,int x,int y,int val){  if(lazy[c]!=0){   lazy[2*c+1]+=lazy[c];   lazy[2*c+2]+=lazy[c];   if(l==r)   arr[c]+=lazy[c];   lazy[c] = 0;  }  if(l>r||x>y||l>y||x>r)   return;  if(x<=l&&y>=r){   lazy[c]+=val;   return ;  }  int mid = l+r>>1;  update(l,mid,2*c+1,x,y,val);  update(mid+1,r,2*c+2,x,y,val);  arr[c] = (arr[2*c+1]+ arr[2*c+2]);  }  int an(int ind){  return ans(0,n-1,0,ind);  }  int ans(int l,int r,int c,int ind){  if(lazy[c]!=0){   lazy[2*c+1]+=lazy[c];   lazy[2*c+2]+=lazy[c];   if(l==r)   arr[c]+=lazy[c];   lazy[c] = 0;  }  if(l==r)   return arr[c];  int mid = l+r>>1;  if(mid>=ind)   return ans(l,mid,2*c+1,ind);  return ans(mid+1,r,2*c+2,ind);  } } public static class FenwickTree {    int[] array;   public FenwickTree(int size) {   array = new int[size + 1];  }  public int rsq(int ind) {   assert ind > 0;   int sum = 0;   while (ind > 0) {    sum += array[ind];        ind -= ind & (-ind);   }   return sum;  }  public int rsq(int a, int b) {   assert b >= a && a > 0 && b > 0;   return rsq(b) - rsq(a - 1);  }  public void update(int ind, int value) {   assert ind > 0;   while (ind < array.length) {    array[ind] += value;        ind += ind & (-ind);   }  }  public int size() {   return array.length - 1;  } } public static int[] shuffle(int[] a, Random gen){  for(int i = 0, n = a.length;i < n;i++)  {   int ind = gen.nextInt(n-i)+i;   int d = a[i];   a[i] = a[ind];  a[ind] = d;  }  return a;  } long power(long x, long y, int mod){  long ans = 1;  while(y>0){  if(y%2==0){   x = (x*x)%mod;   y/=2;  }  else{   ans = (x*ans)%mod;   y--;  }  }  return ans; } void soln() {  is = System.in;  out = new PrintWriter(System.out);  long s = System.currentTimeMillis();  solve();   out.flush();   }    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 double nd() {  return Double.parseDouble(ns()); }  private char nc() {  return (char) skip(); } private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(isSpaceChar(b))) {        sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while (p < n && !(isSpaceChar(b))) {  buf[p++] = (char) b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)  map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))  ;  if (b == '-') {  minus = true;  b = readByte();  }  while (true) {  if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');  } else {   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))  ;  if (b == '-') {  minus = true;  b = readByte();  }  while (true) {  if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');  } else {   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null;  private void tr(Object... o) {  if (!oj)  System.out.println(Arrays.deepToString(o)); } }
5	public class A implements Runnable{  BufferedReader in;  PrintWriter out;  StringTokenizer st;  public static final String filename = "a";  class I implements Comparable<I>{   int x;   int a;   I(int x, int a){    this.x = x;    this.a = a;   }   public int compareTo(I o){    return Double.compare(x, o.x);   }  }  public void solve() throws IOException{   int n = nextInt();   int t = nextInt();   I[] a = new I[n];   for(int i = 0;i < n;i ++){    a[i] = new I(nextInt(), nextInt());   }   int res = 2;   Arrays.sort(a);   for(int i = 1;i < n;i ++){    if((a[i].x - a[i - 1].x - 1.0 * (a[i].a + a[i - 1].a) / 2) >= t)res ++;    if((a[i].x - a[i - 1].x - 1.0 * (a[i].a + a[i - 1].a) / 2) > t)res ++;   }   out.println(res);  }  public void run(){   try{    Locale.setDefault(Locale.US);    in = new BufferedReader(new InputStreamReader(System.in));       out = new PrintWriter(System.out);       st = new StringTokenizer("");    solve();    out.close();   } catch(IOException e){    throw new RuntimeException(e);   }  }  public static void main(String[] args){   new Thread(new A()).start();  }  public String nextToken() throws IOException{   while(!st.hasMoreTokens()){    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  public int nextInt() throws IOException{   return Integer.parseInt(nextToken());  }  public double nextDouble() throws IOException{   return Double.parseDouble(nextToken());  } }
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); } }
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());  }  public long nextLong() {  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);  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);  }  }
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());  }  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 C701 {  public static int f(char c) {   if (c >= 'a' && c <= 'z') {    return c - 'a';   } else {    return 26 + c - 'A';   }  }  public static void main(String[] args) throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(reader.readLine());   char[] ch = reader.readLine().toCharArray();   LinkedList<Integer>[] p = new LinkedList[52];   for (int i = 0; i < 52; i++) {    p[i] = new LinkedList<>();   }   int[] fc = new int[n];   for (int i = 0; i < n; i++) {    int cc = f(ch[i]);    p[cc].add(i);    fc[i] = cc;   }   int en = 0;   for (int i = 0; i < 52; i++) {    if (p[i].size() > 0) en = Math.max(en, p[i].poll());   }   int mx = en + 1;   for (int i = 0; i < n; i++) {    if (p[fc[i]].size() == 0) break;    en = Math.max(en, p[fc[i]].poll());    mx = Math.min(mx, en - i);   }   System.out.println(mx);  } }
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());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  } } }
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();   }  } }
3	public class C { static int [][] memo; static int n; static char [] c; static int mod = (int)1e9+7; static int dp(int ind, int loops){  if(ind == n)  return loops == 0?1:0;  if(memo[ind][loops] != -1)  return memo[ind][loops];  long ans = 0;  if(c[ind] == 's'){  ans = (ans + dp(ind+1, loops))%mod;  if(loops > 0)   ans = (ans + dp(ind, loops-1))%mod;  }  else{  ans = (ans + dp(ind+1, loops+1))%mod;  }  return memo[ind][loops] = (int) ans; } public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  n = sc.nextInt();  memo = new int[n+1][n+1];  for(int [] i:memo)  Arrays.fill(i, -1);  c = new char[n];  for (int i = 0; i < c.length; i++) {  c[i] = sc.next().charAt(0);  }  out.println(dp(0,0));  out.flush();  out.close(); }  static class Scanner {  BufferedReader bf;  StringTokenizer st;  public Scanner(InputStream i) {  bf = new BufferedReader(new InputStreamReader(i));  }  public String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(bf.readLine());  return st.nextToken();  }  public int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(next());  }  public double nextDouble() throws IOException {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-') {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.') {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  } } }
1	public class Main {  public static void main(String[] args) {   new Thread(null, new Runnable() {    public void run() {     new Main().solve();    }   }, "1", 1 << 26).start();  }  void solve() {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   ACodehorsesTShirts solver = new ACodehorsesTShirts();   solver.solve(1, in, out);   out.close();  }  static class ACodehorsesTShirts {   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    ArrayList<String>[] arrayLists = new ArrayList[5];    ArrayList<String>[] arrayLists1 = new ArrayList[5];    for (int i = 0; i < 5; i++) {     arrayLists[i] = new ArrayList<>();     arrayLists1[i] = new ArrayList<>();    }    for (int i = 0; i < n; i++) {     String s = in.scanString();     arrayLists[s.length()].add(s);    }    for (int i = 0; i < n; i++) {     String s = in.scanString();     arrayLists1[s.length()].add(s);    }    long ans = 0;    for (int i = 0; i < 5; i++) {     for (int diff = 0; diff < 5; diff++) {      for (int j = 0; j < arrayLists[i].size(); j++) {       int min = Integer.MAX_VALUE;       int index = -1;       for (int k = 0; k < arrayLists1[i].size(); k++) {        int tt = 0;        for (int l = 0; l < i; l++)         if (arrayLists[i].get(j).charAt(l) != arrayLists1[i].get(k).charAt(l)) tt++;        if (tt < min) {         min = tt;         index = k;        }       }       if (min == diff) {        arrayLists1[i].remove(index);        ans += min;       }      }     }    }    out.println(ans);    }  }  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;   }   public String scanString() {    int c = scan();    if (c == -1) return null;    while (isWhiteSpace(c)) c = scan();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = scan();    } while (!isWhiteSpace(c));    return res.toString();   }   private boolean isWhiteSpace(int n) {    if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;    else return false;   }  } }
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());  }  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();  } }
6	public class A558 { static BufferedReader in = null; static PrintWriter out = null; static StringTokenizer st = new StringTokenizer("");  public static void main(String[] args) {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  out.close();  } catch (Exception e) {  e.printStackTrace();  } }  public static String readString() {  while (!st.hasMoreTokens()) {  try {   st = new StringTokenizer(in.readLine(), " \n\r\t:");  } catch (Exception e) {   e.printStackTrace();  }  }  return st.nextToken(); }  public static int readInt() {  return Integer.parseInt(readString()); }  public static long readLong() {  return Long.parseLong(readString()); }  private static int MAX_VALUE = Integer.MAX_VALUE - 10000000; private static int[] dp; private static int[] parents; private static int[] powers; private static int[] x; private static int[] y; private static int[][] dist; private static int[] distFrom0;  private static void solve() throws IOException {  int x0 = readInt();  int y0 = readInt();  int n = readInt();  long time = System.currentTimeMillis();  x = new int[n];  y = new int[n];  for (int i = 0; i < n; i++) {  x[i] = readInt() - x0;  y[i] = readInt() - y0;  }  dist = new int[n][n];  distFrom0 = new int[n];  for (int i = 0; i < n; i++) {  for (int j = 0; j < n; j++) {   dist[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);  }  }  for (int i = 0; i < n; i++) {  distFrom0[i] = x[i] * x[i] + y[i] * y[i];  }  powers = new int[n + 1];  powers[0] = 1;  for (int i = 1; i < n + 1; i++) {  powers[i] = powers[i - 1] * 2;  }  int maxMask = 1 << n;  dp = new int[maxMask];  parents = new int[maxMask];  Arrays.fill(dp, MAX_VALUE);  dp[0] = 0;  for (int i = 0; i < maxMask; i++) {  if (dp[i] != MAX_VALUE) {   int curMask = i;   int notUsed = 0;   for (int j = 0; j < n; j++) {   if ((curMask & powers[j]) == 0) {    notUsed = j;    break;   }   }   int mask = curMask | powers[notUsed];   for (int j = notUsed; j < n; j++) {   if ((powers[j] & curMask) == 0 || j == notUsed) {    int nextMask = mask | powers[j];    int minDist = dp[curMask] + distFrom0[notUsed] + dist[notUsed][j] + distFrom0[j];    if (dp[nextMask] > minDist) {    dp[nextMask] = minDist;    parents[nextMask] = curMask;    }   }   }  }  }     maxMask--;  out.println(dp[maxMask]);  while (maxMask != 0) {  out.print("0 ");  int[] diffBits = getBits(n, maxMask, parents[maxMask]);  for (int i = 1; i <= diffBits[0]; i++) {   out.print(diffBits[i] + 1 + " ");  }  maxMask = parents[maxMask];  }  out.print(0);   }  private static boolean hasBit(int x, int index) {  return (powers[index] & x) != 0; }  private static int setBit(int x, int index) {  return (x | powers[index]); }  private static int getDist(int xFrom, int yFrom, int xTo, int yTo) {  return (xTo - xFrom) * (xTo - xFrom) + (yTo - yFrom) * (yTo - yFrom); }  private static int[] getBits(int n, int nextMask, int curMask) {  int[] res = new int[3];  for (int i = 0; i < n; i++) {  if (hasBit(nextMask, i) ^ hasBit(curMask, i)) {   res[++res[0]] = i;  }  }  return res; }  private static void brute(int n, int mask) {  List<Integer> listNotTaken = new ArrayList<>();  for (int i = 0; i < n; i++) {  if (!hasBit(mask, i)) {   listNotTaken.add(i);  }  }  for (int first : listNotTaken) {  int temp = setBit(mask, first);  for (int second : listNotTaken) {   int nextMask = setBit(temp, second);   int minDist = dp[mask] + getDist(0, 0, x[first], y[first]) + getDist(x[first], y[first], x[second], y[second]) + getDist(x[second], y[second], 0, 0);   if (dp[nextMask] > minDist) {   dp[nextMask] = minDist;   parents[nextMask] = mask;   brute(n, nextMask);   }  }  } } }
0	public class LuckyDivision { public static void main (String[] args) {  Scanner read = new Scanner(System.in);  int n = read.nextInt();   if (n % 4 == 0 ||  n % 7 == 0 ||  n % 47 == 0 ||  n % 74 == 0 ||  n % 447 == 0 ||  n % 474 == 0 ||  n % 477 == 0 ||  n % 744 == 0 ||  n % 747 == 0 ||  n % 774 == 0) {   System.out.println("YES");  }  else {   System.out.println("NO");  }   } }
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();   int a[] = in.nextIntArray(n);   int i,j,k;   int b[] = a.clone();   ArrayUtils.randomShuffle(a);   Arrays.sort(a);     int c[] = new int[n];   k=0;   for(i=0;i<n;++i) if(a[i]!=b[i]) c[k++] = i;     String res = "NO";   if(k==0){    res = "YES";   }else   if(k==1){      }else   if(k==2){    i = c[0]; j = c[1];    if(a[i]==b[j] && a[j]==b[i]) res = "YES";   }     out.writeln(res); } } 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(Exception e){     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }   public int nextInt(){   return Integer.parseInt(next());  }  public int[] nextIntArray(int size){   int array[] = new int[size];   for(int i=0; i<size; ++i) array[i] = nextInt();   return array;  } } class OutputWriter{  private PrintWriter out;   public OutputWriter(Writer out){   this.out = new PrintWriter(out);  }  public OutputWriter(OutputStream out){   this.out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out)));  }   public void close(){   out.flush();   out.close();  }  public void writeln(Object ... o){   for(Object x : o) out.print(x);   out.println();  } } class ArrayUtils{  private final static Random random = new Random(System.nanoTime());   public static void randomShuffle(int a[]){   int n = a.length;   for(int i=0;i<n;++i){    int j = random.nextInt(n-i);    int t = a[i]; a[i] = a[j]; a[j] = t;   }  } }
1	public class A {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   int N = s.nextInt();   int K = s.nextInt();   int[] primes = getPrimesFast(N);   Set<Integer> ints = new HashSet<Integer>();   for(int i=0;i<primes.length;i++) {    ints.add(primes[i]);   }   for(int i=1;i<primes.length;i++) {    ints.remove(primes[i] + primes[i-1]+1);   }   boolean res = primes.length - ints.size() >= K;   System.out.print(res?"YES":"NO");    }  public static int[] getPrimesFast(int n) {  if (n <= 1) {  return new int[0];  }  boolean[] b = new boolean[n + 1];  int m = n - 1;  for (int i = 2; i * i <= n; i++) {  if (!b[i]) {   for (int j = i + i; j <= n; j += i) {   if (!b[j]) {    m--;    b[j] = true;   }   }  }  }  int[] primes = new int[m];  int j = 0;  for (int i = 2; i <= n; i++) {  if (!b[i]) {   primes[j++] = i;  }  }  return primes; } }
4	public class D {  static boolean isValid(int n, int m, int i, int j){   return 0<=i && i<n && 0<=j && j<m;  }  public static void main(String[] args) throws IOException {   Soumit sc = new Soumit();   int n = sc.nextInt();   int m = sc.nextInt();   int k = sc.nextInt();   StringBuilder sb = new StringBuilder();   if(k%2==1){    for(int i=0;i<n;i++){     for(int j=0;j<m;j++){      sb.append("-1 ");     }     sb.append("\n");    }    System.out.println(sb);    System.exit(0);   }   k/=2;   long[][] horizontaledge = new long[n][m-1];   long[][] verticaledge = new long[n-1][m];   for(int i=0;i<n;i++)    horizontaledge[i] = sc.nextLongArray(m-1);   for(int i=0;i<n-1;i++)    verticaledge[i] = sc.nextLongArray(m);   long[][][] dp = new long[11][n][m];   for(int i=0;i<n;i++){    for(int j=0;j<m;j++){     dp[0][i][j] = 0;    }   }   for(int i=1;i<=k;i++){    for(int j1=0;j1<n;j1++){     for(int j2=0;j2<m;j2++){      long min = Long.MAX_VALUE/2000;           if(isValid(n, m, j1-1, j2)){       min = Math.min(dp[i-1][j1-1][j2]+verticaledge[j1-1][j2], min);      }            if(isValid(n, m, j1+1, j2)){       min = Math.min(min, dp[i-1][j1+1][j2]+verticaledge[j1][j2]);      }            if(isValid(n, m, j1, j2-1)){       min = Math.min(min, dp[i-1][j1][j2-1]+horizontaledge[j1][j2-1]);      }            if(isValid(n, m, j1, j2+1)){       min = Math.min(min, dp[i-1][j1][j2+1]+horizontaledge[j1][j2]);      }      dp[i][j1][j2] = min;     }    }   }   for(int i=0;i<n;i++){    for(int j=0;j<m;j++){     sb.append(dp[k][i][j]*2).append(" ");    }    sb.append("\n");   }   System.out.println(sb);   sc.close();  }  static class Soumit {   final private int BUFFER_SIZE = 1 << 18;   final private DataInputStream din;   final private byte[] buffer;   private PrintWriter pw;   private int bufferPointer, bytesRead;   StringTokenizer st;   public Soumit() {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public Soumit(String file_name) throws IOException {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public void streamOutput(String file) throws IOException {    FileWriter fw = new FileWriter(file);    BufferedWriter bw = new BufferedWriter(fw);    pw = new PrintWriter(bw);   }   public void println(String a) {    pw.println(a);   }   public void print(String a) {    pw.print(a);   }   public String readLine() throws IOException {    byte[] buf = new byte[3000064];    int cnt = 0, c;    while ((c = read()) != -1) {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }   String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   public void sort(int[] arr) {    ArrayList<Integer> arlist = new ArrayList<>();    for (int i : arr)     arlist.add(i);    Collections.sort(arlist);    for (int i = 0; i < arr.length; i++)     arr[i] = arlist.get(i);   }   public void sort(long[] arr) {    ArrayList<Long> arlist = new ArrayList<>();    for (long i : arr)     arlist.add(i);    Collections.sort(arlist);    for (int i = 0; i < arr.length; i++)     arr[i] = arlist.get(i);   }   public int[] nextIntArray(int n) throws IOException {    int[] arr = new int[n];    for (int i = 0; i < n; i++) {     arr[i] = nextInt();    }    return arr;   }   public long[] nextLongArray(int n) throws IOException {    long[] arr = new long[n];    for (int i = 0; i < n; i++) {     arr[i] = nextLong();    }    return arr;   }   public double[] nextDoubleArray(int n) throws IOException {    double[] arr = new double[n];    for (int i = 0; i < n; i++) {     arr[i] = nextDouble();    }    return arr;   }   public int nextInt() throws IOException {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public long nextLong() throws IOException {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public double nextDouble() throws IOException {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (c == '.') {     while ((c = read()) >= '0' && c <= '9') {      ret += (c - '0') / (div *= 10);     }    }    if (neg)     return -ret;    return ret;   }   private void fillBuffer() throws IOException {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }   private byte read() throws IOException {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }   public void close() throws IOException {       if (din != null) din.close();    if (pw != null) pw.close();   }  } }
2	public class Main {  long k;  private void solve() throws IOException {  long n = nl();  k = nl();   if (n == 1) {   prln(0);   return;  }   if (n <= k) {   prln(1);   return;  }   long l = 1, r = k - 1;  long mid = (l + r + 1) / 2;  long old = -1;   while (old != mid) {   old = mid;    if (take(mid) >= n)    r = mid;   if (take(mid) < n)    l = mid;    mid = (l + r + 1) / 2;  }   if (mid >= k || mid <= 0) {   prln(-1);   return;  }   if (take(mid) == n) {   prln(mid);   return;  }   if (mid == k - 1)   prln(-1);  else   if (take(mid) < n)    prln(mid + 1);   else    prln(mid);  }  long take(long t) {  return k * t - t * (t - 1) / 2 - (t - 1);  }  public static void main(String[] args) {  new Main().run();  }  public void run() {  try {   if (isFileIO) {    pw = new PrintWriter(new File("output.out"));    br = new BufferedReader(new FileReader("input.in"));   } else {    pw = new PrintWriter(System.out);    br = new BufferedReader(new InputStreamReader(System.in));   }   solve();   pw.close();   br.close();  } catch (IOException e) {   System.err.println("IO Error");  }  }  private int[] nia(int n) throws IOException {  int arr[] = new int[n];  for (int i = 0; i < n; ++i)   arr[i] = Integer.parseInt(nextToken());  return arr;  }  private int[] niam1(int n) throws IOException {  int arr[] = new int[n];  for (int i = 0; i < n; ++i)   arr[i] = Integer.parseInt(nextToken()) - 1;  return arr;  }  private long[] nla(int n) throws IOException {  long arr[] = new long[n];  for (int i = 0; i < n; ++i)   arr[i] = Long.parseLong(nextToken());  return arr;  }  private void pr(Object o) {  pw.print(o);  }  private void prln(Object o) {  pw.println(o);  }  private void prln() {  pw.println();  }  int ni() throws IOException {  return Integer.parseInt(nextToken());  }  long nl() throws IOException {  return Long.parseLong(nextToken());  }  double nd() throws IOException {  return Double.parseDouble(nextToken());  }  private String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {   tokenizer = new StringTokenizer(br.readLine());  }   return tokenizer.nextToken();  }                                                            private BufferedReader br;  private StringTokenizer tokenizer;  private PrintWriter pw;  private final boolean isFileIO = false; }
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 {   @Override   public void run() {    InputStream inputStream = System.in;    OutputStream outputStream = System.out;    FastInput in = new FastInput(inputStream);    FastOutput out = new FastOutput(outputStream);    FElongatedMatrix solver = new FElongatedMatrix();    solver.solve(1, in, out);    out.close();   }  }  static class FElongatedMatrix {   public void solve(int testNumber, FastInput in, FastOutput out) {    int n = in.readInt();    int m = in.readInt();    int[][] mat = new int[n][m];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      mat[i][j] = in.readInt();     }    }    int[][] minDist = new int[n][n];    SequenceUtils.deepFill(minDist, (int) 1e9);    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      for (int k = 0; k < m; k++) {       minDist[i][j] = Math.min(minDist[i][j], Math.abs(mat[i][k] - mat[j][k]));      }     }    }    int[][] minDistBetweenHeadAndTail = new int[n][n];    SequenceUtils.deepFill(minDistBetweenHeadAndTail, (int) 1e9);    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      for (int k = 1; k < m; k++) {       minDistBetweenHeadAndTail[i][j] = Math.min(minDistBetweenHeadAndTail[i][j], Math.abs(mat[i][k] - mat[j][k - 1]));      }     }    }    Log2 log2 = new Log2();    BitOperator bo = new BitOperator();    int[][][] dp = new int[1 << n][n][n];    for (int i = 1; i < (1 << n); i++) {     if (i == Integer.lowestOneBit(i)) {      dp[i][log2.floorLog(i)][log2.floorLog(i)] = (int) 1e9;      continue;     }     for (int j = 0; j < n; j++) {      for (int k = 0; k < n; k++) {       if (bo.bitAt(i, j) == 0) {        continue;       }       for (int t = 0; t < n; t++) {        dp[i][j][k] = Math.max(dp[i][j][k],          Math.min(dp[bo.setBit(i, j, false)][t][k],            minDist[j][t]));       }      }     }    }    int ans = 0;    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      ans = Math.max(ans, Math.min(dp[(1 << n) - 1][i][j], minDistBetweenHeadAndTail[j][i]));     }    }    out.println(ans);   }  }  static class SequenceUtils {   public static void deepFill(Object array, int val) {    if (!array.getClass().isArray()) {     throw new IllegalArgumentException();    }    if (array instanceof int[]) {     int[] intArray = (int[]) array;     Arrays.fill(intArray, val);    } else {     Object[] objArray = (Object[]) array;     for (Object obj : objArray) {      deepFill(obj, val);     }    }   }  }  static class Log2 {   public int floorLog(int x) {    return 31 - Integer.numberOfLeadingZeros(x);   }  }  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 BitOperator {   public int bitAt(int x, int i) {    return (x >> i) & 1;   }   public int setBit(int x, int i, boolean v) {    if (v) {     x |= 1 << i;    } else {     x &= ~(1 << i);    }    return x;   }  }  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();   }  } }
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; }  private static long gcd(long l, long i) {  if (l == 0 || i == 0) {  return 1;  }  if (l % i == 0) {  return i;  }  return gcd(i, l % i); } }
2	public class CFContest {  public static void main(String[] args) throws Exception {   boolean local = System.getProperty("ONLINE_JUDGE") == 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() {    solve();   }   public void solve() {    int n = io.readInt();    int k = io.readInt();    int l = 0;    int r = n;    while (l < r) {     int m = (l + r + 1) >> 1;     if (when(n, m) < k) {      r = m - 1;     } else {      l = m;     }    }    io.cache.append(l);   }   public long when(int n, int t) {    long put = n - t;    return (put + 1) * put / 2 - t;   }  }  public static class FastIO {   public final StringBuilder cache = new StringBuilder();   private final InputStream is;   private final OutputStream os;   private final Charset charset;   private StringBuilder defaultStringBuf = new StringBuilder(1 << 8);   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 long readLong() {    int sign = 1;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+' ? 1 : -1;     next = read();    }    long 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 double readDouble() {    boolean sign = true;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+';     next = read();    }    long val = 0;    while (next >= '0' && next <= '9') {     val = val * 10 + next - '0';     next = read();    }    if (next != '.') {     return sign ? val : -val;    }    next = read();    long radix = 1;    long point = 0;    while (next >= '0' && next <= '9') {     point = point * 10 + next - '0';     radix = radix * 10;     next = read();    }    double result = val + (double) point / radix;    return sign ? result : -result;   }   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 readLine(char[] data, int offset) {    int originalOffset = offset;    while (next != -1 && next != '\n') {     data[offset++] = (char) next;     next = read();    }    return offset - originalOffset;   }   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 char readChar() {    skipBlank();    char c = (char) next;    next = read();    return c;   }   public void flush() {    try {     os.write(cache.toString().getBytes(charset));     os.flush();     cache.setLength(0);    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public boolean hasMore() {    skipBlank();    return next != -1;   }  }  public static class Debug {   private boolean allowDebug;   public Debug(boolean allowDebug) {    this.allowDebug = allowDebug;   }   public void assertTrue(boolean flag) {    if (!allowDebug) {     return;    }    if (!flag) {     fail();    }   }   public void fail() {    throw new RuntimeException();   }   public void assertFalse(boolean flag) {    if (!allowDebug) {     return;    }    if (flag) {     fail();    }   }   private void outputName(String name) {    System.out.print(name + " = ");   }   public void debug(String name, int x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, long x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, double x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, int[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, long[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, double[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, Object x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, Object... x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.deepToString(x));   }  } }
5	public class Main implements Runnable {  private BufferedReader in;  private PrintWriter out;  private StringTokenizer st;   private void eat(String line)  {   st = new StringTokenizer(line);  }   private String next() throws IOException  {   while(!st.hasMoreTokens()) {    String line = in.readLine();    if(line == null)     return null;    eat(line);   }   return st.nextToken();  }   private int nextInt() throws IOException  {   return Integer.parseInt(next());  }   public void run()  {   try {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(new OutputStreamWriter(System.out));    eat("");       go();       out.close();   } catch(Exception e) {    e.printStackTrace();    System.exit(-1);   }  }   public static void main(String[] args)  {   new Thread(new Main()).start();  }   public void go() throws IOException  {   int n = nextInt(), t = nextInt();   int[] x = new int[n], a = new int[n];   for(int i = 0; i < n; ++i) {    x[i] = nextInt();    a[i] = nextInt();   }   out.println(new Algo().solve(n, t, x, a));  } } final class Algo {  public int solve(int n, int t, final int[] x, final int[] a)  {   Integer[] order = new Integer[n];   for(int i = 0; i < n; ++i)    order[i] = i;   Arrays.sort(order, new Comparator<Integer>() {    public int compare(Integer a, Integer b)    {     return x[a] - x[b];    }   });   int result = 2;   for(int i = 0; i + 1 < n; ++i) {    int u = order[i], v = order[i + 1];    int dist = 2 * (x[v] - x[u]) - (a[v] + a[u]);    if(dist > 2 * t)     result += 2;    else if(dist == 2 * t)     ++result;   }   return result;  } }
0	public class LuckyNumbers {  public static void main(String[] args)throws IOException  {   BufferedReader scan=new BufferedReader(new InputStreamReader(System.in));   short num=Short.parseShort(scan.readLine());   if(funcion(num))   {    System.out.println("YES");   }   else    System.out.println("NO");  }  public static boolean funcion(short num)  {   LinkedList<Short>queue=new LinkedList<Short>();   queue.offer((short) 4);   queue.offer((short) 44);   queue.offer((short) 444);   queue.offer((short) 47);   queue.offer((short) 477);   queue.offer((short) 7);   queue.offer((short) 77);   queue.offer((short) 777);   queue.offer((short) 74);   queue.offer((short) 744);   while(queue.peek()!=null)   {    if(num%queue.poll()==0)    {     return true;    }   }   return false;  } }
1	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 int[] dr = {-1, 0, 1, 0, -1, 1, 1, -1};  public static int[] dc = {0, 1, 0, -1, 1, 1, -1, -1};  public static void main(String[] args) throws Exception{   int N = Integer.parseInt(br.readLine());   char[] A = br.readLine().toCharArray();   HashSet<Character> cndD = new HashSet<Character>();   for(int i = 0; i < N; i++){    cndD.add(A[i]);   }   int cnt = cndD.size();   int a = 0;   int b = 0;   int ans = (1 << 30);   HashMap<Character, Integer> d = new HashMap<Character, Integer>();   while(b < N){    if(d.containsKey(A[b])){     if(A[a] == A[b]){      a++;      while(d.get(A[a]) > 1){       d.put(A[a], d.get(A[a])-1);       a++;      }     } else{      d.put(A[b], d.get(A[b])+1);     }    } else{     d.put(A[b], 1);    }    if(d.size() == cnt){     ans = Math.min(b-a+1, ans);    }    b++;   }   pw.print(ans + "\n");   pw.close();   br.close();  } } class Pair implements Comparable<Pair>{  public int a, b;  Pair(int a, int b){   this.a = a;   this.b = b;  }  @Override  public int compareTo(Pair P){   if(P.b != this.b){    return b - P.b;   } else if(P.a == this.a){    return a - P.a;   } else{    return 0;   }  }  public String toString(){   return a + " " + b;  } }
1	public class A6 { public static void main(String[] args) {  Scanner in = new Scanner(System.in);   int n = in.nextInt();  int d = in.nextInt();  int ans=2;   int[] a = new int[n];   for(int i=0;i<n;i++)  a[i] = in.nextInt();   for(int i=1;i<n;i++)  {  if(a[i]-a[i-1]>2*d)  {   ans += 2;  }  else if(a[i]-a[i-1]==2*d)   ans += 1;  }   System.out.println(ans); } }
2	public class ModifyLongest {  InputStream is;  PrintWriter out;  String INPUT = "";    boolean codechef=true;  void solve()  {     long mod=1000000007;   long x=nl(),k=nl();   if(x==0)   {    System.out.println(0);    return;   }   long val=calc((pow(2,k,mod)*(x%mod))%mod);   val-=calc(((pow(2,k,mod)*(x%mod))%mod-(pow(2,k,mod)-1)-1+mod)%mod);      val=(val+mod)%mod;   val=(val*inv(pow(2,k,mod),mod))%mod;   System.out.println(val);  }  static long calc(long a)  {   long b=(a*(a+1))%1000000007;   return b;  }    long PollardRho(long n)  {           if (n==1) return n;      if (n % 2 == 0) return 2;   Random r=new Random();     long x = (r.nextLong()%(n-2))+2;   long y = x;      long c = (r.nextLong()%(n-1))+1;      long d = 1;     while (d==1)   {       x = (pow(x, 2, n) + c + n)%n;        y = (pow(y, 2, n) + c + n)%n;    y = (pow(y, 2, n) + c + n)%n;        d = gcd(Math.abs(x-y), n);        if (d==n) return PollardRho(n);   }   return d;  }  static HashMap<Long,HashSet<Long>> globalSet;    static long fnc(int a,int b)  {   long val=Math.min(a,b)*1000000007;   val+=Math.max(a,b);   return val;  }   static long fnc2(long a,long b)  {   long val=a*1000000007;   val+=b;   return val;  }    static class Pair  {   int a,b;   public Pair(int a,int b)   {    this.a=a;    this.b=b;   }  }   static int bit[];   static void add(int x,int d,int n)  {   for(int i=x;i<=n;i+=i&-i)bit[i]+=d;  }   static int query(int x)  {   int ret=0;   for(int i=x;i>0;i-=i&-i)    ret+=bit[i];   return ret;  }   static long lcm(int a,int b)  {   long val=a;   val*=b;   return (val/gcd(a,b));  }   static long gcd(long a,long b)  {   if(a==0)return b;   return gcd(b%a,a);  }   static long pow(long a, long b, long p)  {   long ans = 1, base = a;   while (b!=0)   {    if ((b & 1)!=0)    {     ans *= base;     ans%= p;    }    base *= base;    base%= p;    b >>= 1;   }   return ans;  }   static long inv(long x,long p)  {   return pow(x, (int)p - 2, p);  }    void run() throws Exception  {   if(codechef)oj=true;   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 ModifyLongest().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 double nd() { return Double.parseDouble(ns()); }  private char nc() { return (char)skip(); }   private String ns()  {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b))){     sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }   private char[] ns(int n)  {   char[] buf = new char[n];   int b = skip(), p = 0;   while(p < n && !(isSpaceChar(b))){    buf[p++] = (char)b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }   private char[][] nm(int n, int m)  {   char[][] map = new char[n][];   for(int i = 0;i < n;i++)map[i] = ns(m);   return map;  }   private int[] na(int n)  {   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = ni();   return a;  }   private int ni()  {   int num = 0, b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }    while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }   private long nl()  {   long num = 0;   int b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }    while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }   private boolean oj = System.getProperty("ONLINE_JUDGE") != null;  private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
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;  } }
5	public class Main {  public static void main(String[] args) throws Exception {     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int iTotTerm, i, j, iSml = 0, iPos = 0;   iTotTerm = Integer.parseInt(br.readLine());   String seq[];   seq = br.readLine().split(" ");   int iSeq[] = new int[iTotTerm];   for (i = 0; i < iTotTerm; i++) {    iSeq[i] = Integer.parseInt(seq[i]);   }   for (i = 0; i < iTotTerm; i++) {    iSml = iSeq[i];    iPos = i;    for (j = i; j < iTotTerm; j++) {     if (iSeq[j] < iSml) {      iSml = iSeq[j];      iPos = j;     }    }    iSeq[iPos] = iSeq[i];    iSeq[i] = iSml;    if (i != 0 && iSeq[i - 1] != iSeq[i]) {     break;    }   }   if (iSml != iSeq[0]) {    System.out.print(iSml);   } else {    System.out.print("NO");   }  } }
3	public class Main {  static LinkedList<Integer> adj[]; static ArrayList<Integer> adj1[]; static int[] color,visited1; static boolean b[],visited[],possible; static int level[]; static Map<Integer,HashSet<Integer>> s; static int totalnodes,colored; static int count[]; static long sum[]; static int nodes; static double ans=0; static long[] as=new long[10001]; static long c1=0,c2=0; static int[] a,d,k; static int max=100000000; static long MOD = (long)1e9 + 7,sm=0,m=Long.MIN_VALUE; static boolean[] prime=new boolean[1000005]; static int[] levl;  static int[] eat;  static int price[];  static int size[],res[],par[];  static int result=0;   public static void main(String[] args) throws IOException {  in=new InputReader(System.in);  w=new PrintWriter(System.out);  int n=ni();  int[] a=na(n);  int ans=0;  for(int i=0;i<n;i++)  {   for(int j=i+1;j<n;j++)   {   if(a[j]<a[i])    ans++;   }  }  int m=ni();  ans=ans%2;  while(m-->0)  {   int l=ni(),r=ni();   int range=r-l+1;   range=range*(range-1)/2;   range=range%2;   ans=(ans+range)%2;   if(ans==1)   w.println("odd");   else   w.println("even");  }   w.close();  }    public static long nCrModp(long n, long r, long p) {    long[] C=new long[(int)r+1];      C[0] = 1;     for (long i = 1; i <= n; i++)  {      for (long j = Math.min(i, r); j > 0; j--)          C[(int)j] = (C[(int)j] + C[(int)(j-1)])%p;  }  return C[(int)r]; } public static long nCr(long n, long r) {  long x=1;  for(long i=n;i>=n-r+1;i--)  x=((x)*(i));  for(long i=r;i>=1;i--)  x=((x)/(i));   return x%MOD; } public static long nCrModpDP(long n, long r, long p) {   long[] C=new long[(int)r+1];    C[0] = 1;      for (long i = 1; i <= n; i++)  {   for (int j = (int)Math.min(i, r); j > 0; j--)    C[j] = (C[j] + C[j-1])%p;  }  return C[(int)r]; }  public static long nCrModpLucas(long n,long r, long p) {    if (r==0)   return 1;    long ni = n%p, ri = r%p;   return (nCrModpLucas(n/p,r/p, p) * nCrModpDP(ni,ri, p)) % p;  }   public static void buildgraph(int n){   adj=new LinkedList[n+1];   visited=new boolean[n+1];   levl=new int[n+1];   par=new int[n+1];   for(int i=0;i<=n;i++){    adj[i]=new LinkedList<Integer>();      }   } public static int getSum(long BITree[], int index) {  int sum = 0;    while (index > 0)  {   sum += BITree[index];   index -= index & (-index);  }  return sum; }  public static long[] updateBIT(long BITree[], int n, int index, int val) {  while (index <= n)  {   BITree[index] += val;   index += index & (-index);  }  return BITree; }    public static boolean isPrime(int n) {    if (n <= 1) return false;  if (n <= 3) return true;        if (n%2 == 0 || n%3 == 0)   return false;    for (int i=5; i*i<=n; i=i+6)   if (n%i == 0 || n%(i+2) == 0)    return false;    return true; }    public static String ns() {  return in.nextLine(); } public static int ni() {  return in.nextInt(); } public static long nl() {  return in.nextLong(); } public static int[] na(int n) {  a=new int[n];  for(int i=0;i<n;i++)  a[i]=ni();  return a; } public static void sieveOfEratosthenes()  {   int n=prime.length;   for(int i=0;i<n;i++)    prime[i] = true;       for(int p = 2; p*p <=n; p++)   {    if(prime[p] == true)    {     for(int i = p*2; i <n; i += p)      prime[i] = false;    }   }  }  public static boolean printDivisors(long n)  {  long ans=0;   for (int i=1; i<=Math.sqrt(n); i++)   {    if (n%i==0)    {     if (n/i == i)      ans++;     else     {     ans=ans+2;     }    }    if(ans>3)    break;   }   if(ans==3)   return true;   else   return false;  }  public static void dfs(int i) {  visited[i]=true;  for(int j:adj[i])  {  if(!visited[j])   {   dfs(j);   nodes++;   }  }   } public static String rev(String s) {  StringBuilder sb=new StringBuilder(s);  sb.reverse();  return sb.toString(); } static long lcm(long a, long b) {  return a * (b / gcd(a, b)); } static long gcd(long a, long b) {  while (b > 0)  {   long temp = b;   b = a % b;    a = temp;  }  return a; } static InputReader in; static PrintWriter w; 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 String readString() { int c = snext(); while (isSpaceChar(c))  {  c = snext(); } StringBuilder res = new StringBuilder(); do {  res.appendCodePoint(c);  c = snext(); } while (!isSpaceChar(c)); return res.toString(); }  public String nextLine() { int c = snext(); while (isSpaceChar(c))  c = snext(); StringBuilder res = new StringBuilder(); do {  res.appendCodePoint(c);  c = snext(); } while (!isEndOfLine(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; }  private boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || 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);   OutputWriter out = new OutputWriter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   long MOD = (long) 1e9 + 7;   long[][] dp;   int[] a;   public void solve(int testNumber, InputReader in, OutputWriter out) {    int N = in.nextInt();    a = new int[N];    dp = new long[N][N];    int i;    for (i = 0; i < N; i++) {     char c = in.nextChar();     if (c == 'f') {      a[i] = 1;     }    }    out.printLine(iterative());     }   public long iterative() {    int i, j, N = a.length, lastLevel = 0;    dp[0][0] = 1;    for (i = 1; i < N; i++) {     if (a[i - 1] == 1) {      lastLevel++;      for (j = 1; j <= lastLevel; j++) {       dp[i][j] = dp[i - 1][j - 1];      }     } else {      dp[i][N - 1] = dp[i - 1][N - 1];      for (j = N - 2; j >= 0; j--) {       dp[i][j] = (dp[i][j + 1] + dp[i - 1][j]) % MOD;      }     }    }    long ans = 0;    for (i = 0; i < N; i++) {     ans += dp[N - 1][i];    }    return ans % MOD;   }  }  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());   }   public char nextChar() {    return next().charAt(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 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 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()); } long nl() { return Long.parseLong(in.next()); } double nd() { return Double.parseDouble(in.next()); } boolean oj = System.getProperty("ONLINE_JUDGE") != null; void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader sc = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   Task solver = new Task();   solver.solve(1, sc, out);   out.close();  }  static class Task {   public void solve(int testNumber, InputReader sc, PrintWriter out) {    int n=sc.nextInt();    int[] a=new int[n];    boolean[] jud=new boolean[101];       for(int i=0;i<n;i++)    a[i]=sc.nextInt();    Arrays.sort(a);    int ans=0;    for(int i=0;i<n;i++) {    if(jud[a[i]])     continue;    ans++;    for(int j=a[i];j<=100;j+=a[i])     jud[j]=true;    }    out.println(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());   }   public long nextLong() {    return Long.parseLong(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); } }
1	public class Answer17A{  public static void main(String[] args){ try{  BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));  String[] tmp=reader.readLine().split(" ");  int n=Integer.parseInt(tmp[0]);  int k=Integer.parseInt(tmp[1]);  boolean[] m=getPrime(n);  ArrayList<Integer> prime=new ArrayList<Integer>();  for(int i=0;i<m.length;i++){  if(m[i])prime.add(i);  }  int sum=0;  for(int i=2;i<=n;i++){  if(m[i]){   for(int j=0;j<prime.size()-1;j++){  if(i==prime.get(j)+prime.get(j+1)+1){   sum++;   break;  }   }  }  }  if(sum>=k){  System.out.println("YES");  }else{  System.out.println("NO");  } }catch(IOException e){  e.printStackTrace(); }  }  public static boolean[] getPrime(int N){ boolean[] memo=new boolean[N+1]; Arrays.fill(memo,true); memo[0]=false; memo[1]=false; for(int i=2;i*i<=N;i++){  if(memo[i]){  for(int j=i*i;j<=N;j+=i){   memo[j]=false;  }  } } return memo;  } }
1	public class Main {  public static void main(String[] args)  {   InputReader in = new InputReader(System.in);   OutputWriter out = new OutputWriter(System.out);   int n = in.nextInt();   int d = in.nextInt();   int[]a = new int[n];   int ans=2;    for (int i =0;i<n;i++)   {    a[i] = in.nextInt();    }   for (int i =0;i<n-1;i++)   {     if (a[i+1]-a[i]==2*d)     ans++;    if (a[i+1]-a[i]>2*d)     ans+=2;   }   out.printLine(ans);   out.flush();  } } class pair implements Comparable {  int key;  int value;  public pair(Object key, Object value) {   this.key = (int)key;   this.value=(int)value;  }  @Override  public int compareTo(Object o) {   pair temp =(pair)o;   return key-temp.key;  } } class Graph {   int n;  ArrayList<Integer>[] adjList;  public Graph(int n) {   this.n = n;   adjList = new ArrayList[n];   for (int i = 0; i < n; i++)    adjList[i] = new ArrayList<>();  } }  class InputReader {  private final InputStream stream;  private final byte[] buf = new byte[8192];  private int curChar, snumChars;  public InputReader(InputStream stream) {   this.stream = stream;  }  public int read() {   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 = read();   while (isSpaceChar(c)) {    c = read();   }   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   int res = 0;   do {    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 {    res *= 10;    res += c - '0';    c = read();   } while (!isSpaceChar(c));   return res * sgn;  }  public int[] nextIntArray(int n) {   int a[] = new int[n];   for (int i = 0; i < n; i++) {    a[i] = nextInt();   }   return a;  }  public String readString() {   int c = read();   while (isSpaceChar(c)) {    c = read();   }   StringBuilder res = new StringBuilder();   do {    res.appendCodePoint(c);    c = read();   } while (!isSpaceChar(c));   return res.toString();  }  public String nextLine() {   int c = read();   while (isSpaceChar(c))    c = read();   StringBuilder res = new StringBuilder();   do {    res.appendCodePoint(c);    c = read();   } while (!isEndOfLine(c));   return res.toString();  }  public 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;  } } 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();  } }
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);  } } }
5	public class Main{  public static void main(String[] args){   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int a = in.nextInt();   int b = in.nextInt();     int[] h = new int[3000];     for(int i = 0; i<n; i++)    h[i] = in.nextInt();     int l = 0, r = 1000000000, m = 0;   int ansl = 0, ansr = 0;     while(l<=r){    m = (l+r)/2;       int ca=0;       for(int i = 0;i<n;i++)     if (h[i]>m) ca++;       if (ca == a) ansl=m;    if (ca <= a) r=m-1; else l=m+1;   }   l = 0; r = 1000000000;   while(l<=r){    m = (l+r)/2;       int ca=0;       for(int i = 0;i<n;i++)     if (h[i]>m) ca++;       if (ca == a) ansr=m;    if (ca < a) r=m-1; else l=m+1;   }   if (ansl == 0 || ansr==0) System.out.print(0); else   System.out.print(ansr-ansl+1);  } }
5	public class Main {  public static void main(String[] args) throws Exception {   MyScanner scan = new MyScanner();   out = new PrintWriter(new BufferedOutputStream(System.out));   int n = scan.nextInt();   int[] vals = new int[n];   for (int i = 0; i < n; i++) {    vals[i] = scan.nextInt();   }   for (int i = 0; i < n; i++) {    if (solve(i, vals)) {     out.print('A');    } else {     out.print('B');    }   }   out.close();  }  static HashMap<Integer, Boolean> dpResult = new HashMap<>();  private static boolean solve(int pos, int[] vals) {   if (dpResult.containsKey(pos)) return dpResult.get(pos);   int val = vals[pos];   boolean hasLose = false;   for (int i = pos; i < vals.length; i += val) {    if (i == pos) continue;    if (vals[i] <= vals[pos]) continue;    if (hasLose) break;    if (!solve(i, vals)) {     hasLose = true;    }   }   for (int i = pos; i >= 0; i -= val) {    if (i == pos) continue;    if (vals[i] <= vals[pos]) continue;    if (hasLose) break;    if (!solve(i, vals)) {     hasLose = true;    }   }   dpResult.put(pos, hasLose);   return hasLose;  }    public static PrintWriter out;    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());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  }   }
4	public class Main {  public static int n;  public static int m;  public static int k;  public static int[][] right;  public static int[][] down;  public static int[][][] dp;  public static void recur(int i, int j, int depth)  {   if(dp[i][j][depth]!=-1)    return;   int min=Integer.MAX_VALUE;     if(j>0)   {    recur(i, j-1, depth-1);    min=Math.min(min, dp[i][j-1][depth-1] + right[i][j-1]);   }     if(j<m-1)   {    recur(i, j+1, depth-1);    min=Math.min(min, dp[i][j+1][depth-1] + right[i][j]);   }     if(i>0)   {    recur(i-1, j, depth-1);    min=Math.min(min, dp[i-1][j][depth-1] + down[i-1][j]);   }     if(i<n-1)   {    recur(i+1, j, depth-1);    min=Math.min(min, dp[i+1][j][depth-1] + down[i][j]);   }   dp[i][j][depth]=min;  }  public static void main (String[] args) throws java.lang.Exception  {     Scanner sc=new Scanner(System.in);   n=sc.nextInt();   m=sc.nextInt();   k=sc.nextInt();   right=new int[n][m-1];   down=new int[n-1][m];   for(int i=0;i<n;i++)    for(int j=0;j<m-1;j++)     right[i][j]=sc.nextInt();   for(int i=0;i<n-1;i++)    for(int j=0;j<m;j++)     down[i][j]=sc.nextInt();   if(k%2==1) {    for(int i=0;i<n;++i) {     for (int j = 0; j < m; j++)      System.out.print(-1 + " ");     System.out.println();    }   }   else   {    k/=2;    dp=new int[n][m][k+1];    for(int i=0;i<n;++i)     for(int j=0;j<m;j++)      for(int z=1;z<=k;z++)       dp[i][j][z]=-1;    for(int i=0;i<n;++i)     for(int j=0;j<m;j++)      recur(i,j,k);    for(int i=0;i<n;++i) {     for (int j = 0; j < m; j++)      System.out.print((dp[i][j][k] * 2) + " ");     System.out.println();    }   }  } }
0	public class ex5 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String S [] = new String[3];  int m=0,s=0,p=0; int temp=0;  for (int i = 0; i < S.length; i++) {  S[i]=scan.next();  if(S[i].indexOf('m')!=-1) m++;  if(S[i].indexOf('s')!=-1) s++;  if(S[i].indexOf('p')!=-1) p++; }   int n1 = Integer.parseInt(S[0].substring(0,1)); int n2 = Integer.parseInt(S[1].substring(0,1)); int n3 = Integer.parseInt(S[2].substring(0,1));     int d3 = Math.abs(n1-n2);  int d4 = Math.abs(n1-n3);  int d5 = Math.abs(n2-n3);    if(m==3||s==3||p==3) {    if(d3==1&d5==1&d4==2||d3==1&d4==1&d5==2||d5==1&d4==1&d3==2)  System.out.println(0);  else   if(d3==0&d4==0) System.out.println(0);  else   if(d3<d5&d3<d4) {   if(d3==1||d3==2||d3==0) System.out.println(1);    else     System.out.println(2);   }  else if (d5<d4&d5<d3){   if(d5==1||d5==2||d5==0) System.out.println(1);   else     System.out.println(2);  }  else if(d4<d5&d4<d3) {   if(d4==1||d4==2||d4==0) System.out.println(1);   else     System.out.println(2);  }  else if(d3==2&d5==2||d4==2&d5==2||d3==2&d4==2||d3==1&d5==1||d4==1&d5==1||d3==2&d4==1)   System.out.println(1);  else System.out.println(2);              }  if(m==2||s==2||p==2) {      char c1 = S[0].charAt(1);  char c2 = S[1].charAt(1);  char c3 = S[2].charAt(1);     if(c1==c2) {  if(n1==n2) System.out.println(1);  else if(d3==1||d3==2) System.out.println(1);  else System.out.println(2);  }  if(c1==c3) {  if(n1==n3) System.out.println(1);  else if(d4==1||d4==2) System.out.println(1);  else System.out.println(2);  }  if(c2==c3) {  if(n2==n3) System.out.println(1);  else if(d5==1||d5==2) System.out.println(1);  else System.out.println(2);  } }  if(m==1&s==1&p==1) System.out.println(2);    } }
0	public class A { public static final boolean DEBUG = false; Scanner sc;  public void debug(Object o) {  if (DEBUG) {  int ln = Thread.currentThread().getStackTrace()[2].getLineNumber();  String fn = Thread.currentThread().getStackTrace()[2].getFileName();  System.out.println("(" + fn + ":" + ln+ "): " + o);  } }  public void pln(Object o) {  System.out.println(o); }   public void run() {  sc = new Scanner(System.in);   long a = sc.nextLong();  long b = sc.nextLong();  long nr = 0;  if (a < b) {  long aux = a;  a = b;  b = aux;  }  while (a != 0 && b != 0) {  nr += a / b;  long c = a % b;  a = b;  b = c;  }   pln(nr);  return;   } public static void main(String[] args) {  A t = new A();  t.run(); } }
0	public class Subtraction {  static long c=0;  public static void main(String[] args) throws IOException {   BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));   int n=Integer.parseInt(reader.readLine());   while (n-->0){    String l=reader.readLine();    String[] a=l.split(" ");    long A=Long.parseLong(a[0]);    long B=Long.parseLong(a[1]);    c=0;    gcd(A,B);    System.out.println(c);   }  }  private static void gcd(long a, long b) {   if (b==0)    return ;   c=c+a/b;   gcd(b,a%b);  } }
6	public class Main { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  while ( sc.hasNextInt() ) {  int n = sc.nextInt();  long m = sc.nextInt();  boolean edge[][] = new boolean[n][n];  long dp[][] = new long[1<<n][n];  for ( long i = 1 ; i<=m ; ++i ) {   int u = sc.nextInt();    int v = sc.nextInt();   -- u;   -- v;   edge[u][v] = edge[v][u] = true;  }  for ( int i = 0 ; i<n ; ++i ) {   dp[1<<i][i] = 1;  }  long res = 0;  for ( int i = 1 ; i<(1<<n) ; ++i ) {   int first = cal(i);   for ( int j = first ; j<n ; ++j ) {   if ( dp[i][j]==0 ) {    continue;   }   for ( int k = first ; k<n ; ++k ) {    if ( j==k || !edge[j][k] ) {    continue;    }    if ( k==first && judge(i) ) {    res += dp[i][j];    }    if ( (i&(1<<k))==0 ) {    dp[i|(1<<k)][k] += dp[i][j];    }   }   }  }  System.out.println(res/2);   } } public static int cal( int x ) {  int ord = 0;  while ( true ) {  if ( (x&(1<<ord))!=0 ) {   break;  }  ++ ord;  }  return ord; } public static boolean judge( int x ) {  int cnt = 0;  while ( x>=1 ) {  if ( (x&1)==1 ) {   ++ cnt;  }  x >>= 1;  }  return cnt >= 3; } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   int MOD = (int) 1e9 + 7;   long power(long a, long k) {    long res = 1;    while (k > 0) {     if ((k & 1) != 0) {      res = res * a % MOD;     }     a = a * a % MOD;     k /= 2;    }    return res;   }   public void solve(int testNumber, InputReader in, OutputWriter out) {    long x = in.nextLong(), k = in.nextLong();    if (x == 0) {     out.println(0);     return;    }    long res = ((power(2, k + 1) % MOD) * (x % MOD)) % MOD;    long temp = power(2, k);    res = res - temp + 1;    while (res < 0) res += MOD;    out.println(res);   }  }  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);   }   public void println(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 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 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 Lucky {   public static void main(String[] args) {   Scanner in = new Scanner(System.in);  int n = in.nextInt();  if(n%4==0 || n%7==0 || n%47==0 || n%74==0 || n%474==0 || n%447==0 || n%774==0 || n%747==0 || n%477==0 || n%744==0)System.out.println("YES");  else System.out.println("NO"); } }
3	public class CF1141F1 {  static FastReader s;  static PrintWriter out;  static String INPUT = "7\n" +    "4 1 2 2 1 5 3\n";  public static void main(String[] args) {   long time = System.currentTimeMillis();   boolean oj = System.getProperty("ONLINE_JUDGE") != null;   out = new PrintWriter(System.out);   s = new FastReader(oj);   int n = s.nextInt();   int[] arr = s.nextIntArray(n);   int[] sum = new int[n];   sum[0] = arr[0];   for (int i = 1; i < n; i++) {    sum[i] = sum[i - 1] + arr[i];   }    HashMap<Integer, ArrayList<pair>> map = new HashMap<>();   for (int i = 0; i < n; i++) {    for (int j = i; j < n; j++) {     if(i == 0) {      ArrayList<pair> list = map.getOrDefault(sum[j], new ArrayList<>());      list.add(new pair(i, j));      map.put(sum[j], list);     } else {      ArrayList<pair> list = map.getOrDefault(sum[j] - sum[i - 1], new ArrayList<>());      list.add(new pair(i, j));      map.put(sum[j] - sum[i - 1], list);     }    }   }   ArrayList<Integer> keys = new ArrayList<>(map.keySet());   ArrayList<pair> ans = null;   for (int curr : keys) {    ArrayList<pair> list = map.get(curr);    Collections.sort(list);    ArrayList<pair> smallAns = new ArrayList<>();    smallAns.add(list.get(0));    for (int k = 1; k < list.size(); k++) {     if(list.get(k).start > smallAns.get(smallAns.size() - 1).finish) {      smallAns.add(list.get(k));     }    }    if(ans == null) {     ans = smallAns;    } else {     if(ans.size() < smallAns.size()) {      ans = smallAns;     }    }   }      StringBuilder ans1 = new StringBuilder();   ans1.append(ans.size() + "\n");   for (pair p : ans) {    ans1.append((p.start + 1) + " " + (p.finish + 1));    ans1.append("\n");   }   out.println(ans1);   if (!oj) {    System.out.println(Arrays.deepToString(new Object[]{System.currentTimeMillis() - time + " ms"}));   }   out.flush();  }  private static class pair implements Comparable<pair>{   int start;   int finish;   public pair(int start, int finish) {    this.start = start;    this.finish = finish;   }    @Override   public int compareTo(pair o) {    return Integer.compare(this.finish, o.finish);   }   @Override   public String toString() {    return this.start + " " + this.finish;   }  }  private static class Matrix {   static long[][] I;   static long mod = 1000000007;   public static long[][] exp(long[][] M, long n) {    if (n <= 0) {     I = new long[M.length][M.length];     for (int i = 0; i < M.length; i++) {      I[i][i] = 1L;     }     return I;    }    if (n == 1) return M;    long[][] res = exp(M, n / 2);    res = mult(res, res);    if (n % 2 == 0) return res;    return mult(res, M);   }   public static long[][] mult(long[][] p, long[][] q) {    long[][] r = new long[p.length][q[0].length];    for (int i = 0; i < p.length; i++)     for (int j = 0; j < q[0].length; j++)      for (int k = 0; k < q.length; k++) {       r[i][j] += p[i][k] * q[k][j];       r[i][j] %= mod;      }    return r;   }  }  private static class Maths {   static ArrayList<Long> printDivisors(long n) {       ArrayList<Long> list = new ArrayList<>();    for (long i = 1; i <= Math.sqrt(n); i++) {     if (n % i == 0) {      if (n / i == i) {       list.add(i);      } else {       list.add(i);       list.add(n / i);      }     }    }    return list;   }      private static long gcd(long a, long b) {    if (b == 0) {     return a;    }    return gcd(b, a % b);   }       static long[] extendedEuclidean(long p, long q) {    if (q == 0)     return new long[]{p, 1, 0};    long[] vals = extendedEuclidean(q, p % q);    long d = vals[0];    long a = vals[2];    long b = vals[1] - (p / q) * vals[2];    return new long[]{d, a, b};   }      static long power(long x, long y, long p) {    long res = 1;    x = x % p;    while (y > 0) {     if ((y & 1) == 1)      res = (res * x) % p;     y = y >> 1;     x = (x * x) % p;    }    return res;   }             static long inv(long a, long m) {    long m0 = m, t, q;    long 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 long findMinX(long num[], long rem[], long k) {    int prod = 1;    for (int i = 0; i < k; i++)     prod *= num[i];    int result = 0;    for (int i = 0; i < k; i++) {     long pp = prod / num[i];     result += rem[i] * inv(pp, num[i]) * pp;    }    return result % prod;   }  }  private static class BS {     private static int binarySearch(int[] arr, int ele) {    int low = 0;    int high = arr.length - 1;    while (low <= high) {     int mid = (low + high) / 2;     if (arr[mid] == ele) {      return mid;     } else if (ele < arr[mid]) {      high = mid - 1;     } else {      low = mid + 1;     }    }    return -1;   }      private static int binarySearchFirstOccurence(int[] arr, int ele) {    int low = 0;    int high = arr.length - 1;    int ans = -1;    while (low <= high) {     int mid = (low + high) / 2;     if (arr[mid] == ele) {      ans = mid;      high = mid - 1;     } else if (ele < arr[mid]) {      high = mid - 1;     } else {      low = mid + 1;     }    }    return ans;   }      private static int binarySearchLastOccurence(int[] arr, int ele) {    int low = 0;    int high = arr.length - 1;    int ans = -1;    while (low <= high) {     int mid = (low + high) / 2;     if (arr[mid] == ele) {      ans = mid;      low = mid + 1;     } else if (ele < arr[mid]) {      high = mid - 1;     } else {      low = mid + 1;     }    }    return ans;   }  }  private static class arrays {     static void merge(int arr[], int l, int m, int r) {    int n1 = m - l + 1;    int n2 = r - m;    int L[] = new int[n1];    int R[] = new int[n2];    for (int i = 0; i < n1; ++i)     L[i] = arr[l + i];    for (int j = 0; j < n2; ++j)     R[j] = arr[m + 1 + j];    int i = 0, j = 0;    int k = l;    while (i < n1 && j < n2) {     if (L[i] <= R[j]) {      arr[k] = L[i];      i++;     } else {      arr[k] = R[j];      j++;     }     k++;    }    while (i < n1) {     arr[k] = L[i];     i++;     k++;    }    while (j < n2) {     arr[k] = R[j];     j++;     k++;    }   }   static void sort(int arr[], int l, int r) {    if (l < r) {     int m = (l + r) / 2;     sort(arr, l, m);     sort(arr, m + 1, r);     merge(arr, l, m, r);    }   }   static void sort(int[] arr) {    sort(arr, 0, arr.length - 1);   }  }  private static class UnionFindDisjointSet {   int[] parent;   int[] size;   int n;   int size1;   public UnionFindDisjointSet(int n) {    this.n = n;    this.parent = new int[n];    this.size = new int[n];    for (int i = 0; i < n; i++) {     parent[i] = i;    }    for (int i = 0; i < n; i++) {     size[i] = 1;    }    this.size1 = n;   }   private int numDisjointSets() {    System.out.println(size1);    return size1;   }   private boolean find(int a, int b) {    int rootA = root(a);    int rootB = root(b);    if (rootA == rootB) {     return true;    }    return false;   }   private int root(int b) {    if (parent[b] != b) {     return parent[b] = root(parent[b]);    }    return b;   }   private void union(int a, int b) {    int rootA = root(a);    int rootB = root(b);    if (rootA == rootB) {     return;    }    if (size[rootA] < size[rootB]) {     parent[rootA] = parent[rootB];     size[rootB] += size[rootA];    } else {     parent[rootB] = parent[rootA];     size[rootA] += size[rootB];    }    size1--;    System.out.println(Arrays.toString(parent));   }  }  private static class SegTree {   int[] st;   int[] arr;   public SegTree(int[] arr) {    this.arr = arr;    int size = (int) Math.ceil(Math.log(arr.length) / Math.log(2));    st = new int[(int) ((2 * Math.pow(2, size)) - 1)];    buildSegmentTree(1, 0, arr.length - 1);   }      private void buildSegmentTree(int index, int L, int R) {    if (L == R) {     st[index] = arr[L];     return;    }    buildSegmentTree(index * 2, L, (L + R) / 2);    buildSegmentTree(index * 2 + 1, (L + R) / 2 + 1, R);    st[index] = Math.min(st[index * 2], st[index * 2 + 1]);   }      private int Query(int queL, int queR) {    return Query1(1, 0, arr.length - 1, queL, queR);   }        private int Query1(int index, int segL, int segR, int queL, int queR) {    if (queL > segR || queR < segL) {     return -1;    }    if (queL <= segL && queR >= segR) {     return st[index];    }    int ans1 = Query1(index * 2, segL, (segL + segR) / 2, queL, queR);    int ans2 = Query1(index * 2 + 1, (segL + segR) / 2 + 1, segR, queL, queR);    if (ans1 == -1) {     return ans2;    }    if (ans2 == -1) {     return ans1;    }    return Math.min(ans1, ans2);   }   private void update(int idx, int val) {    update1(1, 0, arr.length - 1, idx, val);   }   private void update1(int node, int queL, int queR, int idx, int val) {           if (queL == queR) {         arr[idx] += val;     st[node] += val;    } else {     int mid = (queL + queR) / 2;     if (queL <= idx && idx <= mid) {           update1(2 * node, queL, mid, idx, val);     } else {           update1(2 * node + 1, mid + 1, queR, idx, val);     }         st[node] = Math.min(st[2 * node], st[2 * node + 1]);    }   }  }  private static class FastReader {   InputStream is;   public FastReader(boolean onlineJudge) {    is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());   }   byte[] inbuf = new byte[1024];   public int lenbuf = 0, ptrbuf = 0;   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++];   }   boolean isSpaceChar(int c) {    return !(c >= 33 && c <= 126);   }   int skip() {    int b;    while ((b = readByte()) != -1 && isSpaceChar(b))     ;    return b;   }   double nextDouble() {    return Double.parseDouble(next());   }   char nextChar() {    return (char) skip();   }   String next() {    int b = skip();    StringBuilder sb = new StringBuilder();    while (!(isSpaceChar(b))) {     sb.appendCodePoint(b);     b = readByte();    }    return sb.toString();   }   String nextLine() {    int b = skip();    StringBuilder sb = new StringBuilder();    while ((!isSpaceChar(b) || b == ' ')) {     sb.appendCodePoint(b);     b = readByte();    }    return sb.toString();   }   char[] next(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);   }   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 * 10 + (b - '0');     } else {      return minus ? -num : num;     }     b = readByte();    }   }   long nextLong() {    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();    }   }   char[][] nextMatrix(int n, int m) {    char[][] map = new char[n][];    for (int i = 0; i < n; i++)     map[i] = next(m);    return map;   }   int[] nextIntArray(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }   long[] nextLongArray(int n) {    long[] a = new long[n];    for (int i = 0; i < n; i++)     a[i] = nextLong();    return a;   }   int[][] next2DInt(int n, int m) {    int[][] arr = new int[n][];    for (int i = 0; i < n; i++) {     arr[i] = nextIntArray(m);    }    return arr;   }   long[][] next2DLong(int n, int m) {    long[][] arr = new long[n][];    for (int i = 0; i < n; i++) {     arr[i] = nextLongArray(m);    }    return arr;   }   int[] shuffle(int[] arr) {    Random r = new Random();    for (int i = 1, j; i < arr.length; i++) {     j = r.nextInt(i);     arr[i] = arr[i] ^ arr[j];     arr[j] = arr[i] ^ arr[j];     arr[i] = arr[i] ^ arr[j];    }    return arr;   }   int[] uniq(int[] arr) {    Arrays.sort(arr);    int[] rv = new int[arr.length];    int pos = 0;    rv[pos++] = arr[0];    for (int i = 1; i < arr.length; i++) {     if (arr[i] != arr[i - 1]) {      rv[pos++] = arr[i];     }    }    return Arrays.copyOf(rv, pos);   }  } }
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};  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); }  void debug(Object... os){  System.err.println(Arrays.deepToString(os)); }  public static void main(String[] args){  Locale.setDefault(Locale.US);  new P111C().run(); } }
3	public class C {  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[]dp1 = new int[n+1];  int[]dp2 = new int[n+1];  dp1[1] = 1;  int mod = (int) (1e9+7);  char[]instruction = new char[n+1];  instruction[0] = 's';  int[]sum = new int[n+1];  for (int i = 1; i <= n; i++) {  instruction[i] = next().charAt(0);  for (int j = 1; j <= i; j++) {   sum[j] = sum[j-1] + dp1[j];   if (sum[j] >= mod)   sum[j] -= mod;  }  for (int j = 1; j <= i; j++) {   if (instruction[i-1]=='f')   dp2[j] = dp1[j-1];   else {   dp2[j] = sum[i] - sum[j-1];   if (dp2[j] < 0)    dp2[j] += mod;   }  }  for (int j = 1; j <= i; j++) {   dp1[j] = dp2[j];  }  }  int ans = 0;  for (int i = 1; i <= n; i++) {  ans += dp1[i];  if (ans >= mod)   ans -= mod;  }  System.out.println(ans);  pw.close(); } private static int nextInt() throws IOException {  return Integer.parseInt(next()); } private static long nextLong() throws IOException {  return Long.parseLong(next()); } private static double nextDouble() throws IOException {  return Double.parseDouble(next()); } private static String next() throws IOException {  while (st==null || !st.hasMoreTokens())  st = new StringTokenizer(br.readLine());  return st.nextToken(); } }
1	@SuppressWarnings("unchecked") public class P701A {  Map<Character, Integer> cc = new HashMap(72);  void add(char c) {  cc.put(c, cc.getOrDefault(c, 0) + 1); }  void rem(char c) {  Integer cnt = cc.get(c) - 1;  if (cnt != 0) {  cc.put(c, cnt);  } else {  cc.remove(c);  } }  public void run() throws Exception {  int n = nextInt();  char [] s = next().toCharArray();  BitSet bs = new BitSet();  for (char c : s) {  bs.set(c);  }  int t = bs.cardinality();   int m = Integer.MAX_VALUE;  for (int i = 0, j = 0; i < n; i++) {  while ((j < n) && (cc.size() < t)) {   add(s[j]);   j++;  }    if (cc.size() == t) {   m = Math.min(m, j - i);  }    rem(s[i]);  }   println(m); }  public static void main(String... args) throws Exception {  br = new BufferedReader(new InputStreamReader(System.in));  pw = new PrintWriter(new BufferedOutputStream(System.out));  new P701A().run();  br.close();  pw.close();  System.err.println("\n[Time : " + (System.currentTimeMillis() - startTime) + " ms]"); }  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()); } char nextChar() throws IOException { return (char) (br.read()); } String next() throws IOException { return nextToken(); } String nextLine() throws IOException { return br.readLine(); } int [] readInt(int size) throws IOException {  int [] array = new int [size];  for (int i = 0; i < size; i++) { array[i] = nextInt(); }  return array; } long [] readLong(int size) throws IOException {  long [] array = new long [size];  for (int i = 0; i < size; i++) { array[i] = nextLong(); }  return array; } double [] readDouble(int size) throws IOException {  double [] array = new double [size];  for (int i = 0; i < size; i++) { array[i] = nextDouble(); }  return array; } String [] readLines(int size) throws IOException {  String [] array = new String [size];  for (int i = 0; i < size; i++) { array[i] = nextLine(); }  return array; }  int gcd(int a, int b) {  return ((b > 0) ? gcd(b, a % b) : a); } }
6	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();   int m = sc.nextInt();   int[][] a = new int[n][m];   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     a[i][j] = sc.nextInt();   val = new int[n][n];   for (int i = 0; i < n; i++)    Arrays.fill(val[i], Integer.MAX_VALUE);   for (int i = 0; i < n; i++)    for (int j = i; j < n; j++) {     for (int k = 0; k < m; k++)      val[i][j] = val[j][i] = Math.min(val[i][j], Math.abs(a[i][k] - a[j][k]));    }   val2 = new int[n][n];   for (int i = 0; i < n; i++)    Arrays.fill(val2[i], Integer.MAX_VALUE);   for (int i = 0; i < n; i++)    for (int j = 0; j < n; j++) {     for (int k = 0; k < m - 1; k++)      val2[i][j] = Math.min(val2[i][j], Math.abs(a[i][k] - a[j][k + 1]));    }   mem = new Long[n][n][1 << n];   long ans = 0;   for (int i = 0; i < n; i++) {    ans = Math.max(ans, dp(i, i, 1 << i));   }   if (n == 1)    pw.println(val2[0][0]);   else    pw.println(ans);    pw.flush();   pw.close();  }  static int n;  static int[][] val, val2;  static Long[][][] mem;  static long dp(int st, int lst, int msk) {   int bits = Integer.bitCount(msk);   if (mem[st][lst][msk] != null)    return mem[st][lst][msk];   long ans = 0;   for (int i = 0; i < n; i++)    if ((msk & (1 << i)) == 0) {     int newMsk = (msk | (1 << i));     if (bits < n - 1)      ans = Math.max(ans, Math.min(val[lst][i], dp(st, i, newMsk)));     else      ans = Math.max(ans, Math.min(val[lst][i], val2[i][st]));    }   return mem[st][lst][msk] = ans;  }  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());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
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);   TaskF solver = new TaskF();   solver.solve(1, in, out);   out.close();  }  static class TaskF {   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] = in.nextInt();    }    Map<Integer, List<Range>> rgs = new HashMap<Integer, List<Range>>();    for (int i = 0; i < n; i++) {     int s = 0;     for (int j = i; j < n; j++) {      s += a[j];      if (rgs.get(s) == null) {       rgs.put(s, new ArrayList<Range>());      }      rgs.get(s).add(new Range(i, j));     }    }    Iterator it = rgs.entrySet().iterator();    List<Range> ans = new ArrayList<Range>();    while (it.hasNext()) {     Map.Entry pair = (Map.Entry) it.next();     int sum = (int) pair.getKey();     Object[] intermediate = ((List<Object[]>) pair.getValue()).toArray();     Range[] ranges = new Range[intermediate.length];     for (int i = 0; i < intermediate.length; i++) {      ranges[i] = (Range) intermediate[i];     }     Arrays.sort(ranges);     List<Range> cand = new ArrayList<Range>();     for (Range r : ranges) {      if (cand.size() == 0) {       cand.add(r);       continue;      }      if (cand.get(cand.size() - 1).j < r.i) {       cand.add(r);      } else {       if (cand.get(cand.size() - 1).j > r.j) {        cand.remove(cand.size() - 1);        cand.add(r);       }      }     }     if (cand.size() > ans.size()) {      ans = cand;     }    }    out.println(ans.size());    for (Range r : ans) {     out.println((r.i + 1) + " " + (r.j + 1));    }   }   public class Range implements Comparable {    public int i;    public int j;    public Range(int i, int j) {     this.i = i;     this.j = j;    }    public int compareTo(Object o) {     Range t = (Range) o;     if (this.i == t.i) {      if (this.j < t.j) return 1;      else return 0;     }     if (this.i < t.i) return 1;     return 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());   }  } }
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);   APaintTheNumbers solver = new APaintTheNumbers();   solver.solve(1, in, out);   out.close();  }  static class APaintTheNumbers {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.i();    int[] a = in.ia(n);    RadixSort.radixSort(a);    boolean[] flag = new boolean[n];    int count = 0;    for (int i = 0; i < n; i++) {     if (!flag[i]) {      ++count;      flag[i] = true;      for (int j = 0; j < n; j++) {       if (!flag[j] && a[j] % a[i] == 0) {        flag[j] = true;       }      }     }    }    out.printLine(count);   }  }  static class RadixSort {   public static int[] radixSort(int[] f) {    return radixSort(f, f.length);   }   public static int[] radixSort(int[] f, int n) {       int[] to = new int[n];    {     int[] b = new int[65537];     for (int i = 0; i < n; i++) b[1 + (int) (f[i] & 0xffff)]++;     for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];     for (int i = 0; i < n; i++) to[b[(int) (f[i] & 0xffff)]++] = f[i];     int[] d = f;     f = to;     to = d;    }    {     int[] b = new int[65537];     for (int i = 0; i < n; i++) b[1 + (int) (f[i] >>> 16 & 0xffff)]++;     for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];     for (int i = 0; i < n; i++) to[b[(int) (f[i] >>> 16 & 0xffff)]++] = f[i];     int[] d = f;     f = to;     to = d;    }    return f;   }  }  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 is;   private byte[] inbuf = new byte[1024];   private int lenbuf = 0;   private int ptrbuf = 0;   public InputReader(InputStream is) {    this.is = is;   }   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++];   }   public int[] ia(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++) a[i] = i();    return a;   }   public int i() {    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();    }   }  } }
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();   }  } }
3	public class A{     public static int mod = 1000000007;     public static void main(String args[]){    Scanner sc = new Scanner(System.in);    int n = sc.nextInt();    char s[] = new char[n];    for(int i = 0; i < n; i++)      s[i] = sc.next().charAt(0);    int dp[][] = new int[5001][5001];    int sum[][] = new int[5001][5001];    dp[0][0] = 1;    sum[0][0] = 1;    for(int i = 1; i < n; i++){      for(int j = n - 1; j >= 0; j--){        if(s[i-1] == 'f' && j > 0){          dp[i][j] = dp[i-1][j-1] % mod;        }else if(s[i-1] == 's'){          dp[i][j] = sum[i-1][j] % mod;        }        sum[i][j] = (sum[i][j+1] + dp[i][j]) % mod;      }    }    System.out.println(sum[n-1][0]);   } }
2	public class C extends PrintWriter {  final long mod = 1_000_000_007;  long pow(long n, long p) {   long r = 1;   while (p > 0) {    if (p % 2 == 1) {     r = (r * n) % mod;    }    n = (n * n) % mod;    p /= 2;   }   return r;  }  long solve(long n, long k) {   if (k == 0) {    return (2 * n) % mod;   }   if (n == 0) {    return 0;   }   long m = pow(2, k);   long a = 2;   a = (a * n) % mod;   a = (a * m) % mod;   long b = (m + mod - 1) % mod;   return ((a - b + mod) % mod);  }  void run() {   long n = nextLong();   long k = nextLong();   println(solve(n, k));  }  boolean skip() {   while (hasNext()) {    next();   }   return true;  }  int[][] nextMatrix(int n, int m) {   int[][] matrix = new int[n][m];   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     matrix[i][j] = nextInt();   return matrix;  }  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());  }  long nextLong() {   return Long.parseLong(next());  }  double nextDouble() {   return Double.parseDouble(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();  } }
1	public class B {  public static void main(String[] args) {   Scanner input = new Scanner (System.in);   Pattern rc_style = Pattern.compile("R[0-9]+C[0-9]+");   int n = input.nextInt();   while(n-- > 0) {    String str = input.next();    Matcher m = rc_style.matcher(str);    if (m.matches()) {     String nums[] = str.split("[RC]");     String row = nums[1];     String col = nums[2];     String buffer = "";     int col_num = Integer.valueOf(col);     while(col_num > 0) {      if (col_num % 26 > 0) {       buffer += (char)(col_num % 26 + 'A' - 1);       col_num /= 26;      } else {       buffer += 'Z';       col_num /= 26;       col_num--;      }     }     for (int i = buffer.length() - 1; i >= 0; --i) {      System.out.print(buffer.charAt(i));     }     System.out.println(row);    } else {     String col = str.split("[0-9]+")[0];     String row = str.split("[A-Z]+")[1];     int col_num = 0;     int shift = 1;     for (int i = col.length() - 1; i >= 0; --i){      col_num += (int)(col.charAt(i) - 'A' + 1) * shift;      shift *= 26;     }     System.out.println("R" + row + "C" + col_num);    }   }  } }
0	public class Subtractions {  public static void main(String[] args) {   Scanner scan = new Scanner(System.in);   int t = scan.nextInt();   while(t != 0) {    int f = scan.nextInt();    int s = scan.nextInt();    System.out.println(ops(f, s));    t--;   }  }  public static int ops(int f, int s) {   int ops = 0;   while((f > 0) && (s > 0)) {    if(f > s) {     ops += f/s;     f %= s;    } else {         ops += s/f;     s %= f;    }   }   return ops;  } }
1	public class Main {  public static void main(String[] args) {   Main iq = new Main();   Scanner sc = new Scanner(System.in);   int n;   n = sc.nextInt();   int[] naturalNumbers = new int[n];   for (int i = 0; i < naturalNumbers.length; i++) {    naturalNumbers[i] = sc.nextInt();   }   System.out.println(iq.diffInEvenness(n, naturalNumbers));    }   public int diffInEvenness(int n, int[] naturalNumbers) {     int even, odd, lastEvenIndex, lastOddIndex;   even = odd = lastEvenIndex = lastOddIndex = 0;   for (int i = 0; i < naturalNumbers.length; i++) {    if((naturalNumbers[i] % 2) == 0) {     even++;     lastEvenIndex = i + 1;    }    else {     odd++;     lastOddIndex = i + 1;    }   }   return (even > odd ? lastOddIndex : lastEvenIndex);   } }
3	public class D {  int N,M;  int[] a,l,r;  private void solve() {   N = nextInt();   a = new int[N];   for(int i = 0;i < N;i++) {    a[i] = nextInt();   }   M = nextInt();   l = new int[M];   r = new int[M];   for(int i = 0;i < M;i++) {    l[i] = nextInt();    r[i] = nextInt();   }   int count = 0;   for(int i = 0;i < N - 1;i++) {    for(int j = i + 1;j < N;j++) if (a[i] > a[j]) {     count++;    }   }   for(int i = 0;i < M;i++) {    count += (r[i] - l[i] + 1) * (r[i] - l[i]) / 2;    count %= 2;    out.println(count == 0 ? "even" : "odd");   }  }  public static void main(String[] args) {   out.flush();   new D().solve();   out.close();  }    private static final InputStream in = System.in;  private static final PrintWriter out = new PrintWriter(System.out);  private final byte[] buffer = new byte[2048];  private int p = 0;  private int buflen = 0;  private boolean hasNextByte() {   if (p < buflen)    return true;   p = 0;   try {    buflen = in.read(buffer);   } catch (IOException e) {    e.printStackTrace();   }   if (buflen <= 0)    return false;   return true;  }  public boolean hasNext() {   while (hasNextByte() && !isPrint(buffer[p])) {    p++;   }   return hasNextByte();  }  private boolean isPrint(int ch) {   if (ch >= '!' && ch <= '~')    return true;   return false;  }  private int nextByte() {   if (!hasNextByte())    return -1;   return buffer[p++];  }  public String next() {   if (!hasNext())    throw new NoSuchElementException();   StringBuilder sb = new StringBuilder();   int b = -1;   while (isPrint((b = nextByte()))) {    sb.appendCodePoint(b);   }   return sb.toString();  }  public int nextInt() {   return Integer.parseInt(next());  }  public long nextLong() {   return Long.parseLong(next());  }  public double nextDouble() {   return Double.parseDouble(next());  } }
0	public class Arbuz {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   if (n % 4 == 0 || n % 7 == 0 || n % 47 == 0 || n % 74 == 0 || n % 444 == 0 || n % 447 == 0 || n % 474 == 0 || n % 477 == 0) {    System.out.println("YES");   } else {    System.out.println("NO");   }  } }
4	public class Main { static int n, m, k; static int inf = (int) 1e9; static class Pair {  int x, y;  Pair(int a, int b) {  x = a; y = b;  } } static int[] dx = {1, -1, 0, 0}, dy = {0, 0, 1, -1}; static boolean valid(int x, int y) {  return x >= 0 && x < n && y >= 0 && y < m; } static int[][] bfs(int[] xs, int[] ys) {  int[][] dist = new int[n][m];  for(int i = 0; i < n; i++)  Arrays.fill(dist[i], inf);  Queue<Pair> q = new LinkedList<>();  for(int i = 0; i < k; i++) {  dist[xs[i]][ys[i]] = 0;  q.add(new Pair(xs[i], ys[i]));  }  while(!q.isEmpty()) {  Pair p = q.remove();  for(int d = 0; d < 4; d++) {   int nx = p.x + dx[d], ny = p.y + dy[d];   if(valid(nx, ny) && dist[nx][ny] == inf) {   dist[nx][ny] = dist[p.x][p.y] + 1;   q.add(new Pair(nx, ny));   }  }  }  return dist; }  public static void main(String[] args) throws IOException {  Scanner in = new Scanner();  int n = in.nextInt() ;  int m = in.nextInt();  int k = in.nextInt();  int x[] = new int[k] ;  int y[] = new int[k] ;  int trees [][] = new int [n][m] ;   for (int i = 0; i < n; i++)  for (int j = 0; j < m; j++)   trees[i][j]=Integer.MAX_VALUE ;  for (int i = 0; i < k; i++)  {  x[i]=in.nextInt()-1;   y[i]=in.nextInt()-1;  trees[x[i]][y[i]]=0 ;  }  int dis = Integer.MIN_VALUE ; ;  int xp=0; ;  int yp=0;  for (int i = 0; i < n; i++)  for (int j = 0; j < m; j++)   if(trees[i][j] != 0)   for (int j2 = 0; j2 < k; j2++)    trees[i][j]=Math.min(trees[i][j], Math.abs(i-x[j2])+Math.abs(j-y[j2]));  for (int i = 0; i <n; i++)  for (int j = 0; j < m; j++)   if(trees[i][j] > dis)   {   dis=trees[i][j];   xp=i+1;   yp=j+1;   }  PrintWriter out = new PrintWriter("output.txt");  out.printf("%d %d\n", xp ,yp);  out.close(); }  static class Scanner {  BufferedReader br;  StringTokenizer st;  Scanner() throws FileNotFoundException {  br = new BufferedReader(new FileReader("input.txt"));  }  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 Round1B {  public static void main(String[] args) throws Exception {  new Round1B().run(); }  private void run() throws Exception {  Scanner sc = new Scanner(System.in);  int tc = Integer.parseInt(sc.nextLine().trim());  while (tc > 0) {  String s = sc.nextLine().trim();  if (s.matches("R[0-9]+C[0-9]+")) {   Pattern p = Pattern.compile("R([0-9]+)C([0-9]+)");   Matcher m = p.matcher(s);   if (m.matches()) {   int rows = Integer.parseInt(m.group(1));   int cols = Integer.parseInt(m.group(2));   String col = "";   while (cols > 0) {    int mod = (cols - 1) % 26;    col = (char)('A' + mod) + col;    cols = (cols - 1) / 26;   }   System.out.println(col + rows);   } else {   throw new Exception();   }  } else {   Pattern p = Pattern.compile("([A-Z]+)([0-9]+)");   Matcher m = p.matcher(s);   if (m.matches()) {      int rows = Integer.parseInt(m.group(2));   int cols = 0;   int mul = 1;   for (int i = m.group(1).length() - 1; i >= 0; i--) {    cols += mul * (m.group(1).charAt(i) - 'A' + 1);    mul *= 26;   }   System.out.printf("R%dC%d\n", rows, cols);   }   else {   throw new Exception();   }  }   tc--;  }  sc.close(); } }
4	public class N718 { 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);      D();      out.close(); }  private static void A() throws IOException {  int t=ni();  while(t-->0) {   long l=nl();   if(l%2050!=0)ol(-1);   else {   long num=l/2050;   int cnt=0;   while(num>0) {    cnt+=num%10;    num/=10;   }   ol(cnt);      }  }    }  static void B() throws IOException {  int t=ni();  while(t-->0) {   int n=ni(),m=ni();   int[][]a=nmi(n,m);   PriorityQueue<int[]>pq=new PriorityQueue<int[]>((u,v)->u[0]-v[0]);   ArrayList<Integer>[]nums=new ArrayList[n];   for(int i=0;i<n;i++) {      for(int j=0;j<m;j++) {       pq.add(new int[] {a[i][j],i});   }   }   int[][]ans=new int[n][m];   for(int i=0;i<m;i++) {   int[]x=pq.poll();   ans[x[1]][i]=x[0];   }   int []indices=new int[n];   while(!pq.isEmpty()) {   int[]x=pq.poll();   int i=x[1];   while(ans[i][indices[i]]!=0) {    indices[i]++;   }   ans[i][indices[i]]=x[0];   }   for(int i=0;i<n;i++) {   for(int j=0;j<m;j++) {    out.print(ans[i][j]+" ");   }   ol("");   }  }  }   static void C() throws IOException{   int t=1;   while(t-->0) {   int n=ni();   a=nai(n);   int[][]ans=new int[n][n];   for(int i=0;i<n;i++)ans[i][i]=a[i];   for(int i=n-1;i>=0;i--) {    int j=i,k=i;    int cur=ans[i][i];    cur--;    while(cur>0) {    j++;    if(j>=n||ans[j][k]!=0) {     j--;     k--;    }    ans[j][k]=ans[i][i];    cur--;    }   }   for(int i=0;i<n;i++) {    for(int j=0;j<=i;j++) {    out.print(ans[i][j]+" ");    }    ol("");   }   }  }  private static 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 boolean isPrime(long n) {  if(n==2)return true;  if(n<2||n%2==0)return false;    for(long i=3L;i*i<n;i+=2l) {   long rem=(n%i);   if(rem==0)return false;  }  return true;  }  static void D() throws IOException {  int t=1;  while(t-->0) {   int n=ni(),m=ni(),k=ni();   int[][]ans=new int[n][m];   dist=new int[n][m][4];   for(int i=0;i<n;i++)for(int j=0;j>m;j++)   Arrays.fill(dist[i][j], Integer.MAX_VALUE);   int x;   for(int i=0;i<n;i++) {   for(int j=0;j<m-1;j++) {    dist[i][j][2]=(x=ni());    dist[i][j+1][3]=x;   }   }   for(int i=0;i<n-1;i++) {   for(int j=0;j<m;j++) {    dist[i][j][1]=(x=ni());    dist[i+1][j][0]=x;   }   }   int[][]nans=new int[n][m];   if(k%2==1) {   for(int i=0;i<n;i++)Arrays.fill(ans[i], -1);   }else {   for(int ii=0;ii<k/2;ii++) {   for(int i=0;i<n;i++) {       for(int j=0;j<m;j++) {    nans[i][j]=Integer.MAX_VALUE;    if(i>0)     nans[i][j]=Math.min(nans[i][j], ans[i-1][j]+2*dist[i-1][j][1]);    if(i<n-1)     nans[i][j]=Math.min(nans[i][j], ans[i+1][j]+2*dist[i+1][j][0]);    if(j>0)     nans[i][j]=Math.min(nans[i][j], ans[i][j-1]+2*dist[i][j-1][2]);    if(j<m-1)     nans[i][j]=Math.min(nans[i][j], ans[i][j+1]+2*dist[i][j+1][3]);    }   }   int[][]tmp=ans;   ans=nans;   nans=tmp;   }   }   for(int i=0;i<n;i++) {   for(int j=0;j<m;j++) {    out.print(ans[i][j]+" ");   }   ol("");   }  }  }  private static int bfs(int i, int j,int k) {  boolean [][]vis=new boolean[dist.length][dist[0].length];  Queue<int[]>q=new LinkedList<int[]>();  int mn=Integer.MAX_VALUE;  q.add(new int[] {i,j,0,0});  int[]dx=new int[] {-1,1,0,0};  int[]dy=new int[] {0,0,1,-1};  while(!q.isEmpty()) {   int []x=q.poll();   vis[x[0]][x[1]]=true;   int c=x[2];   if(c>k/2)continue;   if(c>0&&k%c==0&&(k/c)%2==0) {   mn=Math.min(mn,x[3]*k/c );   }   for(int a=0;a<4;a++) {   int nx=x[0]+dx[a];   int ny=x[1]+dy[a];   if(valid(nx,ny)&&!vis[nx][ny]) {    q.add(new int[] {nx,ny,c+1,x[3]+dist[x[0]][x[1]][a]});   }   }     }  return mn;  }  private static 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=ni();  while(t-->0) {      }   }  static void F() throws IOException {  int t=ni();  while(t-->0) {    } } static void CC() throws IOException {  for(int kk=2;kk<21;kk++) {  ol(kk+" -------");  int n=kk;  int k=n-2;  int msk=1<<k;  int[]a=new int[k];  for(int i=0;i<a.length;i++)a[i]=i+2;  int mx=1;  int ms=0;  for(int i=1;i<msk;i++) {  long prod=1;  int cnt=0;  for(int j=0;j<a.length;j++) {   if(((i>>j)&1)!=0) {   prod*=a[j];   cnt++;   }  }  if(cnt>=mx&&prod%n==1) {   mx=cnt;   ms=i;  }    }  ol(mx==1?mx:mx+1);  out.print(1+" ");  long pr=1;  for(int j=0;j<a.length;j++) {  if(((ms>>j)&1)!=0) {   out.print(a[j]+" ");   pr*=a[j];  }  }  ol("");  ol("Prod: "+pr);  ol(n+"*"+((pr-1)/n)+" + "+1);  } } static int ni() throws IOException {  return sc.nextInt(); } static double nd() throws IOException {  return sc.nextDouble(); } static long nl() throws IOException {  return sc.nextLong(); } static String ns() throws IOException {  return sc.next(); } 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 long[] nal(int n) throws IOException {  long[] a = new long[n];  for (int i = 0; i < n; i++)  a[i] = sc.nextLong();  return a; } static int[][] nmi(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]=sc.nextInt();  }  }  return a; }  static long[][] nml(int n,int m) throws IOException{  long[][]a=new long[n][m];  for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   a[i][j]=sc.nextLong();  }  }  return a; } static void o(String x) {  out.print(x); } static void ol(String x) {  out.println(x); } static void ol(int x) {  out.println(x); } static void disp1(int []a) {  for(int i=0;i<a.length;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 boolean hasNext() {return st.hasMoreTokens();}  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 String nextLine() throws IOException {return br.readLine();}    public boolean ready() throws IOException {return br.ready(); }   } }
0	public class KingEscape {  public static void main(String[] args) {   Reader read = new Reader();   int n = read.nextInt();   int a1 = read.nextInt();   int a2 = read.nextInt();   int b1 = read.nextInt();   int b2 = read.nextInt();   int c1 = read.nextInt();   int c2 = read.nextInt();   if (b1 > a1 && b2 > a2 && c1 > a1 && c2 > a2)    System.out.print("YES");   else if (b1 > a1 && b2 < a2 && c1 > a1 && c2 < a2)    System.out.print("YES");   else if (b1 < a1 && b2 > a2 && c1 < a1 && c2 > a2)    System.out.print("YES");   else if (b1 < a1 && b2 < a2 && c1 < a1 && c2 < a2)    System.out.print("YES");   else    System.out.print("NO");  }  private static class Reader {   private final BufferedReader reader;   private final String separator;   private String ln;   private String[] tokens;   private int ptr;   Reader(String separator, InputStream input) {    this.reader = new BufferedReader(new InputStreamReader(input));    this.separator = separator;    this.ptr = -1;   }   Reader(String separator) { this(separator, System.in); }   Reader() { this(" "); }   String nextStr(){    if (Objects.isNull(ln)) {     try {      ln = reader.readLine();     } catch (IOException e) {      System.out.println(e.getMessage());     }     if (Objects.nonNull(ln)) {      tokens = ln.split(separator);      ptr = 0;     } else {      throw new NoSuchElementException("no next element");     }    } else if (ptr == tokens.length) {     ln = null;     tokens = null;     ptr = -1;     return nextStr();    }    return tokens[ptr++];   }   int nextInt() { return Integer.parseInt(nextStr()); }   long nextLong() { return Long.parseLong(nextStr()); }   double nextDouble() { return Double.parseDouble(nextStr()); }  } }
5	public class P15A_CottageVillage {   public static void main(String[] args) {  Scanner scanner = new Scanner(System.in);  int n = scanner.nextInt();  int t = scanner.nextInt();  scanner.nextLine();  int[] x = new int[n];  int[] a = new int[n];  for (int i = 0; i < n; i++) {  x[i] = scanner.nextInt();  a[i] = scanner.nextInt();  scanner.nextLine();  }  scanner.close();  for (int i = 0; i < n - 1; i++) {  for (int j = i + 1; j < n; j++) {   if (x[i] > x[j]) {   swap(x, i, j);   swap(a, i, j);   }  }  }  int countPositions = 2;  for (int i = 1; i < n; i++) {  double left = x[i - 1] + a[i - 1] * 1.0 / 2;  double right = x[i] - a[i] * 1.0 / 2;  double length = right - left;   if (length == (double) t) {   countPositions++;  } else if (length > t) {   countPositions += 2;  }  }  System.out.println(countPositions); }  private static void swap(int[] numbers, int i, int j) {  int temp = numbers[i];  numbers[i] = numbers[j];  numbers[j] = temp; } }
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();   }  }  int numLength(long n) {   int l = 0;   while (n > 0) {    n /= 10;    l++;   }   return l;  }  <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;   }  }  <T> Integer[] sortSimultaneously(T[] key, Comparator<T> comparator,    Object[]... moreArrays) {   int n = key.length;   for (Object[] array : moreArrays) {    if (array.length != n) {     throw new RuntimeException("Arrays must have equals lengths");    }   }   Integer[] indices = new Integer[n];   for (int i = 0; i < n; i++) {    indices[i] = i;   }   Comparator<Integer> delegatingComparator = (a, b) -> {    return comparator.compare(key[a], key[b]);   };   Arrays.sort(indices, delegatingComparator);   reorder(indices, key);   for (Object[] array : moreArrays) {    reorder(indices, array);   }   return indices;  }  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;  }  long sumProdMod(int[] a, long b, long mod) {   long res = sumMod(a, mod);   return prodMod(res, b, mod);  }  long sumProdMod(long[] a, long b, long mod) {   long res = sumMod(a, mod);   return prodMod(res, b, mod);  }  long sumProdMod(int[] a, int[] b, long mod) {   if (a.length != b.length) {    throw new RuntimeException("Arrays must have equals lengths");   }   long res = 0;   for (int i = 0; i < a.length; i++) {    res = (res + prodMod(a[i], b[i], mod)) % mod;   }   return res;  }  long sumProdMod(long[] a, long[] b, long mod) {   if (a.length != b.length) {    throw new RuntimeException("Arrays must have equals lengths");   }   long res = 0;   for (int i = 0; i < a.length; i++) {    res = (res + prodMod(a[i], b[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 int[][] nextIntMap(int n, int m) {    int[][] map = new int[n][m];    for (int i = 0; i < n; i++) {     map[i] = nextIntArray(m);    }    return map;   }   public long[][] nextLongMap(int n, int m) {    long[][] map = new long[n][m];    for (int i = 0; i < n; i++) {     map[i] = nextLongArray(m);    }    return map;   }   public char[][] nextCharMap(int n) {    char[][] map = new char[n][];    for (int i = 0; i < n; i++) {     map[i] = next().toCharArray();    }    return map;   }   public void readColumns(Object[]... columns) {    int n = columns[0].length;    for (Object[] column : columns) {     if (column.length != n) {      throw new RuntimeException("Arrays must have equals lengths");     }    }    for (int i = 0; i < n; i++) {     for (Object[] column : columns) {      column[i] = read(column[i].getClass());     }    }   }   public <T> T read(Class<T> c) {    throw new UnsupportedOperationException("To be implemented");   }  } }
5	public class WCS {  public static class Vector implements Comparable <Vector> {  long x, y;  int position;  Vector first, second;  boolean toReverse;   public Vector(long xx, long yy, int p) {  x = xx;  y = yy;  position = p;  first = null;  second = null;  toReverse = false;  }   public Vector negate() {  Vector vv = new Vector(-x, -y, position);  vv.first = first;  vv.second = second;  vv.toReverse = !toReverse;  return vv;  }   public Vector add(Vector v) {  Vector sum = new Vector(this.x + v.x, this.y + v.y, position);  sum.first = this;  sum.second = v;  return sum;  }   public Vector subtract(Vector v) {  return this.add(v.negate());  }   public double euclideanNorm() {  return Math.sqrt(x * x + y * y);  }   @Override  public int compareTo(Vector v) {  double thisa = Math.atan2(this.y, this.x);  double va = Math.atan2(v.y, v.x);  if(thisa < 0)   thisa += 2 * Math.PI;  if(va < 0)   va += 2 * Math.PI;  if(thisa < va)   return -1;  if(thisa > va)   return 1;  return Integer.compare(this.position, v.position);  }   @Override  public String toString() {  return x + " " + y;  } }  public static void dfs(Vector curr, int[] ans) {  if(curr.first == null) {  ans[curr.position] = curr.toReverse ? -1 : 1;  return;  }  curr.first.toReverse ^= curr.toReverse;  curr.second.toReverse ^= curr.toReverse;  dfs(curr.first, ans);  dfs(curr.second, ans); }  public static boolean ok(Vector v1, Vector v2) {  return v1.add(v2).euclideanNorm() <= Math.max(v1.euclideanNorm(), v2.euclideanNorm()); }  public static void stop(long k) {  long time = System.currentTimeMillis();  while(System.currentTimeMillis() - time < k); }  public static void main(String[] args) throws IOException {  int n = in.nextInt();  TreeSet <Vector> vectors = new TreeSet <> ();  for(int i = 0; i < n; i ++) {  Vector v = new Vector(in.nextLong(), in.nextLong(), i);  vectors.add(v);  }  while(vectors.size() > 2) {        TreeSet <Vector> support = new TreeSet <> ();    while(vectors.size() > 0) {   Vector curr = vectors.pollFirst();   Vector next1 = vectors.higher(curr);   Vector next2 = vectors.lower(curr.negate());   Vector next3 = vectors.higher(curr.negate());   Vector next4 = vectors.lower(curr);          if(next1 != null) {   if(ok(curr, next1)) {    support.add(curr.add(next1));    vectors.remove(next1);    continue;   }   }   if(next1 != null) {   if(ok(curr, next1.negate())) {    support.add(curr.subtract(next1));    vectors.remove(next1);    continue;   }   }   if(next2 != null) {   if(ok(curr, next2)) {    support.add(curr.add(next2));    vectors.remove(next2);    continue;   }   }   if(next2 != null) {   if(ok(curr, next2.negate())) {    support.add(curr.subtract(next2));    vectors.remove(next2);    continue;   }   }   if(next3 != null) {   if(ok(curr, next3)) {    support.add(curr.add(next3));    vectors.remove(next3);    continue;   }   }   if(next3 != null) {   if(ok(curr, next3.negate())) {    support.add(curr.subtract(next3));    vectors.remove(next3);    continue;   }   }   if(next4 != null) {   if(ok(curr, next4)) {    support.add(curr.add(next4));    vectors.remove(next4);    continue;   }   }   if(next4 != null) {   if(ok(curr, next4.negate())) {    support.add(curr.subtract(next4));    vectors.remove(next4);    continue;   }   }     support.add(curr);  }    vectors = support;  }   if(vectors.size() == 2) {  Vector curr = vectors.pollFirst();  Vector next = vectors.pollFirst();  Vector add = curr.add(next);  Vector sub = curr.subtract(next);  if(sub.euclideanNorm() <= add.euclideanNorm())   vectors.add(sub);  else   vectors.add(add);  }      StringBuilder buffer = new StringBuilder();  int[] ans = new int[n];  dfs(vectors.pollFirst(), ans);  for(int i = 0; i < n; i ++)  buffer.append(ans[i] + " ");  System.out.println(buffer); }   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();   }    BigInteger nextBigInteger() {   return new BigInteger(in.next());   }     int nextInt() {    return Integer.parseInt(next());   }     char nextChar() {    return in.next().charAt(0);   }    long nextLong() {    return Long.parseLong(next());   }    double nextDouble() {    return Double.parseDouble(next());   }    String nextLine() {    String str = "";    try {     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }  }   static FastReader in = new FastReader();  static OutputStream out = new BufferedOutputStream(System.out);   public static byte[] toByte(Object o) {   return String.valueOf(o).getBytes();  }   public static void sop(Object o) {   System.out.print(o);  } }
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(); } }
5	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()); }  long nextLong() throws Exception {  return Long.parseLong(next()); }  double nextDouble() throws Exception {  return Double.parseDouble(next()); }  void solve() throws Exception {  int n = nextInt(), k = nextInt(), s = nextInt();  int a[] = new int[n];  for (int i = 0; i < n; i++)  a[i] = -nextInt();   Arrays.sort(a);  for(int i=0;i<n;i++)  {  if (s>=k)  {   out.println(i);   return;  }    s += -a[i];  s--;  }  if (s<k)  out.println(-1);  else  out.println(n); }  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(); }  }
0	public class ProblemD_05 {   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());  }   long readLong() throws IOException{   return Long.parseLong(readString());  }   double readDouble() throws IOException{   return Double.parseDouble(readString());  }   public static void main(String[] args){   new ProblemD_05().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{   double a = readDouble();   double v = readDouble();   double l = readDouble();   double d = readDouble();   double w = readDouble();   double t = 0;   double td = d > v * v / (2 * a)? v / a + (d - v * v / (2 * a)) / v: sqrt(2 *d / a);   if (w >= min(a * td, v)){    t += td;    w = min(a * td, v);   }else{    double v0 = sqrt(w * w / 2 + a * d);    if (v0 * v0 <= v * v){     t += (2 * v0 - w) / a;    }else{     t += (2 * v - w) / a;     double s2 = d - (2 * v * v - w * w) / (2 * a);     t += s2 / v;    }   }   double t1 = (sqrt(w * w + 2 * a * (l - d)) - w) / a;   if (t1 > (v - w) / a) t1 = (v - w) / a;   t += t1;   double s1 = w * t1 + a * t1 * t1 / 2;   double t2 = (l - d - s1) / v;   t += t2;   out.printf(Locale.US, "%.12f", t);  }   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 phi(long n){   int[] p = Sieve((int)ceil(sqrt(n)) + 2);   long phi = 1;   for (int i = 0; i < p.length; i++){    long x = 1;    while (n % p[i] == 0){     n /= p[i];     x *= p[i];    }    phi *= x - x/p[i];   }   if (n != 1) phi *= n - 1;   return phi;  }   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 public class PointD{     double x, y;     public PointD(double x, double y){    this.x = x;    this.y = y;   }  }   static double d(Point p1, Point p2){   return sqrt(d2(p1, p2));  }   static public double d(PointD p1, PointD p2){   return sqrt(d2(p1, p2));  }   static double d2(Point p1, Point p2){   return (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);  }   static public double d2(PointD p1, PointD p2){   return (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);  }   static boolean IsProbablyPrime(long n){   if (n == 1) return false;   if ((n & 1) == 0) return false;   for (int j = 3; j < sqrt(n) + 1; j += 2){    if (n % j == 0) return false;   }   return true;  }  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;  }   static int[][] Palindromes(String s){   char[] c = s.toCharArray();   int n = c.length;   int[][] d = new int[2][n];   int l = 0, r = -1;   for (int i = 0; i < n; i++){    int j = (i > r? 0: min(d[0][l+r-i+1], r-i+1)) + 1;    for (; i - j >= 0 && i + j - 1< n && c[i-j] == c[i+j-1]; j++);    d[0][i] = --j;    if (i + d[0][i] - 1 > r){     r = i + d[0][i] - 1;     l = i - d[0][i];    }   }   l = 0;   r = -1;   for (int i = 0; i < n; i++){    int j = (i > r? 0: min(d[1][l+r-i], r-i)) + 1;    for (; i - j >= 0 && i + j < n && c[i-j] == c[i+j]; j++);    d[1][i] = --j;    if (i + d[1][i] > r){     r = i + d[1][i];     l = i - d[1][i];    }   }   return d;  }   static public class Permutation {     int[] a;   int n;     public Permutation(int n){    this.n=n;    a=new int[n];    for (int i=0; i<n; i++){     a[i]=i;    }   }     public boolean nextPermutation(){    int i=n-1;    for (i=n-2; i>=0; i--){     if (a[i]<a[i+1]){      break;     }    }    if (i==-1){     return false;    }    int jMin=i+1;    for (int j=n-1; j>i; j--){     if (a[i]<a[j]&&a[j]<a[jMin]){      jMin=j;     }    }    swap(i, jMin);    for (int j=1; j<=(n-i)/2; j++){     swap(i+j, n-j);    }    return true;   }        public int get(int i){    return a[i];   }     void swap(int i, int j){    int r=a[i];    a[i]=a[j];    a[j]=r;   }  }   static public 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 divide(Fraction f){    Fraction fResult = new Fraction();    fResult.numerator = numerator * f.denominator;    fResult.denominator = denominator * f.numerator;    fResult.Cancellation();    return fResult;   }     @Override   public int compareTo(Fraction f){    long g = gcd(denominator, f.denominator);    long res = numerator * (f.denominator / g) - f.numerator * (denominator / g);    if (res < 0){     return -1;    }    if (res > 0){     return 1;    }    return 0;   }     public Fraction clone(){    Fraction fResult = new Fraction(numerator, denominator);    return fResult;   }     public Fraction floor(){    Fraction fResult = this.clone();    fResult.numerator = (fResult.numerator / fResult.denominator) * fResult.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);   }  }   static public class FenwickTree_1{      int n;   long[] t;     public FenwickTree_1(int n){    this.n = n;    t = new long[n];   }     public long sum(int xl, int xr){    return sum(xr) - sum(xl);   }     public long sum(int x){    long result = 0;    for (int i = x; i >= 0; i = (i & (i + 1)) - 1){     result += t[i];    }    return result;   }     public void update(int x, long delta){    for (int i = x; i < n; i = (i | (i + 1))){     t[i] += delta;    }   }  }   static public class FenwickTree_2{      int n, m;   long[][] t;     public FenwickTree_2(int n, int m){    this.n = n;    this.m = m;    t = new long[n][m];   }     public long sum(int xl, int yl, int xr, int yr){    return sum(xr, yr) - sum(xl - 1, yr) - sum(xr, yl - 1) + sum(xl - 1, yl - 1);   }     public long sum(int x, int y){    long result = 0;    for (int i = x; i >= 0; i = (i & (i + 1)) - 1){     for (int j = y; j >= 0; j = (j & (j + 1)) - 1){      result+=t[i][j];     }    }    return result;   }     public void update(int x, int y, long delta){    for (int i = x; i < n; i = (i | (i + 1))){     for (int j = y; j < m; j = (j | (j + 1))){      t[i][j] += delta;     }    }   }  }   static public class FenwickTree_3{      int n, m, l;   long[][][] t;     public FenwickTree_3(int n, int m, int l){    this.n = n;    this.m = m;    this.l = l;    t = new long[n][m][l];   }     public long sum(int xl, int yl, int zl, int xr, int yr, int zr){    return sum(xr, yr, zr) - sum(xl - 1, yr, zr)    + sum(xl - 1, yr, zl - 1) - sum(xr, yr, zl - 1)    - sum(xr, yl - 1, zr) + sum(xl - 1, yl - 1, zr)    - sum(xl - 1, yl - 1, zl - 1) + sum(xr, yl - 1, zl - 1);   }     public long sum(int x, int y, int z){    long result = 0;    for (int i = x; i >= 0; i = (i & (i + 1)) - 1){     for (int j = y; j >= 0; j = (j & (j + 1)) - 1){      for (int k = z; k >= 0; k = (k & (k + 1)) - 1){       result += t[i][j][k];      }     }    }    return result;   }     public void update(int x, int y, int z, long delta){    for (int i = x; i < n; i = (i | (i + 1))){     for (int j = y; j < n; j = (j | (j + 1))){      for (int k = z; k < n; k = (k | (k + 1))){       t[i][j][k] += delta;      }     }    }   }  } }
4	public class D {  static long[][][] dp;  static int[][] hor, ver;  static int n, m;  static int[][] dir = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};  public static boolean isValid (int row, int col) {   return row >= 0 && col >= 0 && row < n && col < m;  }  public static void minCost (int row, int col, int k) {   if (k == 0)    return;   if (k == 2) {    long min = Long.MAX_VALUE;    for (int i = 0; i < 4; i++) {     if (isValid(row + dir[i][0], col + dir[i][1])) {      if ((row + dir[i][0]) == row) {       if ((col + dir[i][1]) > col) {        min = Math.min(min, hor[row][col]);       } else {        min = Math.min(min, hor[row][col - 1]);       }      } else {       if ((row + dir[i][0]) > row) {        min = Math.min(min, ver[row][col]);       } else {        min = Math.min(min, ver[row - 1][col]);       }      }     }    }    dp[row][col][k] = 2 * min;    return;   }   if (dp[row][col][k] != Long.MAX_VALUE)    return;   long min = Long.MAX_VALUE;   for (int i = 0; i < 4; i++) {    if (isValid(row + dir[i][0], col + dir[i][1])) {     if (k >= 4) {      minCost(row + dir[i][0], col + dir[i][1], k - 2);      int edge = 0;      if ((row + dir[i][0]) == row) {       if ((col + dir[i][1]) > col) {        edge = hor[row][col];       } else {        edge = hor[row][col - 1];       }      } else {       if ((row + dir[i][0]) > row) {        edge = ver[row][col];       } else {        edge = ver[row - 1][col];       }      }      min = Math.min(min, 2 * edge + dp[row + dir[i][0]][col + dir[i][1]][k - 2]);     }    }   }   dp[row][col][k] = min;  }  public static void main(String[] args) {   Scanner input = new Scanner(System.in);   n = input.nextInt();   m = input.nextInt();   int k = input.nextInt();   hor = new int[n][m - 1];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m - 1; j++) {     hor[i][j] = input.nextInt();    }   }   ver = new int[n - 1][m];   for (int i = 0; i < n - 1; i++) {    for (int j = 0; j < m; j++) {     ver[i][j] = input.nextInt();    }   }   if (k % 2 != 0) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      System.out.print(-1 + " ");     }     System.out.println("");    }   } else {    dp = new long[n][m][k + 1];    for (int i = 0; i < n; i++)     for (int j = 0; j < m; j++)      for (int x = 0; x <= k; x++) {       dp[i][j][x] = Long.MAX_VALUE;      }    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      minCost(i, j, k);      System.out.print(dp[i][j][k] + " ");     }     System.out.println("");    }   }     input.close();  } }
6	public class Bag implements Runnable {  private void solve() throws IOException {   int xs = nextInt();   int ys = nextInt();   int n = nextInt();   int[] x = new int[n];   int[] y = new int[n];   for (int i = 0; i < n; ++i) {    x[i] = nextInt();    y[i] = nextInt();   }   final int[][] pair = new int[n][n];   for (int i = 0; i < n; ++i)    for (int j = i + 1; j < n; ++j)     pair[i][j] = (x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys) + (x[j] - xs) * (x[j] - xs) + (y[j] - ys) * (y[j] - ys) + (x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i]);   final int[] single = new int[n];   for (int i = 0; i < n; ++i) {    single[i] = 2 * ((x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys));   }   final int[] best = new int[1 << n];   final int[] prev = new int[1 << n];   for (int set = 1; set < (1 << n); ++set) {    int i;    for (i = 0; i < n; ++i)     if ((set & (1 << i)) != 0)      break;    int bestC = best[set ^ (1 << i)] + single[i];    int prevC = 1 << i;    int nextSet = set ^ (1 << i);    int unoI = 1 << i;    for (int j = i + 1, unoJ = 1 << (i + 1); j < n; ++j, unoJ <<= 1)     if ((set & unoJ) != 0) {      int cur = best[nextSet ^ unoJ] + pair[i][j];      if (cur < bestC) {       bestC = cur;       prevC = unoI | unoJ;      }     }    best[set] = bestC;    prev[set] = prevC;   }   writer.println(best[(1 << n) - 1]);   int now = (1 << n) - 1;   writer.print("0");   while (now > 0) {   int differents = prev[now];   for(int i = 0; i < n; i++)   if((differents & (1 << i)) != 0)   {    writer.print(" ");     writer.print(i + 1);     now ^= 1 << i;   }    writer.print(" ");    writer.print("0");   }   writer.println();  }   public static void main(String[] args) {   new Bag().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();  } }
5	public class Problem {  static int mod = (int) (1e9+7);  static InputReader in;  static PrintWriter out;  static int[] rt;  static int[] size;  static void initialize(int n){   rt = new int[n + 1];   size = new int[n + 1];   for(int i = 0; i < rt.length; i++){    rt[i] = i;    size[i] = 1;   }  }   static int root(int x){   while(rt[x] != x){    rt[x] = rt[rt[x]];    x = rt[x];   }   return x;  }   static long union(int x,int y){   int root_x = root(x);   int root_y = root(y);   if(root_x == root_y) return 0;   long val = size[root_x] *1l* size[root_y];   if(size[root_x]<size[root_y]){    rt[root_x] = rt[root_y];    size[root_y] += size[root_x];   }   else{    rt[root_y] = rt[root_x];    size[root_x] += size[root_y];      }     return val;  }   static void solve()  {   in = new InputReader(System.in);   out = new PrintWriter(System.out);        int t = 1;     while(t-- > 0){    int n = in.nextInt();    int[] arr = in.nextIntArray(n);    ArrayList<Pair> list = new ArrayList<>();       for(int i = 1; i < n; i++){     int u = in.nextInt() - 1;     int v = in.nextInt() - 1;     list.add(new Pair(u, v, Math.max(arr[u],arr[v])));    }    list.sort((p1,p2) -> Integer.compare(p1.i, p2.i));    initialize(n);    long s1 = 0;    for(int i = 0; i < list.size(); i++){     s1 += union(list.get(i).x, list.get(i).y) * list.get(i).i;    }    for(int i = 0; i < list.size(); i++){     Pair p = list.get(i);     p.i = Math.min(arr[p.x],arr[p.y]);    }    list.sort((p1,p2) -> -Integer.compare(p1.i, p2.i));    initialize(n);    long s2 = 0;    for(int i = 0; i < list.size(); i++){     s2 += union(list.get(i).x, list.get(i).y) * list.get(i).i;    }       out.println(s1 - s2);   }     out.close();  }   public static void main(String[] args)  {   new Thread(null ,new Runnable(){    public void run(){     try{      solve();     } catch(Exception e){      e.printStackTrace();     }    }   },"1",1<<26).start();    }  static class Pair implements Comparable<Pair>  {   int x,y;   int i;    Pair (int x,int y)   {     this.x = x;     this.y = y;   }   Pair (int x,int y, int i)   {     this.x = x;     this.y = y;     this.i = i;   }   public int compareTo(Pair o)   {    if(this.x != o.x)     return -Integer.compare(this.x, o.y);    return -Integer.compare(this.y,o.y);       }   public boolean equals(Object o)   {    if (o instanceof Pair)    {     Pair p = (Pair)o;     return p.x == x && p.y==y;    }    return false;   }   @Override   public String toString()   {    return x + " "+ y + " "+i;   }     }   static long add(long a,long b){   long x=(a+b);   while(x>=mod) x-=mod;   return x;  }  static long sub(long a,long b){   long x=(a-b);   while(x<0) x+=mod;   return x;  }   static long mul(long a,long b){   long x=(a*b);   while(x>=mod) x-=mod;   return x;  }   static String rev(String s){   StringBuilder sb=new StringBuilder(s);   sb.reverse();   return sb.toString();  }   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 long pow(long n,long p,long m)  {   long result = 1;   if(p==0){    return n;   }      while(p!=0)   {    if(p%2==1)     result *= n;    if(result >= m)     result %= m;    p >>=1;    n*=n;    if(n >= m)     n%=m;   }     return result;  }  static long pow(long n,long p)  {   long result = 1;   if(p==0)    return 1;   while(p!=0)   {    if(p%2==1)     result *= n;     p >>=1;    n*=n;    }   return result;  }  static void debug(Object... o)  {    System.out.println(Arrays.deepToString(o));  }  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 int[] nextIntArray(int n)   {     int a[] = new int[n];     for (int i = 0; i < n; i++)     {       a[i] = nextInt();     }     return a;   }   public long[] nextLongArray(int n)   {     long a[] = new long[n];     for (int i = 0; i < n; i++)     {       a[i] = nextLong();     }     return a;   }   public String readString()   {     int c = snext();     while (isSpaceChar(c))     {       c = snext();     }     StringBuilder res = new StringBuilder();     do     {       res.appendCodePoint(c);       c = snext();     } while (!isSpaceChar(c));     return res.toString();   }   public String nextLine()   {     int c = snext();     while (isSpaceChar(c))       c = snext();     StringBuilder res = new StringBuilder();     do     {       res.appendCodePoint(c);       c = snext();     } while (!isEndOfLine(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;   }   private boolean isEndOfLine(int c)   {     return c == '\n' || c == '\r' || c == -1;   }   public interface SpaceCharFilter   {     public boolean isSpaceChar(int ch);   }  } }
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));  }  private static 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;  }  private static 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;  } }
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 m = in.nextInt();   int k = in.nextInt();   int[] a = new int[ n ];   for (int i=0; i<n; i++) a[i] = in.nextInt();   if ( m <= k ) out.println( 0 );   else   {    m -= k - 1;    Arrays.sort( a );    int ans = 0;    for (int i=n-1; i>=0; i--)    {     ans++;         m -= a[ i ];     if ( m <= 0 ) break;     m++;    }    if ( m > 0 ) out.println( -1 );    else 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());  } }
0	public class A { public static void main(String[] args){  FastScanner sc = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  String cur = sc.nextToken();  int first = Integer.parseInt(cur);  if(cur.length() > 1){  String second = cur.substring(0,cur.length()-1);  if(Character.isDigit(second.charAt(second.length()-1))){   first = Math.max(first, Integer.parseInt(second));  }  }   if(cur.length() > 2){  String third = cur.substring(0,cur.length()-2) + cur.charAt(cur.length()-1);  if(Character.isDigit(cur.charAt(cur.length()-2))){   first = Math.max(first, Integer.parseInt(third));  }  }  System.out.println(first);  out.close(); }  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());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  } } }
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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
3	public class cf1141f2_2 {  public static void main(String[] args) throws IOException {   int n = ri(), a[] = ria(n), pre[] = new int[n + 1];   for (int i = 0; i < n; ++i) {    pre[i + 1] = pre[i] + a[i];   }   Map<Integer, List<p>> sums = new HashMap<>();   for (int i = 0; i < n; ++i) {    for (int j = 0; j <= i; ++j) {     sums.computeIfAbsent(pre[i + 1] - pre[j], k -> new ArrayList<>()).add(new p(j, i));    }   }   int k = 0;   List<p> ans = new ArrayList<>();   for (int key : sums.keySet()) {    List<p> segs = sums.get(key);    segs.sort((x, y) -> x.b == y.b ? x.a - y.a : x.b - y.b);    int last = -1, cnt = 0;    for (int i = 0, end = segs.size(); i < end; ++i) {     if (segs.get(i).a > last) {      ++cnt;      last = segs.get(i).b;     }    }    if (cnt > k) {     k = cnt;     ans = segs;    }   }   prln(k);   int last = -1;   for (int i = 0, end = ans.size(); i < end; ++i) {    if (ans.get(i).a > last) {     prln(ans.get(i).a + 1, ans.get(i).b + 1);     last = ans.get(i).b;    }   }   close();  }  static class p {   int a, b;   p(int a_, int b_) {    a = a_;    b = b_;   }   @Override   public String toString() {    return "Pair{" + "a = " + a + ", b = " + b + '}';   }    public boolean asymmetricEquals(Object o) {    p p = (p) o;    return a == p.a && b == p.b;   }   public boolean symmetricEquals(Object o) {    p p = (p) o;    return a == p.a && b == p.b || a == p.b && b == p.a;   }   @Override   public boolean equals(Object o) {    return asymmetricEquals(o);   }   public int asymmetricHashCode() {    return Objects.hash(a, b);   }   public int symmetricHashCode() {    return Objects.hash(a, b) + Objects.hash(b, a);   }   @Override   public int hashCode() {    return asymmetricHashCode();   }  }  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 minof(int a, int b, int c) {return min(a, min(b, c));}  static int minof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); int min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static long minof(long a, long b, long c) {return min(a, min(b, c));}  static long minof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); long min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static int maxof(int a, int b, int c) {return max(a, max(b, c));}  static int maxof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); int max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static long maxof(long a, long b, long c) {return max(a, max(b, c));}  static long maxof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); long max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static int powi(int a, int b) {if (a == 0) return 0; int ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static long powl(long a, int b) {if (a == 0) return 0; long ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static int fli(double d) {return (int) d;}  static int cei(double d) {return (int) ceil(d);}  static long fll(double d) {return (long) d;}  static long cel(double d) {return (long) ceil(d);}  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 lcm(int a, int b) {return a * b / gcf(a, b);}  static long lcm(long a, long b) {return a * b / gcf(a, b);}  static int randInt(int min, int max) {return __rand.nextInt(max - min + 1) + min;}  static long mix(long x) {x += 0x9e3779b97f4a7c15L; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9L; x = (x ^ (x >> 27)) * 0x94d049bb133111ebL; return x ^ (x >> 31);}   static void reverse(int[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {int swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(long[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {long swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(double[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {double swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(char[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {char swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  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 void rsort(int[] a) {shuffle(a); sort(a);}  static void rsort(long[] a) {shuffle(a); sort(a);}  static void rsort(double[] a) {shuffle(a); sort(a);}  static int[] copy(int[] a) {int[] ans = new int[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static long[] copy(long[] a) {long[] ans = new long[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static double[] copy(double[] a) {double[] ans = new double[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static char[] copy(char[] a) {char[] ans = new char[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}   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 dc(List<? extends Collection<Integer>> g, int u, int v) {g.get(u).remove(v); g.get(v).remove(u);}  static void dcto(List<? extends Collection<Integer>> g, int u, int v) {g.get(u).remove(v);}   static void r() throws IOException {input = new StringTokenizer(rline());}  static int ri() throws IOException {return Integer.parseInt(rline());}  static long rl() throws IOException {return Long.parseLong(rline());}  static double rd() throws IOException {return Double.parseDouble(rline());}  static int[] ria(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni(); return a;}  static int[] riam1(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni() - 1; return a;}  static long[] rla(int n) throws IOException {long[] a = new long[n]; r(); for (int i = 0; i < n; ++i) a[i] = nl(); return a;}  static double[] rda(int n) throws IOException {double[] a = new double[n]; r(); for (int i = 0; i < n; ++i) a[i] = nd(); return a;}  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 rnl() throws IOException {r(); return nl();}  static long nl() {return Long.parseLong(n());}  static double rnd() throws IOException {r(); return nd();}  static double nd() {return Double.parseDouble(n());}  static List<List<Integer>> rg(int n, int m) throws IOException {List<List<Integer>> g = g(n); for (int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1); return g;}  static void rg(List<List<Integer>> g, int m) throws IOException {for (int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1);}  static List<List<Integer>> rdg(int n, int m) throws IOException {List<List<Integer>> g = g(n); for (int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1); return g;}  static void rdg(List<List<Integer>> g, int m) throws IOException {for (int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1);}  static List<Set<Integer>> rsg(int n, int m) throws IOException {List<Set<Integer>> g = sg(n); for (int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1); return g;}  static void rsg(List<Set<Integer>> g, int m) throws IOException {for (int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1);}  static List<Set<Integer>> rdsg(int n, int m) throws IOException {List<Set<Integer>> g = sg(n); for (int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1); return g;}  static void rdsg(List<Set<Integer>> g, int m) throws IOException {for (int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1);}   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 pryes() {prln("yes");}  static void pry() {prln("Yes");}  static void prY() {prln("YES");}  static void prno() {prln("no");}  static void prn() {prln("No");}  static void prN() {prln("NO");}  static void pryesno(boolean b) {prln(b ? "yes" : "no");};  static void pryn(boolean b) {prln(b ? "Yes" : "No");}  static void prYN(boolean b) {prln(b ? "YES" : "NO");}  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 h() {prln("hlfd"); flush();}  static void flush() {__out.flush();}  static void close() {__out.close();}}
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 int best(int mask, int[][] mat, int col)  {   int max = 0;   for (int t = 0; t < mat[0].length-1; t++)   {    int sum = 0;    int mk = mask;    for (int i = 0; i < mat[0].length-1; i++)    {     if (mk % 2 == 1)     {      sum += mat[col][(i+t)%(mat[0].length-1)];     }     mk /= 2;    }    max = Math.max(max, sum);   }   return max;  }  public void cycle(int[][] mat, int col)  {   int temp = mat[col][0];   for (int i = 0; i < mat[0].length-2; i++)   {    mat[col][i] = mat[col][i+1];   }   mat[col][mat[0].length-2] = temp;  }  public void ntok() throws IOException  {   tok = new StringTokenizer(in.readLine());  }  public int ipar()  {   return Integer.parseInt(tok.nextToken());  }  public int[] iapar(int n)  {   int[] arr = new int[n];   for (int i = 0; i < n; i++)   {    arr[i] = ipar();   }   return arr;  }  public long lpar()  {   return Long.parseLong(tok.nextToken());  }  public long[] lapar(int n)  {   long[] arr = new long[n];   for (int i = 0; i < n; i++)   {    arr[i] = lpar();   }   return arr;  }  public double dpar()  {   return Double.parseDouble(tok.nextToken());  }  public String spar()  {   return tok.nextToken();  }  public static void main(String[] args) throws IOException  {   new E2().go();  } }
3	public class Main {   public static void main(String[] args) throws IOException {   Reader.init(System.in);   int n = Reader.nextInt();   int[] arr = new int[n];   int initial = 0;   for (int i = 0; i < n; i++) arr[i] = Reader.nextInt();   for (int i = 0; i < arr.length; i++) {    for (int j = i + 1; j < arr.length; j++) if (arr[i] > arr[j]) initial++;   }   int m = Reader.nextInt();   boolean parity = initial % 2 == 0;   for (int i = 0; i < m; i++) {    int l = Reader.nextInt();    int r = Reader.nextInt();    int elems = r - l + 1;    boolean change = (elems/2) % 2 == 0;    parity = parity == change;    System.out.println(parity ? "even": "odd");   }  } }  class Reader{  private static BufferedReader reader;  private static StringTokenizer tokenizer;  static void init(InputStream inputStream){   reader = new BufferedReader(new InputStreamReader(inputStream));   tokenizer = new StringTokenizer("");  }  static String next() throws IOException {   String read;   while (!tokenizer.hasMoreTokens()){    read = reader.readLine();    if (read == null || read.equals(""))     return "-1";    tokenizer = new StringTokenizer(read);   }   return tokenizer.nextToken();  }  static int nextInt() throws IOException{   return Integer.parseInt(next());  }       }
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());  } }
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();    boolean[] isF = new boolean[n];    for (int i = 0; i < n; i++) {     isF[i] = in.readCharacter() == 'f';    }    long[][] mem = new long[n + 1][n + 1];    mem[n][0] = 1;    for (int idx = n - 1; idx >= 0; idx--) {     for (int indentLevel = 0; indentLevel < n; indentLevel++) {      mem[idx + 1][indentLevel + 1] += mem[idx + 1][indentLevel];      long res = isF[idx] ?        mem[idx + 1][indentLevel + 1] - mem[idx + 1][indentLevel] :        mem[idx + 1][indentLevel];      mem[idx][indentLevel] = res % MiscUtils.MOD7;     }    }    out.printLine(mem[0][0]);   }  }  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 char readCharacter() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    return (char) c;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  static class MiscUtils {   public static final int MOD7 = (int) (1e9 + 7);  }  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);   }  } }
4	public class Main {  boolean test = false; PrintWriter pw = new PrintWriter(System.out); InputStreamReader inp = new InputStreamReader(System.in); BufferedReader in = new BufferedReader(inp);  private String[] inData = {"zzz"  };   static int id = -1;  public String readLine() {  id++;  if (test)  return inData[id];  else  try{   return in.readLine();   } catch( Exception e){   e.printStackTrace();  }  return ""; }  private void solve() {   String readLine = readLine();   int best = 0;   for (int i = 0; i < readLine.length(); i++) {  for (int j = i; j < readLine.length(); j++) {   String substring = readLine.substring(i,j+1);   String remainString = readLine.substring(i+1);   if(remainString.contains(substring)){   if(substring.length() > best){    best = substring.length();    }      }  }  }  System.out.println(best); }  public static void main(String args[]) throws Exception {  new Main().solve();  }  }
4	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));   String text = reader.readLine().trim();  int out = 0;  for(int i=0;i<text.length();i++){  for(int j=i+1;j<text.length();j++){   for(int len = out+1;len+j<=text.length();len++){   if(text.substring(i,i+len).compareTo(text.substring(j,j+len))==0){    out = len;   }   }  }  }  String buf = ""+out;  writer.write(buf,0,buf.length());  writer.newLine();  writer.flush();  writer.close();  reader.close(); } String process(){  return "1"; } int[] toIntArray(String line){  String[] p = line.split("[ ]+");  int[] out = new int[p.length];  for(int i=0;i<p.length;i++) out[i] = Integer.valueOf(p[i]);  return out; } }
1	public class B {  public static void main(String[] args) {  FastScanner fs=new FastScanner();  int T=fs.nextInt();  for (int tt=0; tt<T; tt++) {  int n=fs.nextInt();  boolean isEven=n%2==0;  while (n%2==0) n/=2;  if (isSquare(n) && isEven) {   System.out.println("YES");  }  else {   System.out.println("NO");  }  } }  static boolean isSquare(long n) {  long sqrt=(long) Math.sqrt(n);  for (int i=(int) Math.max(1, sqrt-5); i<=sqrt+5; i++)  if (i*i==n)   return true;  return false; }  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());  }  int[] readArray(int n) {  int[] a=new int[n];  for (int i=0; i<n; i++) a[i]=nextInt();  return a;  }  long nextLong() {  return Long.parseLong(next());  } }  }
5	public class Solution implements Runnable {  BufferedReader in; PrintWriter out; StringTokenizer st;  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()); }  long nextLong() throws Exception {  return Long.parseLong(nextToken()); }  double nextDouble() throws Exception {  return Double.parseDouble(nextToken()); }  int fu(int[] a, int l) {  for (int i = l; i < a.length - 1; i++) {  if (a[i] > a[i + 1]) return i;  }  return a.length; }  void swap(int[] a, int q, int w) {  int t = a[q]; a[q] = a[w]; a[w] = t; }  void solve() throws Exception {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) a[i] = nextInt();  int q = fu(a, 0);  if (q == n) out.println("YES"); else {  int w = fu(a, q + 1);  if (w < n) {   boolean ans = false;   swap(a, q, w);   ans |= fu(a, 0) == n;   swap(a, q, w);   if (q < n - 1) {   swap(a, q + 1, w);   ans |= fu(a, 0) == n;   swap(a, q + 1, w);   }   if (w < n - 1) {   swap(a, q, w + 1);   ans |= fu(a, 0) == n;   swap(a, q, w + 1);   }   if (q < n - 1 && w < n - 1) {   swap(a, q + 1, w + 1);   ans |= fu(a, 0) == n;   swap(a, q + 1, w + 1);   }   if (ans) out.println("YES"); else out.println("NO");  } else {   int j = q + 1;   while (j < n && a[j] == a[q + 1]) j++;   j--;   swap(a, q, j);   if (fu(a, 0) == n) out.println("YES"); else {   swap(a, q, j);   q++;   j = q - 1;   while (j >= 0 && a[j] == a[q - 1]) j--;   j++;   swap(a, q, j);   if (fu(a, 0) == n) out.println("YES"); else out.println("NO");   }  }  } }  public void run() {  try {  Locale.setDefault(Locale.UK);  in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } finally {  out.close();  } }  public static void main(String[] args) {   (new Solution()).run(); } }
6	public class G {  static int n,t;  static int[]a;  static int[]g;  static long[][][]dp;  static final long MOD=1000000007;  public static void main(String[]args){   Scanner sc=new Scanner(System.in);   n=sc.nextInt();   t=sc.nextInt();   a=new int[n];   g=new int[n];   for(int i=0;i<n;i++) {    a[i] = sc.nextInt();    g[i] = sc.nextInt();   }   dp=new long[4][1<<(n-1)+1][t+1];   for(int i=0;i<4;i++)    for(int j=0;j<1<<(n-1)+1;j++)     for(int k=0;k<=t;k++)      dp[i][j][k]=-1;   System.out.println(dp(0,0,t));  }  private static long dp(int genre,int mask,int time){   if(time<0)    return 0;   if(dp[genre][mask][time]!=-1)    return dp[genre][mask][time];   if(time==0)    return 1;   dp[genre][mask][time]=0;   for(int i=0;i<n;i++) {    if (g[i] != genre && ((1 << i) & mask) == 0)     dp[genre][mask][time] = (dp[genre][mask][time]+dp(g[i], mask | (1 << i), time - a[i]))%MOD;   }   return dp[genre][mask][time];  } }
1	public class algo121 {  public static void main(String args[])  {   Scanner ex=new Scanner(System.in);   int n=ex.nextInt();   String a[]=new String[n];   String b[]=new String[n];   for(int i=0;i<n;i++)   a[i]=ex.next();   for(int i=0;i<n;i++)   b[i]=ex.next();   String valid[]={"S","M","L","XS","XL","XXS","XXL","XXXS","XXXL"};   int ai[]=new int[9];   int bi[]=new int[9];   for(int i=0;i<n;i++)   {    for(int j=0;j<9;j++)    {     if(a[i].equals(valid[j]))     ai[j]++;     if(b[i].equals(valid[j]))     bi[j]++;    }   }   int ans=0;   for(int i=0;i<9;i++)   {    if(ai[i]>bi[i])    ans=ans+ai[i]-bi[i];   }   System.out.println(ans);  } }
4	public class C { Scanner in; PrintWriter out;  String INPUT = "";  void solve() {  int n = ni();  int m = ni();  int k = ni();  int[] x = new int[k];  int[] y = new int[k];  for(int i = 0;i < k;i++){  x[i] = ni() - 1;  y[i] = ni() - 1;  }  int max = -1;  int maxi = -1;  int maxj = -1;  for(int i = 0;i < n;i++){  for(int j = 0;j < m;j++){   int min = Integer.MAX_VALUE;   for(int l = 0;l < k;l++){   min = Math.min(min, Math.abs(x[l] - i) + Math.abs(y[l] - j));   }   if(min > max){   max = min;   maxi = i;   maxj = j;   }  }  }   out.println((maxi+1) + " " + (maxj+1)); }  void run() throws Exception {  in = INPUT.isEmpty() ? new Scanner(new File("input.txt")) : new Scanner(INPUT);  out = INPUT.isEmpty() ? new PrintWriter("output.txt") : new PrintWriter(System.out);  solve();  out.flush(); }   public static void main(String[] args) throws Exception {  new C().run(); }  int ni() { return Integer.parseInt(in.next()); } void tr(Object... o) { if(INPUT.length() != 0)System.out.println(o.length > 1 || o[0].getClass().isArray() ? Arrays.deepToString(o) : o[0]); } static String join(int[] a, int d){StringBuilder sb = new StringBuilder();for(int v : a){sb.append(v + d + " ");}return sb.toString();} }
2	public class template { public static void main(String[] args) {  FastScanner sc = new FastScanner();  PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));  int n = sc.nextInt();  int k = sc.nextInt();  long left = 0;  long right = n;  long mid = left+right/2;  while(left<=right) {  mid = (left+(right))/2;  if(((mid+1)*mid)/2-(n-mid)==k) {   pw.println(n-mid);   pw.close();   break;  }  else if(((mid+1)*mid)/2-(n-mid)>k) {   right = mid-1;  }  else left = mid+1;  } } } @SuppressWarnings("all") 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());  }  long nextLong() {   return Long.parseLong(nextToken());  }  double nextDouble() {   return Double.parseDouble(nextToken());  } }
4	public class cf35c { public static void main(String[] args) throws Exception {  Scanner in = new Scanner(new File("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  int[] dx = {0,0,1,-1};  int[] dy = {1,-1,0,0};  int n = in.nextInt();  int m = in.nextInt();  int[][] seen = new int[n][m];  for(int i=0; i<n; i++)  Arrays.fill(seen[i], -1);  Queue<Integer> q = new LinkedList<Integer>();  int k = in.nextInt();  for(int i=0; i<k; i++) {  int x = in.nextInt()-1;  int y = in.nextInt()-1;  q.add(x);  q.add(y);  q.add(0);  seen[x][y] = 0;  }  while(!q.isEmpty()) {  int x = q.poll();  int y = q.poll();  int t = q.poll();  for(int i=0; i<dx.length; i++) {   int nx = x + dx[i];   int ny = y + dy[i];   if(nx < 0 || nx >= n || ny < 0 || ny >= m)   continue;   if(seen[nx][ny] != -1) continue;   seen[nx][ny] = t+1;   q.add(nx);   q.add(ny);   q.add(t+1);  }  }  int best=-1,x=0,y=0;  for(int i=0; i<n; i++)  for(int j=0; j<m; j++)   if(seen[i][j] > best) {   best = seen[i][j];   x = i+1;   y = j+1;   }  out.println(x + " " +y);  out.close(); } }
1	public class Solution {  Scanner in; PrintWriter out;  boolean isPrime(int x) {  for (int i = 2; i * i <= x; ++i) {  if (x % i == 0) {   return false;  }  }  return true; }  void solve() throws IOException {  in = new Scanner(System.in);   out = new PrintWriter(System.out);  int N = in.nextInt();  int K = in.nextInt();  List<Integer> primes = new ArrayList<Integer>();  for (int i = 2; i <= N; ++i) {  if (isPrime(i)) {   primes.add(i);  }  }  int c = 0;  for (int i = 2; i <= N; ++i) {  if (!isPrime(i)) continue;  for (int j = 0; j + 1 < primes.size(); ++j) {   int p1 = primes.get(j);   int p2 = primes.get(j + 1);   if (p1 + p2 + 1 == i) {   ++c;      break;   }  }  }  if (c >= K) out.println("YES");  else out.println("NO");  out.close();  }  public static void main(String args[]) throws IOException {  new Solution().solve(); } }
1	public class C701 {  static FastReader in = null;  static PrintWriter out = null;  public static void solve()  {   int n = in.nint();   String pk = in.next();   boolean[] occ = new boolean[52];   for(int i=0; i<n; i++)   {    char c = pk.charAt(i);    int val = Character.isUpperCase(c)? (int)(c-'A') : (int)(c-'a'+26);    occ[val] = true;   }   int[][] next = new int[n][52];   for(int i=0; i<n; i++) for(int j=0; j<52; j++) next[i][j] = -1;   for(int i= n-1; i>=0; i--) {    char c = pk.charAt(i);    int val = Character.isUpperCase(c)? (int)(c-'A') : (int)(c-'a'+26);    next[i][val] = i;    if(i<n-1)    for(int j=0; j<52; j++)    {     if(j!=val)     {      next[i][j] = next[i+1][j];     }    }   }   int min = Integer.MAX_VALUE;   for(int i=0; i<n; i++)   {    int maxd = 0;    boolean endearly = false;    for(int j=0; j<52; j++)    {     if(occ[j] && next[i][j] == -1)     {      endearly = true;      break;     }     else if(occ[j])     {      maxd = Math.max(maxd, next[i][j]-i+1);     }    }    if(endearly) break;    min = Math.min(min, maxd);   }   out.println(min);   }  public static void main(String[] args)  {   in = new FastReader(System.in);   out = new PrintWriter(System.out);   solve();   out.flush();   out.close();  }  static class FastReader {   BufferedReader read;   StringTokenizer tokenizer;   public FastReader(InputStream in)   {    read = new BufferedReader(new InputStreamReader(in));   }   public String next()   {    while(tokenizer == null || !tokenizer.hasMoreTokens())    {     try{      tokenizer = new StringTokenizer(read.readLine());     }catch(Exception e){      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }   public int nint()   {    return Integer.parseInt(next());   }   public long nlong()   {    return Long.parseLong(next());   }   public double ndouble()   {    return Double.parseDouble(next());   }   public int[] narr(int n)   {    int[] a = new int[n];    for(int i=0; i<n; ++i)    {     a[i] = nint();    }    return a;   }   public long[] nlarr(int n)   {    long[] a = new long[n];    for(int i=0; i<n; ++i)    {     a[i] = nlong();    }    return a;   }  }  }
1	public class theyareeverywhere {  public static void main(String[] args) throws Exception {   BufferedReader r = new BufferedReader(new InputStreamReader(System.in));   PrintWriter w = new PrintWriter(System.out);        int n = Integer.parseInt(r.readLine());     char[] pokemans = r.readLine().toCharArray();     int[] counts = new int[52];   boolean[] exists = new boolean[52];     for (int i = 0; i < pokemans.length; i++) {    exists[index(pokemans[i])] = true;   }     int left = 0, right = 0;   counts[index(pokemans[0])] = 1;     int answer = 1000000000;     while (left < n && right < n) {    if (!valid(counts, exists)) {         right++;     if (right < n)     counts[index(pokemans[right])]++;    } else {     answer = Math.min(answer, right - left + 1);     left++;     if (left - 1 >= 0)     counts[index(pokemans[left - 1])]--;    }   }     w.println(answer);   w.flush();  }   public static boolean valid(int[] counts, boolean[] exists) {   for (int i = 0; i < counts.length; i++) {    if (exists[i] && counts[i] == 0) return false;   }   return true;  }   public static int index(char c) {   if (c >= 'a' && c <= 'z') {    return c - 'a';   } else {    return c - 'A' + 26;   }  } }
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); } }
1	public class A implements Runnable{ public static void main (String[] args) {new Thread(null, new A(), "_cf", 1 << 28).start();}  public void run() {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  System.err.println("Go!");  int n = fs.nextInt();  int d = fs.nextInt();  int[] a = fs.nextIntArray(n);  sort(a);  long res = 0;  if(n == 1) {  System.out.println(2);  return;  }  HashSet<Integer> set = new HashSet<>();  for(int i = 0; i < n; i++) {  int one = a[i] - d;  int min = Integer.MAX_VALUE;  for(int j = 0; j < n; j++) {   int dist = Math.abs(a[j] - one);   min = Math.min(min, dist);  }  if(min == d) set.add(one);  one = a[i] + d;  min = Integer.MAX_VALUE;  for(int j = 0; j < n; j++) {   int dist = Math.abs(a[j] - one);   min = Math.min(min, dist);  }  if(min == d) set.add(one);  }  System.out.println(set.size());  out.close(); }  void sort (int[] a) {  int n = a.length;  for(int i = 0; i < 50; i++) {  Random r = new Random();  int x = r.nextInt(n), y = r.nextInt(n);  int temp = a[x];  a[x] = a[y];  a[y] = temp;  }  Arrays.sort(a); }  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;  }  public double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }  public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }  public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  }   public int[] nextIntArray(int n) {  int[] res = new int[n];  for(int i = 0; i < n; i++) res[i] = nextInt();  return res;  }   } }
5	public class Success {   public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int a = scan.nextInt();  int b=scan.nextInt();  int[] t=new int[n];  for(int i=0;i<n;i++)  {  t[i]=scan.nextInt();  }  Arrays.sort(t);  System.out.println(t[b]-t[b-1]);  }   }
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 Item {   int a;   int b;   int c;   Item(int a, int b, int c) {    this.a = a;    this.b = b;    this.c = c;   }  }  class Pair implements Comparable<Pair>{   int a;   int b;   Pair(int a, int b) {    this.a = a;    this.b = b;   }   public int compareTo(Pair p) {    if (b < p.b)     return 1;    if (b > p.b)     return -1;    return 0;   }                            }  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());   }   long nextLong() throws NumberFormatException, IOException {    return Long.valueOf(next());   }   double nextDouble() throws NumberFormatException, IOException {    return Double.valueOf(next());   }   String nextLine() throws IOException {    return br.readLine();   }  } }
3	public class Main {  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  int n = s.nextInt();  int[] arr = new int[n];  for(int i = 0; i < n; i++) {  arr[i] = s.nextInt();  }  int parity = 0;  for(int i = 0; i < n; i++) {  int count = 0;  for(int j = i + 1; j < n; j++) {   if(arr[j] < arr[i]) {   parity ^= 1;   }    }  }  int m = s.nextInt();  for(int i = 0; i < m; i++) {  int l = s.nextInt(), r = s.nextInt();  if(((r - l + 1) / 2) % 2 == 1) {   parity ^= 1;  }  System.out.println(parity == 1 ? "odd" : "even");  } } }
4	public class C2 {  public static void main(String[] args) throws IOException{   Scanner sc = new Scanner(new File("input.txt"));   PrintWriter pw = new PrintWriter(new File("output.txt"));   int n = sc.nextInt();   int m = sc.nextInt();   int k = sc.nextInt();   int[]x = new int[k+1], y = new int[k+1];   for (int i = 1; i <= k; i++) {    y[i] = sc.nextInt();    x[i] = sc.nextInt();   }   int max = -1, y0 = 0, x0 = 0;   for (int i = 1; i <= n; i++) {    for (int j = 1; j <= m; j++) {     int min = n+m+2;     for (int j2 = 1; j2 <= k; j2++) {      min = Math.min(min, Math.abs(i-y[j2])+Math.abs(j-x[j2]));     }     if (min > max) {      max = min;      y0 = i;      x0 = j;     }    }   }   pw.println(y0+" "+x0);   pw.close();  } }
0	public class Main implements Runnable {  PrintWriter out;  Scanner in;  public static void main(String[] args) throws IOException {   new Thread(new Main()).start();  }  public void run() {   try {    out = new PrintWriter(new BufferedOutputStream(System.out));    in = new Scanner(System.in);    solve();    out.close();   } catch (IOException e) {    throw new IllegalStateException(e);   }  }  public void solve() throws IOException {   int n = in.nextInt();   if (n >= 0) {    out.println(n);   } else {    String s = String.valueOf(n);    int l = s.length();    String s1 = s.substring(0, l - 2);    if (s.charAt(l - 1) > s.charAt(l - 2)) {     s1 += s.charAt(l - 2);    } else {     s1 += s.charAt(l - 1);    }    out.println(Integer.parseInt(s1));   }  } }
0	public class lukno {  public static void main (String args[])  {   Scanner i= new Scanner(System.in);   int n,p;        n=i.nextInt(); int t=n;   while(n!=0)   {    p=n%10;    if(p!=4||p!=7)    { if(t%7==0||t%4==0||t%47==0||t%74==0||t%447==0||t%477==0||t%474==0)     System.out.print("YES");     else System.out.print("NO");    break;}    else System.out.print("NO");       n=(n/10);    }     } }
6	public class Main {  private int n; private int m; private boolean[][] g; private long[][] dp; private int[] count; private int[] first;  private void solve() throws IOException {  n = nextInt();  m = nextInt();  g = new boolean[n][n];  for (int i = 0; i < m; i++) {  int a = nextInt() - 1;  int b = nextInt() - 1;  g[a][b] = true;  g[b][a] = true;  }  count = new int[1 << n];  first = new int[1 << n];  dp = new long[1 << n][n];  for (int mask = 0; mask < (1 << n); mask++) {  count[mask] = bitCount(mask);  for (int i = 0; i < n; i++) {   if (bit(i, mask) == 1) {   first[mask] = i;   break;   }  }  }  for (int mask = 0; mask < (1 << n); mask++) {  for (int i = 0; i < n; i++) {   if ((count[mask] == 1) && (bit(i, mask) == 1)) {   dp[mask][i] = 1;   } else {   for (int j = 0; j < n; j++) {    if (g[j][i] && (count[mask] > 1) && (bit(i, mask) == 1)     && (first[mask] != i)) {    dp[mask][i] += dp[mask ^ (1 << i)][j];    }   }   }  }  }  long ans = 0;  for (int i = 0; i < n; i++) {  for (int mask = 0; mask < (1 << n); mask++) {   if ((count[mask] >= 3) && (first[mask] != i)    && (g[i][first[mask]])) {   ans += dp[mask][i];   }  }  }  if (ans % 2 != 0) {  throw new RuntimeException("SHIT!!!");  }  out.println(ans / 2); }  private final int bit(int i, int mask) {  return (mask & (1 << i)) != 0 ? 1 : 0; }  private final int bitCount(int mask) {  int ret = 0;  while (mask != 0) {  ret++;  mask -= mask & (-mask);  }  return ret; }  private BufferedReader in; private PrintWriter out; private StringTokenizer st;  private Main() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  eat("");  solve();  in.close();  out.close(); }  private void eat(String s) {  st = new StringTokenizer(s); }  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 Main(); } }
4	public class Main {   BufferedReader in;  PrintWriter out;  public static void main(String[] args) throws IOException {   new Main().run();  }  void run() throws IOException {     in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(new OutputStreamWriter(System.out));   String s = in.readLine();   int n = s.length();   for(int len = n; len > 0; len--) {    for(int i = 0; i + len <= n; i++) {     for(int j = 0; j + len <= n; j++)      if(i != j) {       boolean f = true;       for(int k = 0; k < len; k++)        if(s.charAt(i + k) != s.charAt(j + k)) {         f = false;         break;        }       if(f) {        out.println(len);        out.flush();        return;       }      }    }   }   out.println(0);   out.flush();  }  void solve() throws IOException {    }    }
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 sub(long a, long b) {  return ((a-b)%mod+mod)%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());  }  int[] readArray(int n) {  int[] a=new int[n];  for (int i=0; i<n; i++) a[i]=nextInt();  return a;  }  long nextLong() {  return Long.parseLong(next());  } }  }
2	public class Main {  private void solve() throws IOException {  out.println(solve(nl()));  out.close();  }  private long solve(long n) throws IOException {  if (n > 0) {  n <<= 1;  long k = nl();  n--;  int M = 1000000007;  long p = power(2, k, M);    n = (n % M * p + 1) % M;  }  return n; }  long power(long a, long b, long mod) {  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; }  static BufferedReader in; static PrintWriter out; static StringTokenizer tok;  private int[][] na(int n) throws IOException {  int[][] a = new int[n][2];  for (int i = 0; i < n; i++) {  a[i][0] = ni();  a[i][1] = i;  }  return a; }  String ns() throws IOException {  while (!tok.hasMoreTokens()) {  tok = new StringTokenizer(in.readLine(), " ");  }  return tok.nextToken(); }  int ni() throws IOException {  return Integer.parseInt(ns()); }  long nl() throws IOException {  return Long.parseLong(ns()); }  double nd() throws IOException {  return Double.parseDouble(ns()); }  String[] nsa(int n) throws IOException {  String[] res = new String[n];  for (int i = 0; i < n; i++) {  res[i] = ns();  }  return res; }  int[] nia(int n) throws IOException {  int[] res = new int[n];  for (int i = 0; i < n; i++) {  res[i] = ni();  }  return res; }  long[] nla(int n) throws IOException {  long[] res = new long[n];  for (int i = 0; i < n; i++) {  res[i] = nl();  }  return res; }  public static void main(String[] args) throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  tok = new StringTokenizer("");  Main main = new Main();  main.solve();  out.close(); } }
2	public class B {  BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof;  long f(int x, int y, int sz) {  if (x > y) {  int tmp = x;  x = y;  y = tmp;  }  if (sz <= x)  return (long) sz * (sz + 1) / 2;  if (sz >= x + y - 1)  return (long) x * y;  long val = x * (x + 1) / 2;  if (sz <= y)  return val + (long) (sz - x) * x;  long rest = x + y - 1 - sz;  return (long) x * y - (long) rest * (rest + 1) / 2; }  long count(int x, int y, int n, int time) {  long DL = f(x + 1, y + 1, time + 1);  long DR = f(n - x, y + 1, time + 1);  long UL = f(x + 1, n - y, time + 1);  long UR = f(n - x, n - y, time + 1);   long L = Math.min(x + 1, time + 1);  long R = Math.min(n - x, time + 1);  long U = Math.min(n - y, time + 1);  long D = Math.min(y + 1, time + 1);   return DL + DR + UL + UR - L - R - U - D + 1; }  void solve() throws IOException {  int n = nextInt();  int x = nextInt() - 1;  int y = nextInt() - 1;  long need = nextLong();  if (need == 1) {  out.println(0);  return;  }  int low = 0;  int high = Math.max(x, n - 1 - x) + Math.max(y, n - 1 - y);     while (low < high - 1) {  int mid = (int) (((long) low + high) / 2);  if (count(x, y, n, mid) >= need)   high = mid;  else   low = mid;  }  out.println(high);  }  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(); }  String nextString() {  try {  return br.readLine();  } catch (IOException e) {  eof = true;  return null;  } }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
2	public class CF1195B {  private static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  private static BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));  private static StringTokenizer st;  public static void main(String[] args) throws Exception {   st = new StringTokenizer(reader.readLine());   long n = Long.parseLong(st.nextToken());   long k = Long.parseLong(st.nextToken());   long put = (-3 + (long)Math.sqrt((long)9 + 8 * k + 8 * n)) / 2;   long eat = n - put;   writer.write(Long.toString(eat));   writer.newLine();   writer.flush();  } }
1	public class Solution {  static BufferedReader br=null;  static PrintWriter pw=null;  static StringTokenizer st=null;  static String FILENAME="";   void nline(){   try {    st=new StringTokenizer(br.readLine());   } catch (IOException e) {       e.printStackTrace();   }  }  int ni(){   while(st==null || !st.hasMoreTokens()) nline();   return Integer.parseInt(st.nextToken());  }  long nl(){   while(st==null || !st.hasMoreTokens()) nline();   return Long.parseLong(st.nextToken());  }  double nd(){   while(st==null || !st.hasMoreTokens()) nline();   return Double.parseDouble(st.nextToken());  }  String ns(){   while(st==null || !st.hasMoreTokens()) nline();   return st.nextToken();  }  String nstr(){   String s="";   try {    s=br.readLine();   } catch (IOException e) {       e.printStackTrace();   }   return s;  }  public void solve(){   int n = ni();   String s = nstr();   int[] a = new int[n];   for (int i=0;i<n;i++)    a[i]=s.charAt(i)=='H'?0:1;   int hc = 0;   for (int i=0;i<n;i++)    if (a[i]==0) hc++;   int min = 1000000;   for (int ss=0;ss<n;ss++) {    int rc = 0;    for (int i=0;i<hc;i++)     if (a[(i+ss)%n]==0) rc++;    if (hc-rc<min) min=hc-rc;   }   pw.print(min);  }  public void run(){   solve();   pw.close();  }  public static void main(String[] args) {    br = new BufferedReader(new InputStreamReader(System.in));    pw = new PrintWriter(System.out);     new Solution().run();  } }
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 void run() {   try {    solve();   } catch (Throwable e) {    System.err.println(e.getMessage());    e.printStackTrace();    System.exit(666);   } finally {    output.flush();    output.close();   }  }   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());  }  private long nextLong() throws IOException {   return Long.parseLong(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; }
5	public class CodeForce {   private void solve() throws IOException {   final int N = nextInt();   int []A = new int[N];   for(int i = 0; i < N; i++) A[i] = nextInt();   Arrays.sort(A);   if(A[N-1] == 1) A[N-1] = 2;   else   A[N-1] = 1;   Arrays.sort(A);   for(int i = 0; i < N; i++)    System.out.print(A[i] + " ");  }   public static void main(String[] args) {   new CodeForce().run();  }  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter writer;  public void run() {   try {    reader = new BufferedReader(new InputStreamReader(System.in));    tokenizer = null;    writer = new PrintWriter(new FileOutputStream(new File("output.txt")));    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 nextLine() throws IOException {   return reader.readLine();  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.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);   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());  } }
4	public class A23 { public static void main(String[]args){  Scanner sc = new Scanner(System.in);  String W = sc.next();  ArrayList<String>Q = new ArrayList<String>();  for (int i = 0; i < W.length(); i++){    String O = "";  for (int k = i; k < W.length(); k++){   O = O + W.charAt(k);   Q.add(O);  }   }  Collections.sort(Q);  String tmp = Q.get(0);  int y = 0;  for (int i = 1; i < Q.size(); i++){  if (Q.get(i).equals(tmp)){   if (Q.get(i).length() > y){   y = Q.get(i).length();   }   }  else {   tmp = Q.get(i);    }  }  System.out.println(y); } }
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());   }   double nextDouble() {    return Double.parseDouble(next());   }   long nextLong() {    return Long.parseLong(next());   }   } }
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 int compareTo(Object o) {    Yts1999 to=(Yts1999)o;    if(this.d<to.d) return 1;    else if(this.d==to.d) return 0;    else return -1;   }   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);  }  long lcm(long a,long b){   return a*b/gcd(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 double nd() { return Double.parseDouble(ns()); }  private char nc() { return (char)skip(); }  private String ns(){   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b))){    sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }  private char[] ns(int n){   char[] buf = new char[n];   int b = skip(), p = 0;   while(p < n && !(isSpaceChar(b))){    buf[p++] = (char)b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }  private char[][] nm(int n, int m){   char[][] map = new char[n][];   for(int i = 0;i < n;i++)map[i] = ns(m);   return map;  }  private int[] na(int n){   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = ni();   return a;  }  private int ni(){   int num = 0, b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private long nl(){   long num = 0;   int b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private void tr(Object... o) { if(local)System.out.println(Arrays.deepToString(o)); } }
0	public class J472A { private static 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));  } } }
2	public class l {               static int mod = (int) (1e9 + 7);   static StringBuilder sol;  static class pair implements Comparable<pair> {   int left, type;   double w;   public pair(int x, double y) {    left = x;    w = y;    type= 0;   }   public int compareTo(pair o) {    return Double.compare(w,o.w);   }   public String toString() {    return left + " " + w;   }  }  static class tri implements Comparable<tri> {   int st, end,len, side;   tri(int a, int b, int c,int d) {    st = a;    end = b;    len = c;    side=d;   }   public int compareTo(tri o) {    if (st == o.st) return end - o.end;    return st - o.st;   }   public String toString() {    return st + " " + end ;   }  }   static ArrayList<pair>[]adj;   static int n;  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 k = sc.nextInt();   int lo=0;   int hi=n;   int ans=0;   while (lo<=hi){    int mid=lo+hi>>1;    long rem= n-mid;    rem*=(rem+1);    rem/=2;    rem-=mid;       if (rem==k){     ans=mid;     break;    }    else if (rem>k){     lo=mid+1;    }    else hi=mid-1;   }   pw.println(ans);   pw.flush();  }  static long gcd(long a ,long b){   if (a==0)return b;   return gcd(b%a,a);  }     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() 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 String nextLine() throws IOException {    return br.readLine();   }   public double nextDouble() throws IOException {    String x = next();    StringBuilder sb = new StringBuilder("0");    double res = 0, f = 1;    boolean dec = false, neg = false;    int start = 0;    if (x.charAt(0) == '-') {     neg = true;     start++;    }    for (int i = start; i < x.length(); i++)     if (x.charAt(i) == '.') {      res = Long.parseLong(sb.toString());      sb = new StringBuilder("0");      dec = true;     } else {      sb.append(x.charAt(i));      if (dec)       f *= 10;     }    res += Long.parseLong(sb.toString()) / f;    return res * (neg ? -1 : 1);   }   public boolean ready() throws IOException {    return br.ready();   }  } }
0	public class CodeForce275A {   public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer token = new StringTokenizer(in.readLine());   long l = Long.parseLong(token.nextToken());   long r = Long.parseLong(token.nextToken());        if(r-l<2) {    System.out.println(-1);    return;   }   if(l%2==1&&r-l<3) {    System.out.println(-1);    return;   }   if(l%2==0) {    System.out.println(l+" "+(l+1)+" "+(l+2));    return;   }   if(l%2==1) {    System.out.println((l+1)+" "+(l+2)+" "+(l+3));   }  } }
1	public class Main { static Scanner in = new Scanner(System.in); static PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) {  int n = in.nextInt();  int m = in.nextInt();  long boyMax = 0;  int NBoyMax = 0;  long sweets = 0;  TreeSet<Long> boyMember = new TreeSet<>();  for (int i = 0; i < n; i++) {  long input = in.nextLong();  boyMember.add(input);  if (boyMax < input) {   boyMax = input;   NBoyMax = 1;  } else if (boyMax == input) NBoyMax++;  sweets += (input * m);  }  long smallestGirl = (long) 1e8 + 1;  long sum = 0;  for (int i = 0; i < m; i++) {  long input = in.nextLong();  sum += input;  if (smallestGirl > input) smallestGirl = input;  }  if (smallestGirl < boyMember.last()) {  out.println(-1);  } else if (smallestGirl == boyMember.last()) {  sweets += sum - boyMember.last() * m;  out.println(sweets);  } else {   if (NBoyMax > 1) {   sweets += sum - boyMember.last() * m;   out.println(sweets);  } else {   Object[] boyList = boyMember.toArray();   if (boyList.length > 1) {   long boy = 0;   boy = (long)boyList[boyList.length - 2];   sweets += (sum - smallestGirl - boyMember.last() * (m - 1));   sweets += (smallestGirl - boy);   out.println(sweets);   } else {   out.println(-1);   }  }  }  in.close();  out.close(); } }
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 balance = in.nextInt();   if (balance >= 0) {    out.println(balance);    return;   }   balance = -balance;   int a = balance / 100;   int b = Math.min(balance % 10, (balance / 10) % 10);   balance = -(a * 10 + b);   out.println(balance);  } }
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 int[][] matPow(int[][] base, int p)  {   int n = base.length;   int[][] ans = new int[n][n];   for(int i = 0; i < n; i++)    ans[i][i] = 1;   while(p != 0)   {    if((p & 1) == 1)     ans = matMul(ans, base, n, n, n);    base = matMul(base, base, n, n, n);    p >>= 1;   }   return ans;  }   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;  }  static int pow(int n, int p){   int ans = 1;   for (int i = 0; i < p; i++) {    ans *= n;   }   return ans;  }  static int[][] packD(int n, int[] from, int[] to) {   int[][] g = new int[n][];   int[] p = new int[n];   for (int f : from) if(f != -1) p[f]++;   for (int i = 0; i < n; i++) g[i] = new int[p[i]];   for (int i = 0; i < from.length; i++) if(from[i] != -1) {g[from[i]][--p[from[i]]] = to[i];}   return g;  }  static void shuffle(int[] a)  {   int n = a.length;   for(int i = 0; i < n; i++)   {    int r = i + (int)(Math.random() * (n - i));    int tmp = a[i];    a[i] = a[r];    a[r] = tmp;   }  }  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 String nextLine() throws IOException {return br.readLine();}   public boolean ready() throws IOException {return br.ready();}  } }
2	public class Codechef { public static void main (String[] args) throws java.lang.Exception {   Scanner in=new Scanner(System.in);  long x=in.nextLong();  long k=in.nextLong();   long mod=1000000007;  long get=power(2,k,mod);  long ans=((get%mod)*((2*x)%mod))%mod-get+1;  if(ans<0)  ans+=mod;  if(x==0)  ans=0;  System.out.println(ans);   } static long power(long x, long y, long p)  {     long res = 1;            x = x % p;     while (y > 0)   {           if((y & 1)==1)     res = (res * x) % p;             y = y >> 1;    x = (x * x) % p;   }   return res;  } }
0	public class Traffic extends Template{ public double search1(int a, int w, int d){  double s = 0;  double l = 2*w+2*a*d;  int repeat = 100;  while( repeat-- > 0 ){  double x = (s+l)/2;  if( a*a*x*x + 2*a*w*x - w*w - 4*a*d > 0 ){   l = x;  } else {   s = x;  }  }  return l; }  public double search2(int a, double lim, int k){  double s = 0;  double l = lim + 2*a*k;  int repeat = 100;  while( repeat-- > 0 ){  double x = (s+l)/2;  if( a*x*x + 2*lim*x - 2*k > 0 ){   l = x;  } else {   s = x;  }  }  return l; }  public void solve() throws IOException {  int a = nextInt();  int v = nextInt();  int l = nextInt();  int d = nextInt();  int w = nextInt();  if( w > v ){  w = v;  }  double time_max = Math.sqrt((double)2*d/a);  double time_d = search1(a,w,d);   double t1 = (time_max*a < w) ? time_max : (v >= (w+a*time_d)/2) ? time_d : (w < v) ? (double)(2*v*v-2*v*w+2*a*d+w*w)/(2*a*v) : (double)v/a + (double)(d-(double)v*v/(2*a))/v;  double lim = (time_max*a < w) ? time_max*a : w;  double t3 = Math.min((double)(v-lim)/a, search2(a, lim, l-d));  double dist2 = (l-d) - t3*t3*a/2 - t3*lim;  double t4 = dist2/v;    writer.println((t1+t3+t4)); }  public static void main(String[] args){  new Traffic().run(); } } abstract class Template implements Runnable{ public abstract void solve() throws IOException;  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);  } }  public int nextInt() throws IOException{  return Integer.parseInt(nextToken()); }  public String nextToken() throws IOException{  while( tokenizer == null || !tokenizer.hasMoreTokens() ){  tokenizer = new StringTokenizer(reader.readLine());  }  return tokenizer.nextToken(); } }
0	public class Hexadecimal {  public static void main(String [] args){   Scanner s = new Scanner(new InputStreamReader(System.in));   int x = s.nextInt();   System.out.println(x + " " + 0 + " " + 0);  } }
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);  }     static int greatestDivisor(int n) {  int limit = (int) Math.sqrt(n);  int max = 1;  for (int i = 2; i <= limit; i++) {  if (n % i == 0) {   max = Integer.max(max, i);   max = Integer.max(max, n / i);  }  }  return max; }    static boolean[] sieveOfEratosthenes(int n) {      boolean prime[] = new boolean[n + 1];  for (int i = 0; i <= n; i++)  prime[i] = true;  prime[0] = false;  prime[1] = false;  for (int p = 2; p * p <= n; p++) {    if (prime[p] == true) {     for (int i = p * p; i <= n; i += p)   prime[i] = false;  }  }  return prime; }    private static int bin_gteq(int[] a, int key) {  int low = 0;  int high = a.length;  int max_limit = high;  while (low < high) {  int mid = low + (high - low) / 2;  if (a[mid] < key) {   low = mid + 1;  } else   high = mid;  }  return high == max_limit ? -1 : high; }  public static int gcd(int a, int b) {  if (a == 0)  return b;  return gcd(b % a, a); }  static class Tuple<X, Y> {  public final X x;  public final Y y;  public Tuple(X x, Y y) {  this.x = x;  this.y = y;  }  public String toString() {  return "(" + x + "," + y + ")";  } }  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 int findMinX(int num[], int rem[], int k) {   int prod = 1;  for (int i = 0; i < k; i++)  prod *= num[i];    int result = 0;    for (int i = 0; i < k; i++) {  int pp = prod / num[i];  result += rem[i] * inv(pp, num[i]) * pp;  }  return result % prod; }   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 long nextLong() {  return Long.parseLong(next());  }  public double nextDouble() {  return Double.parseDouble(next());  }  public String next() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  public String nextLine() {  int c = read();  while (isEndline(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isEndline(c));  return res.toString();  } } }
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);  } } }
3	public class Main {  static PrintWriter out; static InputReader ir;  static void solve() {  int n = ir.nextInt();  int[] a = ir.nextIntArray(n);  Arrays.sort(a);  boolean[] used = new boolean[n];  int ct = 0;  for (int i = 0; i < n; i++) {  if (used[i])   continue;  for (int j = i + 1; j < n; j++) {   if (a[j] % a[i] == 0)   used[j] = true;  }  ct++;  }  out.println(ct); }  public static void main(String[] args) {  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 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;  }  public long[] nextLongArray(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  public char[][] nextCharMap(int n, int m) {  char[][] map = new char[n][m];  for (int i = 0; i < n; i++)   map[i] = next().toCharArray();  return map;  } }  static void tr(Object... o) {  out.println(Arrays.deepToString(o)); } }
6	public class CF11D { 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());  boolean[][] ee = new boolean[n][n];  while (m-- > 0) {  st = new StringTokenizer(br.readLine());  int i = Integer.parseInt(st.nextToken()) - 1;  int j = Integer.parseInt(st.nextToken()) - 1;  ee[i][j] = ee[j][i] = true;  }  long cnt = 0;   for (int i = 2; i < n; i++) {  long[][] dp = new long[1 << i][i];  for (int j = 0; j < i; j++)   dp[0][j] = ee[i][j] ? 1 : 0;    for (int b = 1; b < 1 << i; b++)   for (int j = 0; j < i; j++) {   if ((b & 1 << j) > 0)    continue;   for (int k = 0; k < i; k++) {    if ((b & 1 << k) == 0)    continue;    if (ee[k][j])    dp[b][j] += dp[b ^ 1 << k][k];   }   if (dp[b][j] > 0 && ee[j][i])    cnt += dp[b][j];   }  }  System.out.println(cnt / 2); } }
2	public class Solution {  public static void main (String[] args) throws IOException {   boolean online = "true".equals(System.getProperty("ONLINE_JUDGE"));   if (online) {    in = new InputReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);   }   else {    in = new InputReader(new FileReader("input.txt"));    out = new PrintWriter(new File("output.txt"));   }     new Solution().run();     out.close();  }   long sum (int x) {   return x * 1l * (x+1) / 2;  }   int bins (long n, int k) {   int l = 1,    r = k;   while (l < r) {    int w = (l+r)/2;    long s = sum(k) - sum(w-1);    if (s == n)     return w;    if (s < n)     r = w;    else     l = w+1;   }   return l;  }   private void run () {   long n = in.nextLong();   int k = in.nextInt();   if (n == 1) {    out.println(0);    return;   }   if (1 + sum(k-1) < n) {    out.println(-1);    return;   }   int c = bins(n-1,k-1);   if (1 + sum(k-1) - sum(c-1) == n)    out.println(k-c);   else    out.println(k-c+1);  }   private static InputReader in;  private static PrintWriter out; } class InputReader {  public InputReader (Reader r) {   buff = new BufferedReader(r);   try {    str = new StringTokenizer(buff.readLine());   } catch (IOException e) {    e.printStackTrace();   }  }   public String next () {   while (!str.hasMoreTokens())    try {     str = new StringTokenizer(buff.readLine());    } catch (IOException e) {     e.printStackTrace();    }   return str.nextToken();  }   public int nextInt () {   return Integer.parseInt(this.next());  }   public long nextLong () {   return Long.parseLong(this.next());  }   private static BufferedReader buff;  private static StringTokenizer str; }
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(); } } class TaskB { public void solve(int testNumber, InputReader in, OutputWriter out) {     long n = in.nextLong();   long x = in.nextLong();   long y = in.nextLong();   long c = in.nextLong();     long tl, tr, tt = -1, t;   tl = 0;   tr = (long) 4e9;   while(tl<tr){    t = (tl+tr)>>1;       long cc = f(n, t, x, y);    if(cc>=c){     tt = t;     tr = t;    }else tl = t+1;   }     out.writeln(tt); }     public static long f(long n, long t, long x, long y){     long res = (t*t+t)/2 * 4 + 1;   long s;     if(x-t<1){    s = t-x+1;    res -= s*s;   }   if(y-t<1){    s = t-y+1;    res -= s*s;   }   if(x+t>n){    s = x+t-n;    res -= s*s;   }   if(y+t>n){    s = y+t-n;    res -= s*s;   }   s = t-(Math.abs(x-1)+Math.abs(y-1))-1;   if(s>0) res+=(s*s+s)/2;   s = t-(Math.abs(x-1)+Math.abs(n-y))-1;   if(s>0) res+=(s*s+s)/2;   s = t-(Math.abs(n-x)+Math.abs(n-y))-1;   if(s>0) res+=(s*s+s)/2;   s = t-(Math.abs(n-x)+Math.abs(y-1))-1;   if(s>0) res+=(s*s+s)/2;        return res;  } } 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());  }   } class OutputWriter{  private PrintWriter out;  public OutputWriter(Writer out){   this.out = new PrintWriter(out);  }  public OutputWriter(OutputStream out){   this.out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out)));  }  public void write(Object ... o){   for(Object x : o) out.print(x);  }  public void writeln(Object ... o){   write(o);   out.println();  }  public void close(){   out.close();  } }
4	public class Solution implements Runnable {  public static void main(String... strings) throws InterruptedException {  new Thread(new Solution()).start(); }  BufferedReader in; PrintWriter out; StringTokenizer st;  String next() throws Exception {  if (st == null || !st.hasMoreElements())  st = new StringTokenizer(in.readLine());  return st.nextToken(); }  int nextInt() throws Exception {  return Integer.parseInt(next()); }  double nextDouble() throws Exception {  return Double.parseDouble(next()); }  long nextLong() throws Exception {  return Long.parseLong(next()); }  @Override public void run() {  try {  in = new BufferedReader(new FileReader("input.txt"));  out = new PrintWriter(new FileWriter("output.txt"));  solve();  } catch (Exception e) {  throw new RuntimeException(e);  } finally {  out.close();  } } int n, m, k, xor = 0; boolean[][] used; HashSet<Long> [] set; void solve() throws Exception {  n = nextInt();  m = nextInt();  k = nextInt();  used = new boolean[n][m];  set = new HashSet[2];  for(int i = 0; i < 2; set[i++] = new HashSet<Long>());   for(int i = 0; i < k; i++){  int x = nextInt()-1, y = nextInt()-1;  used[x][y] = true;  set[0].add(10000L*x + y);  }  for (;;xor ^= 1){  set[xor^1].clear();  int ansx = -1, ansy = -1;  for (long i : set[xor]){   int x = (int)(i/10000), y = (int)(i%10000);   if (ansx < 0){   ansx = x+1;   ansy = y+1;   }   add(x+1, y);   add(x-1, y);   add(x, y+1);   add(x, y-1);  }  if (set[xor^1].size() == 0){   out.println(ansx + " " + ansy);   break;  }  } } public void add(int x, int y){  if (!( x >= 0 && y >= 0 && x < n && y < m && !used[x][y])) return;  set[xor^1].add(10000L*x + y);  used[x][y] = true; } }
6	public class Main{  static long N = 100;  static long CNT = 62;  static long INF = 1 << 62;   static long parsenum(long j, long l) {   String k = "";   long cur = 0;   for (int i = (int) j; i <= l; ++i) {    cur *= 10;    cur += k.charAt(i) - '0';   }   return cur;  }  static long gcd(long a, long b) {   if (b == 0) {    return a;   } else {    return gcd(b, a % b);   }  }  static boolean pri(int k) {   if (k == 1) return false;   for (int i = 2; i * i <= k; i++) {    if (k % i == 0) return false;   }   return true;  }  static int[] calcz(String s) {   int l = 0;   int r = 0;   int n = s.length();   int z[] = new int[n];   for (int i = 1; i < n; i++) {    if (i <= r) {     z[i] = Math.min(z[i - l], r - i + 1);    }    while (i + z[i] < n && s.charAt(z[i]) == s.charAt(i + z[i])) z[i]++;    if (i + z[i] - 1 > r) {     l = i;     r = i + z[i] - 1;    }   }   return z;  }  static int[] calcpref(String s) {   int p[] = new int[s.length() + 1];   int n = s.length();   p[0] = 0;   for (int i = 2; i <= n; i++) {    p[i] = p[i - 1];    while (p[i] > 0 && s.charAt(p[i]) != s.charAt(i - 1)) p[i] = p[p[i]];    if (s.charAt(p[i]) == s.charAt(i - 1)) p[i]++;   }   return p;  }  static long MOD = 1000000007;  static long binpow (long a, long n)  {   if (n == 0)    return 1;   if (n % 2 == 1)    return binpow (a % MOD, (n-1) % MOD ) * a % MOD;   else {    long b = binpow(a % MOD, n/2 % MOD) % MOD;    return (b * b) % MOD;   }  } static int maxnum=105; static int a[][] = new int[maxnum][maxnum]; static boolean used[] = new boolean[maxnum];  static int curr , cnt ,n ,m;  static void dfs(int i)  {   int j;   boolean flag;   if(i > n)   {    cnt = curr;    return ;   }   flag=true;   for(j = 1 ; j < i; j++)   {    if (used[j] && a[j][i] == 0)    {     flag = false;     break;    }   }   if(flag)   {    curr++;    used[i]=true;    dfs(i+1);    curr--;   }   if(curr + n - i > cnt)   {    used[i]=false;    dfs(i+1);   }  }   public static void main(String[] args) throws Exception  {    Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter((System.out));   n = in.nextInt();   m = in.nextInt();     for(int i = 1 ; i <= n ; i++)    {     for (int j = 1; j <= n; j++)     {      a[i][j] = in.nextInt();     }    }    dfs(1);    out.printf( "%.10f", (double) m * m * (cnt-1) / (2 * cnt ));    out.println();   out.close();   return;  } }
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];      }   }
1	public class Main3 {  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);      int N = sc.nextInt();   String S = sc.next();   HashSet<Character> unique = new HashSet<>();   for(char c : S.toCharArray()){    unique.add(c);   }   int number = unique.size();   Hashtable<Character, Integer> indexes = new Hashtable<>();   TreeSet<Integer> tree = new TreeSet<>();   int min = N+1;   int total = 0;   for(int i = 0; i<N; i++){    char c = S.charAt(i);    if(!indexes.containsKey(c)){     total++;     indexes.put(c, i);     tree.add(i);    }    else{     int old = indexes.get(c);     indexes.put(c, i);     tree.remove(old);     tree.add(i);    }    if(total == number){     int dist = tree.last() - tree.first() + 1;     min = Math.min(dist, min);    }   }   System.out.println(min);  } }
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);  }  static int lineToInt(String line) {   return Integer.parseInt(line);  }  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();  } }
3	public class Main {  static int bit[];  static int array[];  public static void main(String[] args) throws Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(br.readLine());   bit = new int[1505];   array = new int[n + 1];   StringTokenizer st = new StringTokenizer(br.readLine());   for(int i = 1;i <= n;i++)    array[i] = Integer.parseInt(st.nextToken());   long ans = 0;   for(int i = n;i >= 1;i--){    ans += read(array[i]);    update(array[i]);   }   long val = (ans & 1) + 1000_000;   int m = Integer.parseInt(br.readLine());   StringBuilder sb = new StringBuilder();   for(int i = 1;i <= m;i++){    st = new StringTokenizer(br.readLine());    int l = Integer.parseInt(st.nextToken());    int r = Integer.parseInt(st.nextToken());    long temp = (r - l + 1);    temp = temp*(temp - 1) / 2;    if((temp & 1) == 1)--val;    if((val & 1) == 1)sb.append("odd");    else sb.append("even");    sb.append('\n');   }   System.out.print(sb);  }  static int update(int idx){   int sum = 0;   while(idx < 1501){    bit[idx] += 1;    idx += idx & (-idx);   }   return sum;  }  static int read(int idx){   int sum = 0;   while(idx > 0){    sum += bit[idx];    idx -= idx & (-idx);   }   return sum;  } }
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 long nextLong() throws IOException {return Long.parseLong(next());}  public String nextLine() throws IOException {return br.readLine();}  public boolean ready() throws IOException {return br.ready();}  } }
0	public class MAIN {  public static void main(String args[])  {   Scanner sn=new Scanner(System.in);   int n,n1,n2,n3;   int arr[]={0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811,514229,832040,1346269,2178309,3524578,5702887,9227465,14930352,24157817,39088169,63245986,102334155,165580141,267914296,433494437,701408733,1134903170};   n=sn.nextInt();    if(n==2)   {    n1=n2=1;    n3=0;   }   else if(n==1)   {    n3=n2=0;    n1=1;   }   else if(n==0)   {    n1=n2=n3=0;   }   else if(n==3)   {    n1=n2=n3=1;   }   else   {    int index=bsearch(arr,0,arr.length-1,n);    n1=arr[index-1];    n2=arr[index-3];    n3=arr[index-4];   }   System.out.println(n3+" "+n2+" "+n1);  }  static int bsearch(int arr[],int l,int h,int n)  {   if(l>h)   return -1;   int mid=(l+h)/2;   if(n==arr[mid])   return mid;   else if(n>arr[mid])   return(bsearch(arr,mid+1,h,n));   else   return(bsearch(arr,l,mid-1,n));  } }
4	public class EdF { 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 t = sc.nextInt();  while(t-->0) {   int n = sc.nextInt();      Stack<Integer> st = new Stack<>();   Stack<Integer> temporary = new Stack<>();   for(int j = 0;j<n;j++){    int val = sc.nextInt();    boolean found = false;    while(!st.isEmpty()){    int temp = st.peek();    if (val == temp+1){     found = true;     st.pop();     break;    }    else{     temporary.add(st.pop());    }    }    if (!found){    while(!temporary.isEmpty()){     st.add(temporary.pop());    }    }    st.add(val);    ArrayList<Integer> arr = new ArrayList<>();       for(int s : st){    arr.add(s);    }    for (int s =0 ;s<arr.size()-1;s++){    out.print(arr.get(s));    out.print(".");    }    out.println(arr.get(arr.size()-1));    temporary.clear();   }     }    out.close();    }  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 String[] readArrayString(int n){  String[] array = new String[n];  for(int j =0 ;j<n;j++)  array[j] = sc.next();  return array; } static int[] readArrayInt(int n){  int[] array = new int[n];  for(int j = 0;j<n;j++)   array[j] = sc.nextInt();  return array;  } static int[] readArrayInt1(int n){  int[] array = new int[n+1];  for(int j = 1;j<=n;j++){  array[j] = sc.nextInt();  }  return array; } static long[] readArrayLong(int n){  long[] array = new long[n];  for(int j =0 ;j<n;j++)  array[j] = sc.nextLong();  return array; } static double[] readArrayDouble(int n){  double[] array = new double[n];  for(int j =0 ;j<n;j++)  array[j] = sc.nextDouble();  return array; } static int minIndex(int[] array){  int minValue = Integer.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } static int minIndex(long[] array){  long minValue = Long.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } static int minIndex(double[] array){  double minValue = Double.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } 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; } static void verdict(boolean a){   out.println(a ? "YES" : "NO");  }  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());   }   String nextLine() {    String str = "";    try{     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }    } }
6	public class Main {   static int V; static ArrayList<Integer> adjList [];  static int first(int a){  int idx = 0;  while (a > 0 && (a & 1) == 0) {   idx++;   a>>=1;  }  return idx; } static long Number_Of_Simple_Cycles () {  long dp [][] = new long[1 << V][V];   for (int i = 0 ; i < V ; ++i)  dp[1 << i][i] = 1;   for (int mask = 1 ; mask < 1 << V ; ++mask) {   if (Integer.bitCount(mask) <= 1) continue;   for (int current = 0 ; current < V ; ++current) {   if (((1 << current) & mask) == 0) continue;      for (int last : adjList[current])    if (current != first(mask))    {     dp[mask][current] += dp[mask ^ (1 << current)][last];    }   }  }   long ans = 0 ;  int allVisited = (1 << V) - 1;  for (int mask = 1 ; mask < 1 << V ; ++mask) {  if (Integer.bitCount(mask) < 3) continue;  for (int u = 0 ; u < V ; ++u) {   if (adjList[u].contains(first (mask)))   ans += dp[mask][u];  }  }  return ans >> 1; } public static void main(String[] args) throws Exception {  Scanner sc = new Scanner(System.in);  StringBuilder sb = new StringBuilder();  PrintWriter out = new PrintWriter(System.out);  V = sc.nextInt();  adjList = new ArrayList[V];  for (int i = 0 ; i < V ; ++i) adjList[i] = new ArrayList<>();  int E = sc.nextInt();  while (E -- > 0) {  int v = sc.nextInt() - 1;  int u = sc.nextInt() - 1;  adjList[v].add(u);  adjList[u].add(v);  }  out.print(Number_Of_Simple_Cycles());  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 int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-') {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.') {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public boolean ready() throws IOException {  return br.ready();  }  } }
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");  } }  private static 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 nextLine() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isEndOfLine(c));  return res.toString();  }  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 double nextDouble() {  return Double.parseDouble(nextString());  }  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 printlnArray(int[] arr) {  printArray(arr);  writer.println();  }  public void printlnArray(long[] arr) {  printArray(arr);  writer.println();  }  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(); } }
6	public class Main {  final static boolean debug = false;  final static String fileName = "";  final static 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());  }  public byte nextByte() {   return Byte.parseByte(next());  }  byte[][] nextBitMatrix(int n, int m) {   byte[][] a = new byte[n][m];   for (int i = 0; i < n; i++) {    String s = next();    for (int j = 0; j < m; j++) {     a[i][j] = (byte) (s.charAt(j) - '0');    }   }   return a;  }  char[][] nextCharMatrix(int n, int m) {   char[][] a = new char[n][m];   for (int i = 0; i < n; i++) {    String s = next();    for (int j = 0; j < m; j++) {     a[i][j] = s.charAt(j);    }   }   return a;  }  long[] nextLongArray(int n) {   long[] a = new long[n];   for (int i = 0; i < n; i++)    a[i] = nextLong();   return a;  }  int[] nextIntArray(int n) {   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = nextInt();   return a;  } } 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 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); } }
0	public class CF125D2A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   System.out.println("0 0 " + sc.nextInt());  } }
4	public class A { private static StreamTokenizer in; private static PrintWriter out;  private static int nextInt() throws Exception {  in.nextToken();  return (int) in.nval; }  private static String nextString() throws Exception {  in.nextToken();  return in.sval; }  public static void main(String[] args) throws Exception {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(   System.in)));  out = new PrintWriter(System.out);  String s = nextString();  int max = 0;  for (int i=0; i<s.length(); i++) {  for (int j=i+1; j<=s.length(); j++) {   String u = s.substring(i,j);   if (s.substring(i+1).indexOf(u) >= 0) {   max = Math.max(max, u.length());   }  }  }  out.println(max);   out.flush(); } }
6	public class C {  static boolean[][] matrix;  static long[][] dp;  static int n;  static int m;  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   n = s.nextInt();   m = s.nextInt();   matrix = new boolean[n][n];   for (int i=0; i<m; ++i) {    int v1 = s.nextInt()-1;    int v2 = s.nextInt()-1;    matrix[v1][v2] = true;    matrix[v2][v1] = true;   }   dp = new long[n][1<<n+1];   for (int i=0; i<n; ++i) Arrays.fill(dp[i], -1);     long res = 0;   for (int i=0; i<n; ++i)    res += calc(i, i, (1<<i), 1);     System.out.println(res/2);  }   public static long calc(int h, int c, int m, int len) {   if (dp[c][m] != -1)    return dp[c][m];     long ret = 0;   if (len > 2 && matrix[c][h])    ret = 1;   for (int i=h+1; i<n; ++i)    if ((m & (1<<i)) == 0 && matrix[c][i])     ret += calc(h, i, m | (1<<i), len + 1);   return dp[c][m] = ret;  } }
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 leftNormal() {  return new P(-y, x);  }   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);  }  P rotateCW(double sinT, double cosT) {  return rotateCCW(-sinT, cosT);  }  P rotate(double theta) {  return rotateCCW(sin(theta), cos(theta));  }    double theta() {  return atan2(y, x);  }    double angleTo(P a) {  return acos(this.dot(a) / this.length() / a.length());  }  boolean isOrigin() {  return x == 0 && y == 0;  }  public String toString() {  return String.format("(%f,%f)", this.x, this.y);  }  static P read(Scanner s) {  return new P(s.nextDouble(), s.nextDouble());  }  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);  }  P half(P q) {  return normalize().add(q.normalize());  }  double dist(P to) {  return sub(to).length();  }  double signedParallelogramArea(P b, P c) {  return (b.sub(this).crossproduct(c.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;  }  double signedTriangleArea(P b, P c) {  return signedParallelogramArea(b, c) / 2.0;  }     double dist2(P to) {  double dx = this.x - to.x;  double dy = this.y - to.y;  return dx * dx + dy * dy;  }    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 class HP extends P {  HP(double x, double y) {  super(x, y);  }  @Override  public int hashCode() {  return Double.hashCode(x + 32768 * y);  }  @Override  public boolean equals(Object _that) {  HP that = (HP) _that;  return this.x == that.x && this.y == that.y;  } }   static Comparator<P> makePolarAngleComparatorTrig(final P center) {  return new Comparator<P>() {  public int compare(P a, P b) {   double thetaa = a.sub(center).theta();   double thetab = b.sub(center).theta();   if (thetaa < 0)   thetaa += 2 * PI;   if (thetab < 0)   thetab += 2 * PI;   int c = Double.compare(thetaa, thetab);   if (c != 0)   return c;   return Double.compare(b.x, a.x);   }  }; }   static Comparator<P> makePolarAngleComparator(final P center) {  return new Comparator<P>() {  public int compare(P a, P b) {     if (a.y >= center.y && b.y < center.y)   return -1;   if (b.y >= center.y && a.y < center.y)   return 1;   int orientation = (int) Math.signum(center.signedParallelogramArea(b, a));   if (orientation != 0)   return orientation;   return Double.compare(b.x, a.x);   }  }; }   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 reflectPoint(P r) {  return reflect(r.sub(p)).add(p);  }    P project(P a) {  return p.add(d.project(a.sub(p)));  }    double distance(P a) {  return project(a).dist(a);  }  @Override  public String toString() {  return String.format("[%s => %s]", p, q);  }    P intersectsInBounds(Line l) {  double[] st = intersectionParameters(l);  if (st == null)   return null;       double s = st[0];  double t = st[1];  if (s >= -EPS && s <= 1 + EPS && -EPS <= t && t <= 1 + EPS)   return getPointFromParameter(s);   return null;  }    P intersects(Line l) {  double[] st = intersectionParameters(l);  if (st != null)   return getPointFromParameter(st[0]);  return null;  }    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)) };  }    P[] intersectsCircleAlternative(Circle c) {  P ca = c.c.sub(p);  P d = q.sub(p);  Double[] t = solvequadratic(d.length2(), -2 * d.dot(ca), ca.length2() - c.R * c.R);  P[] r = new P[t.length];  for (int i = 0; i < t.length; i++)   r[i] = p.add(d.scale(t[i]));  return r;  }    boolean isInBounds(P r) {  return abs(p.dist(q) - p.dist(r) - q.dist(r)) <= EPS;  }    boolean isOnLine(P r) {  return r.isCollinearWith(p, q);  } }   static class GLine {   P n;  double c;  GLine(double a, double b, double c) {  this.n = new P(a, b);  if (a == 0 && b == 0)   throw new Error("a and b cannot both be zero");  this.c = c;  }  GLine(P p, P q) {  this(p.y - q.y, q.x - p.x, p.det(q));  }  P intersects(GLine that) {  double D = n.det(that.n);  if (D == 0.0)   return null;  return new P((this.n.y * that.c - that.n.y * this.c) / D, (that.n.x * this.c - this.n.x * that.c) / D);  }  double signedDistance(P p) {  return (n.dot(p) + c) / n.length();  }  double distance(P p) {  return abs(signedDistance(p));  }    boolean isOnLine(P p) {  return signedDistance(p) <= EPS;  }    boolean onSameSide(P p, P q) {  return signum(signedDistance(p)) == signum(signedDistance(q));  }     double theta() {  double angle = atan2(n.x, -n.y);  return angle < 0 ? (angle + PI) : angle;  }    boolean parallelWith(GLine that) {  return n.det(that.n) <= EPS;  }    boolean perpendicularTo(GLine that) {  return n.dot(that.n) <= EPS;  }     P[] intersectsCircle(Circle C) {    double c = n.dot(C.c) + this.c;  double n2 = n.length2();  double r = C.R;   P p = n.scale(-c / n2).add(C.c);   if (c * c > r * r * n2 + EPS) {   return new P[] {};  } else if (abs(c * c - r * r * n2) < EPS) {   return new P[] { p };  } else {   double d = r * r - c * c / n2;   double m = sqrt(d / n2);   P q = n.rightNormal().scale(m);   return new P[] { p.add(q), p.sub(q) };  }  }  @Override  public String toString() {  return String.format("Line:(n=%s C=%f)", n, c);  } }  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;  }    boolean isOnCircle(P p) {  return abs(p.dist(c) - R) <= EPS;  }    boolean isOutside(Line l) {  if (isInside(l.p) || isInside(l.q))   return false;  P[] _is = l.intersectsCircle(this);  if (_is.length > 1)   for (P is : _is)   if (l.isInBounds(is))    return false;  return true;  }    Line[] tangentLines(P p) {          P[] r = p.sub(c).solveDotProductConstrainedByNorm(-R * R, R);  Line[] tangents = new Line[r.length];  for (int i = 0; i < tangents.length; i++)   tangents[i] = new Line(p, c.add(r[i]));  return tangents;  }    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;  }    P[] intersectsCircleAlternative(Circle that) {  P m = that.c.sub(this.c);  double b = this.R * this.R;    double e = (m.length2() + b - that.R * that.R) / 2 / m.length();  double f = sqrt(b - e * e);   P[] is = new P[2];  P mid = this.c.add(m.scaleToLength(e));  P midn = m.rightNormal();  for (int i = 0; i < is.length; i++) {   is[i] = mid.add(midn.scaleToLength(f));   f *= -1;  }  return is;  }    boolean isOutside(Circle that) {  return this.c.dist(that.c) > (this.R + that.R);  }    boolean isContainedIn(Circle that) {    P m = this.c.sub(that.c);  return that.isInside(this.c.add(m.scaleToLength(this.R)));  }    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 Circle minEnclosingCircle(P[] p) {  if (p.length == 0)   return new Circle(new P(0, 0), 0);  if (p.length == 1)   return new Circle(p[0], 0);  Collections.shuffle(Arrays.asList(p));  Circle circle = getCircumCircle(p[0], p[1]);  for (int i = 2; i < p.length; i++) {   if (!circle.isInside(p[i])) {   circle = getCircumCircle(p[0], p[i]);   for (int j = 1; j < i; j++) {    if (!circle.isInside(p[j])) {    circle = getCircumCircle(p[j], p[i]);    for (int k = 0; k < j; k++) {     if (!circle.isInside(p[k])) {     circle = getCircumCircle(p[i], p[j], p[k]);     }    }    }   }   }  }  return circle;  } }   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;  }  double absoluteArea() {  return abs(signedArea());  }    public Polygon convexHull() {  if (p.length < 2)   return null;     final P min = Collections.min(Arrays.asList(p), new Comparator<P>() {   public int compare(P p1, P p2) {   int y = Double.valueOf(p1.y).compareTo(p2.y);   return y != 0 ? y : Double.valueOf(p1.x).compareTo(p2.x);   }  });     Arrays.sort(p, new Comparator<P>() {   public int compare(P p1, P p2) {   double o = min.signedParallelogramArea(p1, p2);    if (o != 0)    return -(int) Math.signum(o);       return Double.valueOf(min.dist(p1)).compareTo(min.dist(p2));   }  });     Stack<P> hull = new Stack<P>();  assert p[0] == min;  hull.push(p[0]);  hull.push(p[1]);     for (int i = 2; i < p.length; i++) {   P next = p[i];   while (hull.size() >= 2) {   P snd = hull.get(hull.size() - 2);   P top = hull.peek();   if (snd.isCCW(top, next))    break;    hull.pop();   }     hull.push(next);  }  return new Polygon(hull);  }    public boolean contains(P q) {  return contains_WN(q);  }    private boolean contains_CN(P q) {  boolean c = false;  for (int i = 0, j = p.length - 1; i < p.length; j = i++) {   if ((((p[i].y <= q.y) && (q.y < p[j].y)) || ((p[j].y <= q.y) && (q.y < p[i].y)))    && (q.x < (p[j].x - p[i].x) * (q.y - p[i].y) / (p[j].y - p[i].y) + p[i].x))   c = !c;  }  return c;  }    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;  }    public boolean onBoundary(P q) {  int n = p.length;  for (int i = 0; i < n; i++) {   P pi = this.p[i], pj = this.p[(i + 1) % n];   if (new Line(pi, pj).isInBounds(q))   return true;  }  return false;  }  @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());  }  String readNextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }  int[] readIntArray(int n) {  int[] a = new int[n];  for (int idx = 0; idx < n; idx++) {   a[idx] = nextInt();  }  return a;  }  long[] readLongArray(int n) {  long[] a = new long[n];  for (int idx = 0; idx < n; idx++) {   a[idx] = nextLong();  }  return a;  } } }
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);  }}
5	public class A { private Scanner in; private PrintWriter out;  public void solve() {  int n = ni();  int t = ni();  Pair[] p = new Pair[n];  for(int i = 0;i < n;i++){  p[i] = new Pair();  p[i].x = ni();  p[i].a = ni();  }  Arrays.sort(p);   int ct = 2;  for(int i = 0;i < n - 1;i++){  float d = p[i + 1].x - (float)p[i + 1].a / 2 - p[i].x - (float)p[i].a / 2;  if(Math.abs(d - t) < EPS){   ct++;  }else if(d > t){   ct += 2;  }  }   out.println(ct); }  double EPS = 0.0001;  private static class Pair implements Comparable<Pair> {  public int x;  public int a;   @Override  public int compareTo(Pair o) {  return x - o.x;  } }  public void run() throws Exception {  in = new Scanner(System.in);  System.setOut(new PrintStream(new BufferedOutputStream(System.out)));  out = new PrintWriter(System.out);    int n = 1;  for(int i = 1;i <= n;i++){  long t = System.currentTimeMillis();  solve();  out.flush();  } }   public static void main(String[] args) throws Exception {  new A().run(); }  private int ni() { return Integer.parseInt(in.next()); } private static void tr(Object... o) { System.out.println(o.length == 1 ? o[0] : Arrays.toString(o)); } }
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 [] input = new int[n];  int total = 0;  for (int i = 0; i < n; ++i){  input[i] = in.nextInt();  total +=input[i];  }  Arrays.sort(input);  int res = 0;  int now = 0;  for (int i = n - 1; i >= 0; --i){  now += input[i];  int left = total - now;  ++res;  if (now > left){   break;  }  }  out.println(res);  return; } }
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()); }   long nextLong(){ return Long.parseLong(next()); }  }  FastScanner sc;  PrintWriter out;   public static void main(String[] args){   new Main().run();     }   void TLE(){ for(;;); }  void MLE(){   int[][] adj = new int[1024*1024][];   for( int i = 0; i < adj.length; ++i )    adj[i] = new int[1024*1024];  }  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 );  }  }
1	public class ProblemB {  Map<Integer, List<int[]>> dest;  private ProblemB() throws IOException {   BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));   String h = rd.readLine();   String[] q = h.split("\\s+");   int a = Integer.parseInt(q[1]);   int b = Integer.parseInt(q[2]);   h = rd.readLine();   q = h.split(" ");   int n = q.length;   int[] p = new int[n];   for(int i=0;i<n;i++) {    p[i] = Integer.parseInt(q[i]);   }   Set<Integer> pset = new HashSet<>();   for(int x: p) {    pset.add(x);   }   if(a == b) {    boolean res = true;    for(int x: p) {     if(!pset.contains(a-x)) {      res = false;      break;     }    }    out(res?"YES":"NO");    if(res) {     StringBuilder buf = new StringBuilder();     for(int i=0;i<n;i++) {      if(i > 0) {       buf.append(' ');      }      buf.append('0');     }     out(buf);    }   } else {    dest = new HashMap<>();    boolean res = true;    for(int x: p) {     boolean aOk = pset.contains(a-x);     boolean bOk = pset.contains(b-x);     if(!aOk && !bOk) {      res = false;      break;     } else {      if(aOk) {       addEdgeAndBack(x,a-x,0);      }      if(bOk) {       addEdgeAndBack(x,b-x,1);      }     }    }    Set<Integer> aSet = new HashSet<>();    if(res) {     for(int x: p) {      List<int[]> e = getEdges(x);      if(e.size() == 1) {       int[] edge = e.get(0);       if(edge[0] == x) {        if(edge[1] == 0) {         aSet.add(x);        }       } else {        boolean odd = true;        int curA = edge[1];        int prev = x;        while(true) {         int cur = edge[0];         if(curA == 0 && odd) {          aSet.add(prev);          aSet.add(cur);         }         e = getEdges(cur);         if(e.size() == 1) {          if(!odd && e.get(0)[0] != cur) {           res = false;          }          break;         }         int other = e.get(0)[0] == prev?1:0;         edge = e.get(other);         if(edge[1] == curA) {          res = false;          break;         }         curA = 1-curA;         prev = cur;         odd = !odd;        }        if(!res) {         break;        }       }      }     }    }    out(res?"YES":"NO");    if(res) {     StringBuilder buf = new StringBuilder();     for(int i=0;i<n;i++) {      if(i>0) {       buf.append(' ');      }      buf.append(aSet.contains(p[i])?'0':'1');     }     out(buf);    }   }  }  private void addEdgeAndBack(int from, int to, int u) {   addEdge(from, to, u);   addEdge(to, from, u);  }  private void addEdge(int from, int to, int u) {   List<int[]> edges = getEdges(from);   for(int[] edge: edges) {    if(edge[0] == to) {     return;    }   }   edges.add(new int[] { to, u });  }  private List<int[]> getEdges(int from) {   List<int[]> ds = dest.get(from);   if(ds == null) {    ds = new ArrayList<>();    dest.put(from, ds);   }   return ds;  }  private static void out(Object x) {   System.out.println(x);  }  public static void main(String[] args) throws IOException {   new ProblemB();  } }
1	public class Main{   public static void main(String[] args){   Scanner in = new Scanner(System.in);   int[] a=new int[1010];   while(in.hasNext()){    int n=in.nextInt();    String s=in.next();    int sum=0;    for(int i=0;i<n;++i){     if(s.charAt(i)=='H'){      a[i]=1;      ++sum;     }     else a[i]=0;    }    int min=10010;    for(int i=0;i<n-sum;++i){     int count=0;     for(int j=i+sum;j<n;++j){      if(a[j]==1)++count;     }     for(int j=0;j<i;++j){      if(a[j]==1)++count;     }     if(count<min)min=count;    }    sum=n-sum;    for(int i=0;i<n-sum;++i){     int count=0;     for(int j=i+sum;j<n;++j){      if(a[j]==0)++count;     }     for(int j=0;j<i;++j){      if(a[j]==0)++count;     }     if(count<min)min=count;    }    System.out.println(min);   }  } }
2	public class B2 {    public static void main(String[] args) {     Scanner scan = new Scanner(System.in);   BigInteger n = new BigInteger(scan.next());   BigInteger k = new BigInteger(scan.next());   BigInteger a = k.subtract(bi(1));   BigInteger lim = k.multiply(a).divide(bi(2));   lim = lim.add(bi(1));     if (n.compareTo(lim)>0){    System.out.println(-1);   }   else {    if (n.equals(1)){     System.out.println(0);    }    else {     BigInteger remain2 = lim.subtract(n).add(bi(1));     remain2 = remain2.multiply(bi(2));         double temp = remain2.doubleValue();         long flr = (long)Math.sqrt(temp);         BigInteger flr2 = bi(flr);     BigInteger rnd2 = remain2.subtract(flr2.multiply(flr2));     long rnd = remain2.longValue()-flr*flr;              if (rnd2.compareTo(flr2)<=0){      System.out.println(k.subtract(flr2) );     }     else {      System.out.println(k.subtract(flr2.add(bi(1) ) ) );     }    }   }  }  public static BigInteger bi(int n1){   return new BigInteger(""+n1);  }  public static BigInteger bi(long n1){   return new BigInteger(""+n1);  } }
4	public class Main {  static boolean LOCAL = false;  Scanner sc = new Scanner(System.in);   void run() {   char[] cs = sc.nextLine().toCharArray();   int res = 0;   for (int s1 = 0; s1 < cs.length; s1++) {    for (int s2 = s1 + 1; s2 < cs.length; s2++) {     int len = 0;     while (s2 + len < cs.length && cs[s1 + len] == cs[s2 + len]) {      len++;     }     res = max(res, len);    }   }   System.out.println(res);  }   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 RuntimeException(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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }  }   void debug(Object...os) {   System.err.println(deepToString(os));  }   public static void main(String[] args) {   if (LOCAL) {    try {     System.setIn(new FileInputStream("in.txt"));    } catch (Throwable e) {     LOCAL = false;    }   }   if (!LOCAL) {    try {     Locale.setDefault(Locale.US);     System.setOut(new PrintStream(new BufferedOutputStream(System.out)));    } catch (Throwable e) {    }   }   new Main().run();   System.out.flush();  } }
1	public class Homyak implements Runnable {  private void solve() throws IOException {   int n = nextInt();   String seq = nextToken();   int nh = 0;   int nt = 0;   for (int i = 0; i < n; ++i)    if (seq.charAt(i) == 'H')     ++nh;    else     ++nt;   int res = n;   for (int delta = 0; delta < n; ++delta) {    int changed = 0;    int at = delta;    for (int i = 0; i < nh; ++i) {     if (seq.charAt(at) != 'H')      ++changed;     ++at;     if (at >= n)      at = 0;    }    for (int i = 0; i < nt; ++i) {     if (seq.charAt(at) != 'T')      ++changed;     ++at;     if (at >= n)      at = 0;    }    res = Math.min(res, changed / 2);   }   writer.println(res);  }  public static void main(String[] args) {   new Homyak().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();  } }
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(); }   public static void debug(Object... os){  System.err.println(Arrays.deepToString(os)); } }
2	public class Main {  static long m = 1000000007;  static long powmod(long x, long y, long p)  {     long res = 1;        x = x % p;   while (y > 0)   {           if((y & 1)==1)     res = (res * x) % p;           y = y >> 1;    x = (x * x) % p;   }   return res;  }  static long mulmod(long a, long b, long mod){   long res=0;   a = a % mod;   while (b > 0)   {       if (b % 2 == 1)     res = (res + a) % mod;        a = (a * 2) % mod;        b /= 2;   }      return res % mod;  }  public static void main(String args[] ) throws Exception {   Scanner sc = new Scanner(System.in);   long x = sc.nextLong();   long k = sc.nextLong();   if(x>0) {    long d= powmod(2,k,m);    long ans= mulmod(d,2,m)%m;    ans= mulmod(ans,x,m)%m;    ans++;    ans%=m;    ans= (ans-d+m)%m;    System.out.println(ans);   }   else    System.out.println(0);  } }
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); } }
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));     StringTokenizer st = new StringTokenizer(f.readLine());  BigInteger l = new BigInteger(st.nextToken());  BigInteger r = new BigInteger(st.nextToken());     if (r.subtract(l).intValue()<2 || (r.subtract(l).intValue()==2 && r.mod(new BigInteger("2")).intValue()==1)) out.println(-1);  else out.println(l.add(l.mod(new BigInteger("2"))).toString()+" "+l.add(l.mod(new BigInteger("2"))).add(new BigInteger("1")).toString()+" "+l.add(l.mod(new BigInteger("2"))).add(new BigInteger("2")).toString());     out.close();  System.exit(0); } }
4	public class Main implements Runnable {  public void _main() throws IOException {  String s = next();  for (int len = s.length(); len >= 1; len--) {  for (int i = 0; i + len <= s.length(); i++)   for (int j = i + 1; j + len <= s.length(); j++)   if (s.substring(i, i + len).equals(s.substring(j, j + len))) {    out.print(len);    return;   }  }  out.print(0); }  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 int nextInt() throws IOException {  return Integer.parseInt(next()); }  private long nextLong() throws IOException {  return Long.parseLong(next()); }  private double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static void main(String[] args) {  new Thread(new Main()).start(); }  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   _main();   out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(202);  } } }
4	public class Main implements Runnable {   BufferedReader in;  PrintWriter out;  StringTokenizer tok = new StringTokenizer("");  void init() throws FileNotFoundException {    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());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }   public static void mergeSort(int[] a) {    mergeSort(a, 0, a.length - 1);  }  private static void mergeSort(int[] a, int leftIndex, int rightIndex) {    final int MAGIC_VALUE = 50;    if (leftIndex < rightIndex) {      if (rightIndex - leftIndex <= MAGIC_VALUE) {        insertionSort(a, leftIndex, rightIndex);      } else {        int middleIndex = (leftIndex + rightIndex) / 2;        mergeSort(a, leftIndex, middleIndex);        mergeSort(a, middleIndex + 1, rightIndex);        merge(a, leftIndex, middleIndex, rightIndex);      }    }  }  private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {    int length1 = middleIndex - leftIndex + 1;    int length2 = rightIndex - middleIndex;    int[] leftArray = new int[length1];    int[] rightArray = new int[length2];    System.arraycopy(a, leftIndex, leftArray, 0, length1);    System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);    for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {      if (i == length1) {        a[k] = rightArray[j++];      } else if (j == length2) {        a[k] = leftArray[i++];      } else {        a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];      }    }  }  private static void insertionSort(int[] a, int leftIndex, int rightIndex) {    for (int i = leftIndex + 1; i <= rightIndex; i++) {      int current = a[i];      int j = i - 1;      while (j >= leftIndex && a[j] > current) {        a[j + 1] = a[j];        j--;      }      a[j + 1] = current;    }  }   public static void main(String[] args) {   new Main().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);   }  }  int mini = Integer.MAX_VALUE;  int maxi = Integer.MIN_VALUE;  int ans = 0;  int ans2 = 0;  int sum = 0;  void solve() throws IOException {   int n = readInt();   int m = readInt();   int maxi=0;   int [][] a = new int [n][m];   int k = readInt();   ArrayDeque<Point> dq = new ArrayDeque<Point> ();   Point p = new Point();   for (int i = 0; i<n; i++)    for (int j= 0; j<m; j++){     a[i][j]=Integer.MAX_VALUE;    }   for (int i = 0; i<k; i++){    int x = readInt()-1;    int y = readInt()-1;    p.x=x;    p.y=y;    dq.add(new Point(x,y));    a[x][y]=0;   }   while (!dq.isEmpty()){    Point v = dq.pollFirst();    Point u = new Point();    if (v.x-1!=-1) {     if (a[v.x-1][v.y]>a[v.x][v.y]+1){      a[v.x-1][v.y]=a[v.x][v.y]+1;      maxi=max(maxi,a[v.x-1][v.y]);      u.x=v.x-1;      u.y=v.y;      dq.add(new Point(u.x,u.y));     }    }    if (v.y-1!=-1) {     if (a[v.x][v.y-1]>a[v.x][v.y]+1){      a[v.x][v.y-1]=a[v.x][v.y]+1;      maxi=max(maxi,a[v.x][v.y-1]);      u.y=v.y-1;      u.x=v.x;      dq.add(new Point(u.x,u.y));     }    }    if (v.x+1!=n) {     if (a[v.x+1][v.y]>a[v.x][v.y]+1){      a[v.x+1][v.y]=a[v.x][v.y]+1;      maxi=max(maxi,a[v.x+1][v.y]);      u.x=v.x+1;      u.y=v.y;      dq.add(new Point(u.x,u.y));     }    }    if (v.y+1!=m) {     if (a[v.x][v.y+1]>a[v.x][v.y]+1){      a[v.x][v.y+1]=a[v.x][v.y]+1;      maxi=max(maxi,a[v.x][v.y+1]);      u.y=v.y+1;      u.x=v.x;      dq.add(new Point(u.x,u.y));     }    }   }   for (int i =0; i<n; i++)    for (int j =0; j<m; j++){     if (maxi==a[i][j]) {      out.print((i+1) + " " + (j+1));      return;     }    }     }             char c[];   void per (int left, int right){   if(left == right){    for (int i = 0; i<=right;i++){     out.print(c[i]);    }    out.println();   }   else {    for (int i = left; i <=right; i++){     char k = c[left];     c[left] = c[i];     c[i] = k;     per(left+1,right);     k = c[left];     c[left] = c[i];     c[i] = k;    }   }  } }
4	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);   String s = in.next();  int n = s.length();  int max = 0;  for (int i = 1; i < n; i++) {  String[] subs = new String[n - i + 1];  for (int j = 0; j + i <= n; j++) subs[j] = s.substring(j, j + i);  Arrays.sort(subs);  boolean flag = false;  for (int j = 0; j < n - i; j++)   if (subs[j].equals(subs[j + 1])) flag = true;  if (flag) max = Math.max(max, i);  }  out.println(max);  out.close(); } }
2	public class ProblemB {   public static void main(String[] args) throws IOException {   BufferedReader s = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(System.out);   String[] line = s.readLine().split(" ");   long n = Long.valueOf(line[0]);   long y = Long.valueOf(line[1]);   long x = Long.valueOf(line[2]);   long c = Long.valueOf(line[3]);     long min = 0;   long max = n*2L+20;   for (int cnt = 0 ; cnt < 300 ; cnt++) {    long med = (min+max) / 2L;    long ct = isok(med, n, x, y, c);    if (ct >= c) {     max = med;    } else {     min = med+1;    }   }     long lst = max;   for (long d = -2 ; d <= 2 ; d++) {    if (max+d >= 0 && isok(max+d, n, x, y, c) >= c) {     lst = Math.min(lst, max+d);    }   }     out.println(lst);   out.flush();  }    private static long isok(long time, long n, long x, long y, long c) {   long total = time * 2 * (time + 1) + 1;   long top = y - time;   if (top <= 0) {    long dy = Math.abs(top)+1;    total -= dy*dy;    long over = dy - x;    if (over >= 1) {     total += (1L + over) * over / 2;    }    over = dy - ((n + 1) - x);    if (over >= 1) {     total += (1L + over) * over / 2;    }   }     long bottom = y + time;   if (bottom > n) {    long dy = Math.abs(bottom-n);    total -= dy*dy;    long over = dy - x;    if (over >= 1) {     total += (1L + over) * over / 2;    }    over = dy - ((n + 1) - x);    if (over >= 1) {     total += (1L + over) * over / 2;    }   }     long left = x - time;   if (left <= 0) {    long dy = Math.abs(left)+1;    total -= dy*dy;   }   long right = x + time;   if (right > n) {    long dy = Math.abs(right-n);    total -= dy*dy;   }   return total;  }  public static void debug(Object... os){   System.err.println(Arrays.deepToString(os));  } }
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(),k=in.nextInt()-1,i;   scores a[]=new scores[n];   for(i=0;i<n;i++)    a[i]=new scores(in.nextInt(),in.nextInt());   Arrays.sort(a);     int c=1;   for(i=k-1;i>=0;i--)   {    if(a[i].p==a[k].p&&a[i].t==a[k].t)     c++;    else break;   }   for(i=k+1;i<n;i++)   {    if(a[i].p==a[k].p&&a[i].t==a[k].t)     c++;    else break;   }   out.println(c);  }  class scores implements Comparable<scores>  {   int p,t;   public scores(int p,int t)   {    this.p=p;    this.t=t;   }   public int compareTo(scores a)   {    if(a.p>this.p)     return 1;    if(a.p==this.p&&a.t<this.t)     return 1;    return -1;   }  } }
0	public class A { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  long l = sc.nextLong(), r = sc.nextLong();  if (l % 2 == 0 && r - l >= 2) {  System.out.println(l + " " + (l + 1) + " " + (l + 2));  } else if (l % 2 == 1 && r - l >= 3) {  System.out.println(l + 1 + " " + (l + 2) + " " + (l + 3));  } else {  System.out.println(-1);  } } }
2	public class Contest176B {  public static void main(String[] args) throws IOException{   Scanner sc = new Scanner(System.in);   long n = sc.nextLong();   int k = sc.nextInt();     if( ((long)k * (long)(k + 1))/2 - 1 - (k - 2) < n){    System.out.println(-1);    return;   }     if(n == 1) {    System.out.println(0);    return;   }     if(n <= k) {    System.out.println(1);    return;      }     int ans = rek(2, k, n, k);     System.out.println(ans);  }   private static int rek(int s, int e, long n, int k){     if(s == e){    return k - s + 1;   }   if(s + 1 == e){    if(sum(e, k) >= n) return k - e + 1;    return k - s + 1;   }   int m = (s + e)/2;     long ans = sum(m, k);     if(ans == n) return k - m + 1;   if(ans < n) return rek(s, m - 1, n, k);   else return rek(m , e, n, k);       }  private static long sum(int a, int b ){   long sum1 = ((long)a * (long)(a - 1))/2;   long sum2 = ((long)b * (long)(b + 1))/2;   int numelement = b - a + 1;     return sum2 - sum1 - (numelement - 1);  }    }
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);   CNastyaAndAWardrobe solver = new CNastyaAndAWardrobe();   solver.solve(1, in, out);   out.close();  }  static class CNastyaAndAWardrobe {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    long mod = (long) (1e9 + 7);    long n = in.nextLong();    long k = in.nextLong();    if (n == 0) {     out.println(0);     return;    }    long c = (((2 * n - 1) % mod) * pow(2L, k, mod)) % mod + 1;    c %= mod;    out.println(c);   }   public long pow(long a, long b, long mod) {    long result = 1;    while (b > 0) {     if (b % 2 != 0) {      result *= a;      result %= mod;      b--;     }     a *= a;     a %= mod;     b /= 2;    }    return result % mod;   }  }  static class FastScanner {   private BufferedReader br;   private StringTokenizer st;   public FastScanner(InputStream inputStream) {    br = new BufferedReader(new InputStreamReader(inputStream));   }   public String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   public long nextLong() {    return Long.parseLong(next());   }  } }
4	public class Practice { public static long mod = (long) Math.pow(10, 9) + 7; public static long tt = 0;  public static void main(String[] args) throws Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter pw = new PrintWriter(System.out);  int c = 1;  int t = Integer.parseInt(br.readLine());  while (t-- > 0) {  int n = Integer.parseInt(br.readLine());  HashMap<Integer, Integer> map = new HashMap<>();    int curr = 0;  for (int i = 0; i < n; i++) {   int tt = Integer.parseInt(br.readLine());   if (tt == 1) {   curr++;   map.put(curr, 1);   } else {   ArrayList<Integer> list = new ArrayList<Integer>(map.keySet());   Collections.sort(list);   for (int a = list.size() - 1; a >= 0; a--) {    if (map.get(list.get(a)) == tt - 1) {    map.put(list.get(a), tt);    break;    } else {    curr--;    map.remove(list.get(a));    }   }   }   ArrayList<Integer> list = new ArrayList<Integer>(map.keySet());   Collections.sort(list);   StringBuilder str=new StringBuilder();   for(int a=0;a<list.size();a++) {   if(list.size()-1==a) {    str.append(map.get(list.get(a)));    continue;   }   str.append(map.get(list.get(a))+".");   }pw.println(str);   }  }  pw.close(); }        }
0	public class Main {  public static void main(String[] args) throws Exception {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int res = n;  String str = Integer.toString(n);  res = Math.max(res, Integer.parseInt(str.substring(0, str.length() - 1)));  res = Math.max(res, Integer.parseInt(str.substring(0, str.length() - 2) + str.substring(str.length() - 1)));  System.out.println(res); } }
1	public class C { String line; StringTokenizer inputParser; BufferedReader is; FileInputStream fstream; DataInputStream in;  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; }  String NextString() {  String n = inputParser.nextToken();  return n; }  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];  C c = new C(filePath); }  public C(String inputFile) {   openInput(inputFile);    readNextLine();  int N=NextInt();  boolean [] p = new boolean[N];  readNextLine();  int h=0;  for(int i=0; i<N; i++)  {  p[i]=line.charAt(i)=='H';  if(p[i])h++;  }     int ret=N;   for(int i=0; i<N; i++)  {  int m=0;  for(int j=i; j<i+h; j++)  {   int n=j%N;   if(!p[n])m++;  }  ret=Math.min(ret, m);  }   System.out.println(ret);  closeInput(); }   }
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);   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();    int[] a = new int[n];    for (int i = 0; i < n; ++i) a[i] = in.nextInt();    boolean[] done = new boolean[n];    int res = 0;    while (true) {     int bi = -1;     for (int i = 0; i < n; ++i)      if (!done[i]) {       if (bi < 0 || a[i] < a[bi]) bi = i;      }     if (bi < 0) break;     ++res;     for (int i = 0; i < n; ++i) if (!done[i] && a[i] % a[bi] == 0) done[i] = true;    }    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();   }   public int nextInt() {    return Integer.parseInt(next());   }  } }
6	public class EdC { static long[] mods = {1000000007, 998244353, 1000000009}; static long mod = mods[0]; public static MyScanner sc;  public static PrintWriter out;  static char[][] grid;  static int n;  static int t;  static int[][] dp;  static int[] times;  static int[] genre; public static void main(String[] omkar) throws Exception{    sc = new MyScanner();  out = new PrintWriter(System.out);  n = sc.nextInt();  t = sc.nextInt();  times = new int[n];  genre = new int[n];  for(int j =0 ;j<n;j++){   times[j] = sc.nextInt();   genre[j] = sc.nextInt();   }  dp = new int[1<<n][4];  for(int j = 0;j<1<<n;j++)   Arrays.fill(dp[j], -1);  int ans = 0;  for(int j=0;j<1<<n;j++){   int time = 0;   for(int k = 0;k<n;k++){   if (((1<<k) & j) != 0){    time+=times[k];   }   }   if (time == t){   letsgodp(j, 1);   letsgodp(j, 2);   letsgodp(j, 3);   ans+=dp[j][1];   ans%=mod;   ans+=dp[j][2];   ans%=mod;   ans+=dp[j][3];   ans%=mod;   }  }  out.println(ans);  out.close();  } public static void letsgodp(int mask, int dg){  if (dp[mask][dg] != -1)  return;  dp[mask][dg] = 0;  for(int j = 0;j<n;j++){  if (((1<<j) & mask) != 0 && genre[j] == dg){   int submask = mask - (1<<j);   int og1 = genre[j]+1 > 3 ? genre[j]-2 : genre[j]+1;   int og2 = genre[j]+2 > 3 ? genre[j]-1 : genre[j]+2;   if (submask != 0){   letsgodp(submask, og1);   letsgodp(submask, og2);   dp[mask][dg] +=(dp[submask][og1] + dp[submask][og2]);   dp[mask][dg] %=mod;   }   else{   dp[mask][dg] = 1;   }  }  } } 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 String[] readArrayString(int n){  String[] array = new String[n];  for(int j =0 ;j<n;j++)  array[j] = sc.next();  return array; } static int[] readArrayInt(int n){  int[] array = new int[n];  for(int j = 0;j<n;j++)   array[j] = sc.nextInt();  return array;  } static int[] readArrayInt1(int n){  int[] array = new int[n+1];  for(int j = 1;j<=n;j++){  array[j] = sc.nextInt();  }  return array; } static long[] readArrayLong(int n){  long[] array = new long[n];  for(int j =0 ;j<n;j++)  array[j] = sc.nextLong();  return array; } static double[] readArrayDouble(int n){  double[] array = new double[n];  for(int j =0 ;j<n;j++)  array[j] = sc.nextDouble();  return array; } static int minIndex(int[] array){  int minValue = Integer.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } static int minIndex(long[] array){  long minValue = Long.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } static int minIndex(double[] array){  double minValue = Double.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } 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; } static void verdict(boolean a){   out.println(a ? "YES" : "NO");  }  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());   }   String nextLine() {    String str = "";    try{     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }    } }
6	public class MaeDosDragoes {   public static PrintWriter saida = new PrintWriter(System.out, false);            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());   }  }   public static void main(String[] args) {  FastScanner fastScanner = new FastScanner();   int proximoInt = fastScanner.nextInt();   double proximoDouble = fastScanner.nextInt();   long[] graph = new long[proximoInt];   for(Integer i = 0; i < proximoInt; i++) {    for(Integer j =0; j < proximoInt; j++) {     Integer val = fastScanner.nextInt();     if (val.equals(1) || i.equals(j)) {   graph[i] |= 1L << j;   }    }   }   int szLeft = proximoInt/2;   int szRight = proximoInt - szLeft;   int[] dp = new int[1 << szLeft];   int maxMask = 1 << szLeft;   for(int mask = 1; mask <maxMask; mask++) {    int curMask = mask;    for(int j = 0; j < szLeft; j++) {     if (((1 << j) & mask) > 0) {      curMask &= graph[j + szRight] >> szRight;      dp[mask] = Math.max(dp[mask], dp[mask ^ (1 << j)]);     }    }    if (mask == curMask) {     dp[mask] = Math.max(dp[mask],Integer.bitCount(mask));    }   }   int ans = 0;   int rmaxMask = 1 << szRight;   for(int mask = 0; mask < rmaxMask; mask++) {    int curMask = mask;    int oMask = maxMask -1;    for(int j = 0; j < szRight; j++) {     if (((1 << j) & mask) > 0) {      curMask &= (graph[j] & (rmaxMask-1));      oMask &= graph[j] >> szRight;     }    }    if (curMask != mask) continue;    ans = Math.max(ans, Integer.bitCount(mask) + dp[oMask]);   }   proximoDouble/=ans;   saida.println(proximoDouble * proximoDouble * (ans * (ans-1))/2);   saida.flush();  } }
1	public class Main {  final boolean ONLINE_JUDGE = !new File("input.txt").exists();  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());  }  long readLong() throws IOException {   return Long.parseLong(readString());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  public static void main(String[] args) {   new Main().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);   }  }  class LOL implements Comparable<LOL> {   int x;   int y;    public LOL(int x, int y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(LOL o) {    if (o.x != x)     return (int) (o.x - x);    return (int) (y - o.y);   }  }  long modulo = 1000 * 1000 * 1000 + 7;  long binPow (long a, long b) {   if(b == 0) return 1;   long c = binPow(a, b / 2);   long ans = (c * c) % modulo;   if(b % 2 == 1) ans = (ans * a) % modulo;   return ans;  }   int[] gcd (int a, int b) {   int[] res = new int[3];   if (a == 0) {    res[0] = b; res[1] = 0; res[2] = -1;    return res;   }   res = gcd (b%a, a);   int x = -(res[2] + (b / a) * res[1]);   int y = - res[1];   res[1] = x;   res[2] = y;   return res;  }   public void solve() throws IOException {   int n = readInt();   HashMap<Character,Integer> mapa = new HashMap<>();   char[] s = readString().toCharArray();   for(int i = 0; i < n; i++) {    if(mapa.containsKey(s[i])) {     int x = mapa.get(s[i]);     mapa.replace(s[i], x + 1);    }    else mapa.put(s[i], 1);   }   int sz = mapa.size();   mapa = new HashMap<>();   int i = 0;   while (mapa.size() < sz) {    if(mapa.containsKey(s[i])) {     int x = mapa.get(s[i]);     mapa.replace(s[i], x + 1);    }    else mapa.put(s[i], 1);    i++;   }   int ans = i;   int left = 0;   int right = i - 1;   while(right < n) {    while(left < right) {     int y = mapa.get(s[left]);     if(y == 1) mapa.remove(s[left]);     else mapa.replace(s[left], y - 1);     if(mapa.size() == sz) {      ans = Math.min(ans, right - left);      left++;     }     else {      left++;      break;     }    }    right++;    if(right < n) {     if (mapa.containsKey(s[right])) {      int x = mapa.get(s[right]);      mapa.replace(s[right], x + 1);     } else mapa.put(s[right], 1);    }   }   out.print(ans);  } }
1	public class CodehorsesTShirt {  public static void main(String args[]) throws IOException {   FastReader in = new FastReader();   OutputStream outputStream = System.out;   PrintWriter out = new PrintWriter(outputStream);   Task.solve(in, out);   out.close();  }  static class Task {   public static void solve(FastReader in, PrintWriter out) {    int n = in.nextInt();    HashMap<String , Integer> hm1 = new HashMap<>();    HashMap<String , Integer> hm2 = new HashMap<>();    for(int i=0;i<n;i++){     String val = in.next();     if(hm1.containsKey(val)){      hm1.put(val, hm1.get(val)+1);     }else{      hm1.put(val,1);     }    }    for(int i=0;i<n;i++){     String val = in.next();     if(hm1.containsKey(val)){      int x = hm1.get(val);      if(x==1){       hm1.remove(val);      }else{       hm1.put(val,hm1.get(val)-1);      }     }else{      if(hm2.containsKey(val)){       hm2.put(val, hm2.get(val)+1);      }else{       hm2.put(val,1);      }     }    }    int ans = 0;    for(Map.Entry<String , Integer> row: hm1.entrySet()){     ans += row.getValue();    }    System.out.println(ans);   }  }  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());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
5	public class Main implements Runnable { private static String[] args;  public static void main(String[] args) {  Main.args = args;  new Thread(null, new Main(), "MyRunThread", 1 << 26).start(); }  @Override public void run() {  long time_beg = -1;  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  if (args.length > 0 && args[0].equals("outside")) {  time_beg = System.currentTimeMillis();  try {   inputStream = new FileInputStream("IO/in.txt");   } catch (Exception e) {   System.err.println(e);   System.exit(1);  }  } else {  try {   } catch (Exception e) {   System.err.println(e);   System.exit(1);  }  }  Solver s = new Solver();  s.in = new InputReader(inputStream);  s.out = new OutputWriter(outputStream);  if (args.length > 0 && args[0].equals("outside")) {  s.debug = new DebugWriter(s.out);  }  s.solve();  s.out.close();  if (args.length > 0 && args[0].equals("outside")) {  s.debug.close();  System.err.printf("*** Total time: %.3f ***\n", (System.currentTimeMillis() - time_beg) / 1000.0);  } } } final class Solver { InputReader in; OutputWriter out; DebugWriter debug;  public void solve() {  int n = in.readInt();  int[] mas = new int[n];  int[] sorted = new int[n];   for (int i = 0; i < n; ++i)  sorted[i] = mas[i] = in.readInt();  Random rnd = new Random(System.nanoTime());  for (int i = 1; i < n; ++i) {  int j = rnd.nextInt(i);  int tmp = sorted[j];  sorted[j] = sorted[i];  sorted[i] = tmp;  }  Arrays.sort(sorted);  int id1 = -1;  for (int i = 0; i < n; ++i)  if (mas[i] != sorted[i]) {   id1 = i;   break;  }  int id2 = -1;  for (int i = n - 1; i >= 0; --i)  if (mas[i] != sorted[i]) {   id2 = i;   break;  }  if (id1 != -1 && id2 != -1 && id1 != id2) {  int tmp = mas[id1];  mas[id1] = mas[id2];  mas[id2] = tmp;  }  for (int i = 0; i < n; ++i)  if (mas[i] != sorted[i]) {   out.printLine("NO");   return;  }  out.printLine("YES"); } } class InputReader { private boolean finished = false;  private InputStream stream; private byte[] buf = new byte[1024]; 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 long readLong() {  int c = read();  while (isSpaceChar(c))  c = read();  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  long res = 0;  do {  if (c < '0' || c > '9')   throw new InputMismatchException();  res *= 10;  res += c - '0';  c = read();  } while (!isSpaceChar(c));  return res * sgn; }  public String readString() {  int c = read();  while (isSpaceChar(c))  c = read();  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(); }  public BigInteger readBigInteger() {  try {  return new BigInteger(readString());  } catch (NumberFormatException e) {  throw new InputMismatchException();  } }  public char readCharacter() {  int c = read();  while (isSpaceChar(c))  c = read();  return (char) c; }  public double readDouble() {  int c = read();  while (isSpaceChar(c))  c = read();  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.') {  if (c == 'e' || c == 'E')   return res * Math.pow(10, readInt());  if (c < '0' || c > '9')   throw new InputMismatchException();  res *= 10;  res += c - '0';  c = read();  }  if (c == '.') {  c = read();  double m = 1;  while (!isSpaceChar(c)) {   if (c == 'e' || c == 'E')   return res * Math.pow(10, readInt());   if (c < '0' || c > '9')   throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();  }  }  return res * sgn; }  public boolean isExhausted() {  int value;  while (isSpaceChar(value = peek()) && value != -1)  read();  return value == -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 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(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(); } } 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(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(); }  public void close() {  writer.close(); } }
1	public class B {  public static void main(String[] args) {  Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(   System.in)));  int nc = sc.nextInt();  while (nc-- > 0) {  String s = sc.next();  StringTokenizer st = new StringTokenizer(s, "0123456789");  if (st.countTokens() > 1) {   int k = s.indexOf('C');   int r = Integer.parseInt(s.substring(1, k));   int c = Integer.parseInt(s.substring(k + 1));   int len = 1;   int p = 26;   while (c > p) {   c -= p;   len++;   p *= 26;   }   String col = Integer.toString(--c, 26).toUpperCase();   while (col.length() < len)   col = "0" + col;   StringBuilder sb = new StringBuilder();   for (int i = 0; i < col.length(); i++) {   if (col.charAt(i) < 'A') {    sb.append((char) (col.charAt(i) - '0' + 'A'));   } else {    sb.append((char) (col.charAt(i) + 10));   }   }   System.out.printf("%s%d\n", sb.toString(), r);  } else {   int k = 0;   while (s.charAt(k) > '9')   k++;   char[] col = s.substring(0, k).toCharArray();   int r = Integer.parseInt(s.substring(k));   int c = 1;   int p = 26;   int cnt = 1;   while (cnt++ < col.length) {   c += p;   p *= 26;   }   StringBuilder sb = new StringBuilder();   for (int i = 0; i < col.length; i++) {   if (s.charAt(i) < 'K') {    sb.append((char) ('0' + col[i] - 'A'));   } else {    sb.append((char) (col[i] - 10));   }   }   c += Integer.parseInt(sb.toString(), 26);   System.out.printf("R%dC%d\n", r, c);  }  }  System.out.close(); } }
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 String nextLine() throws IOException {  if (st == null) {   st = new StringTokenizer(br.readLine());  }  String line = st.nextToken("\n");  st = null;  return line;  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static class combinatorics {  static long modInv(long a, long b) {  return 1 < a ? b - modInv(b % a, a) * b / a : 1;  }  static long factorial[], mod;  combinatorics(int n, long MOD) {  mod = MOD;  factorial = new long[n + 1];  factorial[0] = 1;  for (int i = 1; i <= n; i++) {   factorial[i] = i * factorial[i - 1];   factorial[i] %= mod;  }  }  static long nCr(int n, int r) {  if (r > n)   return 0;  return (factorial[n] * modInv((factorial[n - r] * factorial[r]) % mod, mod)) % mod;  }  static long gcd(long a, long b) {  return b == 0 ? a : gcd(b, a % b);  }  static long lcm(long a, long b) {  return a * (b / gcd(a, b));  } }  public static class DisjointSet {  int p[], r[], s[];  int numDisjoint;  DisjointSet(int N) {  numDisjoint = N;  r = new int[N];  s = new int[N];  p = new int[N];  for (int i = 0; i < N; i++)   p[i] = i;  }  int findSet(int i) {  return (p[i] == i) ? i : (p[i] = findSet(p[i]));  }  boolean isSameSet(int i, int j) {  return findSet(i) == findSet(j);  }  void unionSet(int i, int j) {  if (!isSameSet(i, j))   {   numDisjoint--;   int x = findSet(i), y = findSet(j);   if (r[x] > r[y]) {   p[y] = x;    s[x] += s[y];   } else {   p[x] = y;   if (r[x] == r[y])    r[y]++;   s[y] += s[x];   }  }  }  int sizeOfSet(int i) {  return s[findSet(i)];  } }; }
1	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();    Map<String, Integer> map = new HashMap<>();    for (int i = 0; i < n; i++) {     String x = in.next();     map.put(x, map.getOrDefault(x, 0) + 1);    }    int ans = 0;    for (int i = 0; i < n; i++) {     String x = in.next();     if (map.containsKey(x)) {      map.put(x, map.get(x) - 1);      if (map.get(x) == 0) {       map.remove(x);      }     } else {      ans++;     }    }    out.print(ans);   }  }  static class InputReader {   private BufferedReader reader;   private 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 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 B { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  public static void main(String[] args) throws Exception {  String[] split = br.readLine().split(" ");   long n = Long.parseLong(split[0]);  long k = Long.parseLong(split[1]);   long left = -1;  long right = n + 1;   while(right - left >= 2) {  long mid = (left + right) / 2;              long newN = n - mid;   long temp = newN * (newN + 1) / 2;     long eh = temp - k - mid;    if(eh == 0) {   pw.println(mid);   break;  }  else if(eh < 0)   right = mid;  else   left = mid;  }   pw.close(); } }
2	public class B {  public static void main(String[] args) throws Exception {   new B().solve(System.in, System.out);       }  void solve(InputStream _in, PrintStream out) throws IOException {        Scanner sc = new Scanner(_in);   long n = sc.nextLong();   long x = sc.nextLong() - 1;   long y = sc.nextLong() - 1;   long c = sc.nextLong();   long ub = 2 * n;   long lb = -1;   while (lb + 1 < ub) {    long k = (lb + ub) / 2;    long l, u, r, d;    l = Math.max(0, x - k);    u = Math.max(0, y - k);    r = Math.min(n - 1, x + k);    d = Math.min(n - 1, y + k);    long ss = 0;       long lu = x - (k - (y - u));    if (l < lu) {     long a = lu - l;     ss += a * (a + 1) / 2;    }       long ld = x - (k - (d - y));    if (l < ld) {     long a = ld - l;     ss += a * (a + 1) / 2;    }       long ru = x + (k - (y - u));    if (ru < r) {     long a = r - ru;     ss += a * (a + 1) / 2;    }       long rd = x + (k - (d - y));    if (rd < r) {     long a = r - rd;     ss += a * (a + 1) / 2;    }    long cc = (r + 1 - l) * (d + 1 - u) - ss;    if (c <= cc) {         ub = k;    } else {         lb = k;    }   }   out.println(ub);  } }
5	public class Solution15A {     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());   }     long readLong() throws IOException{     return Long.parseLong(readString());   }     double readDouble() throws IOException{     return Double.parseDouble(readString());   }     public static void main(String[] args){     new Solution15A().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);     }   }     static class Utils {      private Utils() {}      public static void mergeSort(int[] a) {       mergeSort(a, 0, a.length - 1);     }      private static void mergeSort(int[] a, int leftIndex, int rightIndex) {       final int MAGIC_VALUE = 50;       if (leftIndex < rightIndex) {         if (rightIndex - leftIndex <= MAGIC_VALUE) {           insertionSort(a, leftIndex, rightIndex);         } else {           int middleIndex = (leftIndex + rightIndex) / 2;           mergeSort(a, leftIndex, middleIndex);           mergeSort(a, middleIndex + 1, rightIndex);           merge(a, leftIndex, middleIndex, rightIndex);         }       }     }      private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {       int length1 = middleIndex - leftIndex + 1;       int length2 = rightIndex - middleIndex;       int[] leftArray = new int[length1];       int[] rightArray = new int[length2];       System.arraycopy(a, leftIndex, leftArray, 0, length1);       System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);       for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {         if (i == length1) {           a[k] = rightArray[j++];         } else if (j == length2) {           a[k] = leftArray[i++];         } else {           a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];         }       }     }      private static void insertionSort(int[] a, int leftIndex, int rightIndex) {       for (int i = leftIndex + 1; i <= rightIndex; i++) {         int current = a[i];         int j = i - 1;         while (j >= leftIndex && a[j] > current) {           a[j + 1] = a[j];           j--;         }         a[j + 1] = current;       }     }   }     class Square implements Comparable<Square>{   public Square(int x, int a){    this.x = x;    this.a = a;   }      @Override  public int compareTo(Square o) {   if(this.x > o.x) return 1;   if(this.x < o.x) return -1;   return 0;  }   public int a, x;   }        void solve() throws IOException{   int n = readInt();   int t = readInt();   Square[] houses = new Square[n];   for(int i = 0; i < n; i++){    int a = readInt();    int b = readInt();    houses[i] = new Square(a, b);   }   Arrays.sort(houses);   int count = 0;   for(int i = 0; i < n; i++){    if(i == 0) count++;    else{    if(houses[i].x - houses[i].a/2.0 - t > houses[i-1].x + houses[i-1].a/2.0)     count++;    }    if(i == n - 1) count++;    else{    if(houses[i].x + houses[i].a/2.0 + t <= houses[i+1].x - houses[i+1].a/2.0)     count++;    }   }   out.println(count);   }     static double distance(long x1, long y1, long x2, long y2){   return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));   }     static long gcd(long a, long b){   while(a != b){    if(a < b) a -=b;    else b -= a;   }   return a;   }     static long lcm(long a, long b){   return a * b /gcd(a, b);   } }
0	public class A122 { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  if (n % 4 == 0 || n % 7 == 0 || n % 44 == 0 || n % 47 == 0   || n % 74 == 0 || n % 77 == 0 || n % 444 == 0 || n % 447 == 0   || n % 474 == 0 || n % 477 == 0 || n % 744 == 0 || n % 747 == 0   || n % 774 == 0 || n % 777 == 0)  System.out.println("YES");  else  System.out.println("NO");  } }
5	public class Village {  private class House implements Comparable<House> {  Double Coordinate;  Double Sidelength;  private House(double coordinate, double sidelength) {  Coordinate = coordinate;  Sidelength = sidelength;  }  public int compareTo(House o) {  return Coordinate.compareTo(o.Coordinate);  } }  private void solve() {  Scanner in = new Scanner(System.in);  in.next();  double requireside = in.nextDouble();  ArrayList<House> coordinate = new ArrayList<House>();  while (in.hasNext()) {  double coo = in.nextDouble();  double side = in.nextDouble();  coordinate.add(new House(coo, side));  }  Collections.sort(coordinate);  ArrayList<Double> edges = new ArrayList<Double>();  int count = 2;  for (int i = 0; i < coordinate.size(); i++) {  edges.add(coordinate.get(i).Coordinate   - (double) coordinate.get(i).Sidelength / (double) 2);  edges.add(coordinate.get(i).Coordinate   + (double) coordinate.get(i).Sidelength / (double) 2);  }  ArrayList<Double> difference = new ArrayList<Double>();  for (int i = 1; i < edges.size() - 1; i++) {  difference.add(Math.abs(edges.get(i) - edges.get(i + 1)));  }  for (int i = 0; i < difference.size(); i += 2) {  if (difference.get(i) == requireside)   count++;  else if (difference.get(i) > requireside)   count += 2;  }  System.out.println(count); }  public static void main(String args[]) {  Village v = new Village();  v.solve(); } }
3	public class D {  public static void main(String[] args) {  Scanner in = new Scanner(System.in);   int n = in.nextInt();  int[] a = new int[n];  for(int i = 0; i < n; ++i) {  a[i] = in.nextInt();  }  int ans = 0;  for(int i = 0; i < n; ++i) {  for(int j = i+1; j < n; ++j) {   if(a[i] > a[j]) ans++;  }  }   int m = in.nextInt();   for(int i = 0; i < m; ++i) {  int l = in.nextInt();  int r = in.nextInt();    int size = r-l + 1;    int x = size * size - size;  x = x >> 1;    ans = ans^x;  if(ans%2 == 0) System.out.println("even");  else System.out.println("odd");    } }   }
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;   }   @Override   public String toString() {    return x1 + " " + y1 + " " + x2 + " " + 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 String nextLine() {    st = null;    try {     return br.readLine();    } catch (IOException e) {     e.printStackTrace();     return null;    }   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public float nextFloat() {    return Float.parseFloat(next());   }  } }
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());  }  public long nextLong() throws IOException {   return Long.parseLong(next());  }  public double nextDouble() throws IOException {   return Double.parseDouble(next());  } } }
5	public class Main {  public static void main(String[] args)  {  Scanner keyboard = new Scanner(System.in);  int size = keyboard.nextInt();  int[] arr = new int[size];  int i = 0;  while( size != 0 )  {  arr[i] = keyboard.nextInt();  size--;  i++;  }    Arrays.sort(arr);   int index = 0;  boolean val = false;  int ans = 0;  for ( i = 0; i< arr.length-1 ; i++ )  {    if( arr[i] != arr[i+1] )  {   val = true;     index = i+1;   System.out.println(arr[index]);   return;  }  }    if (size == 1 || ( val == false))  {   System.out.println("NO");   }    }  }
5	public class AA implements Runnable { public static void main(String[] args) {  new Thread(new AA()).run();  }  static class Utils {  private Utils() {  }  public static void mergeSort(int[] a) {  mergeSort(a, 0, a.length - 1);  }  private static void mergeSort(int[] a, int leftIndex, int rightIndex) {  final int MAGIC_VALUE = 50;  if (leftIndex < rightIndex) {   if (rightIndex - leftIndex <= MAGIC_VALUE) {   insertionSort(a, leftIndex, rightIndex);   } else {   int middleIndex = (leftIndex + rightIndex) / 2;   mergeSort(a, leftIndex, middleIndex);   mergeSort(a, middleIndex + 1, rightIndex);   merge(a, leftIndex, middleIndex, rightIndex);   }  }  }  private static void merge(int[] a, int leftIndex, int middleIndex,   int rightIndex) {  int length1 = middleIndex - leftIndex + 1;  int length2 = rightIndex - middleIndex;  int[] leftArray = new int[length1];  int[] rightArray = new int[length2];  System.arraycopy(a, leftIndex, leftArray, 0, length1);  System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);  for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {   if (i == length1) {   a[k] = rightArray[j++];   } else if (j == length2) {   a[k] = leftArray[i++];   } else {   a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++]    : rightArray[j++];   }  }  }  private static void insertionSort(int[] a, int leftIndex, int rightIndex) {  for (int i = leftIndex + 1; i <= rightIndex; i++) {   int current = a[i];   int j = i - 1;   while (j >= leftIndex && a[j] > current) {   a[j + 1] = a[j];   j--;   }   a[j + 1] = current;  }  }  }  BufferedReader br; StringTokenizer str = new StringTokenizer(""); PrintWriter pw;  public Integer ni() {  return Integer.parseInt(nextToken()); }  public Double nd() {  return Double.parseDouble(nextToken()); }  public Long nl() {  return Long.parseLong(nextToken()); }  public boolean EOF() {  try {  if (!br.ready() && !str.hasMoreTokens()) {   return true;  }  } catch (IOException e) {    e.printStackTrace();  }  return false; }  public String nextToken() {  while (!str.hasMoreTokens())  try {   str = new StringTokenizer(br.readLine());  } catch (IOException e) {     e.printStackTrace();  }  return str.nextToken();  }  @Override public void run() {  br = new BufferedReader(new InputStreamReader(System.in));  pw = new PrintWriter(new OutputStreamWriter(System.out));                  solve();  pw.close(); }  public void solve() {  int n = ni();  int[] a = new int[n];  int total = 0;  for (int i = 0; i < n; i++) {  a[i] = ni();  total+=a[i];  }  Arrays.sort(a);  int c =0;  int left=0;  for(int i=n-1; i>=0;i--){  if (left<=total){   c++;   left+=a[i];   total-=a[i];  }  }  pw.print(c); } }
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));   } }
0	public class Main {  long solve(long a, long b) {   if (a == 0) {    return 0;   }   long answer = a / b;   a %= b;   if (a != 0) {    answer += 1 + solve(b - a, a);   }   return answer;  }  public void run() {   try {    long a = reader.nextLong();    long b = reader.nextLong();    writer.println(solve(a, b));   } catch (IOException ex) {   }   writer.close();  }  InputReader reader;  PrintWriter writer;  Main() {   reader = new InputReader();   writer = new PrintWriter(System.out);  }  public static void main(String[] args) {   new Main().run();  } } class InputReader {  BufferedReader reader;  StringTokenizer tokenizer;  InputReader() {   reader = new BufferedReader(new InputStreamReader(System.in));   tokenizer = new StringTokenizer("");  }  String next() throws IOException {   while (!tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }  Integer nextInt() throws IOException {   return Integer.parseInt(next());  }  Long nextLong() throws IOException {   return Long.parseLong(next());  } }
3	public class cf908G { final static 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; }  }
5	public class ayyyyyy { public static void main(String[] args) { new ayyyyyy(); } Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out);  int t, n; int[] a;  ayyyyyy() {  t = in.nextInt();  while (t --> 0)  {  a = new int[n = in.nextInt()];  for (int i = 0; i < n; i++)   a[i] = in.nextInt();  shuffle(a);  Arrays.sort(a);  out.println(Math.min(n-2, a[n-2]-1));  }   out.close(); }  void shuffle(int[] x) {  for (int i = 0; i < n; i++)  {  int swp = (int)(n*Math.random());  int tmp = x[swp];  x[swp] = x[i];  x[i] = tmp;  } } }
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 int[] nextInts(int N) {    int[] res = new int[N];    for (int i = 0; i < N; i++) {     res[i] = (int) nextLong();    }    return res;   }   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;   }   public double[] nextDoubles(int N) {    double[] res = new double[N];    for (int i = 0; i < N; i++) {     res[i] = nextDouble();    }    return res;   }   public String next() {    StringBuilder res = new StringBuilder();    while (c <= 32) c = getChar();    while (c > 32) {     res.append(c);     c = getChar();    }    return res.toString();   }   public String nextLine() {    StringBuilder res = new StringBuilder();    while (c <= 32) c = getChar();    while (c != '\n') {     res.append(c);     c = getChar();    }    return res.toString();   }   public boolean hasNext() {    if (c > 32) return true;    while (true) {     c = getChar();     if (c == NC) return false;     else if (c > 32) return true;    }   }  }  static void ASSERT(boolean assertion, String message) {   if (!assertion) throw new AssertionError(message);  }  static void ASSERT(boolean assertion) {   if (!assertion) throw new AssertionError();  } }
4	public class A {  static Scanner sc = new Scanner(System.in);  public static void main(String[] args) {   String s = sc.next();   for (int l = s.length(); l > 0; --l) {    HashSet<String> set = new HashSet<String>();    for (int i = 0; i < s.length() - l + 1; ++i)     if (set.contains(s.substring(i, i + l))) {      System.out.println(l);      return;     } else {      set.add(s.substring(i, i + l));     }   }   System.out.println(0);  } }
6	public class C {  static int n, m, a[][]; static int[][] memo; static Integer[] indices;  static int[] getCol(int col, int shift) {  int[] ans = new int[n];  for (int i = 0, j = shift; i < n; i++, j = (j + 1) % n) {  ans[i] = a[j][col];  }  return ans;  }  static int dp(int col, int msk) {  if (col == n||col==m)  return 0;  if (memo[msk][col] != -1)  return memo[msk][col];  int ans = 0;  for (int shift = 0; shift < n; shift++) {  int[] currCol = getCol(indices[col], shift);  for (int nxtMsk = 0; nxtMsk < 1 << n; nxtMsk++) {   if ((nxtMsk & msk) != msk)   continue;   int curr = 0;   int diff = msk ^ nxtMsk;   for (int i = 0; i < n; i++)   if ((diff & 1 << i) != 0)    curr += currCol[i];   ans = Math.max(ans, dp(col + 1, nxtMsk) + curr);  }  }  return memo[msk][col] = ans; }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out);  int tc = sc.nextInt();  while (tc-- > 0) {  n = sc.nextInt();  m = sc.nextInt();  indices = new Integer[m];   memo = new int[1 << n][m];  for (int[] x : memo)   Arrays.fill(x, -1);  a = new int[n][m];  int[] max = new int[m];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++) {   a[i][j] = sc.nextInt();   max[j] = Math.max(max[j], a[i][j]);   }  for (int j = 0; j < m; j++) {   indices[j] = j;  }  Arrays.sort(indices, Comparator.comparingInt(i -> -max[i]));  out.println(dp(0, 0));  }  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();  }  String nextLine() throws IOException {  return br.readLine();  }  int nextInt() throws IOException {  return Integer.parseInt(next());  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(next());  }  boolean ready() throws IOException {  return br.ready();  }  }  static void sort(int[] a) {  shuffle(a);  Arrays.sort(a); }  static void shuffle(int[] a) {  int n = a.length;  Random rand = new Random();  for (int i = 0; i < n; i++) {  int tmpIdx = rand.nextInt(n);  int tmp = a[i];  a[i] = a[tmpIdx];  a[tmpIdx] = tmp;  } } }
1	public class q1 {  public static MyScanner in = new MyScanner();  public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out), true);  public static MyViewer view = new MyViewer();  public static BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));  public static Random rand = new Random(System.currentTimeMillis());  public static class Pair<A, B> {   private final A first;   private final B second;   public Pair(A first, B second) {    super();    this.first = first;    this.second = second;   }   public int hashCode() {    int hashFirst = first != null ? first.hashCode() : 0;    int hashSecond = second != null ? second.hashCode() : 0;    return (hashFirst + hashSecond) * hashSecond + hashFirst;   }   public boolean equals(Object other) {    if (other instanceof Pair) {     Pair otherPair = (Pair) other;     return       ((this.first == otherPair.first ||         (this.first != null && otherPair.first != null &&           this.first.equals(otherPair.first))) &&         (this.second == otherPair.second ||           (this.second != null && otherPair.second != null &&             this.second.equals(otherPair.second))));    }    return false;   }   public String toString() {    return "(" + first + ", " + second + ")";   }   public A getFirst() {    return first;   }   public B getSecond() {    return second;   }  }  public static class MyScanner {   BufferedReader br;   StringTokenizer st;   private boolean randomInput = false;   private Random rand;   void randomInput(boolean r) {    randomInput = r;    rand = new Random(System.currentTimeMillis());      }   public MyScanner() {    br = new BufferedReader(new InputStreamReader(System.in));   }   public MyScanner(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 int nextInt(int val) {    return randomInput ? val : Integer.parseInt(next());   }   public int nextInt(int low, int high) {    if (randomInput) {     return rand.nextInt(high - low + 1) + low;    } else {     return Integer.parseInt(next());    }   }   long nextLong() {    return Long.parseLong(next());   }   long nextLong(long val) {    return randomInput ? val : Long.parseLong(next());   }   long nextLong(long low, long high) {    if (randomInput) {     return low + ((long) (rand.nextDouble() * (high - low + 1)));    } else {     return Long.parseLong(next());    }   }   double nextDouble() {    return Double.parseDouble(next());   }   int[] arrayInt(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = nextInt();    }    return a;   }   int[] arrayInt(int n, int low, int high) {    int[] a = new int[n];    if (randomInput) {     for (int i = 0; i < n; i++) {      a[i] = rand.nextInt(high - low + 1) + low;     }    } else {     for (int i = 0; i < n; i++) {      a[i] = nextInt();     }    }    return a;   }   ArrayList<Integer> list(int n) {    ArrayList<Integer> a = new ArrayList<Integer>(n);    for (int i = 0; i < n; i++) {     a.add(nextInt());    }    return a;   }   ArrayList<Integer> list(int n, int low, int high) {    ArrayList<Integer> a = new ArrayList<Integer>(n);    if (randomInput) {     for (int i = 0; i < n; i++) {      a.add(rand.nextInt(high - low + 1) + low);     }    } else {     for (int i = 0; i < n; i++) {      a.add(nextInt());     }    }    return a;   }   long[] arrayLong(int n) {    long[] a = new long[n];    for (int i = 0; i < n; i++) {     a[i] = nextLong();    }    return a;   }   long[] arrayLong(int n, long low, long high) {    long[] a = new long[n];    if (randomInput) {     for (int i = 0; i < n; i++) {      double r = rand.nextDouble();      a[i] = (long) (r * (double) (high - low + 1)) + low;      if (a[i] == 0) {       out.println("Ouch : " + r);      }     }    } else {     for (int i = 0; i < n; i++) {      a[i] = nextLong();     }    }    return a;   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   void close() {    try {     br.close();    } catch (IOException e) {     e.printStackTrace();    }   }   ArrayList<ArrayList<Integer>> randomTree(int n) {    ArrayList<ArrayList<Integer>> edges = new ArrayList<>();    for (int i = 0; i < n; i++) {     edges.add(new ArrayList<>());    }    for (int i = 1; i < n; i++) {     int par = rand.nextInt(i);     edges.get(par).add(i);    }    return edges;   }  }  static class MyViewer {   private static boolean print = true;   public void on() {    print = true;   }   public void off() {    print = false;   }   public <T extends List> void list(T a) {    if (!print) return;    if (a == null) {     out.println("List: NULL");     return;    }    if (a.size() == 0) {     out.println("List: []");     return;    }    out.print("List: [" + a.get(0));    for (int i = 1; i < a.size(); i++) {     out.print(", " + a.get(i));    }    out.println("] Len: " + a.size());   }   public <T> void array(T[] a) {    if (!print) return;    if (a == null) {     out.println("Array: NULL");     return;    }    if (a.length == 0) {     out.println("Array: []");     return;    }    out.print("Array: [" + a[0]);    for (int i = 1; i < a.length; i++) {     out.print(", " + a[i]);    }    out.println("] Len: " + a.length);   }   public void array(boolean[] a) {    if (!print) return;    if (a == null) {     out.println("boolean[]: NULL");     return;    }    if (a.length == 0) {     out.println("boolean[]: Len: 0");     return;    }    out.print("boolean[] Len: " + a.length + " [");    for (boolean x : a) {     out.print(x + ", ");    }    out.println("\b\b]");   }   public void array(int[] a) {    if (!print) return;    if (a == null) {     out.println("Array: NULL");     return;    }    if (a.length == 0) {     out.println("Array: []");     return;    }    out.print("int[] Len: " + a.length + " [");    for (int x : a) {     out.print(x + ", ");    }    out.println("\b\b]");   }   public void array(long[] a) {    if (!print) return;    if (a == null) {     out.println("Array: NULL");     return;    }    if (a.length == 0) {     out.println("Array: []");     return;    }    out.print("long Array: [");    for (long x : a) {     out.print(x + ", ");    }    out.println("\b\b] Len: " + a.length);   }   public void matrix(int[][] a, int cutoff) {    if (cutoff == 0)     cutoff = Integer.MAX_VALUE;    if (a == null) {     out.println("Matrix: NULL");     return;    }    for (int i = 0; i < a.length; i++) {     if (i < cutoff) {      printMatrixRow(a[i], cutoff);     } else {      out.println("  ...");      printMatrixRow(a[a.length - 1], cutoff);      break;     }    }   }   public void matrix(long[][] a, long cutoff) {    if (cutoff == 0)     cutoff = Long.MAX_VALUE;    if (a == null) {     out.println("Matrix: NULL");     return;    }    for (int i = 0; i < a.length; i++) {     if (i < cutoff) {      printMatrixRow(a[i], cutoff);     } else {      out.println("  ...");      printMatrixRow(a[a.length - 1], cutoff);      break;     }    }   }   public void matrix(boolean[][] a, int cutoff) {    if (cutoff == 0)     cutoff = Integer.MAX_VALUE;    if (a == null) {     out.println("Matrix: NULL");     return;    }    for (int i = 0; i < a.length; i++) {     if (i < cutoff) {      printMatrixRow(a[i], cutoff);     } else {      out.println("  ...");      printMatrixRow(a[a.length - 1], cutoff);      break;     }    }   }   private void printMatrixRow(int[] a, int cutoff) {    for (int j = 0; j < a.length; j++) {     if (j < cutoff) {      out.printf("%6d ", a[j]);     } else {      out.printf(" ... %6d", a[a.length - 1]);      break;     }    }    out.println();   }   private void printMatrixRow(long[] a, long cutoff) {    for (int j = 0; j < a.length; j++) {     if (j < cutoff) {      out.printf("%6d ", a[j]);     } else {      out.printf(" ... %6d", a[a.length - 1]);      break;     }    }    out.println();   }   private void printMatrixRow(boolean[] a, int cutoff) {    for (int j = 0; j < a.length; j++) {     if (j < cutoff) {      out.print(a[j] ? "T " : "F ");     } else {      out.print(" ... " + (a[a.length - 1] ? "T" : "F"));      break;     }    }    out.println();   }  }  public static void main(String[] args) throws IOException {   int n = in.nextInt();   int d = in.nextInt();   int[] a = in.arrayInt(n);   int count = 2;   for(int i = 0 ;i < n-1; i++) {    if( a[i+1] - a[i] == 2 * d )     count += 1;    if( a[i+1] - a[i] > 2 * d)     count += 2;   }   out.println(count);    log.flush();   in.close();  } }
0	public class A {  static void solve() throws IOException {  long a = nextLong(), b = nextLong();  long answer = get(a, b);  out.println(answer); }  private static long get(long p, long q) {  if (p == 0) {  return 0;  }  if (q == 1) {  return p;  }  if (p == 1) {  return q;  }  if (p >= q) {  return p / q + get(p % q, q);  }  return q / p + get(p, q % p); }  static BufferedReader br; static StringTokenizer st; static PrintWriter out;  public static void main(String[] args) throws IOException {  InputStream input = System.in;  PrintStream output = System.out;  File file = new File("a.in");  if (file.exists() && file.canRead()) {  input = new FileInputStream(file);  }  br = new BufferedReader(new InputStreamReader(input));  out = new PrintWriter(output);  solve();  out.close(); }  static long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  static double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  static int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  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(); } }
2	public class Pipeline {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  long n = sc.nextLong();  long k = sc.nextLong();  sc.close();  if (k * (k - 1) / 2 + 1 < n) {  System.out.println(-1);  } else {  long l = -1, r = k;  while (r - l > 1) {   long m = (r + l) / 2;   if (cantidadPosible(k, m) >= n) {   r = m;   } else {   l = m;   }  }  System.out.println(r);  }  }  private static long cantidadPosible(long k, long usadas) {  return (k * (k - 1) / 2 + 1 - (k - usadas) * (k - usadas - 1) / 2); } }
1	public class Main {  StreamTokenizer in;  PrintWriter out;  public static void main(String[] args) throws IOException  {   new Main().run();  }  public void run() throws IOException  {      in =new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(new OutputStreamWriter(System.out));    solve();   out.flush();    }  public int nextInt() throws IOException  {   in.nextToken();   return (int) in.nval;  }  boolean pr(int i)  {  if(i<4) return true;  for(int j=2;j<Math.sqrt(i)+1;j++)   if(i%j==0)   return false;  return true;  }  public void solve() throws IOException  {  int n=nextInt(),k=nextInt();  int prost[]=new int[1000];  boolean now[]=new boolean[10000];  int a=0;  for(int i=2;i!=1000;i++)   if(pr(i))   prost[a++]=i;  for(int i=0;i!=a-1;i++)  {   if(pr(prost[i]+prost[i+1]+1))   now[prost[i]+prost[i+1]+1]=true;  }  int answ=0;  for(int i=0;i!=n+1;i++)   if(now[i])   answ++;  if(answ>=k)   out.print("YES");  else   out.print("NO");  } }
1	public class Main {   private MyScanner scan = new MyScanner();  private PrintWriter out = new PrintWriter(System.out);  private final double PI = Math.PI;  private final int INF = (int)(1e9);  private final double EPS = 1e-6;  private final int SIZEN = (int)(1e7);  private final int MOD = (int)(1e9 + 7);  private final long MODH = 10000000007L, BASE = 10007;  private final int[] DX = {0, 1, 0, -1}, DY = {-1, 0, 1, 0};  int n;  int[] sum;  int[][] a;  public void foo1() {   int n = scan.nextInt();   int sum = 0;   int[] a = new int[n];   for (int i = 0;i < n;++i) {    a[i] = scan.nextInt();    sum += a[i];   }   int avg = sum * 2 / n;   for (int i = 0;i < n;++i) {    if (a[i] == 0) {     continue;    }    for (int j = i + 1;j < n;++j) {     if (a[i] + a[j] == avg) {      a[j] = 0;      System.out.println((i + 1) + " " + (j + 1));      break;     }    }   }  }  public void foo2() {   int n = scan.nextInt();   int m = scan.nextInt();   HashSet<Integer> row = new HashSet<Integer>();   HashSet<Integer> col = new HashSet<Integer>();   for (int i = 0;i < m;++i) {    int x = scan.nextInt();    int y = scan.nextInt();    row.add(x);    col.add(y);    out.print((long) (n - row.size()) * (n - col.size()) + " ");   }  }  public int getId(char c) {   return (c >= 'a' && c <= 'z') ? c - 'a': c - 'A' + 26;  }  public boolean isOk(int len) {   for (int i = 0;i + len <= n;++i) {    boolean flag = true;    for (int j = 0;j < 52;++j) {     if (a[i + len][j] - a[i][j] == 0 && sum[j] != 0) {      flag = false;      break;     }    }    if (flag) {     return true;    }   }   return false;  }  public void foo() {   n = scan.nextInt();   char[] s = scan.next().toCharArray();   a = new int[n + 1][52];   sum = new int[52];   for (int i = 0;i < n;++i) {    for (int j = 0;j < 52;++j) a[i + 1][j] = a[i][j];    ++a[i + 1][getId(s[i])];    ++sum[getId(s[i])];   }   int left = 1, right = n, ans = n;   while (left <= right) {    int mid = (left + right) >> 1;    if (isOk(mid)) {     ans = mid;     right = mid - 1;    } else {     left = mid + 1;    }   }   out.println(ans);  }  public static void main(String[] args)  {   Main m = new Main();   m.foo();   m.out.close();  }     public long gcd(long a, long b)  {   return 0 == b ? a : gcd(b, a % b);  }    public double getDist(long x1, long y1, long x2, long y2, long x, long y)  {   long a = y2 - y1;   long b = x1 - x2;   long c = y1 * (x2 - x1) - x1 * (y2 - y1);   return Math.abs(a * x + b * y + c) / Math.sqrt(a * a + b * b);  }    public double ptToSeg(long x1, long y1, long x2, long y2, long x, long y)  {   double cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);   if(cross <= 0)   {    return (x - x1) * (x - x1) + (y - y1) * (y - y1);   }   double d = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);   if(cross >= d)   {    return (x - x2) * (x - x2) + (y - y2) * (y - y2);   }   double r = cross / d;   double px = x1 + (x2 - x1) * r;   double py = y1 + (y2 - y1) * r;   return (x - px) * (x - px) + (y - py) * (y - py);  }    public int kmpMatch(char[] t, char[] p)  {   int n = t.length;   int m = p.length;   int[] next = new int[m + 1];   next[0] = -1;   int j = -1;   for(int i = 1;i < m;++i)   {    while(j >= 0 && p[i] != p[j + 1])    {     j = next[j];    }    if(p[i] == p[j + 1])    {     ++j;    }    next[i] = j;   }   j = -1;   for(int i = 0;i < n;++i)   {    while(j >= 0 && t[i] != p[j + 1])    {     j = next[j];    }    if(t[i] == p[j + 1])    {     ++j;    }    if(j == m - 1)    {     return i - m + 1;    }   }   return -1;  }    public long hash(String s)  {   long key = 0, t = 1;   for(int i = 0;i < s.length();++i)   {    key = (key + s.charAt(i) * t) % MODH;    t = t * BASE % MODH;   }   return key;  }    public long quickMod(long x, long n)  {   long ans = 1;   while(n > 0)   {    if(1 == n % 2)    {     ans = ans * x % MOD;    }    x = x * x % MOD;    n >>= 1;   }   return ans;  }       public boolean isOnSeg(long x1, long y1, long x2, long y2, long x, long y)  {   return (x - x1) * (y2 - y1) == (x2 - x1) * (y - y1) &&     x >= Math.min(x1, x2) && x <= Math.max(x1, x2) &&     y >= Math.min(y1, y2) && y <= Math.max(y1, y2);  }        class MyScanner  {   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   BufferedInputStream bis = new BufferedInputStream(System.in);   public int read()   {    if (-1 == numChars)    {     throw new InputMismatchException();    }    if (curChar >= numChars)    {     curChar = 0;     try     {      numChars = bis.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 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 & 15;     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 & 15) * m;      c = read();     }    }    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();   }   private boolean isSpaceChar(int c)   {    return ' ' == c || '\n' == c || '\r' == c || '\t' == c || -1 == c;   }  } }
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 B {  final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  final PrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  StringTokenizer tokenizer;  final int[][] d;  final int n;  final int[] time;  final Action[] actions;  private static final class Action {   int a;   int b;   public Action(int a) {    this.a = this.b = a;   }   public Action(int a, int b) {    this.a = a;    this.b = b;   }   @Override   public String toString() {    if (a == b)     return " " + (a+1);    return " " + (a+1) + " " + (b+1);   }  }  private static final int dist(int x1, int y1, int x2, int y2) {   return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);  }  private final boolean in(int x, int set) {   return ((1 << x) & set) != 0;  }  private final int off(int x, int set) {   return (set ^ (set & (1 << x)));  }  private final int solve(int set) {   if (time[set] > 0)    return time[set];   int min = Integer.MAX_VALUE;   if (set == 0)    min = 0;   else {    int a;    for (a = 0; a < n; a++)     if (in(a, set))      break;    int subset = off(a, set);    int aux = 2 * d[a][a] + solve(subset);    if (aux < min) {     min = aux;     actions[set] = new Action(a);    }    for (int b = a + 1; b < n; b++)     if (in(b, subset)) {      aux = d[a][a] + d[b][b] + d[a][b] + solve(off(b, subset));      if (aux < min) {       min = aux;       actions[set] = new Action(a, b);      }     }   }   time[set] = min;   return min;  }  private B() throws IOException {   int bx = nextInt();   int by = nextInt();   n = nextInt();   int[] x = new int[n];   int[] y = new int[n];   for (int i = 0; i < n; i++) {    x[i] = nextInt();    y[i] = nextInt();   }   reader.close();   d = new int[n][n];   for (int i = 0; i < n; i++) {    d[i][i] = dist(bx, by, x[i], y[i]);    for (int j = i + 1; j < n; j++)     d[i][j] = dist(x[i], y[i], x[j], y[j]);   }   int set = 1 << n;   time = new int[set];   actions = new Action[set];   set--;   printer.println(solve(set));   printer.print("0");   while (set != 0) {    solve(set);    Action action = actions[set];    printer.print(action);    printer.print(" 0");    set = off(action.a, set);    set = off(action.b, set);   }   printer.println();   printer.close();  }  private final int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  private final String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }  public static void main(String[] args) throws IOException {   new B();  } }
4	public class FireAgain implements Runnable {  private BufferedReader in;  private PrintWriter out;  private StringTokenizer tok;  private void solve() throws IOException {   int n = nextInt(), m = nextInt();   int[][] sources = readIntMatrix(nextInt(), 2);   int max = -1, maxI = 0, maxJ = 0;   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     int min = Integer.MAX_VALUE;     for (int[] source : sources) {      int dist = abs(source[0] - i) + abs(source[1] - j);      if (dist < min) {       min = dist;      }     }     if (min > max) {      max = min;      maxI = i;      maxJ = j;     }    }   }   out.print((maxI + 1) + " " + (maxJ + 1));  }    public static void main(String[] args) {   new FireAgain().run();  }  @Override  public void run() {   try {    in = new BufferedReader(new FileReader("input.txt"));    out = new PrintWriter(new FileWriter("output.txt"));    tok = null;    solve();    in.close();    out.close();   } catch (IOException e) {    System.exit(0);   }  }  private String nextToken() throws IOException {   while (tok == null || !tok.hasMoreTokens()) {    tok = new StringTokenizer(in.readLine());   }   return tok.nextToken();  }  private int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  private int[][] readIntMatrix(int n, int m) throws IOException {   int[][] mx = new int[n][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     mx[i][j] = nextInt() - 1;    }   }   return mx;  } }
2	public class Pipeline {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   long n = in.nextLong();   long k = in.nextLong();   if (n == 1) {    System.out.println(0);    return;   }   if (k >= n) {    System.out.println(1);    return;   }   long total = (k + 2) * (k - 1) / 2 - (k - 2);   if (total < n) {    System.out.println(-1);    return;   }         int i = 2, j = (int) k;   while (i < j) {    int m = (i + j + 1) / 2;    total = (k + m) * (k - m + 1) / 2 - (k - m);    if (total < n)     j = m - 1;    else     i = m;   }   System.out.println(k - i + 1);  } }
0	public class Solution implements Runnable {  public static void main(String[] args) {   new Thread(new Solution()).start();  }  public void run() {   try{    br = new BufferedReader(new InputStreamReader(System.in));    pw = new PrintWriter(new OutputStreamWriter(System.out));    solve();    pw.close();   }   catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }  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());  }  }
4	public class CF_1523_C{   void pre() throws Exception{}  void solve(int TC) throws Exception{   int N = ni();   int[] A = new int[N];   for(int i = 0; i< N; i++)A[i] = ni();    int[] stack = new int[2*N];   int sz = 0;   for(int i = 0; i< N; i++){    if(A[i] == 1)stack[sz++] = 1;    else{     while (sz > 0 && stack[sz-1]+1 != A[i])sz--;     hold(sz != 0);     stack[sz-1]++;     hold(stack[sz-1] == A[i]);    }    hold(sz != 0);    StringBuilder st = new StringBuilder();    for(int s = 0; s< sz; s++){     st.append(stack[s]);     if(s+1 < sz)st.append(".");    }    pn(st.toString());   }  }   void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}  void exit(boolean b){if(!b)System.exit(0);}  static void dbg(Object... o){System.err.println(Arrays.deepToString(o));}  final long IINF = (long)1e17;  final int INF = (int)1e9+2;  DecimalFormat df = new DecimalFormat("0.00000000000");  double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-8;  static boolean multipleTC = true, 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 CF_1523_C().run();}catch(Exception e){e.printStackTrace();System.exit(1);}}}, "1", 1 << 28).start();   else new CF_1523_C().run();  }  int[][] make(int n, int e, int[] from, int[] to, boolean f){   int[][] g = new int[n][];int[]cnt = new int[n];   for(int i = 0; i< e; i++){    cnt[from[i]]++;    if(f)cnt[to[i]]++;   }   for(int i = 0; i< n; i++)g[i] = new int[cnt[i]];   for(int i = 0; i< e; i++){    g[from[i]][--cnt[from[i]]] = to[i];    if(f)g[to[i]][--cnt[to[i]]] = from[i];   }   return g;  }  int[][][] makeS(int n, int e, int[] from, int[] to, boolean f){   int[][][] g = new int[n][][];int[]cnt = new int[n];   for(int i = 0; i< e; i++){    cnt[from[i]]++;    if(f)cnt[to[i]]++;   }   for(int i = 0; i< n; i++)g[i] = new int[cnt[i]][];   for(int i = 0; i< e; i++){    g[from[i]][--cnt[from[i]]] = new int[]{to[i], i, 0};    if(f)g[to[i]][--cnt[to[i]]] = new int[]{from[i], i, 1};   }   return g;  }  int find(int[] set, int u){return set[u] = (set[u] == u?u:find(set, set[u]));}  int digit(long s){int ans = 0;while(s>0){s/=10;ans++;}return ans;}  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 p(Object... o){for(Object oo:o)out.print(oo+" ");}  void pn(Object... o){for(int i = 0; i< o.length; i++)out.print(o[i]+(i+1 < o.length?" ":"\n"));}  void pni(Object... o){for(Object oo:o)out.print(oo+" ");out.println();out.flush();}  String n()throws Exception{return in.next();}  String nln()throws Exception{return in.nextLine();}  int ni()throws Exception{return Integer.parseInt(in.next());}  long nl()throws Exception{return Long.parseLong(in.next());}  double nd()throws Exception{return Double.parseDouble(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;   }  } }
0	public class Solution implements Runnable { private BufferedReader in; private PrintWriter out; private StringTokenizer st; private Random rnd;  double Vend;  private double calcFirstSegment(double a, double Vmax, double Vend, double l) {  double Vl = 0, Vr = Vmax;   for(int it = 0; it < 256; it++) {  double Vm = (Vl + Vr) / 2.0;    double tFirst = Vm / a;    double tSecond = 0;  if(Vend < Vm) tSecond = (Vm - Vend) / a;    double firstPart = a * tFirst * tFirst / 2.0;  double secondPart = Vm * tSecond - a * tSecond * tSecond / 2.0;    double res = firstPart + secondPart;    if(res < l) Vl = Vm;  else Vr = Vm;  }   this.Vend = Math.min(Vl, Vend);   double res = 0.0;   {  double Vm = Vl;    double tFirst = Vm / a;  double tSecond = 0;  if(Vend < Vm) tSecond = (Vm - Vend) / a;        double firstPart = a * tFirst * tFirst / 2.0;  double secondPart = Vm * tSecond - a * tSecond * tSecond / 2.0;    double remain = l - firstPart - secondPart;    res = tFirst + tSecond + (remain / Vm);  }   return res; }  private double calcSecondPart(double a, double Vmax, double Vstart, double l) {  double Vl = Vstart, Vr = Vmax;      for(int it = 0; it < 256; it++) {  double Vm = (Vl + Vr) / 2.0;  double t = (Vm - Vstart) / a;    double s = Vstart * t + a * t * t / 2.0;    if(s < l) Vl = Vm;  else Vr = Vm;  }   double res = 0.0;   {  double Vm = (Vl + Vr) / 2.0;  double t = (Vm - Vstart) / a;    double s = Vstart * t + a * t * t / 2.0;    double remain = l - s;    res = t + (remain / Vmax);  }   return res; }  public void solve() throws IOException {  double a = nextDouble(), v = nextDouble(), l = nextDouble(), d = nextDouble(), w = nextDouble();   double res = calcFirstSegment(a, v, w, d);  res += calcSecondPart(a, v, Vend, l - d);   out.println(res); }   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()); }  private long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  private double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
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))); } } } }
2	public class Main { public static void main(String[] args) throws IOException {  (new Main()).solve(); }  public Main() { }  MyReader in = new MyReader(); PrintWriter out = new PrintWriter(System.out);  void solve() throws IOException {          long n = in.nextLong();  long k = in.nextLong();  long sum = 1;  long count = 0;   long index = k - 1;   long[] delta = {1000000000, 100000000, 10000000, 1000000, 100000, 10000, 1000, 100, 10, 1, 0};   while (index > 0) {  if (index + sum <= n) {   for (int d = 0; d < delta.length; d++) {   if (delta[d] < index) {    long m = (2 * index - delta[d])*(delta[d] + 1)/2;    if (m + sum <= n) {    sum += m;    index -= (delta[d] + 1);    count += (delta[d] + 1);    }   }   }  } else {   index = n - sum;  }  }  if (sum == n) {  out.println(count);  } else {  out.println(-1);  }     out.close(); }  }; class MyReader { private BufferedReader in; String[] parsed; int index = 0;  public MyReader() {  in = new BufferedReader(new InputStreamReader(System.in)); }  public int nextInt() throws NumberFormatException, IOException {  if (parsed == null || parsed.length == index) {  read();  }  return Integer.parseInt(parsed[index++]); }  public long nextLong() throws NumberFormatException, IOException {  if (parsed == null || parsed.length == index) {  read();  }  return Long.parseLong(parsed[index++]); }  public String nextString() throws IOException {  if (parsed == null || parsed.length == index) {  read();  }  return parsed[index++]; }  private void read() throws IOException {  parsed = in.readLine().split(" ");  index = 0; }  public String readLine() throws IOException {  return in.readLine(); } };
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) {    final int SIZE = 256;    final int UNDEF = -1;    int nPixels = in.nextInt();    int groupSize = in.nextInt();    int[] a = in.nextIntArray(nPixels);    boolean[] exists = new boolean[SIZE];    int[] left = new int[SIZE];    int[] right = new int[SIZE];    int[] ret = new int[nPixels];    Arrays.fill(ret, UNDEF);    for (int i = 0; i < nPixels; i++) {     for (int p = 0; p < SIZE; p++) {      if (exists[p] && left[p] <= a[i] && a[i] <= right[p]) {       ret[i] = left[p];       left[a[i]] = left[p];       right[a[i]] = right[p];       break;      }     }     if (ret[i] == UNDEF) {      int l = Math.max(a[i] - groupSize + 1, 0);      int r = l + groupSize - 1;      for (int p = a[i] - 1; p >= 0; p--) {       if (exists[p]) {        if (p >= l) {         int d = p - l;         l = p + 1;         r += d + 1;        }        if (right[p] >= l) {         right[p] = l - 1;        }       }      }      for (int p = a[i] + 1; p < SIZE; p++) {       if (exists[p] && left[p] <= r) {        r = left[p] - 1;       }      }      left[a[i]] = l;      right[a[i]] = r;      ret[i] = l;     }     exists[a[i]] = true;    }      out.print(ret);   }  }  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(int[] array) {    for (int i = 0; i < array.length; i++) {     if (i != 0) {      writer.print(' ');     }     writer.print(array[i]);    }   }   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 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 int[] nextIntArray(int n) {    int[] array = new int[n];    for (int i = 0; i < n; ++i) array[i] = nextInt();    return array;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
1	public class HamstersAndTigers { Scanner in; PrintWriter out;  HamstersAndTigers() {  in = new Scanner(System.in);  out = new PrintWriter(System.out); }  HamstersAndTigers(String i, String o) throws FileNotFoundException {  in = new Scanner(new File(i));  out = new PrintWriter(new File(o)); }  public void finalize() {  out.flush();  in.close();  out.close(); }  void solve() {  int i = 0,  h = 0,  n = in.nextInt();   String buf = "";  char[] ht = in.next().toCharArray();   for(i = 0; i < n; ++i)  if(ht[i] == 'H')   ++h;   for(i = 0; i < h; ++i)  buf += 'H';   for(i = 0; i < n - h; ++i)  buf += 'T';   int diff = (1 << 28);  for(i = 0; i < n; ++i)  {  int tmp = 0;    for(int j = 0; j < n; ++j)   if(buf.charAt(j) != ht[(i + j) % n])   ++tmp;    diff = Math.min(tmp, diff);  }   out.println(diff / 2); }  public static void main(String[] args) throws FileNotFoundException {  HamstersAndTigers t = new HamstersAndTigers();  t.solve();  t.finalize(); } }
1	public final class CF {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   ArrayList<String> a = new ArrayList<>();   for(int i = 0; i<n; i++)    a.add(sc.next());   int count = 0;   for(int i = 0; i<n; i++) {    String b = sc.next();    int idx = a.indexOf(b);    if(idx!=-1)     a.remove(idx);    else     count++;   }   System.out.println(count);  } }
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());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public float nextFloat() {    return Float.parseFloat(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();  } }
6	public class Sol2{ final public static 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 void shuffle(int[] a) {  Random get = new Random();  for (int i = 0; i < a.length; i++) {  int r = get.nextInt(a.length);  int temp = a[i];  a[i] = a[r];  a[r] = temp;  } } 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;  }   long nextLong() throws IOException {  long 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();  }  } }
3	public class D { public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);   int inv = 0;  int n = sc.nextInt();  int[] arr = new int[n];  for (int i = 0; i < arr.length; i++)  arr[i] = sc.nextInt();   for (int i = 0; i < arr.length; i++)  for (int j = i+1; j < arr.length; j++)   if(arr[i] > arr[j])   inv++;     boolean odd = (inv%2)!=0;  int q = sc.nextInt();  for (int i = 0; i < q; i++)  {  int l = sc.nextInt();  int r = sc.nextInt();  int sz = r-l+1;  int tot = (sz*(sz-1))/2;  if(tot%2 != 0)   odd = !odd;  if(odd)   pw.println("odd");  else   pw.println("even");  }   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 long nextLong() throws IOException  {  return Long.parseLong(next());  }  public String nextLine() throws IOException  {  return br.readLine();  }  public double nextDouble() throws IOException  {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-')  {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.')   {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else   {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public boolean ready() throws IOException  {  return br.ready();  } } }
5	public class C { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = null; PrintWriter out;  public void solution() throws IOException {  int n = nextInt();  int a[] = new int[n];  int b[] = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  b[i] = a[i];  }  Arrays.sort(a);  int ans = 0;  for (int i = 0; i < n; i++) {  if (a[i] != b[i]) {   ans++;  }  }  if (ans == 2 || ans == 0) {  System.out.println("YES");  } else {  System.out.println("NO");  }  }  public String nextToken() throws IOException {  if (st == null || !st.hasMoreTokens()) {  st = new StringTokenizer(bf.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()); }  public void print(int a[]) {  for (int i = 0; i < a.length; i++) {  System.out.print(a[i] + " ");  } }  public static void main(String args[]) throws IOException {  new C().solution(); } }
3	public class C {  public static void main(String[] args){  try(Scanner sc = new Scanner(System.in)){  final int N = sc.nextInt();    String[] ins = new String[N];  for(int i = 0; i < N; i++){   ins[i] = sc.next();  }    final long MOD = 1000000007;  long[] DP = new long[N];  long[] nextDP = new long[N];    DP[0] = 1;    for(int i = 1; i < N; i++){   Arrays.fill(nextDP, 0);   if("f".equals(ins[i - 1])){   for(int j = 0; j < N - 1; j++){    nextDP[j + 1] += DP[j];    nextDP[j + 1] %= MOD;   }   }else{   for(int j = N - 1; j >= 0; j--){    nextDP[j] += DP[j];    nextDP[j] %= MOD;       if(j < N - 1){    nextDP[j] += nextDP[j + 1];    nextDP[j] %= MOD;    }   }   }     {   long[] tmp = DP;   DP = nextDP;   nextDP = tmp;   }  }    long answer = 0;  for(int i = 0; i < N; i++){   answer += DP[i];   answer %= MOD;  }    System.out.println(answer);  } }  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 int nextInt() {  return Integer.parseInt(next());  }   public long nextLong() {  return Long.parseLong(next());  }  public void close() {  try {   br.close();  } catch (IOException e) {   }  } } }
3	public class D {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt(), sum = 0;   int [] a = new int[n+1];   for (int i = 1; i <= n; i++) {    a[i] = in.nextInt();   }   for (int i = 1; i <= n; ++i)    for (int j = i + 1; j <= n; ++j)     sum += a[i] > a[j] ? 1 : 0;   int m = in.nextInt();   sum &= 1;   for (int i = 1; i <= m; i++) {    int l = in.nextInt(), r = in.nextInt();    if (((r - l + 1) / 2) % 2 == 1)     sum ^= 1;    System.out.println(sum == 1 ? "odd" : "even");   }  } }
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); } }
5	public class A111_div2 {   static boolean test = false; static String testDataFile = "testdata.txt"; static String feedFile = "feed.txt"; CompetitionType type = CompetitionType.CF; private static String ENDL = "\n";   private void solve() throws Throwable {  int n = iread();   int[] vals = new int[n];  double tot = 0;  for (int i = 0; i < n; i++) {  int value = iread();  vals[i] = value;  tot += value;  }   Arrays.sort(vals);  int pick = 0;  int worth = 0;  for (int i = vals.length - 1; i >= 0; i--) {  worth += vals[i];  pick ++;  if(worth > tot/2.0d){   break;  }  }   out.write(pick + ENDL);  out.flush(); }  public int iread() throws Exception {  return Integer.parseInt(wread()); }  public double dread() throws Exception {  return Double.parseDouble(wread()); }  public long lread() throws Exception {  return Long.parseLong(wread()); }  public String wread() 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) throws Throwable {  if (test) {   BufferedReader testdataReader = new BufferedReader(new FileReader(testDataFile));  String readLine = testdataReader.readLine();  int casenr = 0;  out: while (true) {   BufferedWriter w = new BufferedWriter(new FileWriter(feedFile));   if (!readLine.equals("input")) {   break;   }   while (true) {   readLine = testdataReader.readLine();   if (readLine.equals("output")) {    break;   }   w.write(readLine + "\n");   }   w.close();   System.out.println("Answer on case " + (++casenr) + ": ");   new A111_div2().solve();   System.out.println("Expected answer: ");   while (true) {   readLine = testdataReader.readLine();    if (readLine == null) {    break out;   }   if (readLine.equals("input")) {    break;   }   System.out.println(readLine);   }   System.out.println("----------------");  }  testdataReader.close();  } else {   new A111_div2().solve();  }  out.close(); }  public A111_div2() throws Throwable {  if (test) {  in = new BufferedReader(new FileReader(new File(feedFile)));  } }  InputStreamReader inp = new InputStreamReader(System.in); BufferedReader in = new BufferedReader(inp); static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));  enum CompetitionType {  CF, OTHER }; }
0	public class A { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  String inp = in.nextLine();  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);  }  }
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 void run() {   try {    solve();   } catch (Throwable e) {    System.err.println(e.getMessage());    e.printStackTrace();    System.exit(666);   } finally {    output.flush();    output.close();   }  }   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());  }  private long nextLong() throws IOException {   return Long.parseLong(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; }
3	public class C {  private static final int MOD = (int) 1e9 + 7;  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[][] DP = new int[n][n + 1];   DP[0][0] = 1;   for (int i = 0; i < n - 1; i++) {    if (in.next().charAt(0) == 'f') {     for (int j = 1; j < n; j++)      DP[i+1][j] = DP[i][j-1];    } else {     for (int j = n - 1; j >= 0; j--)      DP[i+1][j] = (DP[i][j] + DP[i+1][j+1]) % MOD;    }   }   int answer = 0;   for (int i = 0; i < n; i++)    answer = (answer + DP[n-1][i]) % MOD;   System.out.println(answer);  } }
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();    }   }
5	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   MyReader in = new MyReader(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, MyReader in, PrintWriter out) {    int n = in.nextInt();    int[] a = new int[n];    for (int i = 0; i < n; ++i) {     a[i] = in.nextInt();    }    Map<Integer, Integer> map = new HashMap<>();    for (int i = 0; i < n; ++i) {     if (map.containsKey(a[i])) {      map.put(a[i], map.get(a[i]) + 1);     } else {      map.put(a[i], 1);     }    }    List<Integer> compressed = new ArrayList<>();    compressed.add(-1);    compressed.add(Integer.MAX_VALUE);    compressed.addAll(map.keySet());    Collections.sort(compressed);       int N = compressed.size() + 10;    BIT count = new BIT(N);    BIT sum = new BIT(N);    BigInteger ret = BigInteger.ZERO;    for (int i = n - 1; i >= 0; --i) {     int l = findLeft(compressed, a[i] - 2);     int r = findRight(compressed, a[i] + 2);     long left = sum.sum(0, l);     long countLeft = count.sum(0, l);     long right = sum.sum(r, N);     long countRight = count.sum(r, N);                           long t = (left - countLeft * a[i]) + (right - a[i] * countRight);     ret = ret.add(BigInteger.valueOf(t));     int x = Collections.binarySearch(compressed, a[i]);     sum.update(x, a[i]);     count.update(x, 1);    }    out.println(ret);   }   private int findLeft(List<Integer> a, int t) {    int lo = -1, hi = a.size();    while (hi - lo > 1) {     int m = lo + (hi - lo) / 2;     if (a.get(m) <= t) {      lo = m;     } else {      hi = m;     }    }    return lo;   }   private int findRight(List<Integer> a, int t) {    int lo = -1, hi = a.size();    while (hi - lo > 1) {     int m = lo + (hi - lo) / 2;     if (a.get(m) < t) {      lo = m;     } else {      hi = m;     }    }    return hi;   }   class BIT {    long[] tree;    public BIT(int n) {     tree = new long[n + 1];    }    public void update(int x, long d) {     while (x < tree.length) {      tree[x] += d;      x += x & -x;     }    }    public long sum(int l, int r) {     return sum(r) - sum(l - 1);    }    public long sum(int x) {     long sum = 0;     while (x > 0) {      sum += tree[x];      x -= x & -x;     }     return sum;    }   }  }  static class MyReader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public MyReader(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 class Task {   public class Maxflow {    class Edge {     int t, rev;     long cap, f;     public Edge(int t, int rev, long cap) {      this.t = t;      this.rev = rev;      this.cap = cap;     }    }    public Maxflow(int n) {     graph = new List[n];     for (int i = 0; i < n; i++) {      graph[i] = new ArrayList<>();     }    }    List<Edge>[] graph;    void addEdge(int s, int t, long cap) {     graph[s].add(new Edge(t, graph[t].size(), cap));     graph[t].add(new Edge(s, graph[s].size() - 1, 0));    }    boolean dinicBFS(int src, int dest, int[] dist) {     Arrays.fill(dist, -1);     dist[src] = 0;     int[] Q = new int[graph.length];     int sizeQ = 0;     Q[sizeQ++] = src;     for (int i = 0; i < sizeQ; i++) {      int u = Q[i];      for (Edge e: graph[u]) {       if (dist[e.t] < 0 && e.f < e.cap) {        dist[e.t] = dist[u] + 1;        Q[sizeQ++] = e.t;       }      }     }     return dist[dest] >= 0;    }    long dinicDFS(int[] ptr, int[] dist, int dest, int u, long f) {     if (u == dest) return f;     for (;ptr[u] < graph[u].size(); ++ptr[u]) {      Edge e = graph[u].get(ptr[u]);      if (dist[e.t] == dist[u] + 1 && e.f < e.cap) {       long df = dinicDFS(ptr, dist, dest, e.t, Math.min(f, e.cap - e.f));       if (df > 0) {        e.f += df;        graph[e.t].get(e.rev).f -= df;        return df;       }      }     }     return 0;    }    long maxFLow(int src, int dest) {     long flow = 0;     int[] dist = new int[graph.length];     while (dinicBFS(src, dest, dist)) {      int[] ptr = new int[graph.length];      while (true) {       long df = dinicDFS(ptr, dist, dest, src, Long.MAX_VALUE);       if (df == 0) break;       flow += df;      }     }     return flow;    }   }   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 long nextLong() throws IOException {    return Long.parseLong(next());   }   public String nextLine() throws IOException {    return br.readLine();   }   public double nextDouble() throws IOException {    return Double.parseDouble(next());   }   public boolean ready() throws IOException {    return br.ready();   }  } }
4	public class _1523_C {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(System.out);   int t = Integer.parseInt(in.readLine());   while(t-- > 0) {    int n = Integer.parseInt(in.readLine());    int[] a = new int[n];    for(int i = 0; i < n; i++) {     a[i] = Integer.parseInt(in.readLine());    }    boolean[][] used = new boolean[n][n + 1];    boolean[] used2 = new boolean[n];    String[][] res = new String[n][2];    res[0][0] = "1";    res[0][1] = "";    for(int i = 1; i < n; i++) {     if(a[i] == 1) {      for(int j = i - 1; j >= 0; j--) {       if(!used[j][a[i]] && !used2[j]) {        res[i][0] = res[j][0] + ".1";        res[i][1] = res[j][0];        used[j][a[i]] = true;        break;       }      }     }else {      for(int j = i - 1; j >= 0; j--) {       if(!used[j][a[i]] && !used2[j] && a[j] == a[i] - 1) {        if(res[j][1].equals("")) {         res[i][0] = "" + a[i];        }else {         res[i][0] = res[j][1] + "." + a[i];        }        res[i][1] = res[j][1];        used[j][a[i]] = true;        break;       }       used2[j] = true;      }     }    }    for(int i = 0; i < n; i++) {     out.println(res[i][0]);    }   }   in.close();   out.close();  } }
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));   }  } }
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);   _992C solver = new _992C();   solver.solve(1, in, out);   out.close();  }  static class _992C {   static int mod = (int) 1e9 + 7;   public void solve(int testNumber, InputReader in, OutputWriter out) {    long x = in.nextLong();    long k = in.nextLong();    if (x == 0) {     out.println(0);     return;    }    long[][] base = new long[][]{{2, 0}, {1, 1}};    _992C.Matrix.N = 2;    base = _992C.Matrix.matrixPower(base, base, k);    x %= mod;    long ans = 2 * base[0][0] * x - base[1][0];    ans %= mod;    if (ans < 0)     ans += mod;    out.println(ans);   }   static public class Matrix {    static int N;    static long[][] id = new long[][]{{1, 0}, {0, 1}};    static long[][] matrixPower(long[][] mat, long[][] base, long pow) {     if (pow == 0) {      return id;     }     if (pow == 1) {      return base;     }     long[][] t = matrixPower(mat, base, pow / 2);     t = multiplyMatrix(t, t);     if (pow % 2 == 1) {      t = multiplyMatrix(t, base);     }     return t;    }    static long[][] multiplyMatrix(long[][] m, long[][] m2) {     long[][] ans = new long[N][N];     for (int i = 0; i < N; i++)      for (int j = 0; j < N; j++) {       ans[i][j] = 0;       for (int k = 0; k < N; k++) {        ans[i][j] += m[i][k] * m2[k][j];        ans[i][j] %= mod;       }      }     return 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 println(long i) {    writer.println(i);   }   public void println(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 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 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);   }  } }
1	public class A{   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));     PrintWriter out = new PrintWriter(System.out);     int[][] d = new int[5][3];   int[][] d2 = new int[5][3];     int N = Integer.parseInt(br.readLine());   for (int i = 0; i < N; i++) {    String r = br.readLine();    int len = r.length();    int fin = 0;    if(r.charAt(r.length()-1) == 'S')     fin = 0;    if(r.charAt(r.length()-1) == 'M')     fin = 1;    if(r.charAt(r.length()-1) == 'L')     fin = 2;    d[len][fin]++;   }     for (int i = 0; i < N; i++) {    String r = br.readLine();    int len = r.length();    int fin = 0;    if(r.charAt(r.length()-1) == 'S')     fin = 0;    if(r.charAt(r.length()-1) == 'M')     fin = 1;    if(r.charAt(r.length()-1) == 'L')     fin = 2;    d2[len][fin]++;   }     int ans = 0;   for (int i = 0; i < d.length; i++) {    int sum = 0;    int sum2 = 0;    for (int j = 0; j < d[0].length; j++) {     sum += d[i][j];     sum2 += d2[i][j];     ans += Math.max(0, d2[i][j] - d[i][j]);    }      }   System.out.println(ans);   out.close();  }  }
1	public class A {    public static void main(String[] args) throws IOException  {     Scanner sc=new Scanner(System.in);   PrintWriter pw=new PrintWriter(System.out);   int n=sc.nextInt();   String []a=new String[n];   String []b=new String[n];     TreeMap<String,Integer> map1=new TreeMap(),map2=new TreeMap();   for(int i=0;i<n;i++)   {   String s=sc.next();   map1.put(s, map1.getOrDefault(s, 0)+1);      }   for(int i=0;i<n;i++)   {   String s=sc.next();   map2.put(s, map2.getOrDefault(s, 0)+1);      }   int ans=0;   for(String s:map2.keySet())   {   int cnt=map1.getOrDefault(s, 0);   ans+=Math.max(0, map2.get(s)-cnt);   }   pw.println(ans);   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 Scanner(String s) throws FileNotFoundException {  br = new BufferedReader(new FileReader(s));  }  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 String nextLine() throws IOException {  return br.readLine();  }  public boolean ready() throws IOException {  return br.ready();  } }    }
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); } }
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()); }  double nextDouble(){ return Double.parseDouble(next()); }  float nextFloat() { return Float.parseFloat(next()); }  boolean nextBoolean() { return Boolean.parseBoolean(next()); }  String nextLine()  {  String str = "";  try  {   str = br.readLine();  }  catch (IOException e)  {   e.printStackTrace();  }  return str;  } } static long modExp(long x, long n, long mod)  {  long result = 1;  while(n > 0)  {   if(n % 2 == 1)    result = (result%mod * x%mod)%mod;   x = (x%mod * x%mod)%mod;   n=n/2;  }  return result; } 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);  } } } class pair { public int first; public int second; public pair(int first,int second) {  this.first = first;  this.second = second; } public pair(pair p) {  this.first = p.first;  this.second = p.second; } public int first() { return first; } public int second() { return second; } public void setFirst(int first) { this.first = first; } public void setSecond(int second) { this.second = second; } } class myComp implements Comparator<pair> { public int compare(pair a,pair b) {  if(a.first != b.first) return (a.first - b.first);  return (b.second - a.second); } } class BIT   { public long[] m_array;  public BIT(long[] dat) {  m_array = new long[dat.length + 1];  Arrays.fill(m_array,0);  for(int i = 0; i < dat.length; i++)  {  m_array[i + 1] = dat[i];  }  for(int i = 1; i < m_array.length; i++)  {  int j = i + (i & -i);  if(j < m_array.length)  {   m_array[j] = m_array[j] + m_array[i];  }  } }  public final long prefix_query(int i) {  long result = 0;  for(++i; i > 0; i = i - (i & -i))  {  result = result + m_array[i];  }  return result; }  public final long range_query(int fro, int to) {  if(fro == 0)  {  return prefix_query(to);  }  else  {  return (prefix_query(to) - prefix_query(fro - 1));  } }  public void update(int i, long add) {  for(++i; i < m_array.length; i = i + (i & -i))  {  m_array[i] = m_array[i] + add;  } } }
0	public class Codechef {   static String reverse(String s){  String reverse="";  for(int i=s.length()-1;i>=0;i--){   reverse=reverse + s.charAt(i);  }  return reverse; }    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);  } }
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 class Pair<E extends Comparable, V extends Comparable> implements Comparable<Pair<E, V>> {   public Pair(E first, V second) {    this.first = first;    this.second = second;   }   @Override   public int compareTo(Pair<E, V> obj) {    if(first == obj.first) return second.compareTo(obj.second);    return first.compareTo(obj.first);   }   @Override   public boolean equals(Object obj) {    Pair other = (Pair)obj;    return first.equals(other.first) && second.equals(other.second);   }   public E first;   public V second;  }  @Override  public void run() {   try {    if(in.equals("")) reader = new BufferedReader(new InputStreamReader(System.in));    else reader = new BufferedReader(new FileReader(in));    if(out.equals("")) writer = new PrintWriter(new OutputStreamWriter(System.out));    else writer = new PrintWriter(new FileWriter(out));    solve();   } catch(IOException e) {    e.printStackTrace();   } finally {    try {     reader.close();     writer.close();    } catch(IOException e) {     e.printStackTrace();    }   }  }  private int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  private long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  private double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  private float nextFloat() throws IOException {   return Float.parseFloat(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; }
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)]);  } }
2	public class b817 { public static Scanner scn = new Scanner(System.in);  public static void main(String[] args) {    long n = scn.nextLong();  long s = scn.nextLong();  long lo = 0;  long hi = n ;  while(lo<=hi)  {  long mid=(lo+hi)/2;   if(check(mid, s))  {   hi=mid-1;  }  else  {   lo=mid+1;  }    }  if(check(lo, s))  {  System.out.println(n-lo+1);  }  else  {  System.out.println("0");    } }  public static boolean check(long n, long s) {  long sum=0;  long a=n;  while(n>0)  {   sum=sum+(n%10);  n=n/10;  }  if(a-sum>=s)  {  return true;  }  return false;  } }
2	public class Codeforces { public StreamTokenizer st; public PrintWriter pw; public static final int modulo = 1000000009;   static class Point {  public int x, y;  Point(int _x, int _y)  {  x = _x;  y = _y;  } }  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 int nI() {  try{  st.nextToken();  }  catch(IOException e)  {    }  return (int)st.nval; }  private double nD() {  try{  st.nextToken();  }  catch(IOException e)  {    }  return st.nval; }  private String nS() {  try{  st.nextToken();  }  catch(IOException e)  {    }  return st.sval; }   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); }    }
4	public class p1 {    public static void main(String[] args) {   new p1().run();  }  private void run() {   try {       Scanner scanner = new Scanner(System.in);    String in = scanner.next();       Hashtable<String, Boolean> tmp = new Hashtable<String, Boolean>();    int sol = 0;    for (int i = 0; i < in.length(); i++) {     for (int j = i + 1; j <= in.length(); j++) {      String str = in.substring(i, j);      if (tmp.containsKey(str)) {       if (tmp.get(str)) {        if(str.length() > sol) sol=str.length();        boolean tmp1 = tmp.remove(str);        tmp.put(str, false);       }      } else {       tmp.put(str, Boolean.TRUE);      }     }    }    System.out.println(sol);   } catch (Exception ex) {   }  }   }
1	public class B {  private void solve() throws IOException {   int n = nextInt();   int k = nextInt();     int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = nextInt();     int[] f = new int[100000 + 2];     int min = Integer.MAX_VALUE;   int cur = 0;   int start = 0;   int from = -1, to = -1;     for (int i = 0; i < n; i++) {    f[a[i]]++;    if (f[a[i]] == 1) cur++;    if (cur == k) {     while (f[a[start]] > 1) {      f[a[start]]--;      start++;     }     if (i - start + 1 < min) {      min = i - start + 1;      from = start;      to = i;     }    }   }   pl(from == -1 ? "-1 -1" : ((1 + from) + " " + (1 + to)));  }  public static void main(String[] args) {   new B().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());  }  BigInteger nextBigInteger() throws IOException {   return new BigInteger(nextToken());  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }  void p(Object... objects) {   for (int i = 0; i < objects.length; i++) {    if (i != 0)     writer.print(' ');    writer.flush();    writer.print(objects[i]);    writer.flush();   }  }  void pl(Object... objects) {   p(objects);   writer.flush();   writer.println();   writer.flush();  }  int cc;  void pf() {   writer.printf("Case #%d: ", ++cc);   writer.flush();  } }
5	public class Main {  private void solve() {   int n = in.nextInt();   int k = in.nextInt();   final int[] p = new int[n];   final int[] t = new int[n];   for(int i =0 ; i < n; ++i) {    p[i] = in.nextInt();    t[i] = in.nextInt();   }   Integer[] ord = new Integer[n];   for(int i = 0; i < n; ++i)    ord[i] = i;   for(int i = 0; i < n; ++i) {    for(int j = 0; j < n - 1; ++j) {     if (Less(ord[j], ord[j + 1], p, t)) {      Integer tx = ord[j];      ord[j] = ord[j + 1];      ord[j + 1] = tx;     }    }   }          for(int i = 0, j = 0; i < n; i = j) {    for(j = i; j < n && p[ord[i]] == p[ord[j]] && t[ord[i]] == t[ord[j]]; ++j) ;    int first = i+1;    int second = j;    if (first <= k && k <= second) {     out.print(j - i);     return ;    }   }   out.print(0);  }  private boolean Less(Integer i, Integer j, int[] p, int[] t) {   return p[i] < p[j] || p[i] == p[j] && t[i] > t[j];  }  private void run() {   try {    in = new FastScanner();    out = new PrintWriter(new OutputStreamWriter(System.out));    solve();    out.flush();   } catch (Exception e) {    e.printStackTrace();   }  }   public static void main(String[] args) {   new Main().run();  }  FastScanner in;  PrintWriter out;  class FastScanner {   public BufferedReader reader;   private StringTokenizer tokenizer;   public FastScanner(String file) {    try {     reader = new BufferedReader(new FileReader(new File(file)));     tokenizer = null;    } catch (FileNotFoundException e) {     e.printStackTrace();    }   }     public FastScanner() {    try {     reader = new BufferedReader(new InputStreamReader(System.in));     tokenizer = null;    } catch (Exception e) {     e.printStackTrace();    }   }   public String nextToken() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (Exception e) {      e.printStackTrace();     }    }    return tokenizer.nextToken();   }   int nextInt() {    return Integer.parseInt(nextToken());   }   long nextLong() {    return Long.parseLong(nextToken());   }  } }
6	public class A{ static int n,m,start; static boolean [][] adj; static long [][] mem; public static void main(String[] args)throws Throwable {  Scanner sc=new Scanner(System.in);  n=sc.nextInt();  m=sc.nextInt();  adj=new boolean [n][n];  for(int i=0;i<m;i++){  int u=sc.nextInt()-1;  int v=sc.nextInt()-1;  adj[u][v]=true;  adj[v][u]=true;  }  mem=new long [n+1][(1<<n)];  for(int i=0;i<=n;i++)  Arrays.fill(mem[i], -1);  long ans=0;  for(int i=0;i<n;i++){  start=i;  ans+=dp(i, (1<<i));  }  System.out.println(ans/2); }  public static long dp(int i,int msk){  if(mem[i][msk]!=-1)  return mem[i][msk];  long ans=0;  if(adj[i][start] && Integer.bitCount(msk)>2)  ans++;  for(int j=start+1;j<n;j++){  if(adj[i][j] && (msk & (1<<j))==0){   ans+=dp(j, msk | (1<<j));  }  }  return mem[i][msk]=ans; }  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 long nextLong() throws IOException {return Long.parseLong(next());}  public String nextLine() throws IOException {return br.readLine();}  public double nextDouble() throws IOException { return Double.parseDouble(next()); }  public boolean ready() throws IOException {return br.ready();}  } }
6	public class E { private static 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); }  private static void fill(int[][] array, int val) {  for(int [] fill : array)  Arrays.fill(fill, val); } }
3	public class SameSumBlocks {  public static void main(String[] args) throws Exception {   FastScanner sc = new FastScanner();   PrintWriter out = new PrintWriter(System.out);   int N = sc.nextInt();   int[] pre = new int[N + 1];   for (int i = 1; i <= N; i++) {    pre[i] = pre[i - 1] + sc.nextInt();   }    Pair[] sums = new Pair[N * (N + 1) / 2];   int k = 0;   for (int i = 1; i <= N; i++) {    for (int j = i; j <= N; j++) {     int sum = pre[j] - pre[i - 1];     sums[k++] = new Pair(i, j, sum);    }   }   Arrays.sort(sums, (p1, p2) -> p1.sum - p2.sum != 0 ? p1.sum - p2.sum : p1.r - p2.r);   var ans = new ArrayList<Pair>();   int i = 0;   while (i < k) {    var group = new ArrayList<Pair>();    int last = 0;    int j = i;    while (j < k && sums[j].sum == sums[i].sum) {     if (sums[j].l > last) {      group.add(sums[j]);      last = sums[j].r;     }     j++;    }    if (group.size() > ans.size()) {     ans = group;    }    i = j;   }   out.println(ans.size());   for (Pair p : ans) {    out.println(p);   }   out.close();  }  static class Pair {   int l, r, sum;   public Pair(int ll, int rr, int ss) {    l = ll; r = rr; sum = ss;   }   public String toString() {    return l + " " + r;   }  }  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 int[] nextInts(int N) {    int[] res = new int[N];    for (int i = 0; i < N; i++) {     res[i] = (int) nextLong();    }    return res;   }   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;   }   public String next() {    StringBuilder res = new StringBuilder();    while(c<=32)c=getChar();    while(c>32) {     res.append(c);     c=getChar();    }    return res.toString();   }   public String nextLine() {    StringBuilder res = new StringBuilder();    while(c<=32)c=getChar();    while(c!='\n') {     res.append(c);     c=getChar();    }    return res.toString();   }   public boolean hasNext() {    if(c>32)return true;    while(true) {     c=getChar();     if(c==NC)return false;     else if(c>32)return true;    }   }  } }
3	public class cf1 implements Runnable {   static void addMap(int curr, HashMap<Integer, Integer> map, HashMap<Integer, Integer>[] hm, int j) {   int prev = 0;   if(map.get(curr) != null)  prev = map.get(curr);   int val = 0;   if(hm[j].get(curr) != null)  val = hm[j].get(curr);   if(prev + 1 <= val)  return;   hm[j].put(curr, prev + 1); }  public void run() {   InputReader s = new InputReader(System.in);  PrintWriter w = new PrintWriter(System.out);   int n = s.nextInt();   int[] a = new int[n];   HashMap<Integer, Integer>[] hm = new HashMap[n];   for(int i = 0; i < n; i++) {  a[i] = s.nextInt();  hm[i] = new HashMap<Integer, Integer>();  }   HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();   for(int i = 0; i < n; i++) {    int curr = 0;    for(int j = i; j < n; j++) {   curr += a[j];   addMap(curr, map, hm, j);  }    for(Map.Entry<Integer, Integer> e : hm[i].entrySet()) {     if(map.get(e.getKey()) != null && map.get(e.getKey()) >= e.getValue())   continue;     map.put(e.getKey(), e.getValue());  }  }   int key = -1;  int value = 0;   for(Map.Entry<Integer, Integer> e : map.entrySet()) {    if(e.getValue() > value) {   key = e.getKey(); value = e.getValue();  }  }   w.println(value);   int prev = -1;   for(int i = 0; i < n; i++) {    int curr = 0;    for(int j = i; j > prev; j--) {     curr += a[j];     if(curr == key) {   w.println((j + 1) + " " + (i + 1));   prev = i;   break;   }  }  }   w.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);  }  }  public static void main(String args[]) throws Exception {  new Thread(null, new cf1(),"cf1",1<<26).start(); } }
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();   }   static int INF = (int)1e5*4*4+5;  static int maxn = (int)1e5*2+1;  static int mod=(int)1e9+7 ;  static int n,m,k,t,q,x,a,b,y;   static ArrayList<Integer> adj[];  static int[] dist,parent,back;  static boolean[] vis,vist;  static int root=0,ans=1;     void solve(PrintWriter out, Reader in) throws IOException{   n = in.nextInt();    if(n==1) {out.println(1);return;}   adj = new ArrayList[n+1];   for(int i=1;i<=n;i++)    adj[i] = new ArrayList<Integer>();     int u,v;   for(int i=0;i<n-1;i++){    u = in.nextInt();    v = in.nextInt();        adj[u].add(v);    adj[v].add(u);   }     vist = new boolean[n+1];   vis = new boolean[n+1];   vist[1] =true;   makeroot(1);     parent = new int[n+1];   dist = new int[n+1];   back = new int[n+1];     dfs(root,0);   calcdist(root);     vist = new boolean[n+1];   vis = new boolean[n+1];   vist[root] =true;        PriorityQueue<Node> pq = new PriorityQueue<Node>();   for(int i=1;i<=n;i++){    if(i!=root) pq.add(new Node(i,dist[i]));   }     Node elm;   int rt = root;   out.print(1);     makeroot(root);   removeNodes(root,rt);   ans+=dist[rt];   out.print(" "+ans);   int itr=2;   for(int i=2;i<=n;i++){       elm = pq.remove();    if(vis[elm.idx]) continue;    removeNodes(back[elm.idx],elm.idx);    ans += elm.dist+1;    out.print(" "+ans);    itr++;   }   for(int i=itr;i<n;i++)    out.print(" "+ans);   out.println();  }      static class Node implements Comparable<Node>{   int dist,idx;     Node(int idx,int dist){    this.idx = idx;    this.dist = dist;   }     public int compareTo(Node o) {    return o.dist-this.dist;   }  }   static void removeNodes(int s,int e){   vis[s]=true;   while(s!=e){    vis[s] = true;    s = parent[s];   }   vis[s]=true;   return;  }   static int calcdist(int s){   int res=0;   int tmp=0;   for(int e:adj[s]){    if(e!=parent[s]){     tmp= calcdist(e);     if(1+tmp>res){      res = 1+tmp;      back[s] = back[e];     }    }   }     if(res==0) back[s]=s;   return dist[s] = res;  }   static void dfs(int s,int p){   for(int e:adj[s]){    if(e!=p){     parent[e]=s;     dfs(e,s);    }   }   return;  }   static void makeroot(int s){   Queue<Integer> q = new LinkedList<>();   q.add(s);     int elm=0;   while(q.size()!=0){    elm = q.remove();    for(int e:adj[elm]){     if(!vist[e]){      vist[e]=true;      q.add(e);      root = e;     }    }   }   return;  }     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 nextLine() {   int c = read();   while (isSpaceChar(c)) {    c = read();   }   StringBuilder res = new StringBuilder();   do {    res.appendCodePoint(c);    c = read();   } while (!isEndOfLine(c));   return res.toString();  }  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();  }  double nextDouble()  {   return Double.parseDouble(next());  }  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 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;  }  } }
5	public class A {  class Team implements Comparable<Team>{  int p, t;  public Team(int p, int t) {  this.p = p;  this.t = t;  }  public int compareTo(Team other) {  if (this.p != other.p) return other.p - this.p;  return this.t - other.t;  } }  public void solve() throws IOException {  int n = nextInt();  int K = nextInt() - 1;  Team[] team = new Team[n];  for (int i = 0; i < n; i++)   team[i] = new Team(nextInt(), nextInt());   Arrays.sort(team);  int ans = -1;  int pre = 0;  for (int i = 1; i < n; i++)  if (team[i].compareTo(team[i - 1]) != 0) {   if (K >= pre && K < i) {   ans = i - pre;   break;   }   pre = i;  }  if (ans == -1) ans = n - pre;  writer.println(ans); }  public static void main(String[] args) throws FileNotFoundException {  new A().run(); }  BufferedReader reader; StringTokenizer tokenizer; PrintWriter writer;  public void run() {  try {  long tbegin = System.currentTimeMillis();  reader = new BufferedReader(new InputStreamReader(System.in));    tokenizer = null;  writer = new PrintWriter(System.out);    solve();      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(); } }
2	public class TestClass implements Runnable {  public static void main(String args[]) {  new Thread(null, new TestClass(),"TESTCLASS",1<<18).start(); } public void run() {   InputReader hb=new InputReader(System.in);  PrintWriter w=new PrintWriter(System.out);   long n=hb.nextLong();  long s=hb.nextLong();   long start=0;  long end=n;  long ans=0;  while(start<=end)  {  long mid=(start+end)/2;  if(mid-get(mid)>=s)  {   end=mid-1;   ans=mid;  }  else  {   start=mid+1;  }  }  if(ans<1)  w.print(0);  else  w.print(n-ans+1);  w.close(); }  public long get(long a) {  String str = Long.toString(a);  int ans = 0;  for(char ch : str.toCharArray())  ans += (ch-'0');  return ans; }   private void shuffle(int[] arr) {  Random ran = new Random();  for (int i = 0; i < arr.length; i++) {  int i1 = ran.nextInt(arr.length);  int i2 = ran.nextInt(arr.length);   int temp = arr[i1];  arr[i1] = arr[i2];  arr[i2] = temp;  } }  static class DSU {  int parent[];  int sizeParent[];  DSU(int n)  {  parent=new int[n];  sizeParent=new int[n];  Arrays.fill(sizeParent,1);  for(int i=0;i<n;i++)   parent[i]=i;  }   int find(int x)  {  if(x!=parent[x])   parent[x]=find(parent[x]);  return parent[x];  }   void union(int x,int y)  {  x=find(x);  y=find(y);  if(sizeParent[x]>=sizeParent[y])  {   if(x!=y)   sizeParent[x]+=sizeParent[y];   parent[y]=x;  }  else  {   if(x!=y)   sizeParent[y]+=sizeParent[x];   parent[x]=y;  }  } }  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);  } }  static class Pair implements Comparable<Pair> {  int a;  int b;  String str;  public Pair(int a,int b)  {  this.a=a;  this.b=b;  str=min(a,b)+" "+max(a,b);  }   public int compareTo(Pair pair)  {  if(Integer.compare(a,pair.a)==0)   return Integer.compare(b,pair.b);   return Integer.compare(a,pair.a);  } }   }
1	public class PlayingPiano {  public static void main(String[] args) {  Scanner scanner = new Scanner(System.in);  int n = scanner.nextInt();    List<Integer> as = new LinkedList<>();  int[] as2 = new int[n];    for (int i = 0; i < n; i++) {   int a = scanner.nextInt();   as.add(a);   as2[i] = a;  }      System.out.println(solve2(as2));   scanner.close(); }  public static String solve(List<Integer> as) {  List<Integer> fingers = new LinkedList<>();  fingers.add(1);  fingers.add(2);  fingers.add(3);  fingers.add(4);  fingers.add(5);    List<Integer> solution = assign(as, fingers, fingers);  if (solution == null) {   return "-1";  } else {   StringBuilder sb = new StringBuilder();   for (int b : solution) {   sb.append(b);   sb.append(" ");   }   sb.deleteCharAt(sb.length() - 1);   return sb.toString();  } }  private static List<Integer> assign(List<Integer> as, List<Integer> fingers, List<Integer> allFingers) {   if (fingers.isEmpty()) {  return null;  }     if (as.size() == 1) {  List<Integer> ret = new LinkedList<>();  ret.add(fingers.get(0));  return ret;  }     List<Integer> subList = as.subList(1, as.size());   for (int i = 0; i < fingers.size(); i++) {    List<Integer> subFingers = new LinkedList<>();  final int j = i;  if (as.get(0) < as.get(1)) {   subFingers = allFingers.stream()    .filter(p -> p > fingers.get(j)).collect(Collectors.toList());  } else if (as.get(0) > as.get(1)) {   subFingers = allFingers.stream()    .filter(p -> p < fingers.get(j)).collect(Collectors.toList());  } else {   subFingers = allFingers.stream()    .filter(p -> p != fingers.get(j)).collect(Collectors.toList());  }    List<Integer> ret = assign(subList, subFingers, allFingers);  if (ret != null) {   List<Integer> solution = new LinkedList<>();   solution.add(fingers.get(i));   solution.addAll(ret);   return solution;  }      }  return null;   }  public static String solve2(int[] as) {  int[] ret = new int[as.length];   if (as.length == 1) return "1";   if (as[0] < as[1]) ret[0] = 1;  else if (as[0] == as[1]) ret[0] = 3;  else ret[0] = 5;   for (int i = 1; i < as.length - 1; i++) {  if (as[i-1] < as[i] && ret[i-1] == 5) return "-1";  if (as[i-1] > as[i] && ret[i-1] == 1) return "-1";    if (as[i-1] < as[i] && as[i] < as[i+1]) {   ret[i] = ret[i-1] + 1;  } else if (as[i-1] == as[i] && as[i] < as[i+1]) {   ret[i] = ret[i-1] == 1 ? 2 : 1;  } else if (as[i-1] > as[i] && as[i] < as[i+1]) {   ret[i] = 1;  } else if (as[i-1] < as[i] && as[i] == as[i+1]) {   ret[i] = ret[i-1] + 1;  } else if (as[i-1] == as[i] && as[i] == as[i+1]) {   ret[i] = ret[i-1] == 4 ? 2 : 4;  } else if (as[i-1] > as[i] && as[i] == as[i+1]) {   ret[i] = ret[i-1] == 2 ? 1 : 2;  } else if (as[i-1] < as[i] && as[i] > as[i+1]) {   ret[i] = 5;  } else if (as[i-1] == as[i] && as[i] > as[i+1]) {   ret[i] = ret[i-1] == 5 ? 4 : 5;  } else if (as[i-1] > as[i] && as[i] > as[i+1]) {   ret[i] = ret[i-1] - 1;  }  }   if (as.length > 1) {  if (as[as.length - 1] > as[as.length - 2]) {   if (ret[as.length - 2] == 5)   return "-1";   ret[as.length - 1] = 5;  } else if (as[as.length - 1] == as[as.length - 2]) {   ret[as.length - 1] = ret[as.length - 2] == 5 ? 4 : 5;  } else {   if (ret[as.length - 2] == 1)   return "-1";   ret[as.length - 1] = 1;  }  }  StringBuilder sb = new StringBuilder();  for (int b : ret) {   sb.append(b);   sb.append(" ");  }  sb.deleteCharAt(sb.length() - 1);  return sb.toString(); } }
6	public class Main implements Runnable { private void solution() throws IOException {  int n = in.nextInt();  int m = in.nextInt();  boolean[][] adj = new boolean[n][n];  long res = 0;  for (int i = 0; i < m; ++i) {  int x = in.nextInt();  int y = in.nextInt();  adj[x - 1][y - 1] = true;  adj[y - 1][x - 1] = true;  }  for (int i = 0; i < n; ++i) {  for (int j = i + 1; j < n; ++j) {   if (adj[i][j]) {   --res;   }  }  }  for (int i = 0; i < n; ++i) {  long[][] dp = new long[1 << (n - i)][n - i];  dp[0][0] = 1;  for (int mask = 0; mask < (1 << (n - i)); ++mask) {   for (int j = 0; j < n - i; ++j) {   if (dp[mask][j] != 0) {    for (int k = 0; k < n - i; ++k) {    if (((mask >> k) & 1) == 0 && adj[j + i][k + i]) {     dp[mask | (1 << k)][k] += dp[mask][j];    }    }   }   }   if (((mask >> 0) & 1) != 0) {   res += dp[mask][0];   }  }  }  out.println(res / 2); }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  private class Scanner {  BufferedReader reader;  StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  public boolean hasNext() throws IOException {  while (!tokenizer.hasMoreTokens()) {   String next = reader.readLine();   if (next == null) {   return false;   }   tokenizer = new StringTokenizer(next);  }  return true;  }  public String next() throws IOException {  hasNext();  return tokenizer.nextToken();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
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); } }
6	public class codeforces {  public static long cnt = 0;  public static void f(int g1, int g2, int g3, int last) {   if (g1 == 0 && g2 == 0 && g3 == 0) cnt++;   if (g1 > 0 && last != 1) f(g1 - 1, g2, g3, 1);   if (g2 > 0 && last != 2) f(g1, g2 - 1, g3, 2);   if (g3 > 0 && last != 3) f(g1, g2, g3 - 1, 3);  }  public static void main(String[] args) throws IOException {   BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(scan.readLine());   int n = Integer.parseInt(st.nextToken());   int t = Integer.parseInt(st.nextToken());   int T[] = new int[n];   int G[] = new int[n];   for (int i = 0; i < n; i++) {    st = new StringTokenizer(scan.readLine());    T[i] = Integer.parseInt(st.nextToken());    G[i] = Integer.parseInt(st.nextToken());   }   long ans = 0;   for (int mask = 1; mask < (1 << n); mask++) {    int sum = 0;    int g1 = 0;    int g2 = 0;    int g3 = 0;    for (int i = 0; i < n; i++) {     if (((1 << i) & mask) > 0) {      sum += T[i];      if (G[i] == 1) g1++;      if (G[i] == 2) g2++;      if (G[i] == 3) g3++;     }    }    cnt = 0;    if (sum == t) f(g1, g2, g3, -1);    for (long i = 1; i <= g1; i++) cnt *= i;    for (long i = 1; i <= g2; i++) cnt *= i;    for (long i = 1; i <= g3; i++) cnt *= i;    ans += cnt;   }   System.out.println(ans % 1000000007);  } }
2	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 {   long n,x,y,c;  public void solve(int testNumber, FastScanner in, FastPrinter out) {  n=in.nextLong(); x=in.nextLong(); y=in.nextLong(); c=in.nextLong(); long td=-1,tup=2*(n-1);  while(Math.abs(td-tup)>1){  long mid=(td+tup)/2;   if(chk(mid))tup=mid;   else td=mid;  }   out.println(tup);  }  private boolean chk(long t) {  long ct=-3;   long d=x,w=y;   if(w>d){    long tt=w;    w=d;d=tt;   }   if(t>=d+w-2) ct+=d*w;   else if(t<w&&t<d) {       ct+=(t+1)*(t+2)/2;   }   else if(t>=w&&t<d) {       ct+=w*(w+1)/2;    long k=t-(w-1);    ct+=k*w;   }   else if(t>=w&&t>=d) {        ct+=w*d;    long k=w-2-(t-d);    ct-=k*(k+1)/2;   }     w=x;d=n+1-y;   if(w>d){    long tt=w;    w=d;d=tt;   }   if(t>=d+w-2) ct+=d*w;   else if(t<w&&t<d) {       ct+=(t+1)*(t+2)/2;   }   else if(t>=w&&t<d) {       ct+=w*(w+1)/2;    long k=t-(w-1);    ct+=k*w;   }   else if(t>=w&&t>=d) {        ct+=w*d;    long k=w-2-(t-d);    ct-=k*(k+1)/2;   }   w=n+1-x;d=y;   if(w>d){    long tt=w;    w=d;d=tt;   }   if(t>=d+w-2) ct+=d*w;   else if(t<w&&t<d) {       ct+=(t+1)*(t+2)/2;   }   else if(t>=w&&t<d) {       ct+=w*(w+1)/2;    long k=t-(w-1);    ct+=k*w;   }   else if(t>=w&&t>=d) {        ct+=w*d;    long k=w-2-(t-d);    ct-=k*(k+1)/2;   }   w=n+1-x;d=n+1-y;   if(w>d){    long tt=w;    w=d;d=tt;   }   if(t>=d+w-2) ct+=d*w;   else if(t<w&&t<d) {       ct+=(t+1)*(t+2)/2;   }   else if(t>=w&&t<d) {       ct+=w*(w+1)/2;    long k=t-(w-1);    ct+=k*w;   }   else if(t>=w&&t>=d) {        ct+=w*d;    long k=w-2-(t-d);    ct-=k*(k+1)/2;   }   ct-=Math.min(t,x-1);   ct-=Math.min(t,y-1);   ct-=Math.min(t,n-x);   ct-=Math.min(t,n-y);     if(ct>=c)return true;   else   return false;  } } 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();   }  }  public String next() {   StringBuilder sb = new StringBuilder();   int c = read();   while (isWhiteSpace(c)) {    c = read();   }   if (c < 0) {    return null;   }   while (c >= 0 && !isWhiteSpace(c)) {    sb.appendCodePoint(c);    c = read();   }   return sb.toString();  }  static boolean isWhiteSpace(int c) {   return c >= 0 && c <= 32;  }  public long nextLong() {   return Long.parseLong(next());  }  public String readLine() {   try {    return super.readLine();   } catch (IOException e) {    return null;   }  }  } class FastPrinter extends PrintWriter {  public FastPrinter(OutputStream out) {   super(out);  }  public FastPrinter(Writer out) {   super(out);  }  }
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 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[at]) / 100.0) * solve(at + 1, ok + 1, B)     + (1.0 - ((l[at]) / 100.0)) * solve(at + 1, ok, B + b[at]);   return ret;  }        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 AMain { static int n; static int[] best; static int[][] dist; static int[] home; static LinkedList<Integer> ret; public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  State curr = new State(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));  n = Integer.parseInt(br.readLine());  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()));  }  dist = new int[n][n];  home = new int[n];  for(int i = 0; i < n; i++) {  home[i] = dist(curr, list[i]);  }  for(int i = 0; i < n; i++) {  dist[i][i] = 2 * home[i];  for(int j = i+1; j < n; j++) {   dist[i][j] = dist(list[i], list[j]) + home[i] + home[j];  }  }  best = new int[1 << (n)];  Arrays.fill(best, -1);  best[0] = 0;  System.out.println(solve(-1 + (1<<n)));  ret = new LinkedList<Integer>();  resolve(-1 + (1<<n));  for(int x: ret)  System.out.print(x + " "); } public static int dist(State a, State b) {  int x = a.x-b.x;  int y = a.y-b.y;  return x*x+y*y; } public static void resolve(int curr) {  ret.addLast(0);  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;   }   if(dist[i][j] + solve(curr ^ (1<<i) ^ (1 << j)) == best[curr]) {   ret.addLast(i+1);   ret.addLast(j+1);   resolve(curr - (1<<i) - (1<<j));   return;   }  }  if(best[curr] == dist[i][i] + solve(curr ^ (1<<i))) {   ret.addLast(i+1);   resolve(curr - (1<<i));   return;  }  } } public static int solve(int curr) {  if(best[curr] != -1)  return best[curr];  int ret = Integer.MAX_VALUE;  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;   }   ret = Math.min(ret, dist[i][j] + solve(curr ^ (1<<i) ^ (1 << j)));  }  ret = Math.min(ret, dist[i][i] + solve(curr ^ (1<<i)));  break;  }  best[curr] = ret;  return ret; } static class State {  public int x,y;  public State(int a, int b) {  x=a;  y=b;  } } }
0	public class A {  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  long n = s.nextLong();  if(n >= 0)   System.out.println(n);  else {   String str = ("" + n).substring(1);   if(str.length() == 1)   System.out.println("-" + str);   else {   long one = Long.parseLong(str.substring(0, str.length()-1));   long two = Long.parseLong(str.substring(0, str.length()-2) + str.substring(str.length()-1));   if(one > two)    System.out.println((two!=0?"-":"") + two);   else    System.out.println((one!=0?"-":"") + one);   }  }  } }
5	public class SolA {  private static InputReader in; private static PrintWriter out;  public static void main(String[] args) throws IOException {  in = new InputReader(System.in);  out = new PrintWriter(System.out);  run();  out.close(); }  public static void run() {  int n = in.readInt();  int a = in.readInt();  int b = in.readInt();  int[] h = new int[n];  for(int i = 0; i < n; i++) {  h[i] = - in.readInt();  }  Arrays.sort(h);   int base = -h[a-1];  int base1 = -h[a];  out.print(-(base1 - base));   } } 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 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();  StringBuffer res = new StringBuffer();  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; }  public String next() {  return readString(); } }
0	public class D {  public static void main(String[] args)  {   new D();  }   D()  {   Scanner in = new Scanner(System.in);   double a = in.nextDouble();   double v = in.nextDouble();   double l = in.nextDouble();   double d = in.nextDouble();   double w = in.nextDouble();     if (w>v) w=v;     double dx=(v*v-w*w)/(2*a);   double d0=(w*w)/(2*a);     double t=0;   if (d0>d)   {    if (d0>=l)    {     t=Math.sqrt(2*a*l)/a;    }    else    {     t=w/a;     if (d0+dx>=l)     {      t+=(-w+Math.sqrt(w*w+2*a*(l-d0)))/a;     }     else     {      t+=(v-w)/a;      t+=(l-(d0+dx))/v;     }    }   }   else   {    t=w/a;           if (d+dx>l)    {     t+=(-w+Math.sqrt(w*w+2*a*(l-d)))/a;    }    else    {     t+=(v-w)/a;     t+=(l-(d+dx))/v;    }           if (d0+2*dx>d)    {     double half=(d-d0)/2;     t+=2*(-w+Math.sqrt(w*w+2*a*half))/a;    }    else    {     t+=2*(v-w)/a;     t+=(d-2*dx-d0)/v;    }   }     System.out.printf("%.12f%n", t+1e-11);  } }
0	public class Main implements Runnable {   public static void main(String[] args) {  new Thread(new Main()).start(); }  public void run() {  Locale.setDefault(Locale.US);  try {  run1();  } catch (IOException e) {  throw new RuntimeException();  } }  int nextInt(StreamTokenizer st) throws IOException {  st.nextToken();  return (int) st.nval; }  double nextDouble(StreamTokenizer st) throws IOException {  st.nextToken();  return st.nval; }  String nextLine(StreamTokenizer st) throws IOException {  st.nextToken();  return st.sval; }  Map<String, BigInteger> map = new HashMap<String, BigInteger>();  public void run1() throws IOException {  Locale.setDefault(Locale.US);    Scanner sc = new Scanner(new InputStreamReader(System.in));           double a = sc.nextDouble();  double vmax = sc.nextDouble();  double l2 = sc.nextDouble();  double l1 = sc.nextDouble();  l2 -= l1;  double boundv = sc.nextDouble();  if (boundv >= vmax || boundv * boundv / a / 2 > l1) {  System.out.print(get(0, a, vmax, l1 + l2));  System.exit(0);  }  double tmplen = vmax * vmax / a / 2 + (vmax + boundv) / 2   * (vmax - boundv) / a;  if (tmplen < l1) {  System.out.print(get(boundv, a, vmax, l2) + vmax   / a + (vmax - boundv) / a + (l1 - tmplen) / vmax);  System.exit(0);  }  double v = Math.sqrt(l1 * a + boundv * boundv / 2);  System.out.print(get(boundv, a, vmax, l2) + v / a   + (v - boundv) / a); }  double get(double v0, double a, double vmax, double l) {  double tmplen = (vmax + v0) / 2 * (vmax - v0) / a;   if (l >= tmplen) {  return (vmax - v0) / a + (l - tmplen) / vmax;  }  return (-v0 + Math.sqrt(v0 * v0 + 2 * a * l)) / a; } }
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 nck(int n, int k) {   if (n < k)    return 0;   long den = inv((int) (fac[k] * fac[n - k] % mod));   return fac[n] * den % 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());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   } }
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);  } }
5	public class D { public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);   BigInteger ans = BigInteger.ZERO;  int n = sc.nextInt();  int arr[] = new int[n];  long cum[] = new long[n];   for (int i = 0; i < n; i++)  arr[i] = sc.nextInt();        for (int i = 0; i < cum.length; i++)  {  cum[i] = arr[i];  if(i > 0)   cum[i] += cum[i-1];  }   for (int i = 0; i < n; i++)  ans = ans.add(BigInteger.valueOf((1l*(i+1)*arr[i] - cum[i])));   HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();  for (int i = 0; i < n; i++)  {  ans = ans.subtract(BigInteger.valueOf(map.getOrDefault(arr[i]-1, 0)));  ans = ans.add(BigInteger.valueOf(map.getOrDefault(arr[i]+1, 0)));  map.put(arr[i], map.getOrDefault(arr[i], 0)+1);  }   pw.println(ans);  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 long nextLong() throws IOException  {  return Long.parseLong(next());  }  public String nextLine() throws IOException  {  return br.readLine();  }  public double nextDouble() throws IOException  {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-')  {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.')   {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else   {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public boolean ready() throws IOException  {  return br.ready();  } } }
5	public class LittleElephant { public static void main(String[] args){  Scanner input = new Scanner(System.in);  int n = input.nextInt();  int temp;  ArrayList<Integer> a2 = new ArrayList<Integer>();  ArrayList<Integer> a1 = new ArrayList<Integer>();  int count = 0;  int temp1,temp2;   for(int i= 0; i < n ; i++){  temp = input.nextInt();  a2.add(temp);  a1.add(temp);  }  Collections.sort(a2);  input.close();  for(int i = 0; i < n; i++){  temp1 = a2.get(i);  temp2 = a1.get(i);  if(temp1 != temp2){   count++;  }  }  if(count==2 || count==0){  System.out.println("YES");  }else{  System.out.println("NO");  } } }
3	public class Main911D { public static void main(String[] args) {  run(System.in, System.out); }  public static void run(InputStream in, PrintStream out) {  try (Scanner sc = new Scanner(in)) {  int n = sc.nextInt();  int[] t = new int[n];  int inv = 0;  for (int i = 0; i < n; i++) {   t[i] = sc.nextInt();   for (int j = 0; j < i; j++) {   if (t[j] > t[i]) inv++;   }  }   inv = inv % 2;  int m = sc.nextInt();  for (int i = 0; i < m; i++) {   int a = sc.nextInt();   int b = sc.nextInt();   int s = b - a + 1;   inv = (inv + s * (s - 1) / 2) % 2;   out.println(inv == 0 ? "even" : "odd");   }  } } }
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);   F2SameSumBlocksHard solver = new F2SameSumBlocksHard();   solver.solve(1, in, out);   out.close();  }  static class F2SameSumBlocksHard {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    long[] a = in.nextLongArray(n);    HashMap<Long, ArrayList<Pair>> hm = new HashMap<>();    long sum;    for (int j = 0; j < n; j++) {     sum = 0;     for (int i = j; i >= 0; i--) {      sum += a[i];      if (!hm.containsKey(sum))       hm.put(sum, new ArrayList<>());      hm.get(sum).add(new Pair(i + 1, j + 1));     }    }    ArrayList<Pair> al1 = new ArrayList<>();    ArrayList<Pair> al2 = new ArrayList<>();    int prev;    for (ArrayList<Pair> al : hm.values()) {     prev = 0;     al1.clear();     for (Pair p : al) {      if (p.x > prev) {       al1.add(p);       prev = p.y;      }     }     if (al1.size() > al2.size())      al2 = new ArrayList<>(al1);    }    out.println(al2.size());    for (Pair p : al2)     out.println(p.x + " " + p.y);   }  }  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[8192];   private int curChar;   private int snumChars;   private InputReader.SpaceCharFilter filter;   public InputReader(InputStream stream) {    this.stream = stream;   }   public int snext() {    if (snumChars == -1)     throw new InputMismatchException();    if (curChar >= snumChars) {     curChar = 0;     try {      snumChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (snumChars <= 0)      return -1;    }    return buf[curChar++];   }   public int nextInt() {    int c = snext();    while (isSpaceChar(c))     c = snext();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = snext();    }    int res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = snext();    } while (!isSpaceChar(c));    return res * sgn;   }   public long nextLong() {    int c = snext();    while (isSpaceChar(c))     c = snext();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = snext();    }    long res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = snext();    } while (!isSpaceChar(c));    return res * sgn;   }   public long[] nextLongArray(int n) {    long a[] = new long[n];    for (int i = 0; i < n; i++)     a[i] = nextLong();    return a;   }   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 class Pair implements Comparable<Pair> {   public int x;   public int y;   public Pair(int x, int y) {    this.x = x;    this.y = y;   }   public boolean equals(Object obj) {    if (obj == null)     return false;    if (obj == this)     return true;    if (!(obj instanceof Pair))     return false;    Pair o = (Pair) obj;    return o.x == this.x && o.y == this.y;   }   public int hashCode() {    return this.x + this.y;   }   public int compareTo(Pair p) {    if (x == p.x)     return Integer.compare(y, p.y);    return Integer.compare(x, p.x);   }  }  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();   }  } }
3	public class Template {  String fileName = "";  long INF = Long.MAX_VALUE / 3;  int MODULO = 1000*1000*1000+7;  long[] fenwik;  int BORDER = 1000*1000+100;  void solve() throws IOException {   int n = readInt();   int[] a = new int[n];   for(int i=0; i<n; ++i){    a[i] = readInt();   }   fenwik = new long[BORDER];   long ans = 0;   for(int i=n-1;i>=0;--i){    ans+=sumFenwik(a[i]);    incFenwik(a[i],1);   }   boolean even = ans % 2 == 0;   int m = readInt();   for(int i=0; i<m; ++i){    int l = readInt();    int r = readInt();    if(((r-l+1)/2)%2==1){     even = !even;    }    out.println(even?"even":"odd");   }  }  void incFenwik(int i, int delta){   for(;i<BORDER;i = i|(i+1)){    fenwik[i]+=delta;   }  }  long sumFenwik(int r){   long sum = 0;   for(;r>=0;r = (r&(r+1))-1){    sum+=fenwik[r];   }   return sum;  }  int gcd(int a, int b){   return b == 0 ? a : gcd(b, a%b);  }  long binPow(long a, long b, long m) {   if (b == 0) {    return 1;   }   if (b % 2 == 1) {    return ((a % m) * (binPow(a, b - 1, m) % m)) % m;   } else {    long c = binPow(a, b / 2, m);    return (c * c) % m;   }  }  class Fenwik {   long[] t;   int length;   Fenwik(int[] a) {    length = a.length + 100;    t = new long[length];    for (int i = 0; i < a.length; ++i) {     inc(i, a[i]);    }   }   void inc(int ind, int delta) {    for (; ind < length; ind = ind | (ind + 1)) {     t[ind] += delta;    }   }   long getSum(int r) {    long sum = 0;    for (; r >= 0; r = (r & (r + 1)) - 1) {     sum += t[r];    }    return sum;   }  }  class SegmentTree {   int[] t;   SegmentTree(int[] a) {    int n = a.length - 1;    t = new int[n * 4];    build(a, 1, 1, n);   }   void build(int[] a, int v, int tl, int tr) {    if (tl == tr) {     t[v] = a[tl];     return;    }    int mid = (tr + tl) / 2;    build(a, 2 * v, tl, mid);    build(a, 2 * v + 1, mid + 1, tr);    t[v] = Math.max(t[2 * v], t[2 * v + 1]);   }   void update(int v, int tl, int tr, int pos, int value) {    if (tl == tr) {     t[v] = value;     return;    }    int mid = (tl + tr) / 2;    if (pos <= mid) {     update(2 * v, tl, mid, pos, value);    } else {     update(2 * v + 1, mid + 1, tr, pos, value);    }    t[v] = Math.max(t[2 * v], t[2 * v + 1]);   }   int getMax(int v, int tl, int tr, int l, int r) {    if (l > r) {     return -1000 * 1000;    }    if (tl == tr) {     return t[v];    }    if (l == tl && r == tr) {     return t[v];    }    int mid = (tl + tr) / 2;    int max1 = getMax(2 * v, tl, mid, l, Math.min(mid, r));    int max2 = getMax(2 * v + 1, mid + 1, tr, Math.max(mid + 1, l), r);    return Math.max(max1, max2);   }  }  public static void main(String[] args) throws NumberFormatException, IOException {     new Template().run();  }  void run() throws NumberFormatException, IOException {   solve();   out.close();  };  BufferedReader in;  PrintWriter out;  StringTokenizer tok;  String delim = " ";  Random rnd = new Random();  Template() throws FileNotFoundException {   try {    in = new BufferedReader(new FileReader("input.txt"));    out = new PrintWriter("output.txt");   } catch (Exception e) {    if (fileName.isEmpty()) {     in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);    } else {     in = new BufferedReader(new FileReader(fileName + ".in"));     out = new PrintWriter(fileName + ".out");    }   }   tok = new StringTokenizer("");  }  String readLine() throws IOException {   return in.readLine();  }  String readString() throws IOException {   while (!tok.hasMoreTokens()) {    String nextLine = readLine();    if (null == nextLine) {     return null;    }    tok = new StringTokenizer(nextLine);   }   return tok.nextToken();  }  int readInt() throws NumberFormatException, IOException {   return Integer.parseInt(readString());  }  long readLong() throws NumberFormatException, IOException {   return Long.parseLong(readString());  }  double readDouble() throws NumberFormatException, IOException {   return Double.parseDouble(readString());  } }
6	public class B {  public static void swap(int[] array, int a, int b) {   int t = array[a];   array[a] = array[b];   array[b] = t;  }   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();  }  public static void debug(Object... arr) {   System.err.println(Arrays.deepToString(arr));  } }
6	public class Main { static final int MOD = (int)1e9 + 7; static int n; static int[] t; static int[] g;  static int[][] memo;  static int dp(int mask, int rem, int last) {  if(rem == 0)  return 1;  if(memo[last][mask] != -1)  return memo[last][mask];   int ans = 0;  for(int i = 0; i < n; i++)  {  if((mask & (1 << i)) == 0 && rem >= t[i] && g[i] != last)   ans += dp(mask | 1 << i, rem - t[i], g[i]);    if(ans >= MOD)   ans -= MOD;  }   return memo[last][mask] = ans; }  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);   n = in.nextInt();  int T = in.nextInt();   t = new int[n];  g = new int[n];   for(int i = 0; i < n; i++)  {  t[i] = in.nextInt();  g[i] = in.nextInt() - 1;  }   memo = new int[4][1 << n];  for(int []x : memo)  {  Arrays.fill(x, -1);  }   out.println(dp(0, T, 3));  out.close(); }  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());   }   catch(IOException e)   {   throw new RuntimeException(e);   }  }    return tokenizer.nextToken();  }   public int nextInt()  {  return Integer.parseInt(next());  } } }
5	public class C { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = null;  private void solution() throws IOException {  int n = nextInt();  int[] mas = new int[n];  for (int i = 0; i < n; i++) {  mas[i] = nextInt();  }  Arrays.sort(mas);  if (mas[n - 1] == 1) {  mas[n - 1] = 2;  } else {  mas[n - 1] = 1;  }  Arrays.sort(mas);  for (int i = 0; i < n; i++) {  System.out.print(mas[i] + " ");  }  }  String nextToken() throws IOException {  if (st == null || !st.hasMoreTokens()) {  st = new StringTokenizer(bf.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()); }  public static void main(String args[]) throws IOException {  new C().solution(); } }
4	public class Main{  public static void main(String args[]){   Scanner sc=new Scanner(System.in);   String str=sc.next();   sc.close();     int maxm=0;   int ind1,ind2;     for(int i=0;i<str.length();i++){    for(int j=i+1;j<str.length();j++){     int len=0;     ind1=i;ind2=j;     while(ind2<str.length() && str.charAt(ind1)==str.charAt(ind2)){      ind1++;      ind2++;      len++;     }     maxm=Math.max(maxm,len);    }   }   System.out.println(maxm);  } }
1	public class Noldbach { public static void main(String[] args) throws Exception {  Scanner sc = new Scanner(System.in);  int n=sc.nextInt();  int k=sc.nextInt();  boolean[] sieve=new boolean[1001];  sieve[2]=false;  ArrayList<Integer> primes=new ArrayList<Integer>();  for(int x=2;x<1001;x++)  if(!sieve[x])  {   primes.add(x);   for(int y=x;y<1001;y+=x)   sieve[y]=true;  }  int sum=0;  for(int x=2;x<=n;x++)  {  if(primes.contains(x))  {  int need=x-1;  for(int y=0;y<primes.size()-1;y++)  {   if(primes.get(y)+primes.get(y+1)==need)   {   sum++;   break;   }  }  }  if(sum==k)break;  }  if(sum==k)System.out.println("YES");  else System.out.println("NO");   }  }
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); } }
3	public class A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int count = sc.nextInt();   HashSet<Integer> set = new HashSet<>();   for (int i = 0; i < count; i++) {    set.add(sc.nextInt());   }   ArrayList<Integer> list = new ArrayList<>(set);   Collections.sort(list);   for (int i = 0; i < list.size(); i++) {    for (int j = i + 1; j < list.size(); j++) {     if (list.get(i) % list.get(j) == 0 ||       list.get(j) % list.get(i) == 0) {      list.remove(j);      j--;     }    }   }   System.out.println(list.size());  } }
1	public class Solution{   public static long page(long p,long k){     return (p-1)/k;    }   public static void main(String[] args) throws Exception {   Scanner sc = new Scanner(System.in);     long n = sc.nextLong();   int m = sc.nextInt();   long k = sc.nextLong();   long[] p = new long[m];   long del = 0;   long nb = 1;   int op = 0;   for(int i=0;i<m;i++) p[i] = sc.nextLong();   for(int i=1;i<m;i++){    if(page(p[i]-del,k)!=page(p[i-1]-del,k)){         del += nb;     nb = 1;     op++;        }else{     nb++;        }   }   if(nb!=0) op++;     System.out.println(op);    }  }
1	public class C {  static int[] arr ; static int L ;  public static void rotate()  {   int tmp = arr[0] ;   for (int i = 1 ; i < L ; i ++)    arr[i-1] = arr[i] ;   arr[L-1] = tmp ;  }  public static void main(String[] args)  {   Scanner input = new Scanner(System.in) ;   L = input.nextInt() ; String s = input.next() ;   arr = new int[L]; for (int i = 0 ; i < L ; i ++) {arr[i] = s.charAt(i) == 'H' ? 1 : 0 ;}        int count = 99999 ;   for (int A = 0; A < L ; A ++)   {    int[] tmp = new int[L] ; System.arraycopy(arr, 0, tmp, 0, arr.length);    int ans = 0 ;    for (int i = 0 ; i < L ; i ++)    {     if (tmp[i] == 1) continue ;     for (int j = L-1 ; j > i ; j --)     {      if (tmp[j] == 0) continue ;      ans ++ ;      tmp[i] = 1 ; tmp[j] = 0 ;                            break;     }    }    count = Math.min(count,ans) ;    rotate() ;   }     System.out.println(count);  } }
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 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 long nextLong(){    int c = read();    while (isSpaceChar(c)){     c = read();    }    int sign = 1;    if (c == '-') {     sign = -1;     c = read();    }    long rep = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     rep *= 10;     rep += c - '0';     c = read();    } while (!isSpaceChar(c));    return rep * (long)sign;   }   public String next(){    char c = (char)read();    while (isSpaceChar(c)){     c = (char)read();    }    StringBuilder build = new StringBuilder();    do{     build.append(c);     c = (char)read();    }while(!isSpaceChar(c));    return build.toString();   }   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 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;  } }  public void run() {  n = nextInt();  k = nextInt() * 10;  a = nextInt();  max = 0;  b = new int[n];  loy = new int[n];  decision = new boolean[n];  for (int i = 0; i < n; i++) {  b[i] = nextInt();  loy[i] = nextInt();  }   rec(k, 0);  long pow = (long) pow(100, n);  out.print((double) max / pow);    out.close();  System.exit(0); }  private static boolean fileIOMode = false; private static String problemName = "harmful"; private static BufferedReader in; private static PrintWriter out; private static 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(); }  private static String nextLine() {  try {  return in.readLine();  } catch (IOException e) {  return null;  } }  private static String nextToken() {  while (!tokenizer.hasMoreTokens()) {  tokenizer = new StringTokenizer(nextLine());  }  return tokenizer.nextToken(); }  private static double nextDouble() {  return Double.parseDouble(nextToken()); }  private static int nextInt() {  return Integer.parseInt(nextToken()); } }
6	public class PetyaSpiders implements Runnable {  public static void main(String[] args) throws Exception {   new Thread(null, new PetyaSpiders(), ": )", 1 << 28).start();  }  public void run() {   FastScanner sc = new FastScanner();   PrintWriter out = new PrintWriter(System.out);   N = sc.nextInt();   M = sc.nextInt();   if (N > M) {    int temp = N;    N = M;    M = temp;   }        if (M == 1) {    out.println(0);   } else {    int[][][] dp = new int[M][1 << N][1 << N];           for (int prev = 0; prev < 1 << N; prev++) {                       if (prev == 0) {      for (int curr = 0; curr < 1 << N; curr++) {             dp[0][prev][curr] = Integer.bitCount(curr);      }     } else {           Arrays.fill(dp[0][prev], oo);     }    }    for (int prev = 0; prev < 1 << N; prev++) {     for (int curr = 0; curr < 1 << N; curr++) {      if (isValid(0, prev, curr)) {       dp[1][prev][curr] = Integer.bitCount(prev) + Integer.bitCount(curr);      } else {       dp[1][prev][curr] = oo;      }     }    }    for (int col = 2; col <= M - 2; col++) {     for (int next = 0; next < 1 << N; next++) {      for (int curr = 0; curr < 1 << N; curr++) {       dp[col][curr][next] = oo;       for (int prev = 0; prev < 1 << N; prev++) {        if (dp[col - 1][prev][curr] != oo && isValid(prev, curr, next)) {         dp[col][curr][next] = Math.min(dp[col][curr][next], dp[col - 1][prev][curr] + Integer.bitCount(next));        }       }      }     }    }              int ans = oo;    for (int next = 0; next < 1 << N; next++) {     for (int curr = 0; curr < 1 << N; curr++) {      dp[M - 1][curr][next] = oo;      for (int prev = 0; prev < 1 << N; prev++) {       if (dp[M - 2][prev][curr] != oo && isValid(prev, curr, next) && isValid(curr, next, 0)) {        dp[M - 1][curr][next] = Math.min(dp[M - 1][curr][next], dp[M - 2][prev][curr] + Integer.bitCount(next));        ans = Math.min(ans, dp[M - 1][curr][next]);       }      }     }    }        out.println(N * M - ans);   }   out.close();  }  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 int[] nextInts(int N) {    int[] res = new int[N];    for (int i = 0; i < N; i++) {     res[i] = (int) nextLong();    }    return res;   }   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;   }   public double[] nextDoubles(int N) {    double[] res = new double[N];    for (int i = 0; i < N; i++) {     res[i] = nextDouble();    }    return res;   }   public String next() {    StringBuilder res = new StringBuilder();    while (c <= 32) c = getChar();    while (c > 32) {     res.append(c);     c = getChar();    }    return res.toString();   }   public String nextLine() {    StringBuilder res = new StringBuilder();    while (c <= 32) c = getChar();    while (c != '\n') {     res.append(c);     c = getChar();    }    return res.toString();   }   public boolean hasNext() {    if (c > 32) return true;    while (true) {     c = getChar();     if (c == NC) return false;     else if (c > 32) return true;    }   }  }  static void ASSERT(boolean assertion, String message) {   if (!assertion) throw new AssertionError(message);  }  static void ASSERT(boolean assertion) {   if (!assertion) throw new AssertionError();  } }
6	public class Main {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int m = scan.nextInt();  boolean[][] graph = new boolean[n][n];  for (int i = 0; i < m; i++) {  int u = scan.nextInt() - 1;  int v = scan.nextInt() - 1;  graph[u][v] = true;  graph[v][u] = true;  }  long[][] dp = new long[1 << n][n];  long sum = 0;  for (int i = 0; i < n; i++)  dp[1 << i][i] = 1;  for (int mask = 1; mask < (1 << n); mask++) {   int first = Integer.numberOfTrailingZeros(mask);   for (int i = 0; i < n; i++) {   if ((mask & (1 << i)) == 0 || first == i)   continue;   for (int j = 0; j < n; j++) {   if (graph[i][j] && (mask & (1 << j)) != 0)    dp[mask][i] += dp[mask ^ 1 << i][j];   }   if (Integer.bitCount(mask) >= 3 && graph[i][first])   sum += dp[mask][i];  }  }  System.out.println(sum / 2);  scan.close(); } }
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;  }  long nextLong() throws Exception {  long 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++];  }  String next() throws Exception {  StringBuffer ret = new StringBuffer();   byte b;  do {   b = nextByte();  } while (b <= ' ');  while (b > ' ') {   ret.appendCodePoint(b);   b = nextByte();  }   return ret.toString();  }  } }
5	public class Sockets {  BufferedReader in;  PrintWriter out;  StringTokenizer st;   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());  }   void solve() throws Exception {   int n = nextInt();   int m = nextInt();   int k = nextInt();   List<Integer> fs = new ArrayList<Integer>();   for (int i = 0; i < n; i++)    fs.add(nextInt());   Collections.sort(fs);   Collections.reverse(fs);   int c = k;   for (int i = 0; i < fs.size(); i++) {    if (c >= m) {     out.println(i);     return;    }    c += (fs.get(i)-1);   }   if (c>=m)    out.println(fs.size());   else    out.println(-1);  }   void run() {   try {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   } finally {    out.close();   }  }   public static void main(String[] args) {   new Sockets().run();  } }
4	public class Main implements Runnable {  public void _main() throws IOException {  int height = nextInt();  int width = nextInt();   int k = nextInt();  int[] r = new int[k];  int[] c = new int[k];  for (int i = 0; i < k; i++) {  r[i] = nextInt() - 1;  c[i] = nextInt() - 1;   }  int res = 0, R = r[0], C = c[0];  for (int i = 0; i < height; i++)  for (int j = 0; j < width; j++) {   int cur = Integer.MAX_VALUE;   for (int z = 0; z < k; z++)   cur = Math.min(cur, Math.abs(i - r[z]) + Math.abs(j - c[z]));   if (res < cur) {   res = cur;   R = i;   C = j;   }  }  out.print((R + 1) + " " + (C + 1)); }  private BufferedReader in; private PrintWriter out; private StringTokenizer st;  private String next() throws IOException {  while (st == null || !st.hasMoreTokens())  st = new StringTokenizer(in.readLine());  return st.nextToken(); }  private int nextInt() throws IOException {  return Integer.parseInt(next()); }  private long nextLong() throws IOException {  return Long.parseLong(next()); }  private double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static void main(String[] args) {  new Thread(new Main()).start(); }  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  in = new BufferedReader(new FileReader("input.txt"));  out = new PrintWriter(new FileWriter("output.txt"));   _main();   out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(202);  } } }
6	public class C {  static Point hand;  static int n;  static Point[] data;  static int[] next;  static int[] dp;  static int[][] pre;  public static void main(String[] args) {   Scanner in = new Scanner();   PrintWriter out = new PrintWriter(System.out);     hand = new Point(in.nextInt(), in.nextInt());   n = in.nextInt();   data = new Point[n];   for (int i = 0; i < n; i++) {    data[i] = new Point(in.nextInt(), in.nextInt());   }   pre = new int[n][n];   for (int i = 0; i < n; i++) {    for (int j = i + 1; j < n; j++) {     pre[i][j] = distance(data[i], data[j]);    }   }    next = new int[1 << n];   dp = new int[1 << n];   Arrays.fill(dp, -1);   out.println(cal(0));    int start = 0;   do {    int m = next[start];    int val = m - start;    out.print(0 + " ");    for (int i = 0; i < n; i++) {     if (((1 << i) & val) != 0) {      out.print((i + 1) + " ");     }    }       start = m;   } while (start != (1 << n) - 1);   out.println(0);   out.close();  }  public static int cal(int mask) {   if ((1 << n) - 1 == mask) {       return 0;   }   if (dp[mask] != -1) {    return dp[mask];   }   int result = Integer.MAX_VALUE;   for (int i = 0; i < n; i++) {    if (((1 << i) & mask) == 0) {     int dist = distance(hand, data[i]);         for (int j = i + 1; j < n; j++) {      if (((1 << j) & mask) == 0) {             int temp = dist + distance(hand, data[j]) + pre[i][j] + cal(mask | (1 << i) | (1 << j));             if (temp < result) {        result = temp;        next[mask] = (mask | (1 << i) | (1 << j));       }            }     }          int temp = 2 * dist + cal(mask | (1 << i));      if (temp < result) {       result = temp;       next[mask] = (mask | (1 << i));      }         break;    }   }   dp[mask] = result;   return result;  }  static int distance(Point a, Point b) {   int total = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);   return total;  }  static class Point {   int x, y;   public Point(int x, int 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 long nextLong() {    return Long.parseLong(next());   }   public int nextInt() {    return Integer.parseInt(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    st = null;    try {     return br.readLine();    } catch (Exception e) {     throw new RuntimeException();    }   }   public boolean endLine() {    try {     String next = br.readLine();     while (next != null && next.trim().isEmpty()) {      next = br.readLine();     }     if (next == null) {      return true;     }     st = new StringTokenizer(next);     return st.hasMoreTokens();    } catch (Exception e) {     throw new RuntimeException();    }   }  } }
5	public class A { int n, m, k; int[] a;  void run()throws IOException{  Scanner sc = new Scanner(new InputStreamReader(System.in));  n = sc.nextInt();  m = sc.nextInt();  k = sc.nextInt();  a = new int[n];  for(int i=0;i<n; i++) a[i] = sc.nextInt();  Arrays.sort(a);   if(m<=k){  System.out.println(0);  return;  }   int cnt = k;  int ind = a.length-1;  int ret = 0;  while(cnt<m && ind>=0){  cnt += a[ind]-1;  --ind;  ret++;    }   if(cnt>=m) System.out.println(ret);  else System.out.println(-1); }  public static void main(String[] args)throws IOException {  new A().run(); } }
3	public class _909C { int mod = (int) 1e9 + 7;  public void solve() throws FileNotFoundException {  InputStream inputStream = System.in;  InputHelper in = new InputHelper(inputStream);    int n = in.readInteger();  char[] a = new char[n];  for (int i = 0; i < n; i++) {  a[i] = in.read().charAt(0);  }  int[][][] dp = new int[2][n + 1][2];  dp[0][0][0] = dp[0][0][1] = 1;  for (int i = 1; i < n; i++) {  for (int j = n; j >= 0; j--) {   if (a[i - 1] == 's') {   dp[1][j][0] = dp[1][j][1] = dp[0][j][1];   } else {   if (j > 0)    dp[1][j][0] = dp[1][j][1] = dp[0][j - 1][0];   }  }   for (int j = 0; j <= n; j++) {   dp[0][j][0] = dp[1][j][0];   dp[0][j][1] = dp[1][j][1];   dp[1][j][0] = 0;   dp[1][j][1] = 0;  }  for (int j = n - 1; j >= 0; j--) {   dp[0][j][1] += dp[0][j + 1][1];   dp[0][j][1] %= mod;  }  }  System.out.println(dp[0][0][1]);   }  public static void main(String[] args) throws FileNotFoundException {  (new _909C()).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());  }  public Long readLong() {  return Long.parseLong(read());  } } }
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());   }  } }
6	public class G {  private static int M = 1000000007, MM = 998244353; private static int N = 15,n,T; private static int[] time,gi; private static int[][][] dp;  public static void process() throws IOException {  n = sc.nextInt();T = sc.nextInt();  time = new int[n+1];  gi = new int[n+1];  for(int i=0; i<n; i++) {  int a = sc.nextInt(),b = sc.nextInt();  time[i] = a;  gi[i] = b-1;  }   dp = new int[1<<n][T+1][3];  for(int i=0; i<1<<n; i++) {  for(int j=0; j<T+1; j++) {   for(int k=0; k<3; k++)dp[i][j][k] = -1;  }  }   int ans = 0;  for(int i=0; i<n; i++) {  if(time[i] <= T) {   ans = (ans + solve(1<<i,time[i],gi[i]))%M;  }  }  println(ans); }  private static int solve(int mask, int tim, int code) {  if(tim == T)return 1;  if(dp[mask][tim][code] != -1)return dp[mask][tim][code];  int ans = 0;  for(int i=0; i<n; i++) {  if((mask>>i & 1) > 0)continue;  if(code == gi[i])continue;  if(tim + time[i] > T)continue;  ans = (ans + solve(mask|(1<<i), time[i]+tim, gi[i]))%M;    }  return dp[mask][tim][code] = (ans%M); }     static FastScanner sc; static PrintWriter out;  public static void main(String[] args) throws IOException {  boolean oj = true;  if (oj) {  sc = new FastScanner();  out = new PrintWriter(System.out);  } else {  sc = new FastScanner(100);  out = new PrintWriter("output.txt");  }  int t = 1;  while (t-- > 0) {  process();  }  out.flush();  out.close(); }  static class Pair implements Comparable<Pair> {  int x, y;  Pair(int x, int y) {  this.x = x;  this.y = y;  }  @Override  public int compareTo(Pair o) {  return Integer.compare(this.x, o.x);  } }   static void println(Object o) {  out.println(o); }  static void println() {  out.println(); }  static void print(Object o) {  out.print(o); }  static void pflush(Object o) {  out.println(o);  out.flush(); }  static int ceil(int x, int y) {  return (x % y == 0 ? x / y : (x / y + 1)); }  static long ceil(long x, long y) {  return (x % y == 0 ? x / y : (x / y + 1)); }  static int max(int x, int y) {  return Math.max(x, y); }  static int min(int x, int y) {  return Math.min(x, y); }  static int abs(int x) {  return Math.abs(x); }  static long abs(long x) {  return Math.abs(x); }  static int log2(int N) {  int result = (int) (Math.log(N) / Math.log(2));  return result; }  static long max(long x, long y) {  return Math.max(x, y); }  static long min(long x, long y) {  return Math.min(x, y); }  public static int gcd(int a, int b) {  BigInteger b1 = BigInteger.valueOf(a);  BigInteger b2 = BigInteger.valueOf(b);  BigInteger gcd = b1.gcd(b2);  return gcd.intValue(); }  public static long gcd(long a, long b) {  BigInteger b1 = BigInteger.valueOf(a);  BigInteger b2 = BigInteger.valueOf(b);  BigInteger gcd = b1.gcd(b2);  return gcd.longValue(); }   static class FastScanner {  BufferedReader br;  StringTokenizer st;  FastScanner() throws FileNotFoundException {  br = new BufferedReader(new InputStreamReader(System.in));  }  FastScanner(int a) throws FileNotFoundException {  br = new BufferedReader(new FileReader("input.txt"));  }  String next() throws IOException {  while (st == null || !st.hasMoreElements()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  }  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());  }  String nextLine() throws IOException {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }  int[] readArray(int n) throws IOException {  int[] A = new int[n];  for (int i = 0; i != n; i++) {   A[i] = sc.nextInt();  }  return A;  }  long[] readArrayLong(int n) throws IOException {  long[] A = new long[n];  for (int i = 0; i != n; i++) {   A[i] = sc.nextLong();  }  return A;  } }  static void ruffleSort(int[] a) {  Random get = new Random();  for (int i = 0; i < a.length; i++) {  int r = get.nextInt(a.length);  int temp = a[i];  a[i] = a[r];  a[r] = temp;  }  Arrays.sort(a); }  static void ruffleSort(long[] a) {  Random get = new Random();  for (int i = 0; i < a.length; i++) {  int r = get.nextInt(a.length);  long temp = a[i];  a[i] = a[r];  a[r] = temp;  }  Arrays.sort(a); } }
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);   Task547F solver = new Task547F();   solver.solve(1, in, out);   out.close();  }  static class Task547F {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    long arr[] = in.nextLongArray(n);    long cur = 0;    int i, j;    Map<Long, List<Pair>> hm = new HashMap<>();    for (i = 0; i < n; i++) {     cur = 0;     for (j = i; j < n; j++) {      cur += arr[j];      if (!hm.containsKey(cur)) {       List<Pair> al = new LinkedList<>();       al.add(new Pair(i + 1, j + 1));       hm.put(cur, al);      } else {       List<Pair> al = hm.get(cur);       al.add(new Pair(i + 1, j + 1));       hm.put(cur, al);      }     }    }       long max = arr[0];    int msize = 0;    for (long key : hm.keySet()) {     List<Pair> al = hm.get(key);     if (al.size() < hm.get(max).size())      continue;     Collections.sort(al, new Comparator<Pair>() {      public int compare(Pair o1, Pair o2) {       if (o1.b != o2.b)        return o1.b - o2.b;       return o1.a - o2.a;      }     });         List<Pair> all = new LinkedList<>();     int prev = -1;     for (Pair p : al) {      if (p.a > prev) {       all.add(p);       prev = p.b;      }     }          hm.put(key, all);         if (all.size() > msize) {           msize = all.size();      max = key;     }    }        List<Pair> al = hm.get(max);    out.println(al.size());    for (Pair p : al) {     out.println(p.a + " " + p.b);    }   }   class Pair {    int a;    int b;    public Pair(int a, int b) {     this.a = a;     this.b = b;    }    public String toString() {     return "(" + a + ", " + b + ")";    }   }  }  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 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 static boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public long[] nextLongArray(int n) {    long[] array = new long[n];    for (int i = 0; i < n; ++i) array[i] = nextLong();    return array;   }   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 println(Object... objects) {    print(objects);    writer.println();   }   public void close() {    writer.close();   }   public void println(int i) {    writer.println(i);   }  } }
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); }  void debug(Object... os){  System.err.println(Arrays.deepToString(os)); }  public static void main(String[] args){  Locale.setDefault(Locale.US);  new A().run(); } }
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()); } long nextLong() throws IOException {  return Long.parseLong(nextToken()); } double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } String nextLine() throws IOException {  st = new StringTokenizer("");  return in.readLine(); } boolean EOF() throws IOException {  while (!st.hasMoreTokens()) {  String s = in.readLine();  if (s == null)   return true;  st = new StringTokenizer(s);  }  return false; } }
2	public class BBi implements Runnable { public static void main(String[] args) {  new Thread(new BBi()).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()); }  public double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  public long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  int n, x, y;  public long count(long z) {  long total = 0;  long[][] c = new long[][] { { x, y }, { y, n - x + 1 },   { n - x + 1, n - y + 1 }, { n - y + 1, x } };  for (int i = 0; i < c.length; i++) {  long inside = z;   for (int j = 0; j < c[i].length; j++) {   if (z > c[i][j]) {   total += Math.min(z - c[i][j], c[i][1 - j]) * c[i][j];   inside -= (z - c[i][j]);   }  }   if (z > c[i][0] && z > c[i][1]) {   total -= Math.min(z - c[i][0], c[i][1])    * Math.min(z - c[i][1], c[i][0]);  }   if (inside > 0)   total += inside * (inside + 1) / 2;  }  for (int i = 0; i < c.length; i++) {  total -= Math.min(z, c[i][0]);  }  return total + 1; }  public long solve(int n, int x, int y, long c) throws IOException {  this.n = n;  this.x = x;  this.y = y;   long l = 0;  long r = 2L * n + 2;  while (r - l > 1) {  long z = (l + r) / 2;   if (c <= count(z)) {   r = z;  } else {   l = z;  }  }  return r - 1; }  public void run() {  try {  out.println(solve(nextInt(), nextInt(), nextInt(), nextLong()));  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } } }
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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   int n;   boolean[][] adj;   long[] mem;   int start;   long cycles(int cur, int visited) {    if (cur == start && visited > 0) {     return Integer.bitCount(visited) >= 3 ? 1 : 0;    }    int index = visited * n + cur;    if (mem[index] != -1) return mem[index];    long res = 0;    int newvisited = visited | (1 << cur);    for (int nxt = 0; nxt < n; nxt++)     if (adj[cur][nxt]) {      if (nxt >= start && (nxt == start || ((visited >> nxt) & 1) == 0)) {       res += cycles(nxt, newvisited);      }     }    return mem[index] = res;   }   public void solve(int testNumber, InputReader in, OutputWriter out) {    n = in.readInt();    int m = in.readInt();    mem = new long[n * (1 << n)];    adj = new boolean[n][n];    for (int i = 0; i < m; i++) {     int a = in.readInt() - 1, b = in.readInt() - 1;     adj[a][b] = true;     adj[b][a] = true;    }    long res = 0;    for (int start = 0; start < n; start++) {     Arrays.fill(mem, -1);     this.start = start;     res += cycles(start, 0) / 2;    }    out.printLine(res);   }  }  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);   }  }  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);   }  } }
1	public class javatemp { static String map(int a) {  if( a == 0) return "S";  else if ( a == 1 ) return "M";  else if ( a == 2 ) return "L";  else if ( a == 3 ) return "XL";  else if ( a == 4 ) return "XXL";  return ""; }  public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader( new InputStreamReader(System.in));  int ans = 1000;  in.readLine();  String s = in.readLine();  int H = 0;  for(int i =0; i < s.length(); i++)  if( s.charAt(i) == 'H') H++;    for(int i = 0; i < s.length(); i++)  {  int count = 0;  for(int j = 0; j < H; j++)   if( s.charAt( (i +j) % s.length()) =='T') count ++;  ans = Math.min ( ans, count);  }  System.out.println(ans);  }   static void debug(Object...os) {  System.out.println(Arrays.deepToString(os)); } }
5	public class Solution {  BufferedReader in;  PrintWriter out;  StringTokenizer st;  void solve() throws IOException {   int n = ni();   int[] v = new int[n];   for (int i = 0; i < n; ++i)    v[i] = ni();   Arrays.sort(v);   int mn = v[0];   for (int i = 1; i < n; ++i)    if (v[i] > mn) {     out.println(v[i]);     return;    }   out.println("NO");  }  public Solution() throws IOException {   Locale.setDefault(Locale.US);   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   solve();   in.close();   out.close();  }  String ns() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int ni() throws IOException {   return Integer.valueOf(ns());  }  long nl() throws IOException {   return Long.valueOf(ns());  }  double nd() throws IOException {   return Double.valueOf(ns());  }  public static void main(String[] args) throws IOException {   new Solution();  } }
5	public class Task{  static final boolean readFromFile = false; static final String fileInputName = "input.txt",    fileOutputName = "output.txt";  public static void main(String args[]){  FileInputStream fileInputStream;  FileOutputStream fileOutputStream;  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  if (readFromFile){  try{   fileInputStream = new FileInputStream(new File(fileInputName));   fileOutputStream = new FileOutputStream(new File(fileOutputName));  }catch (FileNotFoundException e){   throw new RuntimeException(e);  }  }  PrintWriter out = new PrintWriter((readFromFile)?fileOutputStream:outputStream);  InputReader in = new InputReader((readFromFile)?fileInputStream:inputStream);   Solver s = new Solver(in, out);  s.solve();   out.close(); } } class Solver{ private PrintWriter out; private InputReader in;  public void solve(){  int n = in.nextInt();  double t = in.nextDouble(),  a[] = new double[n],  x[] = new double[n];  for (int i=0;i<n;i++){  x[i] = in.nextDouble();  a[i] = in.nextDouble();  }  int ans = 2;  for (int i=0;i<n-1;i++)  for (int j=i+1;j<n;j++)   if (x[j]<x[i]){   double buf = x[i];x[i]=x[j];x[j]=buf;   buf = a[i]; a[i]=a[j];a[j]=buf;   }   for (int i=0;i<n-1;i++){  if (x[i]+a[i]/2+t<x[i+1]-a[i+1]/2)   ans += 2;  if (x[i]+a[i]/2+t==x[i+1]-a[i+1]/2)   ans++;  }  out.println(ans); }  Solver(InputReader in, PrintWriter out){  this.in = in;  this.out = out; } } class InputReader{ StringTokenizer tok; BufferedReader buf;  InputReader(InputStream in){  tok = null;  buf = new BufferedReader(new InputStreamReader(in)); }  InputReader(FileInputStream in){  tok = null;  buf = new BufferedReader(new InputStreamReader(in)); }  public String next(){  while (tok==null || !tok.hasMoreTokens()){  try{   tok = new StringTokenizer(buf.readLine());  }catch (IOException e){   throw new RuntimeException(e);  }  }  return tok.nextToken(); }  public int nextInt(){  return Integer.parseInt(next()); } public long nextLong(){  return Long.parseLong(next()); } public double nextDouble(){  return Double.parseDouble(next()); } public float nextFloat(){  return Float.parseFloat(next()); } public String nextLine(){  try{  return buf.readLine();  }catch (IOException e){  return 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 pair { int f,s; } 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());  }   public long nextLong() throws IOException  {   return Long.parseLong(next());  } }
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 long nextLong() {  return Long.parseLong(next());  }  public double nextDouble() {  return Double.parseDouble(next());  }  public String nextLine() {  try {   return reader.readLine();  } catch (IOException e) {   throw new RuntimeException(e);  }  }  } }
1	public class CF364C {  public static void main(String[] args) throws Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   PrintWriter pw = new PrintWriter(System.out);   int n=Integer.parseInt(br.readLine());   String input=br.readLine();   Set<Character> set = new HashSet<Character>();   for(int i=0;i<input.length();i++){    set.add(input.charAt(i));   }   StringBuilder sb= new StringBuilder(); for(char x:set){  sb.append(x); }   String substring1=sb.toString();                 System.out.println(solve(input,substring1).length());   pw.close();   br.close();  }  public static boolean isEmpty(int[] a){   for(int i=0;i<a.length;i++){    if(a[i]!=0){     return false;    }   } return true;  }  public static String solve(String S, String T) {   HashMap<Character, Integer> D = new HashMap<>();   HashMap<Character, Integer> GET = new HashMap<>();   int B,E;   for (int i=0; i<T.length();i++) {    char c=T.charAt(i);    if (!D.containsKey(c))    {     D.put(c, 1);    }    else    {     D.put(c, D.get(c) + 1);    }   }   int ccc = 0;   B=0; E=0;   int min = Integer.MAX_VALUE;      String RESULT = "";   while (E < S.length()) {    char c = S.charAt(E);    if (D.containsKey(c)) {     if (GET.containsKey(c)) {      if (GET.get(c) < D.get(c))       ccc++;           GET.put(c, GET.get(c) + 1);     } else {      GET.put(c, 1);      ccc++;          }    }    if (ccc == T.length()) {         char test = S.charAt(B);     while (!GET.containsKey(test) ||       GET.get(test) > D.get(test)) {      if (GET.containsKey(test)        && GET.get(test) >        D.get(test))             GET.put(test, GET.get(test) - 1);           B++;      test = S.charAt(B);           }     if (E - B + 1 < min) {      RESULT = S.substring(B, E + 1);      min = E - B + 1;     }        }    E++;   }     return RESULT;  }  }
3	public class Main {  static int N;  static int [][] dp;  static int M = (int)(1e9 + 7);  static ArrayList<Integer> l;  static int f(int idx, int b) {   if(idx == l.size())    return 1;   if(dp[idx][b] != -1)    return dp[idx][b];   long ret = f(idx + 1, b + l.get(idx));   if(b > 0)    ret += f(idx, b - 1);   return dp[idx][b] = (int) (ret % M);  }  public static void main(String[] args) throws IOException{  Scanner sc = new Scanner();  N = sc.nextInt();   int [] val = new int[N];   for(int i = 0; i < N; ++i)    if(sc.next().charAt(0) == 's')     val[i] = 0;    else     val[i] = 1;   l = new ArrayList<Integer>();   l.add(val[0]);   for(int i = 1; i < N; ++i)    if(val[i] == val[i - 1] && val[i] == 1) {     int prev = l.get(l.size() - 1);     l.set(l.size() - 1, ++prev);    } else if(val[i - 1] == 0){     l.add(val[i]);    }    dp = new int[l.size() + 1][N + 1];   for(int i = 0; i <= l.size(); ++i)    Arrays.fill(dp[i], -1);   System.out.println(f(0, 0));  }   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());   }   long nextLong() throws IOException {    return Long.parseLong(next());   }   double nextDouble() throws IOException {    return Double.parseDouble(next());   }   String nextLine() throws IOException {    return br.readLine();   }  } }
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);    } }
6	public class D {  Reader in = new Reader(System.in);  PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {   new D().run();  }  int n, m;  boolean[][] adjacency;  void run() throws IOException {   n = in.nextInt();   m = in.nextInt();   adjacency = new boolean[n+1][n];   for (int i = 0; i < m; i++) {    int u = in.nextInt(), v = in.nextInt();    adjacency[u-1][v-1] = adjacency[v-1][u-1] = true;   }   final int MAX_MASK = (1 << n) - 1;   long[][] dp = new long[MAX_MASK+1][n];   for (int i = 0; i < n; i++)    dp[1<<i][i] = 1;   long sum = 0;   for (int mask = 1; mask <= MAX_MASK; mask++) {    int lowestBit = first(mask);    for (int i = 0; i < n; i++) {     if (bit(i, mask) && i != lowestBit) {      for (int j = 0; j < n; j++) {       if (adjacency[j][i]) {        dp[mask][i] += dp[mask^(1<<i)][j];       }      }      if (count(mask) >= 3 && adjacency[lowestBit][i])       sum += dp[mask][i];     } else {          }    }   }   out.println(sum / 2);   out.flush();  }  int count(int mask) {   int count = 0;   while (mask > 0) {    if ((mask & 1) == 1)     count++;    mask >>= 1;   }   return count;  }  int first(int mask) {   int index = 0;   while (mask > 0) {    if ((mask & 1) == 1)     return index;    mask >>= 1;    index++;   }   return -1;  }  boolean bit(int index, int mask) {   return ((1 << index) & mask) > 0;  }  static class Reader {   BufferedReader reader;   StringTokenizer tokenizer;   public Reader(InputStream input) {    reader = new BufferedReader(new InputStreamReader(input));    tokenizer = new StringTokenizer("");   }      String nextToken() throws IOException {    while ( ! tokenizer.hasMoreTokens() ) {         tokenizer = new StringTokenizer( reader.readLine() );    }    return tokenizer.nextToken();   }   String readLine() throws IOException {    return reader.readLine();   }   int nextInt() throws IOException {    return Integer.parseInt( nextToken() );   }   long nextLong() throws IOException {    return Long.parseLong( nextToken() );   }   double nextDouble() throws IOException {    return Double.parseDouble( nextToken() );   }  } }
1	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();    char[] str = IOUtils.readCharArray(in, n);    for (int i = 0; i < n; i++) {     if (str[i] <= 'Z') {      str[i] = (char) (str[i] - 'A');     } else {      str[i] = (char) (str[i] - 'a' + 26);     }    }    IntHashSet set = new IntHashSet();    for (char c : str) {     set.add(c);    }    int max = 26 + 26;    int[][] next = new int[max][n];    ArrayUtils.fill(next, -1);    for (int i = n - 2; i >= 0; i--) {     for (int ch = 0; ch < max; ch++) {      next[ch][i] = next[ch][i + 1];     }     next[str[i + 1]][i] = i + 1;    }    int ans = (int) 1e9;    final int tagetCnt = set.size();    for (int s = 0; s < n; s++) {     boolean[] used = new boolean[max];     used[str[s]] = true;     int cnt = 1;     int pos = s;     while (cnt < tagetCnt) {      int nextPos = n;      for (int ch = 0; ch < max; ch++) {       if (!used[ch]) {        if (next[ch][pos] == -1) {         continue;        }        nextPos = Math.min(nextPos, next[ch][pos]);       }      }      pos = nextPos;      if (nextPos == n) {       break;      }      ++cnt;      used[str[nextPos]] = true;     }     if (pos == n) {      break;     }     ans = Math.min(ans, pos - s + 1);    }    out.printLine(ans);   }  }  static interface IntCollection extends IntStream {   public int size();   default public void add(int value) {    throw new UnsupportedOperationException();   }   default public IntCollection addAll(IntStream values) {    for (IntIterator it = values.intIterator(); it.isValid(); it.advance()) {     add(it.value());    }    return this;   }  }  static interface IntStream extends Iterable<Integer>, Comparable<IntStream> {   public IntIterator intIterator();   default public Iterator<Integer> iterator() {    return new Iterator<Integer>() {     private IntIterator it = intIterator();     public boolean hasNext() {      return it.isValid();     }     public Integer next() {      int result = it.value();      it.advance();      return result;     }    };   }   default public int compareTo(IntStream c) {    IntIterator it = intIterator();    IntIterator jt = c.intIterator();    while (it.isValid() && jt.isValid()) {     int i = it.value();     int j = jt.value();     if (i < j) {      return -1;     } else if (i > j) {      return 1;     }     it.advance();     jt.advance();    }    if (it.isValid()) {     return 1;    }    if (jt.isValid()) {     return -1;    }    return 0;   }  }  static class IntHashSet extends IntAbstractStream implements IntSet {   private static final Random RND = new Random();   private static final int[] SHIFTS = new int[4];   private static final byte PRESENT_MASK = 1;   private static final byte REMOVED_MASK = 2;   private int size;   private int realSize;   private int[] values;   private byte[] present;   private int step;   private int ratio;   static {    for (int i = 0; i < 4; i++) {     SHIFTS[i] = RND.nextInt(31) + 1;    }   }   public IntHashSet() {    this(3);   }   public IntHashSet(int capacity) {    capacity = Math.max(capacity, 3);    values = new int[capacity];    present = new byte[capacity];    ratio = 2;    initStep(capacity);   }   public IntHashSet(IntCollection c) {    this(c.size());    addAll(c);   }   public IntHashSet(int[] arr) {    this(new IntArray(arr));   }   private void initStep(int capacity) {    step = RND.nextInt(capacity - 2) + 1;    while (IntegerUtils.gcd(step, capacity) != 1) {     step++;    }   }    public IntIterator intIterator() {    return new IntIterator() {     private int position = size == 0 ? values.length : -1;     public int value() throws NoSuchElementException {      if (position == -1) {       advance();      }      if (position >= values.length) {       throw new NoSuchElementException();      }      if ((present[position] & PRESENT_MASK) == 0) {       throw new IllegalStateException();      }      return values[position];     }     public boolean advance() throws NoSuchElementException {      if (position >= values.length) {       throw new NoSuchElementException();      }      position++;      while (position < values.length && (present[position] & PRESENT_MASK) == 0) {       position++;      }      return isValid();     }     public boolean isValid() {      return position < values.length;     }     public void remove() {      if ((present[position] & PRESENT_MASK) == 0) {       throw new IllegalStateException();      }      present[position] = REMOVED_MASK;     }    };   }    public int size() {    return size;   }    public void add(int value) {    ensureCapacity((realSize + 1) * ratio + 2);    int current = getHash(value);    while (present[current] != 0) {     if ((present[current] & PRESENT_MASK) != 0 && values[current] == value) {      return;     }     current += step;     if (current >= values.length) {      current -= values.length;     }    }    while ((present[current] & PRESENT_MASK) != 0) {     current += step;     if (current >= values.length) {      current -= values.length;     }    }    if (present[current] == 0) {     realSize++;    }    present[current] = PRESENT_MASK;    values[current] = value;    size++;   }   private int getHash(int value) {    int hash = IntHash.hash(value);    int result = hash;    for (int i : SHIFTS) {     result ^= hash >> i;    }    result %= values.length;    if (result < 0) {     result += values.length;    }    return result;   }   private void ensureCapacity(int capacity) {    if (values.length < capacity) {     capacity = Math.max(capacity * 2, values.length);     rebuild(capacity);    }   }   private void rebuild(int capacity) {    initStep(capacity);    int[] oldValues = values;    byte[] oldPresent = present;    values = new int[capacity];    present = new byte[capacity];    size = 0;    realSize = 0;    for (int i = 0; i < oldValues.length; i++) {     if ((oldPresent[i] & PRESENT_MASK) == PRESENT_MASK) {      add(oldValues[i]);     }    }   }  }  static interface IntList extends IntReversableCollection {   public abstract int get(int index);   public abstract void addAt(int index, int value);   public abstract void removeAt(int index);   default public IntIterator intIterator() {    return new IntIterator() {     private int at;     private boolean removed;     public int value() {      if (removed) {       throw new IllegalStateException();      }      return get(at);     }     public boolean advance() {      at++;      removed = false;      return isValid();     }     public boolean isValid() {      return !removed && at < size();     }     public void remove() {      removeAt(at);      at--;      removed = true;     }    };   }    default public void add(int value) {    addAt(size(), value);   }  }  static class IntegerUtils {   public static int gcd(int a, int b) {    a = Math.abs(a);    b = Math.abs(b);    while (b != 0) {     int temp = a % b;     a = b;     b = temp;    }    return a;   }  }  static abstract class IntAbstractStream implements IntStream {   public String toString() {    StringBuilder builder = new StringBuilder();    boolean first = true;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     if (first) {      first = false;     } else {      builder.append(' ');     }     builder.append(it.value());    }    return builder.toString();   }    public boolean equals(Object o) {    if (!(o instanceof IntStream)) {     return false;    }    IntStream c = (IntStream) o;    IntIterator it = intIterator();    IntIterator jt = c.intIterator();    while (it.isValid() && jt.isValid()) {     if (it.value() != jt.value()) {      return false;     }     it.advance();     jt.advance();    }    return !it.isValid() && !jt.isValid();   }    public int hashCode() {    int result = 0;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     result *= 31;     result += it.value();    }    return result;   }  }  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 char readCharacter() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    return (char) c;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  static class IntHash {   private IntHash() {   }   public static int hash(int c) {    return c;   }  }  static interface IntReversableCollection extends IntCollection {  }  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 IntArray extends IntAbstractStream implements IntList {   private int[] data;   public IntArray(int[] arr) {    data = arr;   }   public int size() {    return data.length;   }   public int get(int at) {    return data[at];   }   public void addAt(int index, int value) {    throw new UnsupportedOperationException();   }   public void removeAt(int index) {    throw new UnsupportedOperationException();   }  }  static interface IntSet extends IntCollection {  }  static class IOUtils {   public static char[] readCharArray(InputReader in, int size) {    char[] array = new char[size];    for (int i = 0; i < size; i++) {     array[i] = in.readCharacter();    }    return array;   }  }  static interface IntIterator {   public int value() throws NoSuchElementException;   public boolean advance();   public boolean isValid();  }  static class ArrayUtils {   public static void fill(int[][] array, int value) {    for (int[] row : array) {     Arrays.fill(row, value);    }   }  } }
3	public class USACO {  public static void main(String[] args) throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(reader.readLine());   StringTokenizer st = new StringTokenizer(reader.readLine()," ");   int[] perm = new int[n];   int count=0;   for (int i=0;i<n;i++) {    perm[i]=Integer.parseInt(st.nextToken());    for (int j=0;j<i;j++) {     if (perm[j]>perm[i]) {      count++;     }    }   }   count=count%2;   int m = Integer.parseInt(reader.readLine());   for (int i=0;i<m;i++) {    StringTokenizer st2 = new StringTokenizer(reader.readLine()," ");    int a = Integer.parseInt(st2.nextToken());    int b = Integer.parseInt(st2.nextToken());    if ((b-a+1)%4==2||(b-a+1)%4==3) {     count++;     count=count%2;    }    if(count%2==0) {     System.out.println("even");    } else {     System.out.println("odd");    }   }  } }
4	public class A implements Runnable {  String file = "input";   void init() throws IOException  {     input = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(new BufferedOutputStream(System.out));  }   void solve() throws IOException  {   String s = next();   int res = 0;   int L = s.length();   for(int i = 0; i < L; i++)    for(int j = i + 1; j <= L; j++)    {     String ss = s.substring(i, j);     int k = s.indexOf(ss);         if(k >= 0)     {      if(s.substring(k + 1).indexOf(ss) >= 0) res = max(res, j - i);     }    }   System.out.println(res);  }   String next() throws IOException  {   if(st == null || !st.hasMoreTokens()) st = new StringTokenizer(input.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());  }   void print(Object... o)  {   System.out.println(deepToString(o));  }   void gcj(Object o)  {   String s = String.valueOf(o);   out.println("Case #" + test + ": " + s);   System.out.println("Case #" + test + ": " + s);  }   BufferedReader input;  PrintWriter out;  StringTokenizer st;  int test;   public static void main(String[] args) throws IOException  {   new Thread(null, new A(), "", 1 << 20).start();  }   public void run()  {   try   {    init();    solve();    out.close();     }   catch(Exception e)   {    e.printStackTrace();    System.exit(1);   }  } }
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));    } }
4	public class BetaRound35_C implements Runnable {  final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer("");  void init() throws IOException {  in = new BufferedReader(new FileReader("input.txt"));  out = new PrintWriter("output.txt"); }  String readString() throws IOException {  while (!tok.hasMoreTokens()) {  tok = new StringTokenizer(in.readLine());  }  return tok.nextToken(); }  int readInt() throws IOException {  return Integer.parseInt(readString()); }  @Override public void run() {  try {  long t1 = System.currentTimeMillis();  init();  solve();  out.close();  long t2 = System.currentTimeMillis();  System.err.println("Time = " + (t2 - t1));  } catch (Exception e) {  e.printStackTrace(System.err);  System.exit(-1);  } }  public static void main(String[] args) {  new Thread(new BetaRound35_C()).start(); }  void solve() throws IOException {  int n = readInt();  int m = readInt();  int k = readInt();  Queue<Point> q = new ArrayDeque<Point>();  boolean[][] visited = new boolean[n + 2][m + 2];  for (int j = 0; j < m + 2; j++) {  visited[0][j] = true;  visited[n + 1][j] = true;  }  for (int i = 0; i < n + 2; i++) {  visited[i][0] = true;  visited[i][m + 1] = true;  }  for (int i = 0; i < k; i++) {  int x = readInt();  int y = readInt();  q.add(new Point(x, y));  visited[x][y] = true;  }   Point p = null;  while (!q.isEmpty()) {  p = q.poll();  int x = p.x, y = p.y;  if (!visited[x + 1][y]) {   q.add(new Point(x + 1, y));   visited[x + 1][y] = true;  }  if (!visited[x - 1][y]) {   q.add(new Point(x - 1, y));   visited[x - 1][y] = true;  }  if (!visited[x][y + 1]) {   q.add(new Point(x, y + 1));   visited[x][y + 1] = true;  }  if (!visited[x][y - 1]) {   q.add(new Point(x, y - 1));   visited[x][y - 1] = true;  }  }  out.print(p.x + " " + p.y); }  }
1	public class First {  StreamTokenizer in;  PrintWriter out;  int nextInt() throws IOException {   in.nextToken();   return (int)in.nval;  }  long nextLong() throws IOException {   in.nextToken();   return (long) in.nval;  }  String nextString() throws IOException {   in.nextToken();   return in.sval;  }   void run() throws IOException {   in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));   out = new PrintWriter(System.out);   solve();   out.flush();  }  void solve() throws IOException {   int n = nextInt(), k = nextInt(), sum = 0, count = 0;   String str = nextString();   char[] arr = str.toCharArray();   boolean[] bool = new boolean[26];   for(char ch: arr){    bool[((int)ch)-97] = true;   }   for(int i = 0; i < 26; i++){    if(bool[i]){     sum += i+1;     count++;     i += 1;    }    if(count == k) break;   }   if(count == k) out.println(sum);   else out.println(-1);  }  public static void main(String[] args) throws IOException {   new First().run();  } }
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;}   }  }  } }
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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, FastReader in, PrintWriter out) {    int n = in.nextInt();    int[] a = in.nextIntArray(n);    int ct = 0;    for (int i = 0; i < n; ++i) {     for (int j = i + 1; j < n; ++j) {      if (a[i] > a[j]) ++ct;     }    }    ct &= 1;    int Q = in.nextInt();    for (int q = 0; q < Q; ++q) {     int l = in.nextInt();     int r = in.nextInt();     int size = (r - l + 1) * (r - l) >> 1;     ct ^= size & 1;     out.println(ct % 2 == 0 ? "even" : "odd");    }   }  }  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;   }   public int[] nextIntArray(int n) {    int[] array = new int[n];    for (int i = 0; i < n; i++) {     array[i] = nextInt();    }    return array;   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
3	public class Problem_A {  public static void main(String[] args) {  MyScanner scan = new MyScanner();  int n = scan.nextInt();  int[] elements = new int[n];  for (int i = 0; i < n; i++)  elements[i] = scan.nextInt();   int x = 0;   Arrays.sort(elements);  while(n > 0) {  x++;  int[] temp = new int[n];  int j = 0;  int size = n;  int min = elements[0];  n--;  for (int i = 1; i < size; i++) {   if (elements[i]%min == 0) {   n--;   }   else {   temp[j++] = elements[i];   }  }    elements = temp;  }   out.println(x);  out.close(); }  public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static class MyScanner {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st;  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());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  } }  }
5	public class ProblemA {  public static class Team {   int solved;   int penalty;   Team(int s, int p) {    solved = s;    penalty = p;   }  }   public static void main(String[] args) throws IOException {   BufferedReader s = new BufferedReader(new InputStreamReader(System.in));   String[] data = s.readLine().split(" ");   int n = Integer.valueOf(data[0]);   int k = Integer.valueOf(data[1]);      Team[] t = new Team[n];   for (int i = 0 ; i < n ; i++) {    String[] line = s.readLine().split(" ");    t[i] = new Team(Integer.valueOf(line[0]), Integer.valueOf(line[1]));   }   Arrays.sort(t, new Comparator<Team>(){    public int compare(Team arg0, Team arg1) {     if (arg0.solved != arg1.solved) {      return arg1.solved - arg0.solved;     }     return arg0.penalty - arg1.penalty;    }   });        int idx = k - 1;   int ksol = t[idx].solved;   int kpen = t[idx].penalty;   int count = 0;   for (int i = 0 ; i < n ; i++) {    if (t[i].solved == ksol && t[i].penalty == kpen) {     count++;    }   }   System.out.println(count);  } }
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" );  } }
2	public class Contest {  public static void main(String[] args)throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   String[] s=br.readLine().split(" ");  BigInteger x = new BigInteger(s[0]);  BigInteger k = new BigInteger(s[1]);  BigInteger mod = new BigInteger(String.valueOf((int) (Math.pow(10, 9) + 7)));  BigInteger two = new BigInteger("2");  BigInteger interm = two.modPow(k, mod);  BigInteger res = interm.multiply(two.multiply(x).subtract(BigInteger.ONE)).add(BigInteger.ONE).mod(mod);  if(x.equals(BigInteger.ZERO)) {  System.out.println("0");  return;  }  System.out.println(res); } }
5	public class Main {   public static void main(String[] args) throws Exception {   int n = nextInt();     int[] mas = new int[n];     for(int i = 0; i<n; i++) {    mas[i] = nextInt();   }     Arrays.sort(mas);     if(mas[n-1] == 1) {    for(int i = 0; i<n-1; i++) {     out.print(1 + " ");    }    out.println(2);    out.flush();    exit();   }     out.print("1 ");     for(int i = 0; i<n-1; i++) {    out.print(mas[i] + " ");   }     out.println();   out.flush();  }        private static StreamTokenizer in;  private static PrintWriter out;  private static BufferedReader inB;   private static boolean FILE=false;   private static int nextInt() throws Exception{   in.nextToken();   return (int)in.nval;  }   private static String nextString() throws Exception{   in.nextToken();   return in.sval;  }   static{   try {    out = new PrintWriter(FILE ? (new FileOutputStream("output.txt")) : System.out);    inB = new BufferedReader(new InputStreamReader(FILE ? new FileInputStream("input.txt") : System.in));   } catch(Exception e) {e.printStackTrace();}   in = new StreamTokenizer(inB);  }         private static void println(Object o) throws Exception {   out.println(o);   out.flush();  }  private static void exit(Object o) throws Exception {   println(o);   exit();  }  private static void exit() {   System.exit(0);  }  private static final int INF = Integer.MAX_VALUE;  private static final int MINF = Integer.MIN_VALUE;  }
6	public class Main implements Runnable { private void solution() throws IOException {  int n = in.nextInt();  int m = in.nextInt();  boolean[][] adj = new boolean[n][n];  long res = 0;  for (int i = 0; i < m; ++i) {  int x = in.nextInt();  int y = in.nextInt();  adj[x - 1][y - 1] = true;  adj[y - 1][x - 1] = true;  }  for (int i = 0; i < n; ++i) {  for (int j = i + 1; j < n; ++j) {   if (adj[i][j]) {   --res;   }  }  }  final long[][] dp = new long[1 << n][n];  for (int i = 0; i < n; ++i) {  for (int mask = 0; mask < (1 << (n - i)); ++mask) {   for (int j = 0; j < n - i; ++j) {   dp[mask][j] = 0;   }  }  dp[0][0] = 1;  for (int mask = 0; mask < (1 << (n - i)); ++mask) {   for (int j = 0; j < n - i; ++j) {   if (dp[mask][j] != 0) {    for (int k = 0; k < n - i; ++k) {    if (((mask >> k) & 1) == 0 && adj[j + i][k + i]) {     dp[mask | (1 << k)][k] += dp[mask][j];    }    }   }   }   if (((mask >> 0) & 1) != 0) {   res += dp[mask][0];   }  }  }  out.println(res / 2); }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  private class Scanner {  BufferedReader reader;  StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  public boolean hasNext() throws IOException {  while (!tokenizer.hasMoreTokens()) {   String next = reader.readLine();   if (next == null) {   return false;   }   tokenizer = new StringTokenizer(next);  }  return true;  }  public String next() throws IOException {  hasNext();  return tokenizer.nextToken();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
5	public class A {  public void run() throws IOException {   final int n = IOFast.nextInt();   int[] xs = new int[n];   for(int i = 0; i < n; i++) {    xs[i] = IOFast.nextInt();   }   int[] ys = xs.clone();   Random random = new Random();   for(int i = 0; i < n; i++) {    final int j = random.nextInt(i + 1);    final int t = ys[j]; ys[j] = ys[i]; ys[i] = t;   }   Arrays.sort(ys);     int diff = 0;   for(int i = 0; i < ys.length; i++) {    if(xs[i] != ys[i]) {     diff++;    }   }     IOFast.out.println(diff > 2 ? "NO" : "YES");  }   public static void main(String[] args) throws IOException {   new A().run();   IOFast.out.flush();  }  static public class IOFast {   private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   private static PrintWriter out = new PrintWriter(System.out);    private static int pos, readLen;   private static final char[] buffer = new char[1024 * 8];   private static final StringBuilder buf = new StringBuilder();   private static boolean[] isDigit = new boolean[256];   private static boolean[] isSpace = new boolean[256];   static {    for(int i = 0; i < 10; i++) {     isDigit['0' + i] = true;    }    isDigit['-'] = true;    isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;   }     static boolean endInput;     private static int read() throws IOException {    if(readLen == -1) {     return -1;    }       if(pos >= readLen) {     readLen = in.read(buffer);     pos = 0;         if(readLen <= 0) {      return -1;     }    }       return buffer[pos++];   }   private static int nextInt() throws IOException {    boolean plus = false;    int ret = 0;    while(true) {     final int c = read();         if(c == -1) {      endInput = true;      return Integer.MIN_VALUE;     }         if(isDigit[c]) {      if(c != '-') {       plus = true;       ret = c - '0';      }      break;     }    }       while(true) {     final int c = read();     if(c == -1 || !isDigit[c]) {      break;     }     ret = ret * 10 + c - '0';    }       return plus ? ret : -ret;   }     private static long nextLong() throws IOException {    boolean plus = false;    long ret = 0;    while(true) {     final int c = read();         if(c == -1) {      endInput = true;      return Integer.MIN_VALUE;     }         if(isDigit[c]) {      if(c != '-') {       plus = true;       ret = c - '0';      }      break;     }    }       while(true) {     final int c = read();     if(c == -1 || !isDigit[c]) {      break;     }     ret = ret * 10 + c - '0';    }       return plus ? ret : -ret;   }   private static char nextChar() throws IOException {    while(true) {     final int c = read();         if(c == -1) {      endInput = true;      return '\0';     }         if(!isSpace[c]) {      return (char)c;     }    }   }   private static int next(char[] cs) throws IOException {    int n = 0;    while(true) {     final int c = read();         if(c == -1) {      endInput = true;      return n;     }         if(!isSpace[c]) {      cs[n++] = (char)c;      break;     }    }       while(true) {     final int c = read();         if(c == -1 || isSpace[c]) {      break;     }     cs[n++] = (char)c;    }       return n;   }   private static String next() throws IOException {    buf.setLength(0);    while(true) {     final int c = read();         if(c == -1) {      endInput = true;      return "-1";     }         if(!isSpace[c]) {      buf.append((char)c);      break;     }    }       while(true) {     final int c = read();         if(c == -1 || isSpace[c]) {      break;     }     buf.append((char)c);    }    return buf.toString();   }   private static double nextDouble() throws IOException {    return Double.parseDouble(next());   }  } }
3	public class Main {  public static void main(String[] args) {   solve(System.in,System.out);  }  static void solve(InputStream inStream, PrintStream printStream) {   Scanner in = new Scanner(inStream);   int n = in.nextInt();   long[] sums = new long[n];   for (int i = 1; i < n; i++) {    sums[i]=0;   }   sums[0]=1;   long mod = 1000000007;   for (int i = 0; i < n; i++) {    if (in.next().equals("f") ) {     for (int j = n-1; j > 0 ; j--) {      sums[j]=sums[j-1];     }     sums[0]=0;    } else {     for (int j = n-2; j >= 0 ; j--) {      sums[j] += sums[j+1];      if (sums[j]>=mod) {       sums[j]-=mod;      }     }    }   }      printStream.println(sums[0]);  }  }
1	public class Main implements Runnable {  public void _main() throws IOException {  int n = nextInt();  int k = nextInt();  boolean[] p = new boolean[n + 1];  Arrays.fill(p, true);  List<Integer> primes = new ArrayList<Integer>();  for (int i = 2; i <= n; i++)  if (p[i]) {   primes.add(i);   for (int j = i + i; j <= n; j += i)   p[j] = false;  }  boolean[] ok = new boolean[n + 1];  for (int i = 0; i < primes.size() - 1; i++) {  int x = primes.get(i);  int y = primes.get(i + 1);  if (x + y + 1 <= n)   ok[x + y + 1] = true;  }  for (int i = 2; i <= n; i++)  if (p[i] && ok[i]) {   --k;    }   out.println(k <= 0 ? "YES" : "NO"); }  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 int nextInt() throws IOException {  return Integer.parseInt(next()); }  private long nextLong() throws IOException {  return Long.parseLong(next()); }  private double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static void main(String[] args) {  new Thread(new Main()).start(); }  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   _main();   out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(202);  } } }
6	public class EMatrix{  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 {    final int max = (int)(1E9);    int n , m;    int a[][];    int gm[];    boolean visit[][]; int dp[][];    boolean check(int d){     if(n == 1){      for(int i = 0; i < m - 1; i++){       if(Math.abs(a[0][i] - a[0][i + 1]) < d)return false;      }      return true;     }     int nm[] = new int[n], pm[] = new int[n];     for(int i = 0; i < n; i++){      boolean r;      for(int j = 0; j < n; j++){       if(j == i)continue;       r = true;       for(int k = 0; k < m; k++){        if(Math.abs(a[i][k] - a[j][k]) < d){         r = false; break;        }       }       if(r){        nm[i] |= (1 << j);       }       r = true;       for(int k = 0; k < m - 1; k++){        if(Math.abs(a[i][k + 1] - a[j][k]) < d){         r = false; break;        }       }       if(r){        pm[i] |= (1 << j);       }      }     }                  for(int i = 0; i < n; i++){      gm = new int[n];      gm[i] = nm[i];      for(int j = 0; j < n; j++){       if(j == i)continue;       if((nm[j] & (1 << i)) != 0){        gm[j] = nm[j] ^ (1 << i);       }else{        gm[j] = nm[j];       }      }      for(int j = 0; j < n; j++){       if(j == i)continue;       if((pm[i] >> j) % 2 == 1){        gm[j] |= (1 << i);       }      }      visit = new boolean[n][1 << n]; dp = new int[n][1 << n];           if(dfs(i, i, (1 << i)) == n){       return true;      }     }     return false;    }    int dfs(int u, int r, int mask){         if(u == r && mask == (1 << n) - 1)return 0;     if(visit[u][mask])return dp[u][mask];     visit[u][mask] = true;     int val = 0;     for(int i = 0; i < n; i++){      if((gm[u] >> i) % 2 == 1 && ((i == r && mask == (1 << n) - 1) || (mask >> i) % 2 != 1)){       val = Math.max(val, 1 + dfs(i, r, mask | (1 << i)));      }     }         return dp[u][mask] = val;    }    public 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();     }    }    int l = 0, r = max, ans = 0;    while(l <= r){     int m = (l + r) >> 1;     if(check(m)){      ans = m;      l = m + 1;     }else{      r = m - 1;     }    }    out.println(ans);   }                   }  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());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }  } }
4	public class Solution {  public static void main(String[] args) throws Exception {   final String str;   final BufferedReader r = new BufferedReader(new InputStreamReader(System.in));   str = r.readLine();   int max = 0;   for (int x = 0; x < str.length(); x++) {    for (int y = x + 1; y < str.length(); y++) {     int c = 0;     for (;c + x < str.length() && y + c < str.length(); c++) {      if (str.charAt(x + c) != str.charAt(y + c)) {       break;      }     }     if (c > max) {      max = c;     }    }   }   System.out.println(max);  } }
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(in, out);   out.close();  } } class TaskA {  int n;  int m;  String answer = "I'm too stupid to solve this problem";  public void solve(InputReader in, PrintWriter out) {   n = in.nextInt();   out.println("0 0 " + n);    }     } 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 ER23C {  static long s;  public static void main (String[] args) throws java.lang.Exception {   InputReader in = new InputReader(System.in);   PrintWriter w = new PrintWriter(System.out);   long n = in.nextLong();   s = in.nextLong();   long l = 0, h = n;   while (l < h) {    long mid = (l + h ) / 2;              if (Ok(mid))     h = mid;    else     l = mid + 1;   }   if (Ok(h))    w.println(n - h + 1);   else    w.println(n - h);   w.close();  }  static boolean Ok(long n) {   int sum = 0;   long temp = n;   while (n > 0) {    sum += (n % 10);    n = n / 10;   }     return (temp - sum >= s);  }  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 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 void skip(int x) {    while (x-- > 0)     read();   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public String nextString() {    return 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();   }   public String nextLine() {    StringBuffer buf = new StringBuffer();    int c = read();    while (c != '\n' && c != -1) {     if (c != '\r')      buf.appendCodePoint(c);     c = read();    }    return buf.toString();   }   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 int[] nextIntArray(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }   public long[] nextLongArray(int n) {    long[] a = new long[n];    for (int i = 0; i < n; i++)     a[i] = nextLong();    return a;   }   public boolean hasNext() {    int value;    while (isSpaceChar(value = peek()) && value != -1)     read();    return value != -1;   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
1	public class HamstersTigers {  private BufferedReader in;  private PrintWriter out;  private StringTokenizer st;  int solve(String a, int k){  int n = a.length(), ret = 0;  int temp[] = new int[n];  for(int i = 0; i < n; i++) temp[(n + i - k) % n] = (a.charAt(i) == 'T') ? 1: 0;  int left = 0, right = n - 1;  while(left < right){  while(temp[left] == 0) left++;  while(temp[right] == 1) right--;  if(left < right){   int t = temp[left];   temp[left] = temp[right];   temp[right] = t;   ret++;  }  }  return ret; }  void solve() throws IOException {  int n = nextInt();  String a = next();  int ans = Integer.MAX_VALUE;  for(int fix = 0; fix < n; fix++){  ans = Math.min(ans, solve(a, fix));  }  out.println(ans);  }  HamstersTigers() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);   eat("");   solve();   in.close();   out.close();  }  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());  }  long nextLong() throws IOException {   return Long.parseLong(next());  }  double nextDouble() throws IOException {   return Double.parseDouble(next());  }  public static void main(String[] args) throws IOException {   new HamstersTigers();  } }
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());  } } class BitUtils {  public static boolean checkBit(int mask, int bit) {   return (mask & (1 << bit)) > 0;  } } class ArrayUtils {  public static void fill(double[][][] f, double value) {   for (int i = 0; i < f.length; ++i) {    for (int j = 0; j < f[i].length; ++j) {     Arrays.fill(f[i][j], value);    }   }  } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, Scanner in, PrintWriter out) {    long n = in.nextLong();    long s = in.nextLong();    long ans = 0;    long i = 0;    for (i = s; i <= n; i++) {     long t = i - sum(i);     if (t >= s) {      if (i % 10 == 9) {       break;      }      ans++;     }    }    if (n >= s) {     out.println(ans - i + n + 1);    } else {     out.println(0);    }   }   static long sum(long a) {    long sum = 0;    while (a != 0) {     sum += (a % 10);     a /= 10;    }    return sum;   }  } }
0	public class P122A_LuckyDivision {  private static boolean isLuckyNumber(int number) {  while (number > 0) {  int digit = number % 10;   if (digit != 4 && digit != 7) {   return false;  }   number /= 10;  }  return true; }  private static boolean isAlmostLuckyNumber(int number) {  int max = (int) Math.sqrt(number);  int i = 1;  while (i <= max) {  if (number % i == 0   && (isLuckyNumber(i) || isLuckyNumber(number / i))) {   return true;  }   i++;  }  return false; }   public static void main(String[] args) {  try {    InputStreamReader isr = new InputStreamReader(System.in);  BufferedReader reader = new BufferedReader(isr);     int input = Integer.parseInt(reader.readLine());   reader.close();  isr.close();     boolean result = isAlmostLuckyNumber(input);  System.out.println(result ? "YES" : "NO");  } catch (Exception e) {  e.printStackTrace();  } } }
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()); }  double nextDouble() throws IOException {  return Double.parseDouble(next()); } }
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)); } }
1	public class Main {   public static void main(String[] args) throws NumberFormatException, IOException {   Scanner sc = new Scanner(new InputStreamReader(System.in));   int n = sc.nextInt(),even = 0,odd = 0,evI = 0,OdI = 0;    for (int i = 0; i < n; i++) {    if(sc.nextInt()%2 == 1){     odd++;     OdI = i+1;    }else{     even++;     evI = i+1;    }   }   if(even < odd)    System.out.println(evI);   else    System.out.println(OdI);    } }
3	public class Problem911D {   public static void main(String args[]) throws IOException {     Scanner sc = new Scanner(System.in);     int n = sc.nextInt(), i, j;     int ar[] = new int[n];     int inv = 0;         for(i = 0; i < n; i++) {       ar[i] = sc.nextInt();     }         for(i = 0; i < n; i++) {       for(j = 0; j < n; j++) {         if(i > j && ar[i] < ar[j]) {           inv = (inv + 1) % 2;         }       }     }         int q = sc.nextInt();         for(i = 0; i < q; i++) {       int l = sc.nextInt();       int r = sc.nextInt();             int c = ( ((r-l)*(r-l+1))/2 ) % 2;       inv = (inv + c) % 2;             if(inv == 0)         System.out.println("even");       else         System.out.println("odd");     }   } }
4	public class GivenString implements Runnable { public static void main(String[] args) throws Exception {  new GivenString().run(); }  private void solve() throws Exception {  String s = nextToken();  int len = s.length();  KMP kmp = new KMP();  int r = 0;  for (int i = 0; i < len; i++)  {  for (int j = i + 1; j <= len; j++)  {   String cur = s.substring(i, j);   int count = kmp.search(s, cur);   if (count >= 2)   r = max(r, cur.length());  }  }  out.println(r); }  class KMP {  public int search(String text, String pattern)  {  int count = 0;  int n = text.length(), m = pattern.length(), matchPoint = -1;  char pat[] = pattern.toCharArray(), t[] = text.toCharArray();  int p[] = prefixTable(pattern);  int j = 0;  for (int i = 0; i < n; i++)  {   while (j > 0 && pat[j] != t[i])   j = p[j - 1];   if (pat[j] == t[i])   j++;   if (j == m)   {   matchPoint = i - m + 1;   j = p[j - 1];   count++;   }  }  return count;  }  private int[] prefixTable(String pat)  {  int m = pat.length(), p[] = new int[m];  char s[] = pat.toCharArray();  int j = 0;  for (int i = 1; i < m; i++)  {   while (j > 0 && s[j] != s[i])   j = p[j - 1];   if (s[j] == s[i])   j++;   p[i] = j;  }  return p;  }  }   private BufferedReader in; PrintWriter out; StringTokenizer tokenizer;  public void run() {   try  {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new BufferedOutputStream(System.out));  solve();  out.flush();  in.close();  out.close();  }  catch (Exception e)  {  e.printStackTrace();    } }  String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens())  {  tokenizer = new StringTokenizer(in.readLine());  }  return tokenizer.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()); } }
4	public class ExplorerSpace {  int[][] horizontal, vertical;  int n, m;  long[][][] dp;  int large = Integer.MAX_VALUE;  boolean isValid(int i, int j){   return i>=0 && j>=0 && i<n && j<m;  }  long getMin(int i, int j, int k){   if(k==0)    return 0;   if(dp[i][j][k]!=-1)    return dp[i][j][k];   long ans = large;   for (int a = 0; a < 2; a++) {    for (int d = 0; d < 2; d++) {     int dx = a==0 ? (d==0 ? +1 : -1) : 0;     int dy = a==1 ? (d==0 ? +1 : -1) : 0;     int x = i+dx;     int y = j+dy;     if(isValid(x, y)){      if(dx==0){       ans = Math.min(horizontal[i][Math.min(j, y)]+getMin(x, y, k-1), ans);      }else {       ans = Math.min(vertical[Math.min(i, x)][j]+getMin(x, y, k-1), ans);      }     }    }   }   dp[i][j][k] = ans;   return ans;  }  void solve() throws IOException {   n = getInt();   m = getInt();   dp = new long[n+1][m+1][11];   for (int i = 0; i < n+1; i++) {    for (int j = 0; j < m+1; j++) {     for (int k = 0; k < 11; k++) {      dp[i][j][k] = -1;     }    }   }   int k = getInt();   horizontal = new int[n][m-1];   vertical = new int[n-1][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m - 1; j++) {     horizontal[i][j] = getInt();    }   }   for (int i = 0; i < n - 1; i++) {    for (int j = 0; j < m; j++) {     vertical[i][j] = getInt();    }   }   if(k%2!=0){    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      print("-1 ");     }     println("");    }   }else {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      long ans = 2*getMin(i, j, k/2);      print(ans+" ");     }     println("");    }   }  }  public static void main(String[] args) throws Exception {   if (isOnlineJudge()) {    in = new BufferedReader(new InputStreamReader(System.in));    out = new BufferedWriter(new OutputStreamWriter(System.out));    new ExplorerSpace().solve();    out.flush();   } else {    Thread judge = new Thread();    in = new BufferedReader(new FileReader("input.txt"));    out = new BufferedWriter(new FileWriter("output.txt"));    judge.start();    new ExplorerSpace().solve();    out.flush();    judge.suspend();   }  }  static boolean isOnlineJudge(){   try {    return System.getProperty("ONLINE_JUDGE")!=null      || System.getProperty("LOCAL")==null;   }catch (Exception e){    return true;   }  }   static BufferedReader in;  static StringTokenizer st;  static BufferedWriter out;  static String getLine() throws IOException{   return in.readLine();  }  static String getToken() throws IOException{   if(st==null || !st.hasMoreTokens())    st = new StringTokenizer(getLine());   return st.nextToken();  }  static int getInt() throws IOException {   return Integer.parseInt(getToken());  }  static long getLong() throws IOException {   return Long.parseLong(getToken());  }  static void print(Object s) throws IOException{   out.write(String.valueOf(s));  }  static void println(Object s) throws IOException{   out.write(String.valueOf(s));   out.newLine();  } }
2	public class SolutionB {  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();  }  int nextInt() throws IOException {  return Integer.parseInt(next());  }  double nextDouble() throws IOException {  return Double.parseDouble(next());  }  long nextLong() throws IOException {  return Long.parseLong(next());  }  char[] charArray() throws IOException{  return next().toCharArray();  }  public static void main(String[] args) throws IOException {  new SolutionB().run();  }  void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);      solve();  out.close();  }  void solve() throws IOException {    long n = nextLong();  long k = nextLong();  long m=num1(k);  if(m<n){   out.println(-1);   return;  }  if(m==n){   out.println(k-1);   return;  }  long ans=binS(n,k);  out.println(k-ans);  }  long num1(long k){  long r=k*(k+1)/2-1;  r=r-(k-2);  return r;  }  long num2(long k){  return num1(k)-1;  }  long binS(long n, long k) {  long start, end, mid;  start = 2;  end = k;  long ret=-1;  while (start <= end) {   mid = (start + end) / 2;   if (num1(k)-num2(mid) == n) {    return mid;   } else if (num1(k)-num2(mid) < n) {    end = mid - 1;   } else {    ret=mid;    start = mid + 1;   }  }  return ret;  } }
6	public class Main {  public static void main(String[] args) throws IOException {   FastScanner scanner = new FastScanner();   int n = scanner.nextInt();   int m = scanner.nextInt();   boolean graph[][] = new boolean[n][n];   for (int i = 0; i < m; i++) {    int a = scanner.nextInt();    int b = scanner.nextInt();    graph[a-1][b-1] = true;    graph[b-1][a-1] = true;   }   if(n <= 2) {    System.out.println(0);    return;   }   long dp[][] = new long[1<<n][n];   for (int i = 0; i < (1<<n); i++) {    Arrays.fill(dp[i], -1);   }   for (int i = 1; i < (1<<n); i++) {    for (int j = 0; j < n; j++) {     f(i, j, dp, graph, n);    }   }   long sum = 0;          for (int i = 0; i < n; i++) {    for (int j = 0; j < (1 << n); j++) {     if(Integer.bitCount(j) >= 3 && graph[Integer.numberOfTrailingZeros(j)][i]) {      sum += dp[j][i];     }    }   }   System.out.println(sum/2);  }  private static long f(int mask, int i, long[][] dp, boolean[][] graph, int n) {   if(dp[mask][i] != -1) return dp[mask][i];   if(Integer.bitCount(mask) == 1 && (mask&(1<<i)) != 0) {    dp[mask][i] = 1;   } else if(Integer.bitCount(mask) > 1 && (mask&(1<<i)) != 0 && i != Integer.numberOfTrailingZeros(mask)) {    dp[mask][i] = 0;    for (int j = 0; j < n; j++) {     if(graph[i][j]) dp[mask][i] = dp[mask][i] + f(mask^(1<<i), j, dp, graph, n);    }   } else {    dp[mask][i] = 0;   }       return dp[mask][i];  }  static class FastScanner {   BufferedReader br;   StringTokenizer st;   FastScanner() {    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());   }  } }
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);   CNastyaAndAWardrobe solver = new CNastyaAndAWardrobe();   solver.solve(1, in, out);   out.close();  }  static class CNastyaAndAWardrobe {   public void solve(int testNumber, InputReader in, PrintWriter out) {    long x = in.nextLong(), k = in.nextLong();    if (x != 0) {     long m = (int) 1e9 + 7;     x = x % m;     long res = in.fastPowerMod(2, k, m);     long res1 = (2 * res) % m;     long ans = ((res1 * x) % m - (res - 1) % m) % m;     ans = (ans + m) % m;     out.println(ans);    } else {     out.println(0);    }   }  }  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 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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public long fastPowerMod(long x, long y, long m) {    long res = 1;    x = x % m;    while (y > 0) {     if ((y & 1) == 1) {      res = (x * res) % m;     }     x = (x * x) % m;     y = y >> 1;    }    return res % m;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
0	public class Main{  public static void main(String[] args) throws IOException{   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   List<Integer> fibs = new ArrayList<Integer>();   int fib0 = 0;   int fib1 = 1;   int fibN = fib0+fib1;   fibs.add(fib0);   fibs.add(fib1);   while(fibN < 1000000000){    fibs.add(fibN);    fib0 = fib1;    fib1 = fibN;    fibN = fib0+fib1;   }   int n = Integer.parseInt(br.readLine());     if(n == 0){System.out.println(0+" "+0+" "+0);}   else{    if(n == 1){System.out.println(0+" "+0+" "+1);}    else{     if(n == 2){System.out.println(0+" "+1+" "+1);}     else{   int i = fibs.indexOf(n);   System.out.println(fibs.get(i-4)+" "+fibs.get(i-3)+" "+fibs.get(i-1));  }}   } } }
0	public class ProblemA {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   long n = sc.nextLong();   long[] answer = new long[3];   if (n == 1) {    answer[0] = 0;    answer[1] = 0;    answer[2] = 1;   } else if (n > 1) {    long f1 = 0;    long f2 = 1;    long m = 0;    while (m < n) {     answer[0] = answer[1];     answer[1] = f1;     answer[2] = f2;     m = f1 + f2;     f1 = f2;     f2 = m;    }    answer[2] = answer[1];   }   System.out.println(answer[0] + " " + answer[1] + " " + answer[2]);  } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   long mod = (long) 1e9 + 7;   public void solve(int testNumber, InputReader in, PrintWriter out) {    long x = in.nextLong();    long k = in.nextLong();    if (x == 0) {     out.print(0);     return;    }    long n = pow(2, k);    long l = (n * ((x % mod)) % mod);    l = l % mod;    long ans = 2 * l - n + 1;    ans = ans % mod;    if (ans < 0)     ans += mod;    out.print(ans);   }   long pow(long a, long val) {    if (val == 0) {     return 1;    }    if (val % 2 == 0) {     long ans = pow(a, val / 2);     return (ans * ans) % mod;    }    return ((a % mod) * (pow(a, val - 1))) % mod;   }  }  static class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar;   private int snumChars;   public InputReader(InputStream st) {    this.stream = st;   }   public int read() {             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 long nextLong() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;    do {     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;   }  } }
1	public class Cgr14 {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader sc = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   Solver solver = new Solver();  int t = sc.nextInt();   while (t-- != 0) {    solver.solve(sc, out);   }   out.close();  }  static class Solver {   public void solve(InputReader sc, PrintWriter out) {    long n = sc.nextInt();    long l = 1;    long r = (long)1e5;    while(l<=r) {     long mid = (l+r)/2;     long needed = (mid*mid)*2;     if(needed==n) {      out.println("YES");      return;     }     if(needed>n) {      r = mid-1;     } else {      l = mid+1;     }    }    l = 1;    r = (long)1e5;    while(l<=r) {     long mid = (l+r)/2;     long needed = (mid*mid)*4;     if(needed==n) {      out.println("YES");      return;     }     if(needed>n) {      r = mid-1;     } else {      l = mid+1;     }    }    out.println("NO");   }  }  static void sort(int[] arr) {   Random rand = new Random();   int n = arr.length;   for (int i = 0; i < n; i++) {    int idx = rand.nextInt(n);    if (idx == i) continue;    arr[i] ^= arr[idx];    arr[idx] ^= arr[i];    arr[i] ^= arr[idx];   }   Arrays.sort(arr);  }  static void sort(long[] arr) {   Random rand = new Random();   int n = arr.length;   for (int i = 0; i < n; i++) {    int idx = rand.nextInt(n);    if (idx == i) continue;    arr[i] ^= arr[idx];    arr[idx] ^= arr[i];    arr[i] ^= arr[idx];   }   Arrays.sort(arr);  }  static void sortDec(int[] arr) {   Random rand = new Random();   int n = arr.length;   for (int i = 0; i < n; i++) {    int idx = rand.nextInt(n);    if (idx == i) continue;    arr[i] ^= arr[idx];    arr[idx] ^= arr[i];    arr[i] ^= arr[idx];   }   Arrays.sort(arr);   int l = 0;   int r = n - 1;   while (l < r) {    arr[l] ^= arr[r];    arr[r] ^= arr[l];    arr[l] ^= arr[r];    l++;    r--;   }  }  static void sortDec(long[] arr) {   Random rand = new Random();   int n = arr.length;   for (int i = 0; i < n; i++) {    int idx = rand.nextInt(n);    if (idx == i) continue;    arr[i] ^= arr[idx];    arr[idx] ^= arr[i];    arr[i] ^= arr[idx];   }   Arrays.sort(arr);   int l = 0;   int r = n - 1;   while (l < r) {    arr[l] ^= arr[r];    arr[r] ^= arr[l];    arr[l] ^= arr[r];    l++;    r--;   }  }  static 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 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 nextString() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     if (Character.isValidCodePoint(c)) {      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;   }   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 BigInteger readBigInteger() {    try {     return new BigInteger(nextString());    } catch (NumberFormatException e) {     throw new InputMismatchException();    }   }   public char nextCharacter() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    return (char) c;   }   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 boolean isExhausted() {    int value;    while (isSpaceChar(value = peek()) && value != -1) {     read();    }    return value == -1;   }   public String next() {    return nextString();   }   public SpaceCharFilter getFilter() {    return filter;   }   public void setFilter(SpaceCharFilter filter) {    this.filter = filter;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }   public int[] nextIntArray(int n) {    int[] array = new int[n];    for (int i = 0; i < n; ++i) array[i] = nextInt();    return array;   }   public int[] nextSortedIntArray(int n) {    int array[] = nextIntArray(n);    Arrays.sort(array);    return array;   }   public int[] nextSumIntArray(int n) {    int[] array = new int[n];    array[0] = nextInt();    for (int i = 1; i < n; ++i) array[i] = array[i - 1] + nextInt();    return array;   }   public long[] nextLongArray(int n) {    long[] array = new long[n];    for (int i = 0; i < n; ++i) array[i] = nextLong();    return array;   }   public long[] nextSumLongArray(int n) {    long[] array = new long[n];    array[0] = nextInt();    for (int i = 1; i < n; ++i) array[i] = array[i - 1] + nextInt();    return array;   }   public long[] nextSortedLongArray(int n) {    long array[] = nextLongArray(n);    Arrays.sort(array);    return array;   }  }  }
6	public class G1 {  static int n, T, duration[], type[];  static long dp[][][], mod = (long) 1e9 + 7;  public static void main(String[] args) throws Exception {   new Thread(null, new Runnable() {    public void run() {     try {      solveIt();     } catch (Exception e) {      e.printStackTrace();      System.exit(1);     }    }   }, "Main", 1 << 28).start();  }  public static void solveIt() throws Exception {   Scanner in = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   n = in.nextInt();   T = in.nextInt();   dp = new long[4][T + 1][1 << n];   duration = new int[n];   type = new int[n];   for (int i = 0; i < n; i++) {    duration[i] = in.nextInt();    type[i] = in.nextInt() - 1;   }   for (long a[][] : dp) for (long b[] : a) Arrays.fill(b, -1);   pw.println(solve(3, T, 0));   pw.close();  }  static long solve(int lastType, int rem, int mask) {   if (rem == 0) return 1;   if (rem < 0) return 0;   if (dp[lastType][rem][mask] != -1) return dp[lastType][rem][mask];   long res = 0;   for (int i = 0; i < n; i++) {    if (!check(mask, i) && lastType != type[i] && rem - duration[i] >= 0) {     res += solve(type[i], rem - duration[i], set(mask, i));     if (res >= mod) res -= mod;    }   }   return dp[lastType][rem][mask] = res;  }  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 int reset(int N, int pos) {   return N = N & ~(1 << pos);  }  static void debug(Object... obj) {   System.err.println(Arrays.deepToString(obj));  } }
5	public class A { public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int t = scan.nextInt();  List<List<Double>> coords = new ArrayList<List<Double>>();  while (n-- > 0) {  double x = scan.nextDouble();  double a = scan.nextDouble() / 2;  coords.add(Arrays.asList(x - a, x + a));  }  Collections.sort(coords, new Comparator<List<Double>>() {  @Override  public int compare(List<Double> o1, List<Double> o2) {   return o1.get(0).compareTo(o2.get(0));  }  });  int count = 2;  ChoiceFormat f = new ChoiceFormat("-1#0|0#1|0<2");  for (int i = 0; i < coords.size()-1; i++) {  double l = coords.get(i+1).get(0)-coords.get(i).get(1)-t;  count += new Integer(f.format(l));  }  System.out.println(count); } }
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); } }
5	public class A {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int k = in.nextInt() - 1;   Point[] A = new Point[n];   for (int i = 0; i < n; i++)    A[i] = new Point(in.nextInt(), in.nextInt());   Arrays.sort(A, new Comparator<Point>() {    public int compare(Point o1, Point o2) {     if (o1.x != o2.x)      return o2.x - o1.x;     if (o1.y != o2.y)      return o1.y - o2.y;     return 0;    }   });   int i = k;   int j = k;   while (i >= 0 && A[i].x == A[k].x && A[i].y == A[k].y)    i--;   while (j < n && A[j].x == A[k].x && A[j].y == A[k].y)    j++;   System.out.println(j - i - 1);  } }
2	@SuppressWarnings("unused") public class round176B {  static BufferedReader br = new BufferedReader(new InputStreamReader(    System.in));  static StringTokenizer st = new StringTokenizer("");  static int nextInt() throws Exception {   return Integer.parseInt(next());  }  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 n = parseLong(next());   long k = parseLong(next());   if(n == 1){    System.out.println(0);    return;   }   if (n <= k) {    System.out.println(1);    return;   }   if ((((k * (k + 1)) / 2) - 1) - (k - 2) < n) {    System.out.println(-1);   } else {    long lo = 1;    long hi = k + 1;    int best = Integer.MAX_VALUE;    while (lo < hi) {     long mid = lo + ((hi - lo) / 2);     long first = ((mid * (2 + (2 + (mid - 1)))) / 2) - (mid - 1);     long last = ((mid * (k - mid + 1 + k)) / 2) - (mid - 1);         if (n < first) {      hi = mid;     } else {      if (n >= first && n <= last) {       hi = mid;       best = min(best, (int) mid);      } else       lo = mid + 1;     }    }    System.out.println(best);   }  } }
6	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); } }
4	public class C {  private static FastReader fr = new FastReader();  private static PrintWriter out=new PrintWriter(System.out);  private static Random random = new Random();  public static void main(String[] args) throws IOException {   StringBuilder sb = new StringBuilder();     int t = fr.nextInt();   while (t-- > 0){    int n = fr.nextInt();    int[] arr = fr.nextIntArray(n);    sb.append(1).append("\n");    List<Integer> state = new ArrayList<>();    state.add(1);    for(int i = 1; i < n; i++){     List<Integer> nextState = new ArrayList<>();     boolean found = false;     int till = -1;     for(int j = state.size() - 1; j >= 0; j--){      if(state.get(j) + 1 == arr[i]){       till = j;       found = true;       break;      }     }     if(found){      for(int j = 0; j < till; j++){       nextState.add(state.get(j));      }      nextState.add(arr[i]);      sb.append(nextState.get(0));      for(int z = 1; z < nextState.size(); z++){       sb.append(".").append(nextState.get(z));      }      sb.append("\n");     }     if(!found){      nextState.addAll(state);      nextState.add(arr[i]);      sb.append(nextState.get(0));      for(int z = 1; z < nextState.size(); z++){       sb.append(".").append(nextState.get(z));      }      sb.append("\n");     }     state = nextState;    }   }   System.out.print(sb.toString());  }  static void ruffleSort(int[] a) {   int n=a.length;   for (int i=0; i<n; i++) {    int oi=random.nextInt(n), temp=a[oi];    a[oi]=a[i]; a[i]=temp;   }   Arrays.sort(a);  }  static class FastReader{   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 (IOException e) {      e.printStackTrace();     }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }   public int[] nextIntArray(int n) {    int[] a=new int[n];    for (int i=0; i<n; i++) a[i]=nextInt();    return a;   }   public long nextLong() {    return Long.parseLong(next());   }   public long[] nextLongArray(int n) {    long[] a=new long[n];    for (int i=0; i<n; i++) a[i]=nextLong();    return a;   }  }  static class Pair<A, B>{   A first;   B second;   public Pair(A first, B second){    this.first = first;    this.second = second;   }  }  static long mod(String num, long a)  {     long res = 0;      for (int i = 0; i < num.length(); i++)    res = (res*10 + num.charAt(i) - '0') %a;   return res;  }  static long binomialCoeff(long n, long k, long MOD)  {   long res = 1;      if (k > n - k)    k = n - k;        for (int i = 0; i < k; ++i) {    res *= (n - i);    res /= (i + 1);    res %= MOD;   }   return res;  }  static long power(long x, long y, long p)  {      long res = 1;        x = x % p;   while (y > 0) {           if (y % 2 == 1)     res = (res * x) % p;        y = y >> 1;    x = (x * x) % p;   }   return res;  }    static long modInverse(long n, long p)  {   return power(n, p - 2, p);  }     static long nCrModPFermat(int n, int r,        long p)  {      if (r == 0)    return 1;           long[] fac = new long[n + 1];   fac[0] = 1;   for (int i = 1; i <= n; i++)    fac[i] = fac[i - 1] * i % p;   return (fac[n] * modInverse(fac[r], p)     % p * modInverse(fac[n - r], p)     % p)     % p;  } }
4	public class DoubleWord implements Runnable {  boolean isLocalMode =false;   private void doJob() throws Exception {     String s = nextToken();     int max=0;   for(int i = 0;i<s.length();i++){    for(int j=i+1;j<s.length()+1;j++){     String s1 = s.substring(i, j);     if(s.substring(i+1).contains(s1)){      max = Math.max(max,s1.length());     }    }   }   writer.write(""+max);  }   public static void main(String[] args) {   new DoubleWord().run();  }  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter writer;  public void run() {   try {    reader = new BufferedReader(getReader());    tokenizer = null;    writer = new PrintWriter(System.out);       doJob();    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();  }  public Reader getReader() throws FileNotFoundException {   if (isLocalMode) {    return new FileReader("input.txt");   } else {    return new InputStreamReader(System.in);   }  } }
1	public class C { InputStream is;  int __t__ = 1; int __f__ = 0; int __FILE_DEBUG_FLAG__ = __f__; String __DEBUG_FILE_NAME__ = "src/C4";  FastScanner in; PrintWriter out;  int charToIndex(char c) {  if (Character.isLowerCase(c))  return c - 'a';  else if (Character.isUpperCase(c))  return c - 'A' + 26;  return -1; }  int CH_NUM = 52; public void solve() {  int n = in.nextInt();  String s = in.next();   boolean[] exist = new boolean[CH_NUM];  int typeNum = 0;  for (int i = 0; i < n; i++) {  int idx = charToIndex(s.charAt(i));  if (!exist[idx]) {   exist[idx] = true;   typeNum++;  }  }   int get = 0;  int tail = 0, head = 0;  int res = Integer.MAX_VALUE;  int[] cnt = new int[CH_NUM];  while (tail < n || head < n) {  if (head == n || typeNum == get) {   int idx = charToIndex(s.charAt(tail++));   if (cnt[idx] == 1) get--;   cnt[idx]--;  } else {   int idx = charToIndex(s.charAt(head++));   if (cnt[idx] == 0) get++;   cnt[idx]++;  }  if (typeNum == get)   res = Math.min(res, head - tail);  }  System.out.println(res);   }  public void run() {  if (__FILE_DEBUG_FLAG__ == __t__) {  try {   is = new FileInputStream(__DEBUG_FILE_NAME__);  } catch (FileNotFoundException e) {     e.printStackTrace();  }  System.out.println("FILE_INPUT!");  } else {  is = System.in;  }  in = new FastScanner(is);  out = new PrintWriter(System.out);  solve(); }  public static void main(String[] args) {  new C().run(); }  public void mapDebug(int[][] a) {  System.out.println("--------map display---------");  for (int i = 0; i < a.length; i++) {  for (int j = 0; j < a[i].length; j++) {   System.out.printf("%3d ", a[i][j]);  }  System.out.println();  }  System.out.println("----------------------------");  System.out.println(); }  public void debug(Object... obj) {  System.out.println(Arrays.deepToString(obj)); }  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;  }  int nextInt() {  return Integer.parseInt(next());  }  int[] nextIntArray(int n) {  return nextIntArray(n, 0);  }  int[] nextIntArray(int n, int margin) {  int[] array = new int[n + margin];  for (int i = 0; i < n; i++)   array[i + margin] = nextInt();   return array;  }  int[][] nextIntMap(int n, int m) {  int[][] map = new int[n][m];  for (int i = 0; i < n; i++) {   map[i] = in.nextIntArray(m);  }  return map;  }  long nextLong() {  return Long.parseLong(next());  }  long[] nextLongArray(int n) {  return nextLongArray(n, 0);  }  long[] nextLongArray(int n, int margin) {  long[] array = new long[n + margin];  for (int i = 0; i < n; i++)   array[i + margin] = nextLong();   return array;  }  long[][] nextLongMap(int n, int m) {  long[][] map = new long[n][m];  for (int i = 0; i < n; i++) {   map[i] = in.nextLongArray(m);  }  return map;  }  double nextDouble() {  return Double.parseDouble(next());  }  double[] nextDoubleArray(int n) {  return nextDoubleArray(n, 0);  }  double[] nextDoubleArray(int n, int margin) {  double[] array = new double[n + margin];  for (int i = 0; i < n; i++)   array[i + margin] = nextDouble();   return array;  }  double[][] nextDoubleMap(int n, int m) {  double[][] map = new double[n][m];  for (int i = 0; i < n; i++) {   map[i] = in.nextDoubleArray(m);  }  return map;  }  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[] nextStringArray(int n) {  String[] array = new String[n];  for (int i = 0; i < n; i++)   array[i] = next();   return array;  }  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();  } } }
3	public class Main { public static void main(String[] args) {  Main main = new Main();  main.solveC(); }  private void solveA() {  Scanner sc = new Scanner(System.in);  String str = sc.next();  long answer = str.chars().filter(   asc -> asc == 'a'   || asc == 'i'   || asc == 'u'   || asc == 'e'   || asc == 'o'   || asc == '1'   || asc == '3'   || asc == '5'   || asc == '7'   || asc == '9').count();  System.out.println(answer); }  private void solveB() {  Scanner sc = new Scanner(System.in);  int N = sc.nextInt();  int M = sc.nextInt();  sc.nextLine();  char[][] map = new char[N + 2][M + 2];  map[0] = new char[M + 2];  map[N + 1] = new char[M + 2];  int s_r = -1;  int s_c = -1;  for (int c = 0; c < M + 2; c++) {  map[0][c] = '#';  map[N + 1][c] = '#';  }  for (int r = 1; r <= N; r++) {  map[r][0] = '#';  String line = sc.nextLine();  for (int c = 1; c <= M; c++) {   map[r][c] = line.charAt(c - 1);   if (map[r][c] == 'S') {   s_r = r;   s_c = c;   }  }  map[r][M + 1] = '#';  }  String inst = sc.next();  long ans = 0L;  for (int left = 0; left < 4; left++) {  for (int up = 0; up < 4; up++) {   for (int right = 0; right < 4; right++) {   for (int down = 0; down < 4; down++) {    if (left == up || left == right || left == down || up == right || up == down || right == down) {    continue;    }    int r_r = s_r;    int r_c = s_c;    for (int i = 0; i < inst.length(); i++) {    char asc = inst.charAt(i);    if (asc == '0' + left) {     r_c--;    }    if (asc == '0' + up) {     r_r--;    }    if (asc == '0' + right) {     r_c++;    }    if (asc == '0' + down) {     r_r++;    }    if (map[r_r][r_c] == '#') {     break;    }    if (map[r_r][r_c] == 'E') {     ans++;     break;    }    }   }   }  }  }  System.out.println(ans); }  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()); }  private void solveD() {  Scanner sc = new Scanner(System.in);  int N = sc.nextInt();  System.out.println(N); }  private void solveE() {  Scanner sc = new Scanner(System.in);  int N = sc.nextInt();  System.out.println(N); }  private void solveF() {  Scanner sc = new Scanner(System.in);  int N = sc.nextInt();  System.out.println(N); }  interface Graph {  void link(int from, int to, long cost);  Optional<Long> getCost(int from, int to);  int getVertexNum(); }  interface FlowResolver {  long maxFlow(int from, int to); }   class ArrayGraph implements Graph {  private Long[][] costArray;  private int vertexNum;  public ArrayGraph(int n) {  costArray = new Long[n][];  for (int i = 0; i < n; i++) {   costArray[i] = new Long[n];  }  vertexNum = n;  }  @Override  public void link(int from, int to, long cost) {  costArray[from][to] = new Long(cost);  }  @Override  public Optional<Long> getCost(int from, int to) {  return Optional.ofNullable(costArray[from][to]);  }  @Override  public int getVertexNum() {  return vertexNum;  } }   class DfsFlowResolver implements FlowResolver {  private Graph graph;  public DfsFlowResolver(Graph graph) {  this.graph = graph;  }    public long maxFlow(int from, int to) {  long sum = 0L;  long currentFlow;  do {   currentFlow = flow(from, to, Long.MAX_VALUE / 3, new boolean[graph.getVertexNum()]);   sum += currentFlow;  } while (currentFlow > 0);  return sum;  }    private long flow(int from, int to, long current_flow, boolean[] passed) {  passed[from] = true;  if (from == to) {   return current_flow;  }  for (int id = 0; id < graph.getVertexNum(); id++) {   if (passed[id]) {   continue;   }   Optional<Long> cost = graph.getCost(from, id);   if (cost.orElse(0L) > 0) {   long nextFlow = current_flow < cost.get() ? current_flow : cost.get();   long returnFlow = flow(id, to, nextFlow, passed);   if (returnFlow > 0) {    graph.link(from, id, cost.get() - returnFlow);    graph.link(id, from, graph.getCost(id, from).orElse(0L) + returnFlow);    return returnFlow;   }   }  }  return 0L;  } }   class BinaryIndexedTree {  private long[] array;  public BinaryIndexedTree(int size) {  this.array = new long[size + 1];  }    public void add(int index, long value) {  for (int i = index; i < array.length; i += (i & -i)) {   array[i] += value;  }  }    public long getSum(int index) {  long sum = 0L;  for (int i = index; i > 0; i -= (i & -i)) {   sum += array[i];  }  return sum;  } } }
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)));   }  } }
0	public class Main { public static int gcd(int a , int b) {  if (b == 0) return 0;  else {  return a / b + gcd (b , a % b);  } }  public static void main(String[] args) {  Scanner sc = new Scanner (System.in);  int testCase = sc.nextInt();  while (testCase-- > 0) {  int n = sc.nextInt();  int m = sc.nextInt();  if (n < m) {   int temp = n;   n = m;   m = temp;  }   int ans = gcd (n , m);  System.out.println(ans);  } } }
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(); }  public static void debug(Object... os){  System.err.println(Arrays.deepToString(os)); } }
2	public class B { static char [] in = new char [1000000]; public static void main (String [] arg) throws Throwable {  int n = nextInt();  int k = nextInt();   long ate = 0;  long ans = -1;  for (long i = 1; ans < 0; ++i) {  long test = (i * (i+1)) / 2;  if (test < k) continue;    long adding_moves = i;  long eating_moves = n-i;  if (test - eating_moves == k) ans = eating_moves;  }  System.out.println(ans);   }                  static class Pair implements Comparable<Pair> {  int i,j;long L; public Pair(int xx, int yy, long LL){i=xx;j=yy;L=LL;}  public int compareTo(Pair p) { return (this.L < p.L) ? -1 : ((this.L == p.L && this.i < p.i) ? -1 : 1);} }  public static long nextLong() throws Throwable {  long i = System.in.read();boolean neg = false;while (i < 33) i = System.in.read();if (i == 45) {neg=true;i=48;}i = i - 48;  int j = System.in.read();while (j > 32) {i*=10;i+=j-48;j = System.in.read();}return (neg) ? -i : i; } public static int nextInt() throws Throwable {return (int)nextLong();} public static String next() throws Throwable {  int i = 0; while (i < 33 && i != -1) i = System.in.read(); int cptr = 0; while (i >= 33) { in[cptr++] = (char)i; i = System.in.read();}  return new String(in, 0,cptr); }  public static long gcdL(long a, long b) {while (b != 0) {long tmp = b;b = (a % b);a = tmp;}return a;} public static int gcd(int a, int b) {while (b != 0) {int tmp = b;b = (a % b);a = tmp;}return a;} public static int[] sieve(int LIM) {  int i,count = 0;  boolean [] b = new boolean [LIM];  for (i = 2;i<LIM; ++i) if (!b[i]) {count++; for (int j = i<<1; j<LIM; j+=i) b[j] = true;}  int [] primes = new int[count];  for (i = 2,count=0;i<LIM;++i) if (!b[i]) primes[count++] = i;  return primes; } public static int[] numPrimeFactors(int LIM) {  int i,count = 0;  int [] b = new int [LIM];  for (i = 2;i<LIM; ++i) if (b[i] == 0) {count++; for (int j = i; j<LIM; j+=i) b[j]++;}  return b; } public static StringBuilder stringFromArray(int [] a) {  StringBuilder b = new StringBuilder(9*a.length);  for (int i = 0; i<a.length; ++i) {  if (i != 0) b = b.append(' ');  b = b.append(a[i]);  }  return b; } public static long modPow (long a, long n, long MOD) { long S = 1; for (;n > 0; n>>=1, a=(a*a)%MOD) if ((n & 1) != 0) S = (a*S) % MOD; return S;} }
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};  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); }  void debug(Object... os){  System.err.println(Arrays.deepToString(os)); }  public static void main(String[] args){  Locale.setDefault(Locale.US);  new P111C().run(); } }
4	public class substring { public static void main(String[] args) { Scanner input = new Scanner(System.in); String s = input.nextLine(); Boolean found = false; int i = s.length(); while(found==false) { i--; ArrayList<String> sub = new ArrayList<String>(); for(int j = 0; j <= s.length() - i; j++) { if(sub.contains(s.substring(j, j+i))) found = true; else sub.add(s.substring(j, j+i)); } } System.out.println(i); } }
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));  } }
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());   }  } }
4	public class Main {   void run() throws IOException {   String s = token();   HashSet <String> h;   int n = s.length();   int r = 0;   loop: for (int i = 1; i <= n; i++) {    h = new HashSet();    for (int j = 0; j < n - i + 1; j++) {     String t = s.substring(j, j + i);     if (h.contains(t)) {      r = i;      continue loop;     } else {      h.add(t);     }    }   }   System.out.println(r);  }  public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);          in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);   st = new StringTokenizer(" ");   new Main().run();   out.close();  }  static BufferedReader in;   static PrintWriter out;  static StringTokenizer st;  String token() throws IOException {   while (!st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int nint() throws IOException {   return Integer.parseInt(token());  }  long nlong() throws IOException {   return Long.parseLong(token());  }  double ndouble() throws IOException {   return Double.parseDouble(token());  } }
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;   }   long remaining() { return capacity - flow; }   void addFlow(long amount) {    flow += amount;    dual.flow -= amount;   }  }   public static abstract class MaxFlowSolver {   List<Node> nodes = new ArrayList<Node>();    public void link(Node n1, Node n2, long capacity) {    link(n1, n2, capacity, 1);   }    public void link(Node n1, Node n2, long capacity, long cost) {    Edge e12 = new Edge(n1, n2, capacity, true);    Edge e21 = new Edge(n2, n1, 0, false);    e12.dual = e21;    e21.dual = e12;    n1.edges.add(e12);    n2.edges.add(e21);    e12.cost = cost;    e21.cost = -cost;   }   void link(int n1, int n2, long capacity) {    link(nodes.get(n1), nodes.get(n2), capacity);   }   protected MaxFlowSolver(int n) {    for (int i = 0; i < n; i++)     addNode();   }   protected MaxFlowSolver() {    this(0);   }    public abstract long getMaxFlow(Node src, Node snk);   public Node addNode() {    Node n = new Node();    n.index = nodes.size();    nodes.add(n);    return n;   }  }  static abstract class MinCostMaxFlowSolver extends MaxFlowSolver {     abstract long [] getMinCostMaxFlow(Node src, Node snk);     MinCostMaxFlowSolver ()  { this(0); }   MinCostMaxFlowSolver (int n) { super(n); }  }   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 int compareTo(Item that) {     return Long.compare(this.dist, that.dist);    }   }  }   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());   }     String readNextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }     int[] readIntArray(int n) {    int[] a = new int[n];    for (int idx = 0; idx < n; idx++) {     a[idx] = nextInt();    }    return a;   }  } }
3	public class Main { static final int MAXN= 1005; static final long MOD =1_000_000_007; static final boolean DEBUG= false; static int n, m; static long stlr[][]= new long[MAXN][MAXN],bell[]= new long[MAXN],occ[]; static PrintStream cerr=System.err; public static void main(String[] args) {   Readin();  stlr[0][0]= bell[0] =1;  for (int i=1; i<=m; i++)  for (int j=1;j<=i;j++) {   stlr[i][j]= (stlr[i-1][j-1]+stlr[i-1][j]*(long)j)%MOD;   bell[i]= (bell[i]+stlr[i][j])%MOD;  }  if (DEBUG)  for (int i=1; i<=m; i++) cerr.println("Bell["+i+"] ="+bell[i]);  Arrays.sort(occ);  if (DEBUG) {  cerr.println("After Sorting");  for (int i=0;i<m; i++) cerr.println(occ[i]+" ");}  long ans=1;  for (int i=0,j=0; i<m; i=j) {  for (j=i+1; j<m && occ[i]==occ[j];j++);  ans= (ans*bell[j-i])%MOD;  }  System.out.println(ans); } static void Readin() {  Scanner cin;  if ( !DEBUG)cin= new Scanner(System.in);  else {  try {   cin = new Scanner(new File("input.txt"));  } catch (FileNotFoundException e) {     if ( DEBUG)cerr.println("Not Fount input.txt");   return ;  }  }  m = cin.nextInt(); n=cin.nextInt();  occ= new long[m];  for (int i=0; i<n; i++) {  String s= cin.next();  for (int j=0;j <m; j++)   occ[j]|=((long)(s.charAt(j)-'0'))<<i;  }  cin.close(); } }
5	public class nA {  Scanner in;  PrintWriter out;  void solve() {   int n = in.nextInt();   int a[] = new int[n];   int sum = 0;   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();    sum+=a[i];   }   Arrays.sort(a);   int nowsum = 0;   int kol = 0;   for(int i = n - 1; i >= 0; i--){    if(nowsum <= sum / 2){     nowsum+=a[i];     kol++;    }else{     break;    }   }   out.println(kol);  }  void run() {   in = new Scanner(System.in);   out = new PrintWriter(System.out);   try {    solve();   } finally {    out.close();   }  }  public static void main(String[] args) {   new nA().run();  } }
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 int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(next());  }  public long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  } } }
4	public class P19 {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   Map<Integer, Integer> mapa = new HashMap<Integer, Integer>();   String str = in.next();   int len = str.length();   int maxCurrent = 0;   for (int i = 0; i < len; ++i) {    for (int j = 1; j <= len; ++j) {     if (i + j > len) continue;         int hashCode = str.substring(i, i + j).hashCode();     Integer current = mapa.get(hashCode);     if (current == null)      current = 0;     current++;     mapa.put(hashCode, current);     if (current > 1)      maxCurrent = Math.max(maxCurrent, j);    }   }   out.println(maxCurrent);   out.flush();   out.close();  } }
4	public class Solution {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   String s = in.nextLine();   int ans = 0;   outer: for (int i = s.length() - 1; i >= 1; i--)    for (int j = 0; j < s.length() - i; j++) {     String sub = s.substring(j, j + i);     String str = s.substring(j + 1);     if (str.contains(sub)) {      ans = i;      break outer;     }    }   out.print(ans);   out.close();  } }
1	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);  BPhoenixAndPuzzle solver = new BPhoenixAndPuzzle();  int testCount = Integer.parseInt(in.next());  for (int i = 1; i <= testCount; i++)  solver.solve(i, in, out);  out.close(); }  static class BPhoenixAndPuzzle {  public static MyScanner sc;  public static PrintWriter out;  public void solve(int testNumber, MyScanner sc, PrintWriter out) {  BPhoenixAndPuzzle.sc = sc;  BPhoenixAndPuzzle.out = out;  long n = sc.nextLong();  boolean can = true;  if (n % 2 != 0) can = false;  n /= 2;  while (n > 1 && n % 2 == 0) n /= 2;  long sq = Math.round(Math.pow(n, 0.5));  if (sq * sq != n) can = false;   out.println(can ? "YES" : "NO");  }  }  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 long nextLong() {  return Long.parseLong(next());  }  } }
0	public class Main{ public static void main(String[] args) throws IOException{ BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in)); String a=buffer.readLine(); int b=Integer.parseInt(a); if(b%4==0 || b%7==0 || b%44==0 || b%47==0 || b%74==0 || b%77==0 || b%444==0 || b%447==0 || b%474==0 || b%477==0 || b%744==0 || b%747==0 || b%774==0 || b%777==0) System.out.println("YES"); else System.out.println("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 long nextLong() {  return Long.parseLong(next());  }  public double nextDouble() {  return Double.parseDouble(next());  }  public String next() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  public String nextLine() {  int c = read();  while (isEndline(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isEndline(c));  return res.toString();  } } }
5	public class A {  final String filename = new String("A").toLowerCase();  void solve() throws Exception {  int n = nextInt();  int[] a = new int[n];  int m = -1;  for (int i = 0; i < n; i++) {  a[i] = nextInt();  if (m == -1 || a[i] > a[m]) {   m = i;  }  }  if (a[m] == 1)  a[m] = 2;  else  a[m] = 1;  Arrays.sort(a);  for (int i = 0; i < n; i++) {  out.print(a[i] + " ");  }  }  void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);       solve();   out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  BufferedReader in; StringTokenizer st; PrintWriter out;  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()); }  long nextLong() throws Exception {  return Long.parseLong(nextToken()); }  double nextDouble() throws Exception {  return Double.parseDouble(nextToken()); }  public static void main(String[] args) {  new A().run(); } }
2	public class C {  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)));  long n = nextLong();  long s = nextLong();  long ans = 0;  if (s+200 <= n)  ans += n - (s+200) + 1;  for (long i = s; i < s+200; i++) {  if (i <= n && i-sumDigits(i) >= s) {   ans++;  }  }  System.out.println(ans);  pw.close(); } private static long sumDigits(long n) {  long sum = 0;  while (n > 0) {  sum += n % 10;  n /= 10;  }  return sum; } private static int nextInt() throws IOException {  return Integer.parseInt(next()); } private static long nextLong() throws IOException {  return Long.parseLong(next()); } private static double nextDouble() throws IOException {  return Double.parseDouble(next()); } private static String next() throws IOException {  while (st==null || !st.hasMoreTokens())  st = new StringTokenizer(br.readLine());  return st.nextToken(); } }
1	public class codeforces2 {  public static void main(String[] args) {   FastScanner sc = new FastScanner();   PrintWriter pw = new PrintWriter(System.out);     int tc = sc.ni();   for (int rep = 0; rep < tc; rep++) {    long n = sc.nl();    if (n % 2 == 1) {     pw.println("NO");    }    else {     n/= 2;     if (perfectSquare(n)) {      pw.println("YES");     }     else if (n % 2 == 0 && perfectSquare(n/2)) {      pw.println("YES");     }     else {      pw.println("NO");     }    }   }   pw.close();  }   public static boolean solve(int n,int m, int k) {   return false;  }  public static boolean perfectSquare(long n) {   long lo = 0;   long hi = n;   while (lo < hi) {    long k = (lo + hi) / 2;    if (k * k < n)     lo = k + 1;    else     hi = k;   }   return (lo * lo == n);  }  static Set<Integer> divisors(int n) {   Set<Integer> set = new HashSet();   for (int i=1; i<=Math.sqrt(n); i++)   {    if (n%i==0)    {         if (n/i == i)      set.add(i);       else {      set.add(i);      set.add(n / i);     }    }   }   return set;  }  static Map<Integer, Integer> primeFactorization(int x) {     Map<Integer, Integer> map = new HashMap();   if (x == 0) return map;   int count = 0;   while (x % 2 == 0) {    x /=2;    count++;   }     if (count > 0) map.put(2, count);   for (int divisor = 3; divisor * divisor <= x; divisor += 2) {    int cnt = 0;    while (x % divisor == 0) {     x /= divisor;     cnt++;    }    if (cnt > 0) map.put(divisor, cnt);   }   if (x > 1) {    map.put(x, 1);   }   return map;  }  static boolean isPrime(int n)  {         if (n <= 1)    return false;      else if (n == 2)    return true;      else if (n % 2 == 0)    return false;      for (int i = 3; i <= Math.sqrt(n); i += 2)   {    if (n % i == 0)     return false;   }   return true;  }  static int gcd(int a, int b)  {   if (a == 0)    return b;   return gcd(b % a, a);  }     static int lcm(int a, int b)  {   return (a / gcd(a, b)) * b;  }  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 printArr(PrintWriter pw, int[] arr) {   StringBuilder sb = new StringBuilder();   for (int x : arr) {    sb.append(x + "");   }   sb.setLength(sb.length() - 1);   pw.println(sb.toString());  }  public static void printArr2d(PrintWriter pw, int[][] arr) {   StringBuilder sb = new StringBuilder();   for (int[] row : arr) {    for (int x : row) {     sb.append(x + " ");    }    sb.setLength(sb.length() - 1);    sb.append("\n");   }   sb.setLength(sb.length() - 1);   pw.println(sb.toString());  } } 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());  }  int[] intArray(int N) {   int[] ret = new int[N];   for (int i = 0; i < N; i++)    ret[i] = ni();   return ret;  }  long nl() {   return Long.parseLong(next());  }  long[] longArray(int N) {   long[] ret = new long[N];   for (int i = 0; i < N; i++)    ret[i] = nl();   return ret;  }  double nd() {   return Double.parseDouble(next());  }  String nextLine() {   String str = "";   try {    str = br.readLine();   } catch (IOException e) {    e.printStackTrace();   }   return str;  } } class UnionFind {  int size;  private int[] id;  public UnionFind(int size) {   this.size = size;   id = new int[size];   for (int i = 0; i < id.length; i++) {    id[i] = i;   }  }  public int find(int a) {   if (id[a] != a) {    id[a] = find(id[a]);   }   return id[a];  }  public void union(int a, int b) {   int r1 = find(a);   int r2 = find(b);   if (r1 == r2) return;   size--;   id[r1] = r2;  }  @Override  public String toString() {   return Arrays.toString(id);  } }
2	public class main { InputStream is; PrintWriter out; static long mod=pow(10,9)+7; int dx[]= {0,0,1,-1},dy[]={+1,-1,0,0}; void solve() {  long x=nl();  long k=nl();  if(x==0)  {  out.println(0);  return;  }  long term=(pow(2,k,mod))%mod;  long last=((x%mod)*pow(2,k+1,mod))%mod;  long sumdom=((2*last)%mod+(((term-1+mod)%mod)*((-2+mod)%mod))%mod)%mod;  sumdom=(sumdom*term)%mod;  sumdom=(sumdom*pow(2,mod-2,mod))%mod;  sumdom=(sumdom*pow(term,mod-2,mod))%mod;  out.println(sumdom);    } int bsdown(ArrayList<Integer> al,int l) {  int low=0,high=al.size()-1,ans=-1;  while(low<=high) {  int mid=low+(high-low)/2;  if(al.get(mid)<=l) {   low=mid+1;   ans=mid;  }else   high=mid-1;   }  return ans; } ArrayList<Integer>al []; void take(int n,int m) {  al=new ArrayList[n];  for(int i=0;i<n;i++)  al[i]=new ArrayList<Integer>();  for(int i=0;i<m;i++)  {  int x=ni()-1;  int y=ni()-1;  al[x].add(y);  al[y].add(x);    } } int arr[][]; int small[]; void pre(int n) {  small=new int[n+1];  for(int i=2;i*i<=n;i++)  {  for(int j=i;j*i<=n;j++)  {   if(small[i*j]==0)   small[i*j]=i;  }  }  for(int i=0;i<=n;i++)  {  if(small[i]==0)   small[i]=i;  } } public static int count(long x) {  int num=0;  while(x!=0)  {  x=x&(x-1);  num++;  }  return num; } static long d, x, y; void extendedEuclid(long A, long B) {  if(B == 0) {   d = A;   x = 1;   y = 0;  }  else {   extendedEuclid(B, A%B);   long temp = x;   x = y;   y = temp - (A/B)*y;  } } long modInverse(long A,long M)  {  extendedEuclid(A,M);  return (x%M+M)%M;  } public static void mergeSort(int[] arr, int l ,int r){  if((r-l)>=1){  int mid = (l+r)/2;  mergeSort(arr,l,mid);  mergeSort(arr,mid+1,r);  merge(arr,l,r,mid);  } } public static void merge(int arr[], int l, int r, int mid){  int n1 = (mid-l+1), n2 = (r-mid);  int left[] = new int[n1];  int right[] = new int[n2];  for(int i =0 ;i<n1;i++) left[i] = arr[l+i];  for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];  int i =0, j =0, k = l;  while(i<n1 && j<n2){  if(left[i]>right[j]){   arr[k++] = right[j++];  }  else{   arr[k++] = left[i++];  }  }  while(i<n1) arr[k++] = left[i++];  while(j<n2) arr[k++] = right[j++]; } public static void mergeSort(long[] arr, int l ,int r){  if((r-l)>=1){  int mid = (l+r)/2;  mergeSort(arr,l,mid);  mergeSort(arr,mid+1,r);  merge(arr,l,r,mid);  } } public static void merge(long arr[], int l, int r, int mid){  int n1 = (mid-l+1), n2 = (r-mid);  long left[] = new long[n1];  long right[] = new long[n2];  for(int i =0 ;i<n1;i++) left[i] = arr[l+i];  for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];  int i =0, j =0, k = l;  while(i<n1 && j<n2){  if(left[i]>right[j]){   arr[k++] = right[j++];  }  else{   arr[k++] = left[i++];  }  }  while(i<n1) arr[k++] = left[i++];  while(j<n2) arr[k++] = right[j++]; }  static class Pair implements Comparable<Pair>{     long x;   long y,k;   int i,h;   String s;  Pair (long x,long y,int i){  this.x=x;  this.y=y;  this.i=i;  }     public int compareTo(Pair o) {  if(this.x!=o.x)   return Long.compare(this.x,o.x);  return Long.compare(this.y,o.y);  }  public boolean equals(Object o) {  if (o instanceof Pair) {   Pair p = (Pair)o;   return p.x == x && p.y == y;  }  return false;  }  public int hashCode() {  return new Long(x).hashCode()*31 + new Long(y).hashCode() ;  }         @Override   public String toString() {    return "("+x + " " + y +" "+k+" "+i+" )";   }    }     public static boolean isPal(String s){   for(int i=0, j=s.length()-1;i<=j;i++,j--){     if(s.charAt(i)!=s.charAt(j)) return false;   }   return true;  }  public static String rev(String s){  StringBuilder sb=new StringBuilder(s);  sb.reverse();  return sb.toString();  }    public static long gcd(long x,long y){  if(x%y==0)  return y;  else  return gcd(y,x%y);  }    public static int gcd(int x,int y){   if(y==0)    return x;   return gcd(y,x%y);  }    public static long gcdExtended(long a,long b,long[] x){      if(a==0){    x[0]=0;    x[1]=1;    return b;   }   long[] y=new long[2];   long gcd=gcdExtended(b%a, a, y);      x[0]=y[1]-(b/a)*y[0];   x[1]=y[0];      return gcd;  }    public static int abs(int a,int b){  return (int)Math.abs(a-b);  }    public static long abs(long a,long b){  return (long)Math.abs(a-b);  }    public static int max(int a,int b){  if(a>b)  return a;  else  return b;  }    public static int min(int a,int b){  if(a>b)  return b;  else   return a;  }    public static long max(long a,long b){  if(a>b)  return a;  else  return b;  }    public static long min(long a,long b){  if(a>b)  return b;  else   return a;  }    public static long pow(long n,long p,long m){  long result = 1;  if(p==0)   return 1;  if (p==1)   return n;  while(p!=0)  {   if(p%2==1)    result *= n;   if(result>=m)   result%=m;   p >>=1;   n*=n;   if(n>=m)   n%=m;  }  return result;  }    public static long pow(long n,long p){  long result = 1;  if(p==0)   return 1;  if (p==1)   return n;  while(p!=0)  {   if(p%2==1)    result *= n;    p >>=1;   n*=n;   }  return result;  }  public static void debug(Object... o) {  System.out.println(Arrays.deepToString(o));  }  void run() throws Exception {  is = System.in;  out = new PrintWriter(System.out);  solve();  out.flush();  }    public static void main(String[] args) throws Exception {  new Thread(null, new Runnable() {   public void run() {   try {    new main().run();   } catch (Exception e) {    e.printStackTrace();   }   }  }, "1", 1 << 26).start();  }  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 double nd() {  return Double.parseDouble(ns());  }   private char nc() {  return (char) skip();  }   private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(isSpaceChar(b))) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }   private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while (p < n && !(isSpaceChar(b))) {   buf[p++] = (char) b;   b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p);  }   private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)   map[i] = ns(m);  return map;  }   private int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = ni();  return a;  }   private long[] nl(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nl();  return a;  }   private int ni() {  int num = 0, b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))   ;  if (b == '-') {   minus = true;   b = readByte();  }    while (true) {   if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }   private long nl() {  long num = 0;  int b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))   ;  if (b == '-') {   minus = true;   b = readByte();  }    while (true) {   if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }  }
4	public class A {   Scanner sc = new Scanner(System.in);   void run(){     String s = sc.next();   String subS;   int max = 0;     for (int i=0;i<s.length();i++) {    for (int j=i+1;j<s.length()+1;j++) {              subS = s.substring(i, j);         for (int k=i+1;k<s.length();k++) {                if ( s.startsWith(subS,k) ){       if ( max < subS.length() )        max = subS.length();      }     }        }   }     System.out.println(max);   return;    }   public static void main(String[] args){     new A().run();    } }
5	public class Main implements Runnable { private BufferedReader in; private PrintWriter out; private StringTokenizer st; private Random rnd;  private void solve() throws IOException {  int n = nextInt();   int[] a = new int[n];  int max = 0;  for(int i = 0; i < n; i++) {  a[i] = nextInt();  if(a[i] > a[max]) max = i;  }   int value = 1;   if(a[max] == 1) value = 2;   a[max] = value;   Arrays.sort(a);   for(int i = 0; i < n; i++) {  out.print(a[i]);  out.print(' ');  } }   public static void main(String[] args) {  new Main().run(); }   public void run() {  try {  try {   in = new BufferedReader(new FileReader("INPUT.TXT"));   out = new PrintWriter(new FileWriter("OUTPUT.TXT"));  } catch(FileNotFoundException e) {   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()); }  private long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  private double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
4	public class Main {  public static Scanner scan = new Scanner(System.in);  public static boolean bg = true;  public static void main(String[] args) throws Exception {   String k1 = scan.next();   HashSet<String> met = new HashSet();   String ans = "";   for (int i=1;i<=k1.length()-1;i++){    for (int j=0;j+i<=k1.length();j++){     String cur = k1.substring(j, j+i);     if (!met.contains(cur)){      met.add(cur);     }     else {      if (cur.length()>ans.length())ans=cur;     }    }   }   System.out.println(ans.length());    } }
2	public class Main implements Runnable {  int n;  boolean inBound (int x, int y) {  return x >= 1 && y >= 1 && x <= n && y <= n; }  void solve() throws Exception {  n = sc.nextInt();  int y = sc.nextInt();  int x = sc.nextInt();  int c = sc.nextInt();   int yu = y;  int yd = y;  int xl = x;  int xr = x;    int current = 1;  int time = 0;  while (current < c) {  time++;  yu--;  yd++;  xl--;  xr++;    {   int cur = time - 1;   if (yu < 1) {   cur -= (-yu);   }   if (xl < 1) {   cur -= (-xl);   }   if (cur > 0) {   current += cur;   }  }    {   int cur = time - 1;   if (yu < 1) {   cur -= (-yu);   }   if (xr > n) {   cur -= (xr - n - 1);   }   if (cur > 0) {   current += cur;   }  }    {   int cur = time - 1;   if (yd > n) {   cur -= (yd - n - 1);   }   if (xl < 1) {   cur -= (-xl);   }   if (cur > 0) {   current += cur;   }  }    {   int cur = time - 1;   if (yd > n) {   cur -= (yd - n - 1);   }   if (xr > n) {   cur -= (xr - n - 1);   }   if (cur > 0) {   current += cur;   }  }    if (inBound(x, yd)) current++;  if (inBound(x, yu)) current++;  if (inBound(xl, y)) current++;  if (inBound(xr, y)) current++;  }   out.println(time); }  BufferedReader in; PrintWriter out; FastScanner sc;  static Throwable uncaught;  @Override public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  sc = new FastScanner(in);  solve();  } catch (Throwable t) {  Main.uncaught = t;  } finally {  out.close();  } }  public static void main(String[] args) throws Throwable {  Thread t = new Thread(null, new Main(), "", (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()); }  public long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  public double nextDouble() throws IOException {  return Double.parseDouble(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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   int mod = (int) 1e9 + 7;   public void solve(int testNumber, InputReader in, PrintWriter out) {    long x = in.readLong();    long k = in.readLong();    if (x == 0) {     out.println(0);     return;    }    long ans = (BigInteger.valueOf(MathUtil.pow(2, k + 1, mod)).multiply(BigInteger.valueOf(x))).mod(BigInteger.valueOf(mod)).longValue();    long sub = (mod + MathUtil.pow(2, k, mod) - 1) % mod;    out.println((mod + ans - sub) % 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 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 MathUtil {   public static long pow(long a, long b, long mod) {    long ans = 1;    while (b > 0) {     if (b % 2 == 1) ans = (ans * a) % mod;     a = (a * a) % mod;     b /= 2;    }    return ans;   }  } }
6	public class r584p5 {  private static BufferedReader r = new BufferedReader(new InputStreamReader(System.in));  private static PrintWriter pw = new PrintWriter(System.out);  private static int n, m, arr[][];  private static ArrayList<HashSet<Integer>> chls;  private static void gench(){   chls.add(new HashSet<>());   chls.get(0).add(0);   for(int i=1; i<(1<<n); i++){    int des = i^Integer.highestOneBit(i);    HashSet<Integer> st = new HashSet<>();    for(int z : chls.get(des)){     st.add(z);     st.add(z|Integer.highestOneBit(i));    }    chls.add(st);   }  }  private static void cal(){   int val[][] = new int[(1<<n)][m];   for(int j=0; j<m; j++){    val[0][j] = 0;    for(int mask=1; mask<(1<<n); mask++){     int max = 0;     for(int begin=0; begin<n; begin++){      int sum = 0;      for(int ptr=begin, pos=0; pos<n; ptr=(ptr+1)%n, pos++){       if((mask&(1<<pos)) > 0)        sum += arr[ptr][j];      }      max = Math.max(max, sum);     }     val[mask][j] = max;    }   }   int dp[][] = new int[(1<<n)][m];   for(int mask=0; mask<(1<<n); mask++)    dp[mask][0] = val[mask][0];   for(int j=1; j<m; j++){    dp[0][j] = 0;    for(int mask=1; mask<(1<<n); mask++){     dp[mask][j] = 0;     for(int ch1 : chls.get(mask)){      int ch2 = mask^ch1;      dp[mask][j] = Math.max(dp[mask][j], val[ch1][j]+dp[ch2][j-1]);     }    }   }   pw.println(dp[(1<<n)-1][m-1]);  }  private static void run()throws IOException{   StringTokenizer tk = new StringTokenizer(r.readLine());   n = Integer.parseInt(tk.nextToken());   m = Integer.parseInt(tk.nextToken());   arr = new int[n][m];   chls = new ArrayList<>();   for(int i=0; i<n; i++){    tk = new StringTokenizer(r.readLine());    for(int j=0; j<m; j++)     arr[i][j] = Integer.parseInt(tk.nextToken());   }   gench();   cal();  }  public static void main(String args[])throws IOException{   int t = Integer.parseInt(r.readLine());   while(t-->0)    run();   pw.flush();   pw.close();  } }
3	public class default_dst {  public static void main(String[] args) {   in = new FastReader();   int n=ni();   int[] arr=takeIntegerArrayInput(n);   HashMap<Long,ArrayList<pair>> hm=new HashMap<>();   int max_size=0;   long S=-1;   for (int i=0;i<arr.length;i++){    long sum=0;    for (int j=i;j>=0;j--){     sum+=arr[j];     if (!hm.containsKey(sum)){      hm.put(sum,new ArrayList<>());     }     if (hm.get(sum).size()==0||hm.get(sum).get(hm.get(sum).size()-1).y<j){      hm.get(sum).add(new pair(j,i));     }     if (hm.get(sum).size()>max_size){      max_size=hm.get(sum).size();      S=sum;     }    }   }   System.out.println(max_size);   StringBuilder sb=new StringBuilder();   for (int i=0;i<hm.get(S).size();i++){    sb.append(hm.get(S).get(i)).append("\n");   }   System.out.print(sb.toString());   }  static class pair{   int x;   int y;   pair(int x,int y){    this.x=x;    this.y=y;   }   @Override   public String toString(){    return (this.x+1)+" "+(this.y+1);   }  }  public static long binarySearch(long low, long high) {   while (high - low > 1) {    long mid = (high - low)/2 + low;       if (works(mid)) {     high = mid;    } else {     low = mid;    }   }   return (works(low) ? low : high);  }  static long fast_exp_with_mod(long base, long exp) {   long MOD=1000000000+7;   long res=1;   while(exp>0) {    if(exp%2==1) res=(res*base)%MOD;    base=(base*base)%MOD;    exp/=2;   }   return res%MOD;  }  public static long gcd(long a, long b)  {   if (a == 0)    return b;   return gcd(b%a, a);  }  static class my_no{   long num;   long denom;   @Override   public String toString() {    if (denom<0){     this.num=-this.num;     this.denom=-this.denom;    }    if (num==0)return "0";    return (num+"/"+denom);   }   my_no(int no){    this.num=no;    this.denom=1;   }   my_no(long num,long denom){    this.num=num;    this.denom=denom;   }   my_no multiply(my_no obj){    long num1=obj.num;    long denom1=obj.denom;    long n=num1*num;    long d=denom1*denom;    long gcd=gcd(n,d);    n/=gcd;    d/=gcd;    return new my_no(n,d);   }       my_no multiply(int no){    long n=num*no;    long d=denom;    long gcd=gcd(n,d);    n/=gcd;    d/=gcd;    return new my_no(n,d);   }  }  static void memset(int[][] arr,int val){   for (int i=0;i<arr.length;i++){    for (int j=0;j<arr[i].length;j++){     arr[i][j]=val;    }   }  }  static void memset(int[] arr,int val){   for (int i=0;i<arr.length;i++){    arr[i]=val;   }  }   static void memset(long[][] arr,long val){   for (int i=0;i<arr.length;i++){    for (int j=0;j<arr[i].length;j++){     arr[i][j]=val;    }   }  }  static void memset(long[] arr,long val){   for (int i=0;i<arr.length;i++){    arr[i]=val;   }  }  static private boolean works(long test){   return true;  }   static void reverse(char[] arr ,int i,int j){   if (i==j)    return;   while (i<j){    char temp=arr[i];    arr[i]=arr[j];    arr[j]=temp;    ++i;    --j;   }  }  static int[] takeIntegerArrayInput(int no){   int[] arr=new int[no];   for (int i=0;i<no;++i){    arr[i]=ni();   }   return arr;  }  static long fast_Multiply(long no , long pow){   long result=1;   while (pow>0){    if ((pow&1)==1){     result=result*no;    }    no=no*no;    pow>>=1;   }   return result;  }  static long[] takeLongArrayInput(int no){   long[] arr=new long[no];   for (int i=0;i<no;++i){    arr[i]=ni();   }   return arr;  }  static final long MOD = (long)1e9+7;  static FastReader in;   static void p(Object o){   System.out.print(o);  }  static void pn(Object o){   System.out.println(o);  }  static String n(){   return in.next();  }  static String nln(){   return in.nextLine();  }  static int ni(){   return Integer.parseInt(in.next());  }  static int[] ia(int N){   int[] a = new int[N];   for(int i = 0; i<N; i++)a[i] = ni();   return a;  }  static long[] la(int N){   long[] a = new long[N];   for(int i = 0; i<N; i++)a[i] = nl();   return a;  }  static long nl(){   return Long.parseLong(in.next());  }  static double nd(){   return Double.parseDouble(in.next());  }  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();   }   String nextLine(){    String str = "";    try{     str = br.readLine();    }catch (IOException e){     e.printStackTrace();    }    return str;   }  }  static void println(String[] arr){   for (int i=0;i<arr.length;++i){    System.out.println(arr[i]);   }  } }
4	public class Main {  public static void main(String[] args)  {   InputStream inputStream;   try   {    inputStream = new FileInputStream("input.txt");   } catch (IOException e)   {    throw new RuntimeException(e);   }   OutputStream outputStream;   try   {    outputStream = new FileOutputStream("output.txt");   } catch (IOException e)   {    throw new RuntimeException(e);   }   FastScanner in = new FastScanner(inputStream);   FastPrinter out = new FastPrinter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC  {   public void solve(int testNumber, FastScanner in, FastPrinter out)   {    int n = in.nextInt();    int m = in.nextInt();    int p = in.nextInt();    int[] x = new int[p];    int[] y = new int[p];    for (int i = 0; i < p; i++)    {     x[i] = in.nextInt();     y[i] = in.nextInt();    }    int X = x[0];    int Y = y[0];    int D = -1;    for (int dx = 1; dx <= n; dx++)    {     int x1 = dx;     int y1 = 1;     int xx = 0;     int yy = 0;     int minD = Integer.MAX_VALUE;     for (int j = 0; j < p; j++)     {      int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);      if (d < minD)      {       minD = d;       xx = x1;       yy = y1;      }     }     if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)     {      D = minD;      X = xx;      Y = yy;     }    }    for (int dx = 1; dx <= n; dx++)    {     int x1 = dx;     int y1 = m;     int xx = 0;     int yy = 0;     int minD = Integer.MAX_VALUE;     for (int j = 0; j < p; j++)     {      int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);      if (d < minD)      {       minD = d;       xx = x1;       yy = y1;      }     }     if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)     {      D = minD;      X = xx;      Y = yy;     }    }    for (int dy = 1; dy <= m; dy++)    {     int x1 = 1;     int y1 = dy;     int xx = 0;     int yy = 0;     int minD = Integer.MAX_VALUE;     for (int j = 0; j < p; j++)     {      int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);      if (d < minD)      {       minD = d;       xx = x1;       yy = y1;      }     }     if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)     {      D = minD;      X = xx;      Y = yy;     }    }    for (int dy = 1; dy <= m; dy++)    {     int x1 = n;     int y1 = dy;     int xx = 0;     int yy = 0;     int minD = Integer.MAX_VALUE;     for (int j = 0; j < p; j++)     {      int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);      if (d < minD)      {       minD = d;       xx = x1;       yy = y1;      }     }     if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)     {      D = minD;      X = xx;      Y = yy;     }    }    for (int i = 1; i <= Math.min(m, n); i++)    {     int x1 = i;     int y1 = i;     int xx = 0;     int yy = 0;     int minD = Integer.MAX_VALUE;     for (int j = 0; j < p; j++)     {      int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);      if (d < minD)      {       minD = d;       xx = x1;       yy = y1;      }     }     if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)     {      D = minD;      X = xx;      Y = yy;     }    }    for (int i = 1, ii = m; i <= n && ii >= 1; i++, ii--)    {     int x1 = i;     int y1 = ii;     int xx = 0;     int yy = 0;     int minD = Integer.MAX_VALUE;     for (int j = 0; j < p; j++)     {      int d = Math.abs(x1 - x[j]) + Math.abs(y1 - y[j]);      if (d < minD)      {       minD = d;       xx = x1;       yy = y1;      }     }     if (D < minD && minD != 0 && minD != Integer.MAX_VALUE)     {      D = minD;      X = xx;      Y = yy;     }    }    out.println(X + " " + Y);   }  }  static class FastScanner  {   public BufferedReader br;   public StringTokenizer st;   public FastScanner(InputStream is)   {    br = new BufferedReader(new InputStreamReader(is));   }   public FastScanner(File f)   {    try    {     br = new BufferedReader(new FileReader(f));    } catch (FileNotFoundException e)    {     e.printStackTrace();    }   }   public 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();   }   public int nextInt()   {    return Integer.parseInt(next());   }  }  static 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) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String[] in = br.readLine().split(" ");  long n = Long.parseLong(in[0]), s = Long.parseLong(in[1]);  Solver solver = new Solver(n, s);  System.out.println(solver.solve());  } } class Solver {  private long n, s;  Solver(long n, long s) {  this.n = n;  this.s = s; }  public long solve() {  long low = 1, high = n;  for (int i = 0; i < 72; ++i) {  long x = low + (high - low) / 2;  if (check(x))   high = x - 1;  else   low = x + 1;  }  return n - high; }  private boolean check(long x) {  long tmp = x;  int sum = 0;  while (tmp > 0) {  sum += tmp % 10;  tmp /= 10;  }  return x - sum >= s; } }
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());   }   char nc() throws IOException {    return (char) (br.read());   }   String nextLine() throws IOException {    return br.readLine();   }     int[] niArray(int n) throws IOException{    int a[] = new int[n];    for (int i = 0; i < n; i++) {     a[i] = ni();    }    return a;   }   long[] nlArray(int n) throws IOException {    long a[] = new long[n];    for (int i = 0; i < n; i++)     a[i] = nl();    return a;   }     double[] ndArray(int n)throws IOException {    double a[] = new double[n];    for (int i = 0; i < n; i++)     a[i] = nd();    return a;   }  }            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 long exponent(long a,long n) { long ans=1;  while(n!=0)  { if(n%2==0)    ans=(ans*a)%mod;   a=(a*a)%mod;   n=n>>1;  }  return ans; } 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);  } }
0	public class CodeForces {  public void solve() throws IOException {  int n = nextInt();  int arr[]=new int[1000];  arr[0]=0;  arr[1]=1;  arr[2]=1;  if(n==0){  out.print("0 0 0");  }  else if(n==1){  out.print("0 0 1");  } else {  int c=2;  while(arr[c]!=n){   c++;   arr[c]=arr[c-1]+arr[c-2];  }  out.print(arr[c-2]+" "+arr[c-2]+" "+arr[c-3]);  }    }  public static void main(String[] args) {  new CodeForces().run(); }    int NOD(int a, int b) {  while (a != 0 && b != 0) {  if (a >= b)   a = a % b;  else   b = b % a;  }  return a + b; }  BufferedReader reader; StringTokenizer tokenizer; PrintWriter out; boolean isOuterFile = false;  public void run() {  try {  if (isOuterFile) {   reader = new BufferedReader(new FileReader("input.txt"));   out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));   out = new PrintWriter(System.out);  } else {   reader = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);  }   tokenizer = null;     solve();    reader.close();  out.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(); } }
5	public class C {     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());   }     long readLong() throws IOException{     return Long.parseLong(readString());   }     double readDouble() throws IOException{     return Double.parseDouble(readString());   }     public static void main(String[] args){     new C().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();   int[] a = new int[n];   for(int i = 0; i < n; i++){    a[i] = readInt();   }   boolean c = true;   for(int i = 0; i < n; i++){    if(a[i] != 1){    c = false;    break;    }   }   if(c){    for(int i = 0; i < n-1; i++){    out.print(a[i] + " ");    }    out.println(2);    return;   }   Utils.mergeSort(a);   out.print(1 + " ");   for(int i = 1; i < n; i++){    out.print(a[i-1] + " ");   }   }     int[] zFunction(char[] s){   int[] z = new int[s.length];   z[0] = 0;   for (int i=1, l=0, r=0; i<s.length; ++i) {    if (i <= r)    z[i] = min (r-i+1, z[i-l]);    while (i+z[i] < s.length && s[z[i]] == s[i+z[i]])    ++z[i];    if (i+z[i]-1 > r){    l = i;     r = i+z[i]-1;    }   }    return z;   }     int[] prefixFunction(char[] s){   int[] pr = new int[s.length];   for (int i = 1; i< s.length; ++i) {    int j = pr[i-1];    while (j > 0 && s[i] != s[j])    j = pr[j-1];    if (s[i] == s[j]) ++j;    pr[i] = j;   }   return pr;   }     int ModExp(int a, int n, int mod){   int res = 1;   while (n!=0)    if ((n & 1) != 0) {    res = (res*a)%mod;    --n;    }    else {    a = (a*a)%mod;    n >>= 1;    }   return res;   }        static class Utils {      private Utils() {}      public static void mergeSort(int[] a) {       mergeSort(a, 0, a.length - 1);     }      private static void mergeSort(int[] a, int leftIndex, int rightIndex) {       final int MAGIC_VALUE = 50;       if (leftIndex < rightIndex) {         if (rightIndex - leftIndex <= MAGIC_VALUE) {           insertionSort(a, leftIndex, rightIndex);         } else {           int middleIndex = (leftIndex + rightIndex) / 2;           mergeSort(a, leftIndex, middleIndex);           mergeSort(a, middleIndex + 1, rightIndex);           merge(a, leftIndex, middleIndex, rightIndex);         }       }     }      private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {       int length1 = middleIndex - leftIndex + 1;       int length2 = rightIndex - middleIndex;       int[] leftArray = new int[length1];       int[] rightArray = new int[length2];       System.arraycopy(a, leftIndex, leftArray, 0, length1);       System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);       for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {         if (i == length1) {           a[k] = rightArray[j++];         } else if (j == length2) {           a[k] = leftArray[i++];         } else {           a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];         }       }     }      private static void insertionSort(int[] a, int leftIndex, int rightIndex) {       for (int i = leftIndex + 1; i <= rightIndex; i++) {         int current = a[i];         int j = i - 1;         while (j >= leftIndex && a[j] > current) {           a[j + 1] = a[j];           j--;         }         a[j + 1] = current;       }     }   }          boolean isPrime(int a){   for(int i = 2; i <= sqrt(a); i++)    if(a % i == 0) return false;   return true;   }     static double distance(long x1, long y1, long x2, long y2){   return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));   }     static long gcd(long a, long b){   if(min(a,b) == 0) return max(a,b);   return gcd(max(a, b) % min(a,b), min(a,b));   }     static long lcm(long a, long b){   return a * b /gcd(a, b);   } }
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); } }
0	public class subtractions {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);   int n=sc.nextInt();     while(n-->0){    int a=sc.nextInt();    int b=sc.nextInt();       int c=0;    while(a!=0 && b!=0){     if(a>b){      int t=a;      a=b;      b=t;     }     c+=b/a;     b=b%a;    }    System.out.println(c);   }  } }
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[center][center]) ? 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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   String nextLine() {    String str = "";    try { str = br.readLine(); }    catch (IOException e) { e.printStackTrace(); }    return str;   }  } }
3	public class Main {  private FastScanner in;  private PrintWriter out;  private void solve() throws IOException {   solveC();  }  private void solveA() throws IOException {   char[] n = in.next().toCharArray(), s = in.next().toCharArray();   out.print(n[0]);   for (int i = 1; i < n.length && n[i] < s[0]; i++)    out.print(n[i]);   out.print(s[0]);  }  private void solveB() throws IOException {   int n = in.nextInt();   long dp[] = new long[n + 1];   for (int i = 1; i <= n; i++) {    dp[i] = i + (i < 3 ? 0 : dp[i - 2]);   }   out.print(dp[n]);  }  private void solveC() throws IOException {   int n = in.nextInt(), prev = -1;   long sum, mod = (long) 1e9 + 7, p;   long[] deep = new long[n + 10];   deep[0] = 1;   char c;   for (int cur = 0; cur < n; cur++) {    c = in.nextLine().charAt(0);    if (prev + 1 != cur) {     sum = 0;     if (c == 'f') {      for (int i = deep.length - 1; i > 0; i--) {       sum += deep[i - 1];       sum %= mod;       deep[i] = sum;      }      deep[0] = 0;     } else {      for (int i = deep.length - 1; i >= 0; i--) {       sum += deep[i];       sum %= mod;       deep[i] = sum;      }     }    }    if (c != 's') {     if (cur == prev + 1) {      for (int i = deep.length - 1; i > 0; i--) {       deep[i] = deep[i - 1];      }      deep[0] = 0;     }     prev = cur;    }       }   long ans = 0;   for (int i = 0; i < deep.length; i++) {    ans += deep[i];    ans %= mod;   }   out.println(ans);  }  private void solveD() throws IOException {  }  private void solveE() throws IOException {  }  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();   }   boolean hasNext() throws IOException {    return br.ready() || (st != null && st.hasMoreTokens());   }   int nextInt() throws IOException {    return Integer.parseInt(next());   }   long nextLong() throws IOException {    return Long.parseLong(next());   }   double nextDouble() throws IOException {    return Double.parseDouble(next());   }   String nextLine() throws IOException {    return br.readLine();   }   boolean hasNextLine() throws IOException {    return br.ready();   }  }  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();  } }
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 lcm(long a, long b) {  return a * (b / gcd(a, b));  }  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;  }  }  static class Point implements Comparable<Point> {  int a;  int b;  Point(int a, int b) {  this.a = a;  this.b = b;  }  @Override  public int compareTo(Point o) {  return this.a - o.a;  }  }  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));  }  ArrayList<Integer>[] ng(int n, int e) {  ArrayList<Integer>[] adj = new ArrayList[n];  for (int i = 0; i < n; i++) {   adj[i] = new ArrayList<Integer>();  }  for (int i = 0; i < e; i++) {   int a = ni() - 1;   int b = ni() - 1;   adj[a].add(b);   adj[b].add(a);  }  return adj;  }  Integer[] nIa(int n) {  Integer[] arr = new Integer[n];  for (int i = 0; i < n; i++) {   arr[i] = ni();  }  return arr;  }  int[] nia(int n) {  int[] arr = new int[n];  for (int i = 0; i < n; i++) {   arr[i] = ni();  }  return arr;  }  Long[] nLa(int n) {  Long[] arr = new Long[n];  for (int i = 0; i < n; i++) {   arr[i] = nl();  }  return arr;  }  long[] nla(int n) {  long[] arr = new long[n];  for (int i = 0; i < n; i++) {   arr[i] = nl();  }  return arr;  }  String[] nsa(int n) {  String[] arr = new String[n];  for (int i = 0; i < n; i++) {   arr[i] = nt();  }  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());  }  double nd() {  return Double.parseDouble(nt());  }  } }
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); } }
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); } }
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);   Task solver = new Task();   int testCount = 1;   for (int i = 1; i <= testCount; i++)    solver.solve(i, in, out);   out.close();  } } class Task {  int n;  int[] a;  int[] b;  public void solve(int testNumber, InputReader in, PrintWriter out) {   n = in.readInt();   a = new int[n];   b = new int[n];   for (int i = 0; i < n; ++i)    a[i] = b[i] = in.readInt();   sort(0, n - 1);   int different = 0;   for (int i = 0; i < n; ++i)    if (a[i] != b[i])     ++different;   out.println(different <= 2 ? "YES" : "NO");  }  public void sort(int lo, int hi) {   if (lo < hi) {    int mid = (lo + hi) / 2;    sort(lo, mid);    sort(mid + 1, hi);    merge(lo, mid, hi);   }  }  public void merge(int lo, int mid, int hi) {   int n1 = mid - lo + 1;   int n2 = hi - (mid + 1) + 1;   int[] x = new int[n1 + 1];   int[] y = new int[n2 + 1];   for (int i = 0; i < n1; ++i)    x[i] = b[lo + i];   for (int j = 0; j < n2; ++j)    y[j] = b[mid + 1 + j];   x[n1] = y[n2] = Integer.MAX_VALUE;   for (int k = lo, i = 0, j = 0; k <= hi; ++k)    b[k] = x[i] < y[j] ? x[i++] : y[j++];  } } 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 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();   StringBuffer res = new StringBuffer();   do {    res.appendCodePoint(c);    c = read();   } while (!isSpaceChar(c));   return res.toString();  }  public Long readLong() {   return Long.parseLong(readString());  }  public Double readDouble() {   return Double.parseDouble(readString());  }  public static boolean isSpaceChar(int c) {   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  } }
2	public class C { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  long n = Long.parseLong(in.next());  long s = Long.parseLong(in.next());  if(!check(n, s)){  System.out.println(0);  }  else  {  long min = 1;  long max = n;  while(min != max)  {   long mid = (min + max) / 2;   if(check(mid, s))   {   max = mid;   }   else   {   min = mid + 1;   }  }    System.out.println((n - min + 1));  } } public static boolean check(long x, long s) {  if(x - sumd(x) < s)  {  return false;  }  else  {  return true;  } } public static long sumd(long x) {  long sum = 0;  while(x != 0)  {  sum += x % 10;  x /= 10;  }  return sum; } }
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 void run() {   try {    solve();   } catch (Throwable e) {    System.err.println(e.getMessage());    e.printStackTrace();    System.exit(666);   } finally {    output.close();   }  }  public static void main(String... args) {   new E(null, null).start();  }  private int nextInt() throws IOException {   return Integer.parseInt(next());  }  private double nextDouble() throws IOException {   return Double.parseDouble(next());  }  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; }
2	public class My { public static void main(String[] args) {  new My().go(); }   void go() {  Scanner in = new Scanner(System.in);  long n = in.nextLong();  int k = in.nextInt();  int mn = 0, mx = k + 1;  while (mn < mx) {  int mid = (mn + mx) / 2;  if (works(n, k, mid)) {   mx = mid;  } else {   mn = mid + 1;  }  }  if (mn > k) {  pl("-1");  } else {  pl((mn - 1) + "");  } }  boolean works(long n, int k, int use) {  return 1 + T(k - 1) - T(k - use) >= n; }  long T(int n) {  return n * (long)(n + 1) / 2; }  void p(String s) {  System.out.print(s); }  void pl(String s) {  System.out.println(s); } }
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);   F2BlokiRavnoiSummiUslozhnennayaRedakciya solver = new F2BlokiRavnoiSummiUslozhnennayaRedakciya();   solver.solve(1, in, out);   out.close();  }  static class F2BlokiRavnoiSummiUslozhnennayaRedakciya {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int[] sum = new int[n];    int prev = 0;    for (int i = 0; i < n; i++) {     sum[i] = in.nextInt() + prev;     prev = sum[i];    }    HashMap<Integer, List<Pair<Integer, Integer>>> blocks = new HashMap<>();    int max = 0;    int maxS = 0;    for (int i = 0; i < n; i++) {     for (int h = i; h >= 0; h--) {      int s = sum[i];      if (h > 0) {       s -= sum[h - 1];      }      blocks.putIfAbsent(s, new ArrayList<>());      List<Pair<Integer, Integer>> l = blocks.get(s);      if (l.isEmpty() || l.get(l.size() - 1).sc < h) {       l.add(new Pair<>(h, i));      }      if (l.size() > max) {       max = l.size();       maxS = s;      }     }    }    out.println(max);    for (int i = 0; i < max; i++) {     out.println(String.format("%d %d", blocks.get(maxS).get(i).fs + 1, blocks.get(maxS).get(i).sc + 1));    }   }  }  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 Pair<T, K> {   T fs;   K sc;   public Pair(T fs, K sc) {    this.fs = fs;    this.sc = sc;   }  } }
4	public class A {  public static void main(String args[])  {   Scanner scan = new Scanner(System.in);     String str = scan.next();     for(int i=str.length();i >= 1;i--)   {    for(int j=0;j + i <= str.length();j++)    {     String sub = str.substring(j, j+i);         int index = str.indexOf(sub, j+1);              if(index > -1)     {      System.out.println(i);      return;     }        }   }     System.out.println(0);  } }
1	public class Main {  public static void process()throws IOException  {   long n=nl();   if(n%2==0)   {    long a1=(long)Math.sqrt(n);    long a2=(long)Math.sqrt(n/2);    if(a1*a1==n || a2*a2*2==n)     {pn("YES");return;}   }   pn("NO");  }   static AnotherReader sc;  static PrintWriter out;  public static void main(String[]args)throws IOException  {   boolean oj = System.getProperty("ONLINE_JUDGE") != null;   if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}   else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}   int t=1;   t=ni();   while(t-- > 0) {process();}   out.flush();out.close();  }  static void pn(Object o){out.println(o);}  static void p(Object o){out.print(o);}  static void pni(Object o){out.println(o);out.flush();}  static int ni()throws IOException{return sc.nextInt();}  static long nl()throws IOException{return sc.nextLong();}  static double nd()throws IOException{return sc.nextDouble();}  static String nln()throws IOException{return sc.nextLine();}  static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}  static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}  static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}  static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}  static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}   static class AnotherReader{BufferedReader br; StringTokenizer st;  AnotherReader()throws FileNotFoundException{  br=new BufferedReader(new InputStreamReader(System.in));}  AnotherReader(int a)throws FileNotFoundException{  br = new BufferedReader(new FileReader("input.txt"));}  String next()throws IOException{  while (st == null || !st.hasMoreElements()) {try{  st = new StringTokenizer(br.readLine());}  catch (IOException e){ e.printStackTrace(); }}  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()); }  String nextLine() throws IOException{ String str = ""; try{  str = br.readLine();} catch (IOException e){  e.printStackTrace();} return str;}}   }
1	public class TimePass {  InputStream is;  PrintWriter out;  String INPUT = "";     boolean codechef=true;   void solve()  {   int t=ni();   while(t-->0) {    int n=ni();    int root=(int)Math.sqrt(n/2);    int rootn = (int)Math.sqrt(n);    if (n==1 || n%2!=0) {     out.println("NO");     continue;    }    if (root*root == n/2 || (rootn*rootn == n && rootn%2==0)) {     out.println("YES");    } else {     out.println("NO");    }   }  }   static int comp(int a,int b){   return a+1097*b;  }   static long printNcR(int n, int r)  {         long p = 1, k = 1;         if (n - r < r) {    r = n - r;   }    if (r != 0) {    while (r > 0) {     p *= n;     k *= r;          long m = __gcd(p, k);                   p /= m;     k /= m;      n--;     r--;    }              }   else {    p = 1;   }      return p;  }   static long __gcd(long n1, long n2)  {   long gcd = 1;    for (int i = 1; i <= n1 && i <= n2; ++i) {       if (n1 % i == 0 && n2 % i == 0) {     gcd = i;    }   }   return gcd;  }  static long[][] dp;   static long desc(int[] a,int l,int r) {   if (l==r) return 0;   if (dp[l][r]!=-1) return dp[l][r];   dp[l][r] = a[r]-a[l] + Math.min(desc(a,l+1,r),desc(a,l,r-1));   return dp[l][r];  }   static int getMax(int arr[], int n)  {   int mx = arr[0];   for (int i = 1; i < n; i++)    if (arr[i] > mx)     mx = arr[i];   return mx;  }      static void countSort(int arr[], int n, int exp)  {   int output[] = new int[n];   int i;   int count[] = new int[10];   Arrays.fill(count, 0);      for (i = 0; i < n; i++)    count[(arr[i] / exp) % 10]++;         for (i = 1; i < 10; i++)    count[i] += count[i - 1];      for (i = n - 1; i >= 0; i--) {    output[count[(arr[i] / exp) % 10] - 1] = arr[i];    count[(arr[i] / exp) % 10]--;   }         for (i = 0; i < n; i++)    arr[i] = output[i];  }      static void radixsort(int arr[], int n)  {     int m = getMax(arr, n);           for (int exp = 1; m / exp > 0; exp *= 10)    countSort(arr, n, exp);  }   static int MAX=1500;   static int prime[], countdiv[];    static int[] getDivisorsArray() {   int n=20000005;   int[] mind = new int[n];   Arrays.fill(mind, -1);   for(int i=2;i<n;i++){    if (mind[i]==-1){     for(int j=i;j<n;j+=i){      if (mind[j]==-1){       mind[j]=i;      }     }    }   }                         return mind;  }       void SieveOfEratosthenes()  {   for (int i = 2; i * i < MAX; ++i)   {    if (prime[i]==0)     for (int j = i * i; j < MAX; j += i)      prime[j] = i;   }        for (int i = 1; i < MAX; ++i)    if (prime[i]==0)     prime[i] = i;  }       int largestGCDSubsequence(int arr[], int n)  {   int ans = 0;   for (int i=0; i < n; ++i)   {    int element = arr[i];          while (element > 1)    {     int div = prime[element];                ++countdiv[div];            ans = Math.max(ans, countdiv[div]);       while (element % div==0)      element /= div;    }   }     return ans;  }      static boolean check(int x)  {   char[] a=(""+x).toCharArray();   int s=0;   for(int i=0;i<a.length;i++)   {    s+=a[i]-'0';    s%=3;   }   if(s==0)return true;   return false;  }     static int[][] packD(int n,int[] from,int[] to)  {   int[][] g=new int[n][];   int[] p=new int[n];   for(int f:from)   {    p[f]++;   }   int m=from.length;   for(int i=0;i<n;i++)   {    g[i]=new int[p[i]];   }   for(int i=0;i<m;i++)   {    g[from[i]][--p[from[i]]]=to[i];   }   return g;  }   static class Pair3  {   int a,b,c;   public Pair3(int a,int b,int c)   {    this.a=a;    this.b=b;    this.c=c;   }  }    static class Pair  {   int a,b;   public Pair(int a,int b)   {    this.a=a;    this.b=b;   }  }   static long lcm(long a,long b)  {   long val=a;   val*=b;   return (val/gcd(a,b));  }   static long gcd(long a,long b)  {   if(a==0)return b;   return gcd(b%a,a);  }   static int pow(int a, int b, int p)  {   long ans = 1, base = a;   while (b!=0)   {    if ((b & 1)!=0)    {     ans *= base;     ans%= p;    }    base *= base;    base%= p;    b >>= 1;   }   return (int)ans;  }   static int inv(int x, int p)  {   return pow(x, p - 2, p);  }    void run() throws Exception  {   if(codechef)oj=true;   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 TimePass().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 double nd() { return Double.parseDouble(ns()); }  private char nc() { return (char)skip(); }   private String ns()  {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b))){    sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }   private char[] ns(int n)  {   char[] buf = new char[n];   int b = skip(), p = 0;   while(p < n && !(isSpaceChar(b))){    buf[p++] = (char)b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }   private char[][] nm(int n, int m)  {   char[][] map = new char[n][];   for(int i = 0;i < n;i++)map[i] = ns(m);   return map;  }   private int[] na(int n)  {   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = ni();   return a;  }   private int ni()  {   int num = 0, b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }     while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }   private long nl()  {   long num = 0;   int b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }     while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }   private boolean oj = System.getProperty("ONLINE_JUDGE") != null;  private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
1	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n;   n = sc.nextInt();   int[] arr = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = sc.nextInt();   }   int min = 1000000000, temp;   for (int i = 0; i < n; i++) {    temp = arr[i] / Math.max(i, n - 1 - i);    if (temp < min)     min = temp;   }   System.out.println(min);  } }
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);  } }
1	public class code1 {   public static long[][] cnt;  public static void main(String[] args)  {  InputReader in = new InputReader(System.in);  PrintWriter pw = new PrintWriter(System.out);                  int n = in.nextInt();  long d = in.nextInt();  long[] a = new long[n];  for(int i=0; i<n; i++)   a[i] = in.nextLong();      int ans = 0;    HashSet<Long> set = new HashSet<>();    for(int i=1; i<n; i++)  {          long dis = (long) Math.abs(a[i]-a[i-1]);     if(dis==2*d)   ans++;     if(dis-(long)2*d>0)   ans += 2;       }  pw.println(ans+2);                  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 long nextLong()   {   int c = snext();   while (isSpaceChar(c))   {   c = snext();   }   int sgn = 1;   if (c == '-')   {   sgn = -1;   c = snext();   }   long res = 0;   do   {   if (c < '0' || c > '9')    throw new InputMismatchException();   res *= 10;   res += c - '0';   c = snext();   } while (!isSpaceChar(c));   return res * sgn;  }    public int[] nextIntArray(int n)   {   int a[] = new int[n];   for (int i = 0; i < n; i++)   {   a[i] = nextInt();   }   return a;  }    public String readString()   {   int c = snext();   while (isSpaceChar(c))   {   c = snext();   }   StringBuilder res = new StringBuilder();   do   {   res.appendCodePoint(c);   c = snext();   } while (!isSpaceChar(c));   return res.toString();  }    public String nextLine()   {   int c = snext();   while (isSpaceChar(c))   c = snext();   StringBuilder res = new StringBuilder();   do   {   res.appendCodePoint(c);   c = snext();   } while (!isEndOfLine(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;  }    private boolean isEndOfLine(int c)   {   return c == '\n' || c == '\r' || c == -1;  }    public interface SpaceCharFilter   {   public boolean isSpaceChar(int ch);  }  }  public static long c = 0;   public static long mod = 1000000007;  public static int d;  public static int p;  public static int q;  public static boolean flag;  public static long INF= Long.MAX_VALUE;   public static long fun(int[] a, int[] b, int m,int n) {  long result =0;  for(int i=0; i<m; i++)   for(int j=0; j<m; j++)   {   long[] fib = new long[Math.max(2, n+2)];   fib[1] = a[i];   fib[2] = b[j];   for(int k=3; k<=n; k++)    fib[k] = (fib[k-1]%mod + fib[k-2]%mod)%mod;   result = (result%mod + fib[n]%mod)%mod;   }    return result;    }     public static double slope(pair p1, pair p2)  {  double m = INF;  if((p1.x - p2.x)!=0)  m = (p1.y - p2.y)/(p1.x - p2.x);       return Math.abs(m);    }     public static int count(String[] s, int f)  {  int count = 0;  int n = s[0].length();    if(f==1)  {  for(int i = 0; i<n; i++)  {   for(int j=0; j<n; j++)   {   if(i%2==0)   {    if(j%2==0 && s[i].charAt(j)=='0')    count++;    if(j%2==1 && s[i].charAt(j)=='1')    count++;   }   if(i%2==1)   {    if(j%2==1 && s[i].charAt(j)=='0')    count++;    if(j%2==0 && s[i].charAt(j)=='1')    count++;   }      }  }  }  else  {     count = 0;    for(int i = 0; i<n; i++)  {   for(int j=0; j<n; j++)   {   if(i%2==1)   {    if(j%2==0 && s[i].charAt(j)=='0')    count++;    if(j%2==1 && s[i].charAt(j)=='1')    count++;   }   if(i%2==0)   {    if(j%2==1 && s[i].charAt(j)=='0')    count++;    if(j%2==0 && s[i].charAt(j)=='1')    count++;   }      }  }   }       return count;        }    public static int gcd(int p2, int p22)  {   if (p2 == 0)    return (int) p22;   return gcd(p22%p2, p2);  }         public static int findGCD(int arr[], int n)  {   int result = arr[0];   for (int i=1; i<n; i++)    result = gcd(arr[i], result);     return result;  }     public static void nextGreater(long[] a, int[] ans)  {    Stack<Integer> stk = new Stack<>();  stk.push(0);      for(int i=1; i<a.length; i++)  {     if(!stk.isEmpty())   {   int s = stk.pop();   while(a[s]<a[i])   {   ans[s] = i;   if(!stk.isEmpty())    s = stk.pop();   else    break;   }   if(a[s]>=a[i])   stk.push(s);   }     stk.push(i);     }  return;    }   public static void nextGreaterRev(long[] a, int[] ans)  {    int n = a.length;  int[] pans = new int[n];  Arrays.fill(pans, -1);  long[] arev = new long[n];  for(int i=0; i<n; i++)   arev[i] = a[n-1-i];    Stack<Integer> stk = new Stack<>();  stk.push(0);      for(int i=1; i<n; i++)  {     if(!stk.isEmpty())   {   int s = stk.pop();   while(arev[s]<arev[i])   {   pans[s] = n - i-1;   if(!stk.isEmpty())    s = stk.pop();   else    break;   }   if(arev[s]>=arev[i])   stk.push(s);   }     stk.push(i);     }           for(int i=0; i<n; i++)   ans[i] = pans[n-i-1];        return;    }     public static void nextSmaller(long[] a, int[] ans)  {    Stack<Integer> stk = new Stack<>();  stk.push(0);      for(int i=1; i<a.length; i++)  {     if(!stk.isEmpty())   {   int s = stk.pop();   while(a[s]>a[i])   {   ans[s] = i;   if(!stk.isEmpty())    s = stk.pop();   else    break;   }   if(a[s]<=a[i])   stk.push(s);   }     stk.push(i);     }  return;    }        public static long lcm(int[] numbers) {   long lcm = 1;   int divisor = 2;   while (true) {    int cnt = 0;    boolean divisible = false;    for (int i = 0; i < numbers.length; i++) {     if (numbers[i] == 0) {      return 0;     } else if (numbers[i] < 0) {      numbers[i] = numbers[i] * (-1);     }     if (numbers[i] == 1) {      cnt++;     }     if (numbers[i] % divisor == 0) {      divisible = true;      numbers[i] = numbers[i] / divisor;     }    }    if (divisible) {     lcm = lcm * divisor;    } else {     divisor++;    }    if (cnt == numbers.length) {     return lcm;    }   }  }  public static long fact(long n) {    long factorial = 1;   for(int i = 1; i <= n; i++)    {     factorial *= i;    }   return factorial;  }  public static void factSieve(int[] a, int n) {      for(int i=2; i<=n; i+=2)   a[i] = 2;      for(int i=3; i<=n; i+=2)  {   if(a[i]==0)   {   a[i] = i;      for(int j=i; j*i<=n; j++)   {    a[i*j] = i;    }   }  }    int k = 1000;  while(k!=1)  {   System.out.print(a[k]+" ");   k /= a[k];     }  }    public static int lowerLimit(int[] a, int n) {  int ans = 0;    int ll = 0;  int rl = a.length-1;    if(a[0]>n)   return 0;  if(a[0]==n)   return 1;  else if(a[rl]<=n)   return rl+1;    while(ll<=rl)  {     int mid = (ll+rl)/2;   if(a[mid]==n)   {   ans = mid + 1;   break;   }     else if(a[mid]>n)   {   rl = mid-1;      }   else   {   ans = mid+1;   ll = mid+1;   }  }    return ans;  }     public static long choose(long total, long choose){   if(total < choose)    return 0;   if(choose == 0 || choose == total)    return 1;   return (choose(total-1,choose-1)+choose(total-1,choose))%mod;  }   public static int[] suffle(int[] a,Random gen)  {  int n = a.length;  for(int i=0;i<n;i++)  {   int ind = gen.nextInt(n-i)+i;   int temp = a[ind];   a[ind] = a[i];   a[i] = temp;  }  return a;  }   public static long[] sort(long[] a)  {  Random gen = new Random();  int n = a.length;  for(int i=0;i<n;i++)  {   int ind = gen.nextInt(n-i)+i;   long temp = a[ind];   a[ind] = a[i];   a[i] = temp;  }    Arrays.sort(a);  return a;  }   public static pair[] sort(pair[] a)  {  Random gen = new Random();  int n = a.length;  for(int i=0;i<n;i++)  {   int ind = gen.nextInt(n-i)+i;   pair temp = a[ind];   a[ind] = a[i];   a[i] = temp;  }    Arrays.sort(a);  return a;  }     public static int[] sort(int[] a)  {  Random gen = new Random();  int n = a.length;  for(int i=0;i<n;i++)  {   int ind = gen.nextInt(n-i)+i;   int temp = a[ind];   a[ind] = a[i];   a[i] = temp;  }    Arrays.sort(a);  return a;  }   public static int floorSearch(int arr[], int low, int high, int x)  {   if (low > high)    return -1;     if (x > arr[high])    return high;   int mid = (low+high)/2;       if (mid > 0 && arr[mid-1] < x && x < arr[mid])    return mid-1;     if (x < arr[mid])    return floorSearch(arr, low, mid-1, x);     return floorSearch(arr, mid+1, high, x);  }     public static void swap(int a, int b){  int temp = a;  a = b;  b = temp;  }  public static ArrayList<Integer> primeFactorization(int n)  {  ArrayList<Integer> a =new ArrayList<Integer>();  for(int i=2;i*i<=n;i++)  {   while(n%i==0)   {   a.add(i);   n/=i;   }  }  if(n!=1)   a.add(n);  return a;  }     public static void sieve(boolean[] isPrime,int n)  {  for(int i=1;i<n;i++)   isPrime[i] = true;    isPrime[0] = false;  isPrime[1] = false;    for(int i=2;i*i<n;i++)  {   if(isPrime[i] == true)   {   for(int j=(2*i);j<n;j+=i)    isPrime[j] = false;   }  }  }   public static int lowerbound(ArrayList<Long> net, long c2) {  int i=Collections.binarySearch(net, c2);  if(i<0)   i = -(i+2);  return i;      }   public static int lowerboundArray(long[] psum, long c2) {  int i=Arrays.binarySearch(psum, c2);  if(i<0)   i = -(i+2);  return i;      }   public static int lowerboundArray(int[] psum, int c2) {  int i=Arrays.binarySearch(psum, c2);  if(i<0)   i = -(i+2);  return i;      }     public static int uperboundArray(long[] psum, long c2) {  int i=Arrays.binarySearch(psum, c2);  if(i<0)   i = -(i+1);  return i;      }     public static int uperbound(ArrayList<Long> net, long c2) {  int i=Collections.binarySearch(net, c2);  if(i<0)   i = -(i+1);  return i;      }     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 long LCM(long a,long b)  {  return (a*b)/GCD(a,b);  }   public static int LCM(int a,int b)  {  return (a*b)/GCD(a,b);  }   public static int binaryExponentiation(int x,int n)  {   int result=1;   while(n>0)   {    if(n % 2 ==1)     result=result * x;    x=x*x;    n=n/2;   }   return result;  }     public static int[] countDer(int n)  {   int der[] = new int[n + 1];      der[0] = 1;   der[1] = 0;   der[2] = 1;      for (int i = 3; i <= n; ++i)    der[i] = (i - 1) * (der[i - 1] + der[i - 2]);         return der;  }     static long binomialCoeff(int n, int k)   {   long C[][] = new long[n+1][k+1];   int i, j;         for (i = 0; i <= n; i++)   {    for (j = 0; j <= Math.min(i, k); j++)    {         if (j == 0 || j == i)      C[i][j] = 1;            else      C[i][j] = C[i-1][j-1] + C[i-1][j];    }   }      return C[n][k];   }   public static long binaryExponentiation(long x,long n)  {   long result=1;   while(n>0)   {    if(n % 2 ==1)     result=result * x;    x=(x%mod * x%mod)%mod;    n=n/2;   }   return result;  }   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%M*x%M)%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 %M* x%M)%M;    x=(x*x)%M;    n=n/2;   }   return result;  }   public static int modInverse(int A,int M)  {   return modularExponentiation(A,M-2,M);  }   public static long modInverse(long A,long M)  {   return modularExponentiation(A,M-2,M);  }     public static boolean checkYear(int year)  {  if (year % 400 == 0)    return true;      if (year % 100 == 0)    return false;      if (year % 4 == 0)    return true;   return false;  }   public static boolean isPrime(int n)  {     if (n <= 1) return false;   if (n <= 3) return true;     if (n%2 == 0 || n%3 == 0)    return false;     for (int i=5; i*i<=n; i=i+6)   {    if (n%i == 0 || n%(i+2) == 0)     return false;   }     return true;  }   static class pair implements Comparable<pair>  {  Long x, y;   pair(long x, long y) {   this.x = x;   this.y = y;  }   public int compareTo(pair o) {   int result = x.compareTo(o.x);   if (result == 0)   result = y.compareTo(o.y);   return result;  }   public String toString() {   return x + " " + y;  }   public boolean equals(Object o) {   if (o instanceof pair) {   pair p = (pair) o;   if(p.x-x==0 && p.y-y==0)    return true;   else   return false;   }   return false;  }   public int hashCode() {   return new Long(x).hashCode() * 31 + new Long(y).hashCode();  }  }     static class triplet implements Comparable<triplet>  {  Integer x,y;  Long z;  triplet(Integer l,Integer m,long z)  {   this.x = l;   this.y = m;   this.z = z;  }    public int compareTo(triplet o)  {   int result = x.compareTo(o.x);   if(result==0)   result = y.compareTo(o.y);   if(result==0)   result = z.compareTo(o.z);    return result;  }    public boolean equlas(Object o)  {   if(o instanceof triplet)   {   triplet p = (triplet)o;   return x==p.x && y==p.y && z==p.z;   }   return false;  }    public String toString()  {   return x+" "+y+" "+z;  }  public int hashCode()  {   return new Long(x).hashCode()*31 + new Long(y).hashCode() + new Long(z).hashCode();   }  }   static class spair implements Comparable<spair>  {  String x;  Integer y;   spair(String x, int y) {   this.x = x;   this.y = y;  }   public int compareTo(spair o) {     String s1 = x + o.x;   String s2 = o.x + x;   long p1 = cnt[y][0] + cnt[o.y][0];   long p2 = p1;     p1 += cnt[y][1] * cnt[o.y][2];   p2 += cnt[o.y][1] * cnt[y][2];     if(p1==p2)    return 0;   if(p1>p2)   return -1;     return 1;            }   public String toString() {   return x + " " + y;  }    } }
0	public class Main {  final static boolean debug = false;  final static String fileName = "";  final static 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();  }  public double nextDouble() {   return Double.parseDouble(next());  }  public int nextInt() {   return Integer.parseInt(next());  }  public long nextLong() {   return Long.parseLong(next());  }  public byte nextByte() {   return Byte.parseByte(next());  } } 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;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   APaintTheNumbers solver = new APaintTheNumbers();   solver.solve(1, in, out);   out.close();  }  static class APaintTheNumbers {   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    int arr[] = new int[n];    in.scanInt(arr);    CodeX.sort(arr);    int ans = 0;    boolean vissited[] = new boolean[n];    for (int i = 0; i < n; i++) {     if (!vissited[i]) {      ans++;      for (int j = 0; j < n; j++) {       if (arr[j] % arr[i] == 0) {        vissited[j] = true;       }      }     }    }     out.println(ans);   }  }  static class CodeX {   public static void sort(int arr[]) {    merge_sort(arr, 0, arr.length - 1);   }   private static void merge_sort(int A[], int start, int end) {    if (start < end) {     int mid = (start + end) / 2;     merge_sort(A, start, mid);     merge_sort(A, mid + 1, end);     merge(A, start, mid, end);    }   }   private static void merge(int A[], int start, int mid, int end) {    int p = start, q = mid + 1;    int Arr[] = new int[end - start + 1];    int k = 0;    for (int i = start; i <= end; i++) {     if (p > mid)      Arr[k++] = A[q++];     else if (q > end)      Arr[k++] = A[p++];     else if (A[p] < A[q])      Arr[k++] = A[p++];     else      Arr[k++] = A[q++];    }    for (int i = 0; i < k; i++) {     A[start++] = Arr[i];    }   }  }  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;   }   private boolean isWhiteSpace(int n) {    if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;    else return false;   }   public void scanInt(int[] A) {    for (int i = 0; i < A.length; i++) A[i] = scanInt();   }  } }
3	public class x1141F  {  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[] arr = new int[N];   st = new StringTokenizer(infile.readLine());   for(int i=0; i < N; i++)    arr[i] = Integer.parseInt(st.nextToken());   HashMap<Long, ArrayList<Integer>> map = new HashMap<Long, ArrayList<Integer>>();   for(int r=0; r < N; r++)   {    long sum = 0L;    for(int i=r; i >= 0; i--)    {     sum += arr[i];     if(!map.containsKey(sum))     map.put(sum, new ArrayList<Integer>());     map.get(sum).add(i);     map.get(sum).add(r);    }   }   ArrayList<Integer> res = new ArrayList<Integer>();   for(long key: map.keySet())   {    ArrayList<Integer> ls = map.get(key);    ArrayList<Integer> temp = new ArrayList<Integer>();    temp.add(ls.get(0));    temp.add(ls.get(1));    int r = ls.get(1);    for(int i=2; i < ls.size(); i+=2)     if(r < ls.get(i))     {     r = ls.get(i+1);     temp.add(ls.get(i));     temp.add(ls.get(i+1));     }    if(res.size() < temp.size())     res = temp;   }   System.out.println(res.size()/2);   StringBuilder sb = new StringBuilder();   for(int i=0; i < res.size(); i+=2)   {    sb.append((1+res.get(i))+" "+(1+res.get(i+1)));    sb.append("\n");   }   System.out.print(sb);  }  }
3	public class B {  static StringBuilder sb;  static int N;  static int[] A;  static boolean[] B;  public static void main(String[] args) {   FastScanner sc = new FastScanner();     sb = new StringBuilder();   N = sc.nextInt();   A = new int[N];   for (int i = 0; i < N; i++) {    A[i] = sc.nextInt();   }   Arrays.sort(A);   B = new boolean[N];   int count = 0;   for (int i = 0; i < A.length; i++) {    if(B[i]) {     continue;    }    else {     count++;     B[i] = true;    }    for (int j = i + 1; j < A.length; j++) {     if(A[j] % A[i] == 0) {      B[j] = true;     }    }   }   sb.append(count);   System.out.println(sb);  }  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());   }   String readNextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   int[] readIntBrray(int n) {    int[] a = new int[n];    for (int idx = 0; idx < n; idx++) {     a[idx] = nextInt();    }    return a;   }   long[] readLongBrray(int n) {    long[] a = new long[n];    for (int idx = 0; idx < n; idx++) {     a[idx] = nextLong();    }    return a;   }  } }
3	public class CFA {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  final long MOD = 1000L * 1000L * 1000L + 7;  int[] dx = {0, -1, 0, 1};  int[] dy = {1, 0, -1, 0};  void solve() throws IOException {   int n = nextInt();   int[] arr = nextIntArr(n);   int cnt = 0;   for (int i = 0; i < n; i++) {    for (int j = i + 1; j < n; j++) {     if (arr[i] > arr[j]) {      cnt++;     }    }   }   int m = nextInt();   boolean[] vis = new boolean[n];   for (int i = 0; i < m; i++) {    int l = nextInt() - 1;    int r = nextInt() - 1;    int len = r - l + 1;    if (len * (len - 1) / 2 % 2 != 0) {     cnt++;    }    if (cnt % 2 != 0) {     outln("odd");    }    else {     outln("even");    }   }  }  void shuffle(int[] a) {   int n = a.length;   for(int i = 0; i < n; i++) {    int r = i + (int) (Math.random() * (n - i));    int tmp = a[i];    a[i] = a[r];    a[r] = tmp;   }  }  long gcd(long a, long b) {   while(a != 0 && b != 0) {    long c = b;    b = a % b;    a = c;   }   return a + b;  }  private void outln(Object o) {   out.println(o);  }  private void out(Object o) {   out.print(o);  }  public CFA() 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 CFA();  }  public long[] nextLongArr(int n) throws IOException{   long[] res = new long[n];   for(int i = 0; i < n; i++)    res[i] = nextLong();   return res;  }  public int[] nextIntArr(int n) throws IOException {   int[] res = new int[n];   for(int i = 0; i < n; i++)    res[i] = nextInt();   return res;  }  public String nextToken() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return null;    }   }   return st.nextToken();  }  public String nextString() {   try {    return br.readLine();   } catch (IOException e) {    eof = true;    return null;   }  }  public int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  public long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  public double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
5	public class Main{   public static void main(String[] args){     Scanner sc = new Scanner(System.in);     int n = sc.nextInt();     TreeSet<Integer> set = new TreeSet<Integer>();      for(int i=0;i<n;i++){       set.add(sc.nextInt());     }      if(set.size() >= 2)       System.out.println(set.toArray()[1]);     else       System.out.println("NO");   } }
0	public class Bank{ public static void main(String[] args){  Scanner reader = new Scanner(System.in);  int in = reader.nextInt();  int sign = (int)Math.signum(in);   String str = Math.abs(in)+"";  if(str.length() == 1){  if(in < 0)   System.out.println(0);  else   System.out.println(in);  return;  }   int max = in;  max = Math.max(max, sign * Integer.parseInt(str.substring(0,str.length()-1)));  max = Math.max(max, sign * Integer.parseInt(str.substring(0,str.length()-2) + str.charAt(str.length()-1)));  System.out.println(max); } }
3	public class Main { public static void main(String[] args) throws IOException {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  PrintWriter out = new PrintWriter(outputStream);  InputReader in = new InputReader(inputStream);       Task t = new Task();  t.solve(in, out);  out.close();   }   static class Task {  public void solve(InputReader in, PrintWriter out) throws IOException {    int n = in.nextInt();  int arr[] = in.readIntArray(n);  int v[][] = new int[n][n];  int c=0;  HashMap<Integer,Integer> mp = new HashMap<Integer,Integer>();  for(int i=0;i<n;i++) {   for(int j=i;j<n;j++) {   v[i][j] = arr[j];   if(j>i) v[i][j] += v[i][j-1];    if(!mp.containsKey(v[i][j])) mp.put(v[i][j], c++);   }  }  ArrayList<seg>[] all = new ArrayList[c];  for(int i=0;i<c;i++) all[i] = new ArrayList<seg>();  for(int i=0;i<n;i++) {   for(int j=i;j<n;j++) {   int idx = mp.get(v[i][j]);   all[idx].add(new seg(i,j,v[i][j]));   }  }  for(int i=0;i<c;i++) Collections.sort(all[i]);  int max = Integer.MIN_VALUE;  int val = -1;  for(int i=0;i<c;i++) {   if(all[i].size()==0) continue;   int num=1;   int p=0;int q=p+1;   while(q<all[i].size()) {   if(all[i].get(q).s>all[i].get(p).e) {    p=q;    num++;   }   q++;   }   if(num>max) {   max=num;   val = i;   }  }  out.println(max);  StringBuilder sb = new StringBuilder();  int p=0;int q=p+1;   sb.append(all[val].get(0).toString());  while(q<all[val].size()) {   if(all[val].get(q).s>all[val].get(p).e) {   sb.append(all[val].get(q).toString());   p=q;   }   q++;  }  out.println(sb.toString());  }  public class seg implements Comparable<seg>{  int s; int e; int val;  public seg(int a, int b, int c) {   s=a;e=b;val=c;  }  @Override  public int compareTo(seg t) {   if(this.e==t.e) return this.s-t.s;     return this.e-t.e;  }  public String toString() {   return (s+1)+" "+(e+1)+"\n";  }  }  public int GCD(int a, int b) {   if (b==0) return a;   return GCD(b,a%b);  } }    static class ArrayUtils {   static final long seed = System.nanoTime();   static final Random rand = new Random(seed);   public static void sort(int[] a) {    shuffle(a);    Arrays.sort(a);   }   public static void shuffle(int[] a) {    for (int i = 0; i < a.length; i++) {     int j = rand.nextInt(i + 1);     int t = a[i];     a[i] = a[j];     a[j] = t;    }   }  }  static class BIT{  int arr[];  int n;  public BIT(int a) {  n=a;  arr = new int[n];  }  int sum(int p) {  int s=0;  while(p>0) {   s+=arr[p];   p-=p&(-p);  }  return s;  }  void add(int p, int v) {  while(p<n) {   arr[p]+=v;   p+=p&(-p);  }  } } static class DSU{  int[] arr;  int[] sz;  public DSU(int n) {  arr = new int[n];  sz = new int[n];  for(int i=0;i<n;i++) arr[i] = i;  Arrays.fill(sz, 1);  }  public int find(int a) {  if(arr[a]!=a) arr[a] = find(arr[a]);  return arr[a];  }  public void union(int a, int b) {  int x = find(a);  int y = find(b);  if(x==y) return;  arr[x] = y;  sz[y] += sz[x];  }  public int size(int x) {  return sz[find(x)];  } }  static class MinHeap<Key> implements Iterable<Key> {  private int maxN;  private int n;  private int[] pq;  private int[] qp;  private Key[] keys;  private Comparator<Key> comparator;   public MinHeap(int capacity){  if (capacity < 0) throw new IllegalArgumentException();  this.maxN = capacity;  n=0;  pq = new int[maxN+1];  qp = new int[maxN+1];  keys = (Key[]) new Object[capacity+1];  Arrays.fill(qp, -1);  }   public MinHeap(int capacity, Comparator<Key> c){  if (capacity < 0) throw new IllegalArgumentException();  this.maxN = capacity;  n=0;  pq = new int[maxN+1];  qp = new int[maxN+1];  keys = (Key[]) new Object[capacity+1];  Arrays.fill(qp, -1);  comparator = c;  }   public boolean isEmpty() { return n==0; }  public int size()  { return n; }  public boolean contains(int i) {   if (i < 0 || i >= maxN) throw new IllegalArgumentException();   return qp[i] != -1;  }  public int peekIdx() {   if (n == 0) throw new NoSuchElementException("Priority queue underflow");   return pq[1];   }  public Key peek(){  if(isEmpty()) throw new NoSuchElementException("Priority queue underflow");  return keys[pq[1]];  }  public int poll(){  if(isEmpty()) throw new NoSuchElementException("Priority queue underflow");  int min = pq[1];  exch(1,n--);  down(1);  assert min==pq[n+1];  qp[min] = -1;  keys[min] = null;   pq[n+1] = -1;  return min;  }  public void update(int i, Key key) {   if (i < 0 || i >= maxN) throw new IllegalArgumentException();   if (!contains(i)) {    this.add(i, key);   }else {    keys[i] = key;    up(qp[i]);    down(qp[i]);   }  }  private void add(int i, Key x){   if (i < 0 || i >= maxN) throw new IllegalArgumentException();   if (contains(i)) throw new IllegalArgumentException("index is already in the priority queue");   n++;   qp[i] = n;   pq[n] = i;   keys[i] = x;   up(n);  }  private void up(int k){  while(k>1&&less(k,k/2)){   exch(k,k/2);   k/=2;  }  }  private void down(int k){  while(2*k<=n){   int j=2*k;   if(j<n&&less(j+1,j)) j++;   if(less(k,j)) break;   exch(k,j);   k=j;  }  }   public boolean less(int i, int j){   if (comparator == null) {    return ((Comparable<Key>) keys[pq[i]]).compareTo(keys[pq[j]]) < 0;   }   else {    return comparator.compare(keys[pq[i]], keys[pq[j]]) < 0;   }  }  public void exch(int i, int j){   int swap = pq[i];   pq[i] = pq[j];   pq[j] = swap;   qp[pq[i]] = i;   qp[pq[j]] = j;  }  @Override  public Iterator<Key> iterator() {    return null;  } }   private static class InputReader  {   private InputStream stream;   private byte[] buf = new byte[1024];   private int zcurChar;   private int znumChars;   private SpaceCharFilter filter;   public InputReader(InputStream stream)   {    this.stream = stream;   }   public int read()   {    if (znumChars == -1)     throw new InputMismatchException();    if (zcurChar >= znumChars)    {    zcurChar = 0;     try     {      znumChars = stream.read(buf);     } catch (IOException e)     {      throw new InputMismatchException();     }     if (znumChars <= 0)      return -1;    }    return buf[zcurChar++];   }   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 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 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 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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public String next()   {    return nextString();   }   public interface SpaceCharFilter   {    public boolean isSpaceChar(int ch);   }   public int[] readIntArray(int n) {    int[] ret = new int[n];    for (int i = 0; i < n; i++) {     ret[i] = nextInt();    }    return ret;   }    }   static class Dumper {  static void print_int_arr(int[] arr) {  for (int i = 0; i < arr.length; i++) {   System.out.print(arr[i] + " ");  }  System.out.println();  System.out.println("---------------------");  }  static void print_char_arr(char[] arr) {  for (int i = 0; i < arr.length; i++) {   System.out.print(arr[i] + " ");  }  System.out.println();  System.out.println("---------------------");  }  static void print_double_arr(double[] arr) {  for (int i = 0; i < arr.length; i++) {   System.out.print(arr[i] + " ");  }  System.out.println();  System.out.println("---------------------");  }  static void print_2d_arr(int[][] arr, int x, int y) {  for (int i = 0; i < x; i++) {   for (int j = 0; j < y; j++) {   System.out.print(arr[i][j] + " ");   }   System.out.println();  }  System.out.println();  System.out.println("---------------------");  }  static void print_2d_arr(boolean[][] arr, int x, int y) {  for (int i = 0; i < x; i++) {   for (int j = 0; j < y; j++) {   System.out.print(arr[i][j] + " ");   }   System.out.println();  }  System.out.println();  System.out.println("---------------------");  }  static void print(Object o) {  System.out.println(o.toString());  }  static void getc() {  System.out.println("here");  } } }
5	public class C113A{  static BufferedReader br;  public static void main(String args[])throws Exception{   br=new BufferedReader(new InputStreamReader(System.in));   int nm[]=toIntArray();   int n=nm[0];   int k=nm[1];   Pai p[]=new Pai[n];   for(int i=0;i<n;i++){    nm=toIntArray();    p[i]=new Pai(nm[0],nm[1]);   }   Arrays.sort(p);   int count=0;   for(int i=0;i<n;i++){    if(p[k-1].first==p[i].first && p[k-1].second==p[i].second){     count++;    }   }   System.out.println(count);  }    public static int[] toIntArray()throws Exception{   String str[]=br.readLine().split(" ");   int k[]=new int[str.length];   for(int i=0;i<str.length;i++){    k[i]=Integer.parseInt(str[i]);   }   return k;  }  public static int toInt()throws Exception{   return Integer.parseInt(br.readLine());  }  public static long[] toLongArray()throws Exception{   String str[]=br.readLine().split(" ");   long k[]=new long[str.length];   for(int i=0;i<str.length;i++){    k[i]=Long.parseLong(str[i]);   }   return k;  }  public static long toLong()throws Exception{   return Long.parseLong(br.readLine());  }  public static double[] toDoubleArray()throws Exception{   String str[]=br.readLine().split(" ");   double k[]=new double[str.length];   for(int i=0;i<str.length;i++){    k[i]=Double.parseDouble(str[i]);   }   return k;  }  public static double toDouble()throws Exception{   return Double.parseDouble(br.readLine());  }  public static String toStr()throws Exception{   return br.readLine();  }  public static String[] toStrArray()throws Exception{   String str[]=br.readLine().split(" ");   return str;  }   } class Pai implements Comparable<Pai> {  int first;  int second;  public Pai(int f, int s) {   first = f;   second = s;  }  public int compareTo(Pai p) {   int ret = 0;   if (first < p.first) {    ret = 1;   } else if (first > p.first) {    ret = -1;   } else {    if(second<p.second){     ret=-1;    }    else if(second>p.second){     ret=1;    }    else ret=0;   }   return ret;  } }
2	public class Alpha_Round {  public static void main(String[] args) throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));   String[] in = reader.readLine().split(" ");   long n = Long.parseLong(in[0]);   long k = Long.parseLong(in[1]);   long D = 9 + 8*k + 8*n;   long m = (long) ((-3 + Math.sqrt(D))/2);   writer.write((n - m) + "");   writer.close();  } }
4	public class temp {  public static void main(String str[]){   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int m = sc.nextInt();   int k = sc.nextInt();   int arr[][] = new int[n][m];   int cross[][] = new int[n][m-1];   int up[][] = new int[n-1][m];   for(int i=0;i<n;i++){    for(int j=0;j<m-1;j++){     cross[i][j] = sc.nextInt();    }   }   for(int i=0;i<n-1;i++){    for(int j=0;j<m;j++){     up[i][j] = sc.nextInt();    }   }   int[][] fans = new int[n][m];    if (k % 2 != 0) {     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       fans[i][j] = -1;      }     }    }    else {     int[][][] ans = new int[(k/2)+1][n][m];     for (int l = 1; l <= k / 2; l++){      for (int i = 0; i < n ; i++) {       for (int j = 0; j < m; j++) {        int min = Integer.MAX_VALUE;        if(i>0){         min = Math.min(min, up[i-1][j] + ans[l-1][i-1][j]);        }        if(j>0){         min = Math.min(min, cross[i][j-1] + ans[l-1][i][j-1]);        }        if(i<n-1){         min = Math.min(min, up[i][j] + ans[l-1][i+1][j]);        }        if(j<m-1){         min = Math.min(min, cross[i][j] + ans[l-1][i][j+1]);        }        ans[l][i][j] = min;       }      }     }     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       fans[i][j] = 2*ans[k/2][i][j];      }     }    }   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     System.out.print(fans[i][j]+" ");    }    System.out.println();   }   } }
4	public class Main {  public static void main(String args[])  {   FastReader input=new FastReader();   PrintWriter out=new PrintWriter(System.out);   int T=input.nextInt();   while(T-->0)   {    int n=input.nextInt();    int b[]=new int[n];    for(int i=0;i<n;i++)    {     b[i]=input.nextInt();    }    StringBuilder sb=new StringBuilder("");    int arr[]=new int[n+1];    out.println('1');    sb.append('1');    int size=1;    arr[size-1]=1;    for(int i=1;i<n;i++)    {     int a=b[i];     if(a==1)     {      size++;      arr[size-1]=1;      sb.append(".1");      out.println(sb.toString());     }     else     {      sb=new StringBuilder("");      int in=0;      for(int j=size-1;j>=0;j--)      {       if(arr[j]==a-1)       {        in=j;        break;       }      }      for(int j=0;j<in;j++)      {       sb.append(arr[j]+".");      }      sb.append(a);      size=in+1;      arr[size-1]=a;      out.println(sb.toString());     }    }   }   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();   }   int nextInt()   {    return Integer.parseInt(next());   }   long nextLong()   {    return Long.parseLong(next());   }   double nextDouble()   {    return Double.parseDouble(next());   }   String nextLine()   {    String str="";    try    {     str=br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  } }
1	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n, k;   n = sc.nextInt();   k = sc.nextInt();   int a = (n - k) / 2;   StringBuilder s = new StringBuilder();   int i;   while (s.length() < n) {    i = 0;    while (i < a && s.length() < n) {     s.append("0");     i++;    }    if (s.length() < n) s.append("1");   }   System.out.println(s);  } }
0	public class substraction {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);  int t=sc.nextInt();  while (t>0) {  long a=sc.nextLong();  long b=sc.nextLong();  int op=0;  if (a>b) {   while (a%b!=0) {   op+=a/b;   a=a%b;   long c=b;   b=a;   a=c;     }   op+=a/b;  }  else{   while (b%a!=0) {   op+=b/a;   b=b%a;   long c=a;   a=b;   b=c;     }   op+=b/a;  }      System.out.println(op);  t--;  }  } }
5	public class A {  void run()throws IOException{   Scanner sc = new Scanner(new InputStreamReader(System.in));   int n = sc.nextInt();   int i;   int[] ar = new int[n];   for(i=0; i<n; i++){    ar[i] = sc.nextInt();   }   Arrays.sort(ar);   int min = ar[0];   for(i=1;i<n;i++){    if(ar[i]>min) break;   }   if(i<n) System.out.println(ar[i]);   else System.out.println("NO");  }   public static void main(String[] args)throws IOException {   new A().run();  } }
0	public class Rules {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   double a = in.nextInt();   double v = in.nextInt();   double l = in.nextInt();   double d = in.nextInt();   double w = in.nextInt();   if (v <= w) {    double t = v / a;    if (0.5 * t * t * a > l) {     t = Math.sqrt(2 * l / a);    } else {     t += (l - 0.5 * t * t * a) / v;    }    System.out.printf("%.5f", t);   } else {    double total = 0.0;    double t = v / a;    double t2 = (v - w) / a;    double tempt = Math.sqrt(2.0 * d / a);    if (tempt * a <= w) {     total += tempt;     w = tempt*a;    } else if (0.5 * t * t * a +v*t2 - 0.5 * t2 * t2 * a > d) {     double as = 2.0*a;     double bs = 4.0*w;     double cs = ((w * w) / (a) - 2.0 * d );     double delta = bs * bs - 4.0 * as * cs;     double root = (-bs + Math.sqrt(delta)) / (2.0 * as);     if (root < 0.0) {      root = (-bs - Math.sqrt(delta)) / (2.0 * as);     }     total += (2.0 * root + w / a);    } else {     total += t + t2;     double smd = (d - 0.5 * t * t * a - v*t2 + 0.5 * t2 * t2 * a) / v;     total += smd;    }    double t3 = (v - w) / a;    if (w * t3 + 0.5 * t3 * t3 * a > l - d) {     double as = 0.5 * a;     double bs = w;     double cs = d - l;     double delta = bs * bs - 4.0 * as * cs;     double root = (-bs + Math.sqrt(delta)) / (2.0 * as);     if (root < 0.0) {      root = (-bs - Math.sqrt(delta)) / (2.0 * as);     }     total += root;    } else {     total += t3;     double t4 = (l - (w * t3 + 0.5 * t3 * t3 * a) - d) / v;     total += t4;    }    System.out.printf("%.5f", total);   }  } }
3	public class F2{ static class Pair{  int l;  int r;  Pair(int l, int r){  this.l = l;  this.r = r;  }  public String toString(){  return "(" + l + ", " + r + ")";  } } public static void main(String[] args){  Scanner in = new Scanner(System.in);  int n = in.nextInt();  int[] a = new int[n+1];  for(int i = 1;i<=n;++i){  a[i] = in.nextInt();  }  HashMap<Integer, Vector<Pair>> map = new HashMap<>();  for(int i = 1;i<=n;++i){  int sum = 0;  for(int j = i;j<=n;++j){   sum+=a[j];   if(!map.containsKey(sum))   map.put(sum,new Vector<>());   map.get(sum).add(new Pair(i,j));  }  }  Vector<Pair> an = null;  for(Integer key : map.keySet()){  Vector<Pair> vec = map.get(key);  Vector<Pair> ans = new Vector<>();  ans.add(vec.get(0));  int size = 1;  for(int i = 1;i<vec.size();++i){   if(ans.get(size-1).r > vec.get(i).r)   ans.set(size-1,vec.get(i));   else if(ans.get(size-1).r < vec.get(i).l){   ans.add(vec.get(i));   size++;   }  }  if(an == null || an.size() < size) an = ans;  }  StringBuilder res = new StringBuilder().append(an.size() + "\n");  for(int i = 0;i<an.size();++i)  res.append(an.get(i).l + " " + an.get(i).r + "\n");  System.out.println(res); } }
5	public class P15A {  public static void main (String [] args)  {   Scanner scan = new Scanner(System.in);   int n = scan.nextInt(), t = scan.nextInt();   TreeMap<Integer,Integer> hm = new TreeMap<Integer, Integer>();   for (int i = 0; i < n; i++) hm.put(scan.nextInt(),scan.nextInt());   int _x = 0, _a = 0, res = 2;   boolean started = false;   for (Integer key : hm.keySet())   {    if (!started)    {     _x = key;     _a = hm.get(_x);     started = true;     continue;    }    if (key - _x - ((Integer)hm.get(key) + _a)/2.0 > t) res +=2;    else if (key - _x - ((Integer)hm.get(key) + _a)/2.0 == t) res++;    _x = key;    _a = hm.get(_x);   }   System.out.println(res);   } }
3	public class a1 {  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  int n = s.nextInt();  int a[] = new int[n];  HashMap<Integer,ArrayList<Integer>> h = new HashMap<>();  boolean visited[] = new boolean[n];  for(int i=0;i<n;i++)  {  a[i] = s.nextInt();      }  Arrays.sort(a);  for(int i=0;i<n;i++) {  if(h.containsKey(a[i])) {        ArrayList<Integer> temp = h.get(a[i]);    temp.add(i);    h.put(a[i],temp);    }    else {    ArrayList<Integer> k =new ArrayList<>();    k.add(i);    h.put(a[i], k);    }  }  int ctr=0;  for(int i=0;i<n;i++) {  if(!visited[i]) {     ctr++;   for(int j=a[i];j<=100;j+=a[i]) {   if(h.containsKey(j)) {    ArrayList<Integer> m = h.get(j);    for(int k=0;k<m.size();k++) {    visited[m.get(k)]=true;    }    h.remove(j);   }   }  }  }  System.out.println(ctr); } }
6	public class mainE {  public static PrintWriter out = new PrintWriter(System.out);  public static FastScanner enter = new FastScanner(System.in);  public static void main(String[] args) throws IOException {   int t=enter.nextInt();   for (int i = 0; i < t; i++) {    solve();   }   out.close();  }  public static int[][] arr=new int[13][2010];  public static pair[] par= new pair[2010];  private static void solve() throws IOException{   int n=enter.nextInt();   int m=enter.nextInt();   for (int i = 0; i <n ; i++) {    for (int j = 0; j <m ; j++) {     arr[i][j]=enter.nextInt();    }   }   for (int i = 0; i <n ; i++) {    for (int j = m; j <m+3 ; j++) {     arr[i][j]=0;    }   }   m=m+3;   for (int i = 0; i <m ; i++) {    int max=-1;    for (int j = 0; j <n ; j++) {     max=Math.max(arr[j][i], max);    }    par[i]=new pair(max,i);   }   Arrays.sort(par,0,m, pair::compareTo);   int i0=par[0].st;   int i1=par[1].st;   int i2=par[2].st;   int i3=par[3].st;   int ans=-1;   for (int i = 0; i <n ; i++) {    for (int j = 0; j <n ; j++) {     for (int k = 0; k <n ; k++) {      for (int l = 0; l <n ; l++) {       int first=Math.max(Math.max(arr[i][i0],arr[j][i1]), Math.max(arr[k][i2],arr[l][i3]));       int second=Math.max(Math.max(arr[(i+1)%n][i0],arr[(j+1)%n][i1]), Math.max(arr[(k+1)%n][i2],arr[(l+1)%n][i3]));       int third=Math.max(Math.max(arr[(i+2)%n][i0],arr[(j+2)%n][i1]), Math.max(arr[(k+2)%n][i2],arr[(l+2)%n][i3]));       int fourth=Math.max(Math.max(arr[(i+3)%n][i0],arr[(j+3)%n][i1]), Math.max(arr[(k+3)%n][i2],arr[(l+3)%n][i3]));       if(n==1) {        second=0;        third=0;        fourth=0;       }       else if(n==2){        third=0;        fourth=0;       }       else if(n==3){        fourth=0;       }       ans=Math.max(ans, first+second+fourth+third);      }     }    }   }   System.out.println(ans);   }  static class pair implements Comparable<pair>{   int max,st;   public pair(int max, int st) {    this.max = max;    this.st = st;   }   @Override   public int compareTo(pair o) {    return -Integer.compare(max, o.max);   }  }  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());   }   double nextDouble() throws IOException {    return Double.parseDouble(next());   }   char nextChar() throws IOException {    return (char) (br.read());   }   String nextLine() throws IOException {    return br.readLine();   }  } }
5	public class A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   int n = sc.nextInt();   int[] a = new int[n];   int sum = 0;   for (int i = 0; i < n; i++) {    a[i] = sc.nextInt();    sum += a[i];   }   for (int i = 0; i < n; i++)    a[i] *= -1;   Arrays.sort(a);   for (int i = 0; i < n; i++)    a[i] *= -1;   int ans = 0;   int sum1 = 0;   for (int i = 0; i < n; i++) {    sum1 += a[i];    sum -= a[i];    ans++;    if (sum1 > sum)     break;   }   pw.print(ans);   pw.close();  } }
4	public class C {  public static void main(String[] args) {  FastScanner sc = new FastScanner();  int T = sc.nextInt();  StringBuilder sb = new StringBuilder();  while(T-->0) {  int n = sc.nextInt();  int[] arr = new int[n];  for(int i = 0; i < n; i++) {   arr[i] = sc.nextInt();  }  int[] p = new int[n];  int[] base = new int[n];  p[0] = -1;  base[0] = -1;  boolean[] used = new boolean[n];  for(int i = 1; i < n; i++) {   if(arr[i] == 1) {   p[i] = i-1;   base[i] = i-1;   }   else {   for(int j = i-1; j >= 0; j--) {    if(used[j]) continue;    if(arr[j] == arr[i]-1) {    p[i] = j; used[j] = true;     base[i] = base[j]; break;    }    else used[j] = true;   }   }  }  StringBuilder[] res = new StringBuilder[n];  res[0] = new StringBuilder("1");  sb.append("1\n");  for(int i = 1; i < n; i++) {   if(base[i] == -1) {    res[i] = new StringBuilder();   }   else {   res[i] = new StringBuilder(res[base[i]]);   res[i].append(".");   }   res[i].append(arr[i]+"");   sb.append(res[i]);   sb.append("\n");  }  }  PrintWriter pw = new PrintWriter(System.out);  pw.println(sb.toString().trim());  pw.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 long nextLong() {  return Long.parseLong(next());  }  public double nextDouble() {  return Double.parseDouble(next());  }  public String nextLine() {  try {   return reader.readLine();  } catch(IOException e) {   throw new RuntimeException(e);  }  } } }
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);  ProblemCFireAgain solver = new ProblemCFireAgain ();  solver.solve (1, in, out);  out.close (); }  static class ProblemCFireAgain {  private static final byte[] dx = {-1, 0, 0, 1};  private static final byte[] dy = {0, -1, 1, 0};  private static int[][] lvl;  private static int max;  private static int n;  private static int m;  private static int k;  private static ProblemCFireAgain.Pair[] bgn;  private static ProblemCFireAgain.Pair res;   private static void bfs2d () {  Queue<ProblemCFireAgain.Pair> bfsq = new LinkedList<ProblemCFireAgain.Pair> ();  for (ProblemCFireAgain.Pair src : bgn) {   lvl[src.a][src.b] = 0;   bfsq.add (src);  }  while (!bfsq.isEmpty ()) {   ProblemCFireAgain.Pair op = bfsq.poll ();   int plvl = lvl[op.a][op.b];   if (plvl>max) {   res = op;   max = plvl;   }   for (int i = 0; i<4; i++) {   int newX = op.a+dx[i];   int newY = op.b+dy[i];    if (newX>0 && newX<=n && newY>0 && newY<=m && lvl[newX][newY] == -1) {    bfsq.add (new ProblemCFireAgain.Pair (newX, newY));    lvl[newX][newY] = (plvl+1);    }   }  }  }   public void solve (int testNumber, InputReader _in, PrintWriter _out) {    try (InputReader in = new InputReader (new FileInputStream ("input.txt"));   PrintWriter out = new PrintWriter (new BufferedWriter (new FileWriter ("output.txt")))) {   n = in.nextInt ();   m = in.nextInt ();   k = in.nextInt ();   bgn = new ProblemCFireAgain.Pair[k];   for (int i = 0; i<k; i++) {   bgn[i] = new ProblemCFireAgain.Pair (in.nextInt (), in.nextInt ());   }   max = Integer.MIN_VALUE;   lvl = new int[n+5][m+5];   for (int i = 0; i<n+4; i++) {   Arrays.fill (lvl[i], -1);   }   bfs2d ();   out.println (res);  } catch (Exception e) {   }  }   private static class Pair {  int a;  int b;    Pair (int a, int b) {   this.a = a;   this.b = b;  }      public String toString () {   return a+" "+b;  }      public boolean equals (Object o) {   if (this == o) return true;   if (!(o instanceof ProblemCFireAgain.Pair)) return false;   ProblemCFireAgain.Pair pair = (ProblemCFireAgain.Pair) o;   return a == pair.a && b == pair.b;  }      public int hashCode () {   return Objects.hash (a, b);  }    }   }  static class InputReader implements AutoCloseable {  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 {   String str;   if ((str = reader.readLine ()) != null) tokenizer = new StringTokenizer (str);   else return null;   } catch (IOException e) {   throw new RuntimeException (e);   }  }  return tokenizer.nextToken ();  }   public int nextInt () {  return Integer.parseInt (next ());  }     public void close () throws Exception {  reader.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; }  private static 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());  } }
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"); }  }
0	public class HexadecimalTheorem {   public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  PrintWriter out = new PrintWriter(System.out);  out.printf("%d %d %d%n", 0, 0, n);  out.flush(); } }
5	public class Main {   Scanner in;  PrintWriter out;   static class House implements Comparable <House>{   int len;   int pos;     House(Scanner in){    pos = in.nextInt() * 2;    len = in.nextInt() * 2;     }     public int compareTo(House arg0) {    return this.pos-arg0.pos;   }    }     void solve(){   int n = in.nextInt();   int size = in.nextInt();   House []h = new House[n];   for (int i = 0; i < h.length; i++){    h[i] = new House(in);   }   Arrays.sort(h);   int ans = 2;   for (int i = 0; i < h.length - 1; i++){    int next = i + 1;    int sz = h[next].pos - h[i].pos - (h[next].len + h[i].len) / 2;    if (sz == size * 2) {     ans ++;    } else if (sz > size * 2) {     ans += 2;    }   }   out.println(ans);  }   public void run(){   in = new Scanner(System.in);   out = new PrintWriter(System.out);     try {    solve();   } finally {    out.close();   }  }   void asserT(boolean e){   if (!e){    throw new Error();   }  }  public static void main(String[] args) {   new Main().run();  } }
4	public class Main { static int[] di = {-1,0,1,0}; static int[] dj = {0,1,0,-1}; public static void main(String[] args) throws IOException  {  Scanner sc = new Scanner("input.txt");  PrintWriter out = new PrintWriter("output.txt");  Queue<Pair> q = new LinkedList<Pair>();  int n = sc.nextInt(),m = sc.nextInt() , k = sc.nextInt();  boolean [][] vis = new boolean[n][m];  while(k-->0)  q.add(new Pair(sc.nextInt()-1,sc.nextInt()-1));   int ansX = 1 , ansY = 1;   while(!q.isEmpty())  {  Pair cur = q.poll();  if(vis[cur.i][cur.j])continue;  ansX = cur.i ; ansY = cur.j;  vis[cur.i][cur.j] = true;  for (int i = 0; i < di.length; i++) {   int ni = cur.i + di[i] , nj = cur.j + dj[i];   if(ni>=0 && ni<n && nj>=0 && nj<m && !vis[ni][nj])   q.add(new Pair(ni,nj));  }  }   out.append(++ansX+" "+ ++ansY);  out.flush();   } static class Pair {  int i,j;  public Pair(int a,int b) {  i = a; j = b;  } }  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(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 String nextLine() throws IOException {return br.readLine();}   public long nextLong() throws IOException {return Long.parseLong(next());}   public double nextDouble() throws IOException {return Double.parseDouble(next());}  public boolean ready() throws IOException {return br.ready();} }  }
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 {   @Override   public void run() {    InputStream inputStream = System.in;    OutputStream outputStream = System.out;    FastInput in = new FastInput(inputStream);    FastOutput out = new FastOutput(outputStream);    AQuiz solver = new AQuiz();    solver.solve(1, in, out);    out.close();   }  }  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 {   private static 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 DigitUtils {   private DigitUtils() {   }   public static int mod(long x, int mod) {    if (x < -mod || x >= mod) {     x %= mod;    }    if (x < 0) {     x += mod;    }    return (int) x;   }  }  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 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);  } }
1	public class CodeForces {  static boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  void runCase(int caseNum) throws IOException {   int n = nextInt();   int k = nextInt();   int[] nums = new int[n];   int distinct = 0;   int L = -1, R = -1;   int minLen = Integer.MAX_VALUE;   int maxNum = 0;   for (int i = 0; i < n; ++i) {    nums[i] = nextInt();    maxNum = Math.max(maxNum, nums[i]);   }   int[] count = new int[maxNum + 1];   int j = 0;   for (int i = 0; i < n; ++i) {    ++count[nums[i]];    if (count[nums[i]] == 1) {     ++distinct;     if (distinct >= k) {      for (; j <= i; ++j) {       --count[nums[j]];       if (count[nums[j]] <= 0) {        --distinct;        if (distinct < k) {         if (i - j < minLen) {          minLen = i - j;          L = j + 1;          R = i + 1;         }         break;        }       }      }     }    }   }   out.print(L + " " + R);  }   public static void main(String[] args) 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");   }   new CodeForces().runIt();   out.flush();   out.close();   return;  }  static BufferedReader in;  private StringTokenizer st;  static PrintWriter out;  String next() throws IOException {   while (!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(next());  }  double nextDouble() throws IOException {   return Double.parseDouble(next());  }  long nextLong() throws IOException {   return Long.parseLong(next());  }   void runIt() throws IOException {   st = new StringTokenizer("");     runCase(0);   out.flush();  } }
1	public class B { static final int[] num = new int[7]; static {  for(int i = 1, c = 1; i <= 6; i++, c *= 26)  num[i] = num[i-1] + c; } public void run() {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  while(n-- > 0) {  String s = sc.next();  System.out.println(s.matches("R[0-9]+C[0-9]+") ? toABdd(s) : toRC(s));  } }  String toRC(String s) {  String ss = s.split("[0-9]+")[0];  String sn = s.split("[A-Z]+")[1];  int r = 0;  for(char c : ss.toCharArray())  r = r * 26 + c - 'A';  r += num[ss.length()];  int c = Integer.parseInt(sn);  return "R" + c + "C" + r; }  String toABdd(String s) {  String[] ss = s.split("[RC]");  int c = Integer.parseInt(ss[1]);  int r = Integer.parseInt(ss[2]);  int a = 0;  while(r > num[++a]);  a--;  r -= num[a];  char[] cs = new char[a];  for(int i = 0; i < a; i++, r /= 26)  cs[a-i-1] = (char) (r % 26 + 'A');  return new String(cs) + c; }  void debug(Object... os) {  System.err.println(Arrays.deepToString(os)); }  public static void main(String...args) {  new B().run(); } }
1	public class B1 {  static Scanner in;  public static void main( String[] args ) throws FileNotFoundException {   in = new Scanner( System.in );   int tn = in.nextInt();   for ( int i = 0; i < tn; i ++ ) {    String s = in.next();      char[] c = s.toCharArray();    boolean second = true;    second &= c[0] == 'R';    int r = s.indexOf( "C" );    if ( r > 0 ) {     second &= isNumber( s.substring( 1, r ) ) && isNumber( s.substring( r + 1 ) );    } else {     second = false;    }    if ( second ) {     System.out.println( toLetters( s.substring( r + 1 ) ) + s.substring( 1, r ) );    } else {     r = 0;     while ( c[r] >= 'A' && c[r] <= 'Z' ) {      r ++;     }     System.out.println( "R" + s.substring( r ) + "C" + fromLetters( s.substring( 0, r ) ) );    }       }  }  private static int fromLetters( String s ) {   int r = 0;   int l = s.length();   for ( int i = 0; i < l; i ++ ) {    r = r * 26 + s.charAt( i ) - 'A';   }   r ++;   for ( int i = 1, c = 26; i < l; i ++, c *= 26 ) {    r += c;   }   return r;  }  private static String toLetters( String s ) {   int x = new Integer( s ) - 1;   int c = 26;   int l = 1;   while ( true ) {    if ( x < c ) {     String r = "";     for ( int i = 0; i < l; i ++ ) {      r = ( char ) ( 'A' + x % 26 ) + r;      x /= 26;     }     return r;    }    x -= c;    c *= 26;    l ++;   }  }  private static boolean isNumber( String s ) {   try {    int x = new Integer( s );   } catch ( NumberFormatException e ) {    return false;   }   return true;  } }
1	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   FastInputReader in = new FastInputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskB solver = new TaskB();   solver.solve(1, in, out);   out.close();  } } class TaskB {  int n, a, b;  Map<Integer, Integer> position;  int[] p;  int[] group;  public void solve(int testNumber, FastInputReader in, PrintWriter out) {   n = in.nextInt();   a = in.nextInt();   b = in.nextInt();   position = new TreeMap<Integer, Integer>();   p = new int[n];   group = new int[n];   for (int i = 0; i < n; i++) {    p[i] = in.nextInt();    group[i] = -1;    position.put(p[i], i);   }   for (int i = 0; i < n; i++) {    if (getMate(i) != -1)     continue;    out.println("NO");    return;   }   for (int i = 0; i < n; i++) {    boolean aMate = position.containsKey(a - p[i]);    boolean bMate = position.containsKey(b - p[i]);    if (aMate && bMate)     continue;    if (group[i] != -1)     continue;    if (!solve(i)) {     out.println("NO");     return;    }   }   for (int i = 0; i < n; i++) {    if (group[i] != -1)     continue;    if (!solve(i)) {     out.println("NO");     return;    }   }   out.println("YES");   for (int i = 0; i < n; i++) {    out.print(group[i]);    out.print(" ");   }   out.println();  }  private boolean solve(int index) {   int mate = getMate(index);   if (mate == -1)    return false;   assign(index, mate);   if (getMate(index) != -1)    return solve(getMate(index));   else    return getMate(mate) == -1 || solve(getMate(mate));  }  private void assign(int index, int mate) {   int sum = p[index] + p[mate];   if (sum == a) {    group[index] = group[mate] = 0;    return;   }   if (sum == b) {    group[index] = group[mate] = 1;    return;   }   throw new RuntimeException("Wrong assignment :(");  }  private int getMate(int index) {   int[] possibleMates = new int[] {a - p[index], b - p[index]};   for (int mate: possibleMates) {    if (position.containsKey(mate)) {     int mateIndex = position.get(mate);     if (group[mateIndex] == -1)      return mateIndex;    }   }   return -1;  } } class FastInputReader {  public BufferedReader reader;  public StringTokenizer tokenizer;  public FastInputReader(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;  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());  }  } }
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 node implements Comparable<node>{ int count; long value; public int compareTo(node t) {  if(this.value == t.value)  return 0;  else if(this.value < t.value)  return -1;  else  return 1; } } 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 String next() {   return readString();  }   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();  }   public void printLine(int i) {   writer.println(i);  } }  class IOUtils {   public static void readIntArrays(InputReader in, int[]... arrays) {   for (int i = 0; i < arrays[0].length; i++) {    for (int j = 0; j < arrays.length; j++)     arrays[j][i] = in.readInt();   }  }   }
1	public class Main{  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);   int t=sc.nextInt();   while(t-->0)   {    int n=sc.nextInt();    if(n%2==1)    {     System.out.println("NO");     continue;    }       int num=n/2;    int root = (int)Math.sqrt(num);    if(root*root==num)    {     System.out.println("YES");     continue;    }       if(n%4!=0)    {     System.out.println("NO");     continue;    }    num = n/4;    root = (int) Math.sqrt(num);    if(root*root==num)    {     System.out.println("YES");    }    else    {     System.out.println("NO");    }   }  } }
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 void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new BufferedWriter(new OutputStreamWriter(System.out));      solve();  out.flush();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  public int iread() throws Exception {  return Integer.parseInt(readword()); }  public double dread() throws Exception {  return Double.parseDouble(readword()); }  public long lread() throws Exception {  return Long.parseLong(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(); } }
1	public class Main {  private FastScanner scanner = new FastScanner();  public static void main(String[] args) {   new Main().solve();  }   private void solve() {   int n = scanner.nextInt();   Map<Integer, Integer> cnt = new HashMap<>();   for (int i = 0; i < n; i++) {    String s = scanner.nextLine();    LinkedList<Character> st = new LinkedList<>();    for (char c : s.toCharArray()) {     if (c == ')' && !st.isEmpty() && st.getLast() == '(') {      st.pollLast();      continue;     }     st.addLast(c);    }    int t = st.size();    Set<Character> set = new HashSet<>(st);    if (set.size() > 1) {     continue;    }    if (set.isEmpty()) {     cnt.put(0, cnt.getOrDefault(0, 0) + 1);     continue;    }    if (st.getLast() == '(') {     cnt.put(t, cnt.getOrDefault(t, 0) + 1);    } else {     cnt.put(-t, cnt.getOrDefault(-t, 0) + 1);    }   }   long ans = 0;   for (int next : cnt.keySet()) {    if (next == 0) {     ans += (long) cnt.get(next) * (cnt.get(next) - 1) + cnt.get(next);    } else if (next > 0) {     int t = next * -1;     if (cnt.containsKey(t)) {      ans += (long) cnt.get(next) * cnt.get(t);     }    }   }   System.out.print(ans);  }  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());   }   Integer[] nextA(int n) {    Integer a[] = new Integer[n];    for (int i = 0; i < n; i++) {     a[i] = scanner.nextInt();    }    return a;   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    try {     return reader.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }  } }
2	public class Main{  final long mod = (int)1e9+7, IINF = (long)1e19;  final int MAX = (int)1e6+1, MX = (int)1e7+1, INF = (int)1e9;  DecimalFormat df = new DecimalFormat("0.0000000000000");  FastReader in;  PrintWriter out;  static boolean multipleTC = false, memory = false;  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 << 26).start();   else new Main().run();  }  void run() throws Exception{   in = new FastReader();   out = new PrintWriter(System.out);   for(int i = 1, t = (multipleTC)?ni():1; i<=t; i++)solve(i);   out.flush();    out.close();  }  void solve(int TC) throws Exception{   long x = nl(), k = nl();   if(x==0)pn(0);   else {    x%=mod;    long p = modPow(2,k);    long b = mul((x-1+mod)%mod,p), e = mul(x,p);    long ans = c(e)%mod;    ans -= c(b)%mod;    ans%=mod;    if(ans<0)ans+=mod;    ans = mul(ans, 2);    ans = mul(ans, modPow(p, mod-2));    pn(ans);   }  }  long modPow(long a, long p){   long o = 1;   while(p>0){    if((p&1)==1)o = mul(a,o);    a = mul(a,a);    p>>=1;   }   return o;  }     long mul(long a, long b){   if(a>=mod)a%=mod;   if(b>=mod)b%=mod;   a*=b;   if(a>=mod)a%=mod;   return a;  }   long c(long c){   return (c*c+c)/2;  }   int[] reverse(int[] a){   int[] o = new int[a.length];   for(int i = 0; i< a.length; i++)o[i] = a[a.length-i-1];   return o;   }  int[] sort(int[] a){   if(a.length==1)return a;   int mid = a.length/2;   int[] b = sort(Arrays.copyOfRange(a,0,mid)), c = sort(Arrays.copyOfRange(a,mid,a.length));   for(int i = 0, j = 0, k = 0; i< a.length; i++){    if(j<b.length && k<c.length){     if(b[j]<c[k])a[i] = b[j++];     else a[i] = c[k++];    }else if(j<b.length)a[i] = b[j++];    else a[i] = c[k++];   }   return a;  }  long[] sort(long[] a){   if(a.length==1)return a;   int mid = a.length/2;   long[] b = sort(Arrays.copyOfRange(a,0,mid)), c = sort(Arrays.copyOfRange(a,mid,a.length));   for(int i = 0, j = 0, k = 0; i< a.length; i++){    if(j<b.length && k<c.length){     if(b[j]<c[k])a[i] = b[j++];     else a[i] = c[k++];    }else if(j<b.length)a[i] = b[j++];    else a[i] = c[k++];   }   return a;  }  int[] ia(int ind,int n){   int[] out = new int[ind+n];   for(int i = 0; i< n; i++)out[ind+i] = ni();   return out;  }  long[] la(int ind, int n){   long[] out = new long[ind+n];   for(int i = 0; i< n; i++)out[ind+i] = nl();   return out;  }  double[] da(int ind, int n){   double[] out = new double[ind+n];   for(int i = 0; i< n; i++)out[ind+i] = nd();   return out;  }  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 bitcount(long n){return (n==0)?0:(1+bitcount(n&(n-1)));}  void p(Object o){out.print(o);}  void pn(Object o){out.println(o);}  void pni(Object o){out.println(o);out.flush();}  String n(){return in.next();}  String nln(){return in.nextLine();}  int ni(){return Integer.parseInt(in.next());}  long nl(){return Long.parseLong(in.next());}  double nd(){return Double.parseDouble(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(){    while (st == null || !st.hasMoreElements()){     try{      st = new StringTokenizer(br.readLine());     }catch (IOException e){      e.printStackTrace();     }    }    return st.nextToken();   }   String nextLine(){    String str = "";    try{     str = br.readLine();    }catch (IOException e){     e.printStackTrace();    }     return str;   }  } }
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)); } }
4	public class C {  public static void main(String[] args) {  FastScanner fs=new FastScanner();  int T=fs.nextInt();  PrintWriter out=new PrintWriter(System.out);  for (int tt=0; tt<T; tt++) {  int n=fs.nextInt();  int[] a=fs.readArray(n);  int[] stack=new int[n];  int size=0;  for (int i:a) {   if (i==1) {   stack[size++]=i;   }   else {   while (stack[size-1]!=i-1) {    size--;   }   size--;   stack[size++]=i;   }   for (int j=0; j<size; j++) {   out.print(stack[j]);   if (j!=size-1) out.print('.');   }   out.println();  }                       }  out.close(); }  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());  }  int[] readArray(int n) {  int[] a=new int[n];  for (int i=0; i<n; i++) a[i]=nextInt();  return a;  }  long nextLong() {  return Long.parseLong(next());  } }  }
5	public class Median_Segments_general {  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];  for (int i = 0; i < n; i++) {  arr[i] = s.nextInt();  }  System.out.println(func(n, m, arr)-func(n, m+1, arr)); } public static long func(int n,int m,int[] arr) {  HashMap<Long, Integer> map = new HashMap<>();  map.put((long) 0, 1);  long sum = 0;  long res = 0;  long add=0;  for(int i=0;i<n;i++) {  if(arr[i]<m) {   sum--;   if(map.containsKey(sum)) {   add-=map.get(sum);   }  }  else {   if(map.containsKey(sum)) {   add+=map.get(sum);   }   sum++;  }  res+=add;  if(map.containsKey(sum)) {   map.put(sum, map.get(sum)+1);  }  else {   map.put(sum,1);  }  }  return res; } }
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);  } }
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));  } }
0	public class A {  private static BufferedReader in;  private static StringTokenizer st;  private static 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 max = n;   max = Math.max(max, n / 10);   max = Math.max(max, (n / 100) * 10 + n % 10);   System.out.println(max);  }    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());  }  static long nextLong() throws NumberFormatException, IOException{   return Long.parseLong(next());  }   static double nextDouble() throws NumberFormatException, IOException{   return Double.parseDouble(next());  } }
4	public class Main {  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 FileReader("input.txt"));    out = new PrintWriter("output.txt");   } 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());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  public static void main(String[] args) {   new Main().run();    }  public static void mergeSort(int[] a) {   mergeSort(a, 0, a.length - 1);  }  private static void mergeSort(int[] a, int levtIndex, int rightIndex) {   final int MAGIC_VALUE = 50;   if (levtIndex < rightIndex) {    if (rightIndex - levtIndex <= MAGIC_VALUE) {     insertionSort(a, levtIndex, rightIndex);    } else {     int middleIndex = (levtIndex + rightIndex) / 2;     mergeSort(a, levtIndex, middleIndex);     mergeSort(a, middleIndex + 1, rightIndex);     merge(a, levtIndex, middleIndex, rightIndex);    }   }  }  private static void merge(int[] a, int levtIndex, int middleIndex,        int rightIndex) {   int length1 = middleIndex - levtIndex + 1;   int length2 = rightIndex - middleIndex;   int[] levtArray = new int[length1];   int[] rightArray = new int[length2];   System.arraycopy(a, levtIndex, levtArray, 0, length1);   System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);   for (int k = levtIndex, i = 0, j = 0; k <= rightIndex; k++) {    if (i == length1) {     a[k] = rightArray[j++];    } else if (j == length2) {     a[k] = levtArray[i++];    } else {     a[k] = levtArray[i] <= rightArray[j] ? levtArray[i++]       : rightArray[j++];    }   }  }  private static void insertionSort(int[] a, int levtIndex, int rightIndex) {   for (int i = levtIndex + 1; i <= rightIndex; i++) {    int current = a[i];    int j = i - 1;    while (j >= levtIndex && a[j] > current) {     a[j + 1] = a[j];     j--;    }    a[j + 1] = current;   }  }  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);   }  }   class LOL implements Comparable<LOL> {   int x;   int y;    public LOL(int x, int y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(LOL o) {    return (x - o.x);       }  }  class LOL2 implements Comparable<LOL2> {   int x;   int y;   int z;    public LOL2(int x, int y, int z) {    this.x = x;    this.y = y;    this.z = z;   }   @Override   public int compareTo(LOL2 o) {    return (z - o.z);       }  }  class test implements Comparable<test> {   long x;   long y;    public test(long x, long y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(test o) {                   int compareResult = Long.compare(x, o.x);    if (compareResult != 0) {     return compareResult;    }    return Long.compare(y, o.y);       }  }  class data {   String name;   String city;   data(String name, String city) {    this.city = city;    this.name = name;   }  }  class Point {   double x;   double y;    Point(double x, double y) {    this.x = x;    this.y = y;   }   double distance(Point temp) {    return Math.sqrt((x - temp.x) * (x - temp.x) + (y - temp.y) * (y - temp.y));   }   double sqrDist(Point temp) {    return ((x - temp.x) * (x - temp.x) + (y - temp.y) * (y - temp.y));   }   Point rotate(double alpha) {    return new Point(x * cos(alpha) - y * sin(alpha), x * sin(alpha) + y * cos(alpha));   }   void sum(Point o) {    x += o.x;    y += o.y;   }   void scalarProduct(int alpha) {    x *= alpha;    y *= alpha;   }  }  class Line {   double a;   double b;   double c;   Line(Point A, Point B) {    a = B.y - A.y;    b = A.x - B.x;    c = -A.x * a - A.y * b;   }   Line(double a, double b, double c) {    this.a = a;    this.b = b;    this.c = c;   }   Point intersection(Line o) {    double det = a * o.b - b * o.a;    double det1 = -c * o.b + b * o.c;    double det2 = -a * o.c + c * o.a;    return new Point(det1 / det, det2 / det);   }  }    class record implements Comparable<record> {   String city;   Long score;   public record(String name, Long score) {    this.city = name;    this.score = score;   }   @Override   public int compareTo(record o) {    if (o.city.equals(city)) {     return 0;    }    if (score.equals(o.score)) {     return 1;    }    if (score > o.score) {     return 666;    } else {     return -666;    }       }  }  public long gcd(long a, long b) {   if (a == 0 || b == 0) return max(a, b);   if (a % b == 0)    return b;   else    return gcd(b, a % b);  }  boolean prime(long n) {   if (n == 1) return false;   for (int i = 2; i <= sqrt(n); i++)    if (n % i == 0)     return false;   return true;  }  public int sum(long n) {   int s = 0;   while (n > 0) {    s += (n % 10);    n /= 10;   }   return s;  }     ArrayList<Integer> primes;  boolean[] isPrime;  public void getPrimes (int n) {   isPrime[0] = false;   isPrime[1] = false;   for (int i = 2; i <= n; i++) {    if (isPrime[i]) {     primes.add(i);     if (1l * i * i <= n) {      for (int j = i * i; j <= n; j += i) {       isPrime[j] = false;      }     }    }   }  }    public long binPowMod(long a, long b, long mod) {   if (b == 0) {    return 1 % mod;   }   if (b % 2 != 0) {    return ((a % mod) * (binPowMod(a, b - 1, mod) % mod)) % mod;   } else {    long temp = binPowMod(a, b / 2, mod) % mod;    long ans = (temp * temp) % mod;    return ans;   }  }   int type[];  boolean vis[];  HashMap<Integer, HashSet<Integer>> g;  int componentNum[];    int p[];  int find(int x) {   if (x == p[x]) {    return x;   }   return p[x] = find(p[x]);  }  boolean merge(int x, int y) {   x = find(x);   y = find(y);   if (p[x] == p[y]) {    return false;   }   p[y] = x;   return true;  }  class Trajectory {   double x0;   double y0;   double vx;   double vy;    Trajectory(double vx, double vy, double x0, double y0) {    this.vx = vx;    this.vy = vy;    this.x0 = x0;    this.y0 = y0;   }   double y (double x) {    return y0 + (x - x0) * (vy / vx) - 5 * (x - x0) * (x - x0) / (vx * vx);   }   double der(double x) {    return (vy / vx) - 10 * (x - x0) / (vx * vx);   }   }  int s;  int n;  int m;  boolean isVisited[][];  char[][] maze;  int[] dx = {0, 0, -1, 1};  int[] dy = {1, -1, 0, 0};  void dfs(int x, int y) {   isVisited[x][y] = true;   for (int i = 0; i < 4; i++) {    int currX = x + dx[i];    int currY = y + dy[i];    if (maze[currX][currY] == '.' && !isVisited[currX][currY]) {     dfs(currX, currY);    }   }   }    public void solve() throws IOException {   n = readInt();   m = readInt();   maze = new char[n + 2][m + 2];   for (int i = 0; i < n + 2; i++) {    maze[i][0] = '#';    maze[i][m + 1] = '#';   }   for (int j = 0; j < m + 2; j++) {    maze[0][j] = '#';    maze[n + 1][j] = '#';   }   for (int i = 1; i <= n; i++) {    for (int j = 1; j <= m; j++) {     maze[i][j] = '.';    }   }   int[][] dist = new int[n + 2][m + 2];   for (int i = 0; i < n + 2; i++) {    for (int j = 0; j < m + 2; j++) {     dist[i][j] = Integer.MAX_VALUE;    }   }   ArrayDeque<Integer> xValues = new ArrayDeque<Integer>();   ArrayDeque<Integer> yValues = new ArrayDeque<Integer>();   int k = readInt();   for (int i = 0; i < k; i++) {    int currX = readInt();    int currY = readInt();    xValues.add(currX);    yValues.add(currY);    dist[currX][currY] = 0;   }    while(!xValues.isEmpty()) {    int x = xValues.poll();    int y = yValues.poll();    for (int i = 0; i < 4; i++) {     int currX = x + dx[i];     int currY = y + dy[i];     if (maze[currX][currY] == '.' && dist[currX][currY] > dist[x][y] + 1) {      dist[currX][currY] = dist[x][y] + 1;      xValues.add(currX);      yValues.add(currY);     }    }   }   int maxDist = 0;   int indexX = 0;   int indexY = 0;   for (int i = 1; i <= n; i++) {    for (int j = 1; j <= m; j++) {     if (dist[i][j] >= maxDist) {      maxDist = dist[i][j];      indexX = i;      indexY = j;     }    }   }   out.print(indexX + " " + indexY);    }  }
2	public class Main { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  long n = in.nextLong();  long k = in.nextLong();  long res = solve(n, k);  System.out.println(res); }  private static long solve(long n, long k) {  return solveEq(1, -3 - 2 * n, n * n + n - 2 * k); }  private static long solveEq(long a, long b, long c) {  long delta = b * b - 4 * a * c;  return (-b - (long)Math.sqrt(delta)) / (2 * a); } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   BigInteger mod = new BigInteger("1000000007");   public void solve(int testNumber, InputReader in, PrintWriter out) {    BigInteger x = new BigInteger(in.next());    BigInteger k = new BigInteger(in.next());    if (x.longValue() == 0) {     out.print(x);     return;    }    BigInteger pow = powerWithMod(new BigInteger("2"), k);    BigInteger current = x.mod(mod).multiply(pow).mod(mod);    BigInteger result = current.multiply(new BigInteger("2")).mod(mod)      .subtract(pow.subtract(new BigInteger("1")).mod(mod))      .mod(mod);    out.print(result);   }   BigInteger powerWithMod(BigInteger base, BigInteger exponent) {    if (exponent.longValue() == 0) {     return new BigInteger("1");    }    BigInteger temp = powerWithMod(base, exponent.divide(new BigInteger("2")));    BigInteger term = temp.mod(mod);    if (exponent.mod(new BigInteger("2")).intValue() == 0) {     return term.multiply(term.mod(mod)).mod(mod);    } else {     return term.multiply(term.mod(mod)).multiply(base.mod(mod)).mod(mod);    }   }  }  static class InputReader {   private BufferedReader reader;   private 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();   }  } }
0	public final class Subtractions {  public static void main(String[] args)  {   InputReader in = new InputReader(System.in);   PrintWriter out = new PrintWriter(System.out);  Solver solver = new Solver(in, out);  solver.solve();   in.close();   out.flush();   out.close();  }  static class Solver  {   int n;   InputReader in;   PrintWriter out;  void solve()  {  n = in.nextInt();   while (n-- > 0)  {   int a, b;   a = in.nextInt();   b = in.nextInt();   int cnt = 0;   while (a > 0 && b > 0)   {   if (a < b)    a = swap(b, b = a);    cnt += a / b;   a -= b * (a / b);   }   out.println(cnt);  }  }  int swap(int a, int b)  {  return a;  }   public Solver(InputReader in, PrintWriter out)   {   this.in = in;   this.out = out;   }  }  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 boolean isSpaceChar(int c)   {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public void close()   {    try    {     stream.close();    } catch (IOException e)    {     e.printStackTrace();    }   }  } }
3	public class D_Edu_Round_35 {  public static long MOD = 1000000007;  public static void main(String[] args) throws FileNotFoundException {        PrintWriter out = new PrintWriter(System.out);   Scanner in = new Scanner();   int n = in.nextInt();   int[] data = new int[n];   for (int i = 0; i < n; i++) {    data[i] = in.nextInt();   }   FT tree = new FT(n + 1);   int result = 0;   for (int i = n - 1; i >= 0; i--) {    tree.update(data[i], 1);    result += tree.get(data[i] - 1);    result %= 2;   }   int q = in.nextInt();   int[] tmp = new int[n];   for (int i = 0; i < q; i++) {    int l = in.nextInt() - 1;    int r = in.nextInt() - 1;    FT a = new FT(n + 1);    int total = r - l + 1;    total = total * (total - 1) / 2;    total %= 2;                    result += total;    result %= 2;           if (result % 2 == 0) {     out.println("even");    } else {     out.println("odd");    }   }   out.close();  }  public static int[] KMP(String val) {   int i = 0;   int j = -1;   int[] result = new int[val.length() + 1];   result[0] = -1;   while (i < val.length()) {    while (j >= 0 && val.charAt(j) != val.charAt(i)) {     j = result[j];    }    j++;    i++;    result[i] = j;   }   return result;  }  public static boolean nextPer(int[] data) {   int i = data.length - 1;   while (i > 0 && data[i] < data[i - 1]) {    i--;   }   if (i == 0) {    return false;   }   int j = data.length - 1;   while (data[j] < data[i - 1]) {    j--;   }   int temp = data[i - 1];   data[i - 1] = data[j];   data[j] = temp;   Arrays.sort(data, i, data.length);   return true;  }  public static int digit(long n) {   int result = 0;   while (n > 0) {    n /= 10;    result++;   }   return result;  }  public static double dist(long a, long b, long x, long y) {   double val = (b - a) * (b - a) + (x - y) * (x - y);   val = Math.sqrt(val);   double other = x * x + a * a;   other = Math.sqrt(other);   return val + other;  }  public static class Point implements Comparable<Point> {   int x, y;   public Point(int start, int end) {    this.x = start;    this.y = end;   }   @Override   public int hashCode() {    int hash = 5;    hash = 47 * hash + this.x;    hash = 47 * hash + this.y;    return hash;   }   @Override   public boolean equals(Object obj) {    if (obj == null) {     return false;    }    if (getClass() != obj.getClass()) {     return false;    }    final Point other = (Point) obj;    if (this.x != other.x) {     return false;    }    if (this.y != other.y) {     return false;    }    return true;   }   @Override   public int compareTo(Point o) {    return Integer.compare(x, o.x);   }  }  public static class FT {   int[] data;   FT(int n) {    data = new int[n];   }   public void update(int index, int value) {    while (index < data.length) {     data[index] += value;     data[index] %= 2;     index += (index & (-index));    }   }   public int get(int index) {    int result = 0;    while (index > 0) {     result += data[index];     result %= 2;     index -= (index & (-index));    }    return result;   }  }  public static long gcd(long a, long b) {   if (b == 0) {    return a;   }   return gcd(b, a % b);  }  public static long pow(long a, long b, 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 long nextLong() {    return Long.parseLong(next());   }   public int nextInt() {    return Integer.parseInt(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    st = null;    try {     return br.readLine();    } catch (Exception e) {     throw new RuntimeException();    }   }   public boolean endLine() {    try {     String next = br.readLine();     while (next != null && next.trim().isEmpty()) {      next = br.readLine();     }     if (next == null) {      return true;     }     st = new StringTokenizer(next);     return st.hasMoreTokens();    } catch (Exception e) {     throw new RuntimeException();    }   }  } }
0	public class Main { static ArrayList<Integer> Unique(ArrayList<Integer> x) {  TreeSet<Integer> tmp=new TreeSet<Integer>();  tmp.addAll(x);  x.clear();  x.addAll(tmp);  return x; } 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 node { ArrayList<Integer> v=new ArrayList<Integer>(); node(){} void push(Integer a) {  v.add(a); } } 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; }  int nextInt()  {  return Integer.parseInt(next()); }  long nextLong()  {  return Long.parseLong(next()); }  double nextDouble()  {  return Double.parseDouble(next()); }  BigInteger nextBigInteger()  {  return new BigInteger(next()); }  BigDecimal nextBigDecimal()  {  return new BigDecimal(next()); } }
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());  } }
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));   }  } }
0	public class A {  static long l, r, A, B, C;  static long GCD(long a, long b) {   if (b == 0)    return a;   return GCD(b, a % b);  }  static boolean gcd(long a, long b) {   return GCD(a, b) == 1;  }  static boolean found(long a, long b, long c) {   if (b <= a || c <= b)    return false;   if (a > r || b > r || c > r)    return false;   if (gcd(a, b) && gcd(b, c) && !gcd(a, c)) {    A = a;    B = b;    C = c;    return true;   }   if (found(a + 1, b + 1, c + 1))    return true;   if (found(a + 1, b, c + 1))    return true;   if (found(a + 1, b + 1, c))    return true;   if (found(a, b, c + 1))    return true;   if (found(a, b + 1, c + 1))    return true;   if (found(a, b + 1, c))    return true;   return found(a + 1, b, c);  }  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   l = sc.nextLong();   r = sc.nextLong();   if (found(l, l + 1, l + 2))    System.out.println(A + " " + B + " " + C);   else    System.out.println(-1);  } }
5	public class p1096f {  static long MOD = 998244353;  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   BIT invert = new BIT(n+5);   BIT neg = new BIT(n+5);   long res = 0;   int[] arr = new int[n];   boolean[] has = new boolean[n+1];   long num1 = 0;   for(int i = 0; i < n; i++) {    arr[i] = in.nextInt();    if(arr[i] != -1) {     res += invert.read(n+5)-invert.read(arr[i]);     res %= MOD;     invert.update(arr[i], 1);     has[arr[i]] = true;    } else num1++;   }   if(num1 == 0) {    System.out.println(res);    return;   }   for(int i = 1; i <= n; i++) if(!has[i]) neg.update(i, 1);   long invertNum1 = modInv(num1, MOD);   res += ((num1*(num1-1))%MOD)*modInv(4, MOD);   res %= MOD;   long cnt = 0;   for(int i = 0; i < n; i++) {    if(arr[i] == -1) {     cnt++;     continue;    }    res += (((neg.read(n+5)-neg.read(arr[i]))*cnt)%MOD)*invertNum1;    res %= MOD;   }   cnt = 0;   for(int i = n-1; i >= 0; i--) {    if(arr[i] == -1) {     cnt++;     continue;    }    res += (((neg.read(arr[i]))*cnt)%MOD)*invertNum1;    res %= MOD;   }   System.out.println(res);  }     static class BIT {    int n;    int[] tree;    public BIT(int n) {      this.n = n;      tree = new int[n + 1];    }    int read(int i) {      int sum = 0;      while (i > 0) {        sum += tree[i];        i -= i & -i;      }      return sum;    }    void update(int i, int val) {      while (i <= n) {        tree[i] += val;        i += i & -i;      }    }     }          static long modInv(long x, long mod) {   return (BigInteger.valueOf(x).modInverse(BigInteger.valueOf(mod))).longValue();  }  static long modInv(long a, long b, long y0, long y1, long q0, long q1) {    long y2 = y0 - y1*q0;    return b == 0 ? y2 : modInv(b, a % b, y1, y2, q1, a / b);  }     static long gcd(long a, long b) { return b == 0 ? a : gcd(b, a % b); }  static long lcm(long a, long b) { return a / gcd(a, b) * b; }  }
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]; }  public void shuffle(int[] arr) {  for (int i = 0; i < arr.length; i++) {  int r = (int) (Math.random() * arr.length);  if (i != r) {   arr[i] ^= arr[r];   arr[r] ^= arr[i];   arr[i] ^= arr[r];  }  } }  static class FastScanner {  final private 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;  }  int[] nextIntArray(int N) throws IOException {  int[] arr = new int[N];  for (int i = 0; i < N; i++) {   arr[i] = nextInt();  }  return arr;  }  String nextLine() throws IOException {  int c = read();  while (c != -1 && isEndline(c))   c = read();  if (c == -1) {   return null;  }  StringBuilder res = new StringBuilder();  do {   if (c >= 0) {   res.appendCodePoint(c);   }   c = read();  } while (!isEndline(c));  return res.toString();  }  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;  }  public long nextLong() throws IOException {  long ret = 0;  byte c = read();  while (c <= ' ')   c = read();  boolean neg = (c == '-');  if (neg) c = read();  do {   ret = ret * 10 + c - '0';  } while ((c = read()) >= '0' && c <= '9');  if (neg) return -ret;  return ret;  }  public double nextDouble() throws IOException {  double ret = 0, div = 1;  byte c = read();  while (c <= ' ')   c = read();  boolean neg = (c == '-');  if (neg) c = read();   do {   ret = ret * 10 + c - '0';  } while ((c = read()) >= '0' && c <= '9');   if (c == '.') {   while ((c = read()) >= '0' && c <= '9') {   ret += (c - '0') / (div *= 10);   }  }   if (neg) return -ret;  return ret;  }  private void fillBuffer() throws IOException {  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();  }  public int[][] readGraph(int N, int M, boolean zeroIndexed, boolean bidirectional) throws Exception {  int[][] adj = new int[N][];  int[] numNodes = new int[N];  int[][] input = new int[M][2];  for (int i = 0; i < M; i++) {   int a = nextInt();   int b = nextInt();   if (zeroIndexed) {   a--;   b--;   }   input[i][0] = a;   input[i][1] = b;   numNodes[a]++;   if (bidirectional) numNodes[b]++;  }  for (int i = 0; i < N; i++) {   adj[i] = new int[numNodes[i]];   numNodes[i] = 0;  }  for (int i = 0; i < M; i++) {   int a = input[i][0];   int b = input[i][1];   adj[a][numNodes[a]++] = b;   if (bidirectional) adj[b][numNodes[b]++] = a;  }  return adj;  }  public int[][][] readWeightedGraph(int N, int M, boolean zeroIndexed, boolean bidirectional) throws Exception {  int[][][] adj = new int[N][][];  int[] numNodes = new int[N];  int[][] input = new int[M][3];  for (int i = 0; i < M; i++) {   int a = nextInt();   int b = nextInt();   if (zeroIndexed) {   a--;   b--;   }   int d = nextInt();   input[i][0] = a;   input[i][1] = b;   input[i][2] = d;   numNodes[a]++;   if (bidirectional) numNodes[b]++;  }  for (int i = 0; i < N; i++) {   adj[i] = new int[numNodes[i]][2];   numNodes[i] = 0;  }  for (int i = 0; i < M; i++) {   int a = input[i][0];   int b = input[i][1];   int d = input[i][2];   adj[a][numNodes[a]][0] = b;   adj[a][numNodes[a]][1] = d;   numNodes[a]++;   if (bidirectional) {   adj[b][numNodes[b]][0] = a;   adj[b][numNodes[b]][1] = d;   numNodes[b]++;   }  }  return adj;  } }  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 printf(String format, Object... args) {  buf.append(String.format(format, args));  }  public void close() {  pw.print(buf);  pw.close();  }  public void flush() {  pw.print(buf);  pw.flush();  buf.setLength(0);  }  } }
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; } }
1	public class ProblemC {  public static void main(String[] args) {   ProblemC problem = new ProblemC();   problem.solve();  }  private void solve() {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   String s = sc.next();   int ret = n;   int toth = 0;   int tott = 0;   for (int j = 0; j < n; j++) {    if (s.charAt(j) == 'H') {     toth++;    } else {     tott++;    }   }   for (int j = 0; j < n; j++) {    int cnth = 0;    for (int k = 0; k < toth; k++) {     int pos = (j + k) % n;     if (s.charAt(pos) == 'H') {      cnth++;     }    }    int makeh = toth - cnth;    ret = Math.min(ret, makeh);   }   System.out.println(ret);  } }
3	public class Main{  static ArrayList a[]=new ArrayList[200001]; static int Count(int a[][],int n) {  dsu d=new dsu(n);  for(int i=0;i<n;i++) {  for(int j=0;j<n;j++) {   if(a[i][j]==0) {   d.union(i, j);   }  }  }  int cnt=0;  boolean chk[]=new boolean [n];  for(int i=0;i<n;i++) {  int p=d.root(i);  if(!chk[p]) {   chk[p]=true;   cnt++;  }  }  return cnt; } public void solve () {  InputReader in = new InputReader(System.in);  PrintWriter pw = new PrintWriter(System.out);   int n=in.nextInt();  int a=in.nextInt();  int b=in.nextInt();  if(a==1 || b==1) {   int ans[][]=new int [n][n];   int temp=(a==1)?b:a;   for(int i=1;i<=n-temp;i++) {   ans[i][i-1]=1;   ans[i-1][i]=1;   }   int freq=Count(ans,n);   if(freq!=1) {   pw.println("NO");   }   else {   pw.println("YES");   for(int i=0;i<n;i++) {    for(int j=0;j<n;j++) {    if(i==j) {     pw.print(0);    }    else     pw.print((ans[i][j]+((temp==b)?1:0))%2);    }    pw.println();   }   }  }  else {   pw.print("NO");  }  pw.flush();  pw.close(); } public static void main(String[] args) throws Exception {        new Thread(null,new Runnable() {   public void run() {    new Main().solve();   }   },"1",1<<26).start();       }  static void debug(Object... o) {  System.out.println(Arrays.deepToString(o));   }     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 int[] nextIntArray(int n)   {    int a[] = new int[n];    for (int i = 0; i < n; i++)    {     a[i] = nextInt();    }    return a;   }    public String readString()   {    int c = snext();    while (isSpaceChar(c))    {     c = snext();    }    StringBuilder res = new StringBuilder();    do    {     res.appendCodePoint(c);     c = snext();    } while (!isSpaceChar(c));    return res.toString();   }    public String nextLine()   {    int c = snext();    while (isSpaceChar(c))     c = snext();    StringBuilder res = new StringBuilder();    do    {     res.appendCodePoint(c);     c = snext();    } while (!isEndOfLine(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;   }    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 void extended(int a,int b) {   if(b==0) {    d=a;    p=1;    q=0;   }   else   {    extended(b,a%b);    int temp=p;    p=q;    q=temp-(a/b)*q;   }   }   public static long[] shuffle(long[] a,Random gen)   {    int n = a.length;    for(int i=0;i<n;i++)    {     int ind = gen.nextInt(n-i)+i;     long temp = a[ind];     a[ind] = a[i];     a[i] = temp;    }    return a;   }     public static void swap(int a, int b){    int temp = a;    a = b;    b = temp;   }     public static HashSet<Integer> primeFactorization(int n)   {    HashSet<Integer> a =new HashSet<Integer>();    for(int i=2;i*i<=n;i++)    {     while(n%i==0)     {      a.add(i);      n/=i;     }    }    if(n!=1)     a.add(n);    return a;   }     public static void sieve(boolean[] isPrime,int n)   {    for(int i=1;i<n;i++)     isPrime[i] = true;       isPrime[0] = false;    isPrime[1] = false;       for(int i=2;i*i<n;i++)    {     if(isPrime[i] == true)     {      for(int j=(2*i);j<n;j+=i)       isPrime[j] = false;     }    }   }     public static int GCD(int a,int b)   {    if(b==0)     return a;    else     return GCD(b,a%b);   }     static class pair implements Comparable<pair>   {    Integer x;    Long y;    pair(int x,long y)    {     this.x=x;     this.y=y;        }           public int compareTo(pair o) {     int result = x.compareTo(o.x);     if(result==0)      result = y.compareTo(o.y);         return result;    }        public String toString()    {     return x+" "+y;    }       public boolean equals(Object o)    {     if (o instanceof pair)     {      pair p = (pair)o;      return p.x == x && p.y == y ;     }     return false;    }       public int hashCode()    {     return new Long(x).hashCode()*31 + new Long(y).hashCode();    }   }     } class pair implements Comparable<pair> {  Integer x;  Long y;  pair(int x,long y)  {   this.x=x;   this.y=y;    }     public int compareTo(pair o) {   int result = x.compareTo(o.x);   if(result==0)    result = y.compareTo(o.y);     return result;  }    public String toString()  {   return x+" "+y;  }   public boolean equals(Object o)  {   if (o instanceof pair)   {    pair p = (pair)o;    return p.x == x && p.y == y ;   }   return false;  }   public int hashCode()  {   return new Long(x).hashCode()*31 + new Long(y).hashCode();  } } class dsu{ int parent[]; dsu(int n){  parent=new int[n+1];  for(int i=0;i<=n;i++)  {  parent[i]=i;  } } int root(int n) {  while(parent[n]!=n)  {   parent[n]=parent[parent[n]];  n=parent[n];  }  return n; } void union(int _a,int _b) {  int p_a=root(_a);  int p_b=root(_b);    parent[p_a]=p_b;     } boolean find(int a,int b) {  if(root(a)==root(b))  return true;  else  return false; }   }
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()); }   long nextLong() { return Long.parseLong(next()); }   double nextDouble()   {    return Double.parseDouble(next());   }   String nextLine()   {    String str = "";    try {     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }  }  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();  } }
6	public class E1 { static byte[] buf = new byte[1<<26];  static int bp = -1;   public static void main(String[] args) throws IOException {    DataInputStream in = new DataInputStream(System.in);     in.read(buf, 0, 1<<26);  int t = nni();  for (int z = 0; z < t; z++) {  int n = nni();  int m = nni();  int[][] mat = new int[n][m];  int[] rmax = new int[n];  int tot = 0;  HashSet<Integer> care = new HashSet<>();  for (int i = 0; i < n; i++) {   PriorityQueue<Integer> cols = new PriorityQueue<>();   for (int j = 0; j < m; j++) {   mat[i][j] = nni();   cols.add(-(mat[i][j]*2000+j));   rmax[i] = Math.max(rmax[i], mat[i][j]);   }   tot += rmax[i];   for (int j = 0; j < Math.min(m, n); j++)   care.add((-cols.poll())%2000);  }  List<Integer> cal = care.stream().sorted().collect(Collectors.toList());  int ret = tot;  if (Math.min(m, n)==1) {   System.out.println(ret);  } else if (Math.min(m, n)==2) {   for (int a = 0; a < cal.size(); a++) {   int la = cal.get(a);   for (int d = 0; d < cal.size(); d++) {    if (d==a)    continue;    int ld = cal.get(d);    for (int i = 0; i < n; i++) {    int tret = 0;    for (int x = 0; x < n; x++) {     tret += Math.max(mat[x][ld], mat[(i+x)%n][la]);    }    ret = Math.max(ret, tret);    }   }   }   System.out.println(ret);  } else if (Math.min(m, n)==3) {   for (int a = 0; a < cal.size(); a++) {   int la = cal.get(a);   for (int b = a+1; b < cal.size(); b++) {    int lb = cal.get(b);    for (int d = 0; d < cal.size(); d++) {    if (d==a)     continue;    if (d==b)     continue;    int ld = cal.get(d);    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {     int tret = 0;     for (int x = 0; x < n; x++) {      tret += Math.max(mat[x][ld], Math.max(mat[(i+x)%n][la], mat[(j+x)%n][lb]));     }     ret = Math.max(ret, tret);     }    }    }   }   }   System.out.println(ret);  } else if (Math.min(m, n)==4) {   for (int a = 0; a < cal.size(); a++) {   int la = cal.get(a);   for (int b = a+1; b < cal.size(); b++) {    int lb = cal.get(b);    for (int c = b+1; c < cal.size(); c++) {    int lc = cal.get(c);    for (int d = 0; d < cal.size(); d++) {     if (d==a)     continue;     if (d==b)     continue;     if (d==c)     continue;     int ld = cal.get(d);     for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      for (int k = 0; k < n; k++) {      int tret = 0;      for (int x = 0; x < n; x++) {       tret += Math.max(mat[x][ld], Math.max(mat[(i+x)%n][la], Math.max(mat[(j+x)%n][lb], mat[(k+x)%n][lc])));      }      ret = Math.max(ret, tret);      }     }     }    }    }   }   }   System.out.println(ret);  }  } }  public static int nni() {   int ret = 0;   byte b = buf[++bp];   while (true) {    ret = ret*10+b-'0';    b = buf[++bp];    if (b<'0'||b>'9') {    while (buf[bp+1]=='\r'||buf[bp+1]=='\n'||buf[bp+1]==' ') {++bp;}    break;    }   }   return ret;  } }
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 ArrayList<long[]>[] ngw(int n, int m) {   ArrayList<long[]>[] graph=(ArrayList<long[]>[])new ArrayList[n];   for(int i=0;i<n;i++) {    graph[i]=new ArrayList<>();   }   for(int i=1;i<=m;i++) {    long s=in.nextLong()-1,e=in.nextLong()-1,w=in.nextLong();    graph[(int)s].add(new long[] {e,w});    graph[(int)e].add(new long[] {s,w});   }   return graph;  }  private int ni() {   return in.nextInt();  }  private long nl() {   return in.nextLong();  }  private String ns() {   return in.next();  }  private long[] na(int n) {   long[] A=new long[n];   for(int i=0;i<n;i++) {    A[i]=in.nextLong();   }   return A;  }  private int[] nia(int n) {   int[] A=new int[n];   for(int i=0;i<n;i++) {    A[i]=in.nextInt();   }   return A;  } } 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 Main {  public static void main(String[] args) throws Exception {   Thread thread = new Thread(null, new TaskAdapter(), "", 1 << 29);   thread.start();   thread.join();  }  static class TaskAdapter implements Runnable {   @Override   public void run() {    InputStream inputStream = System.in;    OutputStream outputStream = System.out;    FastInput in = new FastInput(inputStream);    FastOutput out = new FastOutput(outputStream);    CCompressionAndExpansion solver = new CCompressionAndExpansion();    int testCount = Integer.parseInt(in.next());    for (int i = 1; i <= testCount; i++)     solver.solve(i, in, out);    out.close();   }  }  static class CCompressionAndExpansion {   Node end = new Node(null, -1);   FastOutput out;   public void solve(int testNumber, FastInput in, FastOutput out) {    int n = in.ri();    List<Node> seq = new ArrayList<>(n);    Deque<Node> dq = new ArrayDeque<>(n);    end = new Node(null, -1);    dq.addLast(end);    for (int i = 0; i < n; i++) {     int x = in.ri();     while (true) {      Node last = dq.peekLast();      if (last.nextChild != x) {       dq.removeLast();       continue;      }      last.nextChild++;      dq.addLast(new Node(dq.peekLast(), x));      break;     }     seq.add(dq.peekLast());    }    this.out = out;    for (Node node : seq) {     print(node);     out.println();    }   }   void print(Node root) {    if (root.p != end) {     print(root.p);     out.append('.');    }    out.append(root.index);   }  }  static class FastInput {   private final InputStream is;   private StringBuilder defaultStringBuf = new StringBuilder(1 << 13);   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 String next() {    return readString();   }   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;   }   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);   }  }  static class Node {   Node p;   int index;   int nextChild = 1;   public Node(Node p, int index) {    this.p = p;    this.index = index;   }  }  static class FastOutput implements AutoCloseable, Closeable, Appendable {   private static 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 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();   }  } }
3	public class CF_1141F2 {  public static void main(String args[]) throws Exception {   BufferedScanner in = new BufferedScanner(new InputStreamReader(System.in));   PrintStream out = new PrintStream(new BufferedOutputStream(System.out));   int n = in.nextInt();   int[] arr = in.nextN(n);   HashMap<Integer, ArrayList<Point>> lp = new HashMap<>();   for (int i = 0; i < n; i++) {    int curr = 0;    for (int j = i; j >= 0; j--) {     curr += arr[j];     if (!lp.containsKey(curr)) lp.put(curr, new ArrayList<>());     lp.get(curr).add(new Point(j, i));    }   }   ArrayList<Point> retPs = new ArrayList<>();   for (ArrayList<Point> ps : lp.values()) {    Collections.sort(ps, (a, b) -> a.y - b.y);    ArrayList<Point> currPs = new ArrayList<>();    for (int i = 0; i < ps.size(); ) {     Point curr = ps.get(i);     currPs.add(curr);     while (i < ps.size() && ps.get(i).x <= curr.y) i++;    }    if(currPs.size() > retPs.size()) retPs = currPs;   }   out.println(retPs.size());   for (Point p : retPs) out.println((p.x + 1) + " " + (p.y + 1));    out.close();   in.close();  }  static class BufferedScanner {   private BufferedReader in;   private StringTokenizer st;   BufferedScanner(Reader in) throws IOException {    this.in = new BufferedReader(in);    st = new StringTokenizer(this.in.readLine());   }   int nextInt() throws IOException {    return Integer.parseInt(next());   }   long nextLong() throws IOException {    return Long.parseLong(next());   }   int[] nextN(int n) throws IOException {    int[] ret = new int[n];    for (int i = 0; i < n; i++) ret[i] = this.nextInt();    return ret;   }   long[] nextNL(int n) throws IOException {    long[] ret = new long[n];    for (int i = 0; i < n; i++) ret[i] = this.nextLong();    return ret;   }   String next() throws IOException {    if (!st.hasMoreElements()) st = new StringTokenizer(in.readLine());    return st.nextToken();   }   void close() throws IOException {    in.close();   }  } }
0	public class C {  static StringBuilder st = new StringBuilder();  public static void main(String[] args) throws Exception {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  Point [] square = new Point [4] ;  Point [] rotSquare = new Point[4] ;    for(int i = 0 ; i < 4 ;i++)  square[i] = new Point(sc.nextInt() , sc.nextInt());   for(int i = 0 ; i < 4 ;i++)  rotSquare[i] = new Point(sc.nextInt() , sc.nextInt());   boolean can = false ;    for(int x = -100 ; x <= 100 ; x++)  for(int y = -100 ; y <= 100 ; y++)   can |= inside(new Point(x , y), square) & inside(new Point (x , y), rotSquare);         out.println(can ? "YES" : "NO");   out.flush();  out.close();  } static int crossProduct(Point a , Point b) {  int ans = a.x * b.y - a.y * b.x ;    if(ans < 0)return -1 ;  if(ans == 0) return 0 ;  return 1 ;  }  static boolean inside(Point a , Point [] points) {  boolean allPos = true ;  boolean allNeg = true ;    for(int i = 0 ; i < 4 ; i++)  {  Point v1 = new Point (points[i].x - a.x , points[i].y - a.y) ;   Point v2 = new Point (points[(i + 1) % 4].x - a.x , points[(i + 1) % 4].y - a.y) ;     allPos &= crossProduct(v1, v2) >= 0;  allNeg &= crossProduct(v1, v2) <= 0;  }  return allPos | allNeg ;   }  static class Scanner {  BufferedReader br;  StringTokenizer st;  Scanner(InputStream in) {  br = new BufferedReader(new InputStreamReader(System.in));  }  String next() throws Exception {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());   return st.nextToken();  }  int nextInt() throws Exception {  return Integer.parseInt(next());  }  long nextLong() throws Exception {  return Long.parseLong(next());  }  double nextDouble() throws Exception {  return Double.parseDouble(next());  }  }  static void shuffle(int[] a) {  int n = a.length;  for (int i = 0; i < n; i++) {  int r = i + (int) (Math.random() * (n - i));  int tmp = a[i];  a[i] = a[r];  a[r] = tmp;  } } }
0	public class A {  public static void main(String[] args) {   Scanner input = new Scanner(System.in);   long n = input.nextLong();   System.out.println("25");  } }
1	public class A {  public static void main(String[] args)throws Throwable {   MyScanner sc=new MyScanner();   PrintWriter pw=new PrintWriter(System.out);   int n=sc.nextInt();   int d=sc.nextInt();   int [] a=new int [n];   for(int i=0;i<n;i++)    a[i]=sc.nextInt();   int ans=2;   for(int i=0;i<n-1;i++){    if(a[i+1]-a[i]<2*d)     continue;    if(a[i+1]-a[i]==2*d)     ans++;    else     ans+=2;   }   pw.println(ans);   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());}   long nextLong() {return Long.parseLong(next());}   double nextDouble() {return Double.parseDouble(next());}   String nextLine(){String str = "";    try {str = br.readLine();}    catch (IOException e) {e.printStackTrace();}    return str;}  } }
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));  }     static class MyAlgo{     long gcd(long a, long b){    if (a == 0) return b;    return gcd(b % a, a);   }     long lcm(long a, long b){    return a / gcd(a, b)*b;   }   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;   }     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;   }     long binpowmod(long a, int n, int m){    if (n == 0) return 1;    if ((n & 1) == 0){     long b = binpow(a, n/2);     return (b*b) % m;    }else return binpow(a, n-1)*a % m;   }     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);   }     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;    }   }     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);    }   }     boolean IsProbablyPrime(long n){    if (n == 1) return false;    if ((n & 1) == 0) return false;    for (int j = 3; j < sqrt(n) + 1; j += 2){     if (n % j == 0) return false;    }    return true;   }   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 class Permutation {       int[] a;    int n;       public Permutation(int n){     this.n=n;     a=new int[n];     for (int i=0; i<n; i++){      a[i]=i;     }    }       public boolean nextPermutation(){     int i=n-1;     for (i=n-2; i>=0; i--){      if (a[i]<a[i+1]){       break;      }     }     if (i==-1){      return false;     }     int jMin=i+1;     for (int j=n-1; j>i; j--){      if (a[i]<a[j]&&a[j]<a[jMin]){       jMin=j;      }     }     swap(i, jMin);     for (int j=1; j<=(n-i)/2; j++){      swap(i+j, n-j);     }     return true;    }           public int get(int i){     return a[i];    }       void swap(int i, int j){     int r=a[i];     a[i]=a[j];     a[j]=r;    }   }     public 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 divide(Fraction f){     Fraction fResult = new Fraction();     fResult.numerator = numerator * f.denominator;     fResult.denominator = denominator * f.numerator;     fResult.Cancellation();     return fResult;    }       @Override    public int compareTo(Fraction f){     long g = gcd(denominator, f.denominator);     long res = numerator * (f.denominator / g) - f.numerator * (denominator / g);     if (res < 0){      return -1;     }     if (res > 0){      return 1;     }     return 0;    }       public Fraction clone(){     Fraction fResult = new Fraction(numerator, denominator);     return fResult;    }       public Fraction floor(){     Fraction fResult = this.clone();     fResult.numerator = (fResult.numerator / fResult.denominator) * fResult.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);    }   }     class FenwickTree_1{        int n;    long[] t;       public FenwickTree_1(int n){     this.n = n;     t = new long[n];    }       public long sum(int xl, int xr){     return sum(xr) - sum(xl);    }       public long sum(int x){     long result = 0;     for (int i = x; i >= 0; i = (i & (i + 1)) - 1){      result += t[i];     }     return result;    }       public void update(int x, long delta){     for (int i = x; i < n; i = (i | (i + 1))){      t[i] += delta;     }    }   }     class FenwickTree_2{        int n, m;    long[][] t;       public FenwickTree_2(int n, int m){     this.n = n;     this.m = m;     t = new long[n][m];    }       public long sum(int xl, int yl, int xr, int yr){     return sum(xr, yr) - sum(xl - 1, yr) - sum(xr, yl - 1) + sum(xl - 1, yl - 1);    }       public long sum(int x, int y){     long result = 0;     for (int i = x; i >= 0; i = (i & (i + 1)) - 1){      for (int j = y; j >= 0; j = (j & (j + 1)) - 1){       result+=t[i][j];      }     }     return result;    }       public void update(int x, int y, long delta){     for (int i = x; i < n; i = (i | (i + 1))){      for (int j = y; j < m; j = (j | (j + 1))){       t[i][j] += delta;      }     }    }   }     class FenwickTree_3{        int n, m, l;    long[][][] t;       public FenwickTree_3(int n, int m, int l){     this.n = n;     this.m = m;     this.l = l;     t = new long[n][m][l];    }       public long sum(int xl, int yl, int zl, int xr, int yr, int zr){     return sum(xr, yr, zr) - sum(xl - 1, yr, zr)     + sum(xl - 1, yr, zl - 1) - sum(xr, yr, zl - 1)     - sum(xr, yl - 1, zr) + sum(xl - 1, yl - 1, zr)     - sum(xl - 1, yl - 1, zl - 1) + sum(xr, yl - 1, zl - 1);    }       public long sum(int x, int y, int z){     long result = 0;     for (int i = x; i >= 0; i = (i & (i + 1)) - 1){      for (int j = y; j >= 0; j = (j & (j + 1)) - 1){       for (int k = z; k >= 0; k = (k & (k + 1)) - 1){        result += t[i][j][k];       }      }     }     return result;    }       public void update(int x, int y, int z, long delta){     for (int i = x; i < n; i = (i | (i + 1))){      for (int j = y; j < n; j = (j | (j + 1))){       for (int k = z; k < n; k = (k | (k + 1))){        t[i][j][k] += delta;       }      }     }    }   }  } }
0	public class A {  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter out;   public void solve() throws IOException {    long A = nextLong();  long B = nextLong();   long ans = 0;  while(A > 0){  if(A >= B){   ans += A/B;   A %= B;   if(A == 0) break;  }  else{   long tmp = A; A = B; B = tmp;  }   }   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());  }  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();  } }
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 {  class Team implements Comparable<Team> {   int solved = 0;   int penalty = 0;   Team(int solved, int penalty) {    this.solved = solved;    this.penalty = penalty;   }   public int compareTo(Team o) {    return this.solved == o.solved ? this.penalty - o.penalty : -(this.solved - o.solved);   }   public boolean equals(Object obj) {    if (obj instanceof Team) {     Team o = (Team) obj;     return ((this.solved == o.solved) && (this.penalty == o.penalty));    }    return false;   }  }  public void solve(int testNumber, InputReader in, OutputWriter out) {   int n = in.nextInt();   int k = in.nextInt();   Team[] teams = new Team[n];   for (int i = 0; i < n; i++)    teams[i] = new Team(in.nextInt(), in.nextInt());   Arrays.sort(teams);   int[] top = new int[n];   int[] map = new int[n];   int cur = -1;   for (int i = 0; i < n; i++) {    if (i == 0 || !teams[i].equals(teams[i - 1])) cur = i;    top[cur]++;    map[i] = cur;   }   out.println(top[map[k - 1]]);  } } 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());  }   } 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++) {    writer.print(objects[i]);   }  }  public void println(Object... objects) {   print(objects);   writer.println();  }  public void close() {   writer.close();  } }
1	public class Main {    public static void main(String[] args) {     try   {    Parserdoubt pd=new Parserdoubt(System.in);    int t=pd.nextInt();    int inde=0,indo=0,o=0,e=0;    for(int i=0;i<t;i++)    {     if(pd.nextInt()%2==0)     {      inde=i;      e++;     }     else     {      o++;      indo=i;     }    }    if(o==1)    {     System.out.println(indo+1);    }    else    {     System.out.println(inde+1);    }   }   catch(Exception e){}  } } class Parserdoubt {  final private 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 char nextChar() throws Exception  {   byte c=read();   while(c<=' ') c= read();   return (char)c;  }  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++];  } }
1	public class q1 { int m=(int)1e9+7; public class Node { int a; int b; public void Node(int a,int b) {  this.a=a;  this.b=b; } } public int mul(int a ,int b) { a=a%m; b=b%m; return((a*b)%m); } public int pow(int a,int b) { int x=1; while(b>0) {  if(b%2!=0)  x=mul(x,a);  a=mul(a,a);  b=b/2; } return x; } 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);    } }
0	public class A267 {  static public long _solve(long a,long b){   long result = -1;   while(a!=0 && b!=0){    if(a>b){     result +=(a/b);     a = a%b;    }    else{     result +=(b/a);     b = b%a;    }   }   return result+1;  }  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int t = in.nextInt();   long a,b;   while(t-- > 0){    a = in.nextLong();    b = in.nextLong();    System.out.println(_solve(a,b));   }  }   static class Scanner {   StringTokenizer st;   BufferedReader br;   public Scanner(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }   public Scanner(FileReader r) {    br = new BufferedReader(r);   }   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());   }   public long nextLong() {    return Long.parseLong(next());   }   public String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   public double nextDouble() {    return Double.parseDouble(next());   }   public boolean ready() throws IOException {    return br.ready();   }  } }
0	public class Subtractions {  public static void main(String[] args) {   Scanner scanner = new Scanner(System.in);   int numberOfTests = scanner.nextInt();   while (numberOfTests-- > 0) {    int a = scanner.nextInt();    int b = scanner.nextInt();    int[] res = new int[1];    compute(a, b, res);    System.out.println(res[0]);   }  }  private static void compute(int x, int y, int[] res) {   if (x == 0 || y == 0) {    return;   }   int tmp;   if (x < y) {    tmp = x;    x = y;    y = tmp;   }   res[0] += x / y;   tmp = x % y;   if (tmp == 0) {    return;   }   x = y;   y = tmp;   compute(x, y, res);  } }
5	public class Solution {  BufferedReader in;  PrintWriter out;  StringTokenizer st;  static class Pair implements Comparable<Pair> {   int x, a;   Pair(int x, int a) {    this.x = x;    this.a = a;   }   @Override   public int compareTo(Pair o) {       return 0;   }  }  boolean isCross(double l1, double r1, double l2, double r2) {   double r = min(r1, r2);   double l = max(l1, l2);   return r > l;  }  boolean check(double xl, double xr, double[] l, double[] r, int n) {   boolean ok = false;   for (int j = 0; j < n; ++j)    ok |= isCross(xl, xr, l[j], r[j]);   return ok;  }  void solve() throws IOException {   int n = ni();   double t = ni();   double[] l = new double[n];   double[] r = new double[n];   for (int i = 0; i < l.length; i++) {    double x = ni();    double len = ni();    l[i] = x - len / 2.0;    r[i] = x + len / 2.0;   }   HashSet<Double> set = new HashSet<Double>();   for (int i = 0; i < n; ++i) {    double xl = l[i] - t;    double xr = l[i];    boolean ok = check(xl, xr, l, r, n);    if (!ok)     set.add(xl);    xl = r[i];    xr = r[i] + t;    ok = check(xl, xr, l, r, n);    if (!ok)     set.add(xl);   }   out.println(set.size());  }  public Solution() throws IOException {   Locale.setDefault(Locale.US);   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   solve();   in.close();   out.close();  }  String ns() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int ni() throws IOException {   return Integer.valueOf(ns());  }  long nl() throws IOException {   return Long.valueOf(ns());  }  double nd() throws IOException {   return Double.valueOf(ns());  }  public static void main(String[] args) throws IOException {   new Solution();  } }
6	public class Main implements Runnable {  private int n;  private int nn;  private long[][] dp;  private boolean[][] gr;      private void solve() throws Throwable {   n = nextInt();   nn = 1 << n;   gr = new boolean[n][n];   dp = new long[n][nn];   for (int i = 0; i < n; i++) {    Arrays.fill(dp[i], -1);   }   int m = nextInt();   for (int i = 0; i < m; i++) {    int a = nextInt() - 1, b = nextInt() - 1;    gr[a][b] = gr[b][a] = true;   }   for (int i = 0; i < n; i++) {    dp[i][0] = 0;   }   for (int mask = 1; mask < nn; mask++) {    int bCount = Integer.bitCount(mask);    if (bCount < 2) {     dp[Integer.numberOfTrailingZeros(mask)][mask] = 0;    } else if (bCount == 2) {     int msk = mask;     int one = Integer.numberOfTrailingZeros(msk);     msk ^= (1 << one);     int two = Integer.numberOfTrailingZeros(msk);     dp[two][mask] = gr[one][two] ? 1 : 0;    }   }   long count = 0;   for (int mask = 1; mask < nn; mask++) {    if (Integer.bitCount(mask) < 3) continue;    int i = Integer.numberOfTrailingZeros(mask);    for (int j = i + 1; j < n; j++) {     int jj = 1 << j;     if (gr[i][j] && ((jj & mask) != 0)) {      count += Dp(j, mask);     }    }   }   pw.println(count / 2);  }  private long Dp(int j, int mask) {   if (dp[j][mask] != -1) return dp[j][mask];   int i = Integer.numberOfTrailingZeros(mask);   assert i < j;   int m = mask ^ (1 << j);   long ans = 0;   for (int p = i + 1; p < n; p++) {    if (!gr[p][j]) continue;    if ((mask & (1 << p)) == 0) continue;    ans += Dp(p, m);   }   dp[j][mask] = ans;   return ans;  }      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());  }  long nextLong() throws NumberFormatException, IOException {   return Long.parseLong(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;   }  }  public void run() {   try {    initStreams();    solve();   } catch (Throwable e) {    sError = e;   } finally {    if (pw != null)     pw.close();   }  } }
0	public class C {   public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer tokenizer= new StringTokenizer(br.readLine());  BigInteger left = new BigInteger(tokenizer.nextToken());  BigInteger right= new BigInteger(tokenizer.nextToken());  BigInteger val= (right.subtract(left)).add(new BigInteger(""+1));  if(val.intValue()<3){  System.out.println(-1);  return;    }   BigInteger a, b, c;  BigInteger i=left;  while(i.intValue()<=right.intValue()){  BigInteger temp1=i;   BigInteger temp2= i.add(new BigInteger(""+1));  BigInteger j=temp2.add(new BigInteger(""+1));  while(j.intValue()<=right.intValue()){   BigInteger b1= temp2;   BigInteger b2 =j;   BigInteger b3 = temp1;   BigInteger gcd= b1.gcd(b2);   if(gcd.intValue()==1){   BigInteger gcd2 =b2.gcd(b3);   if(gcd2.intValue() !=1){    a=b3;    b= b1;    c= b2;    System.out.print(a+" "+b+" "+c+" ");    System.out.println();    return ;   }   }   j=j.add(new BigInteger(""+1));  }  i=i.add(new BigInteger(""+1));  }  System.out.println(-1); } }
2	public class Main {  static class LeftOver {   int a;   long b;   long c;   LeftOver(int a, long b, long c) {    this.a = a;    this.b = b;    this.c = c;   }  }  private static 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;   }  }  private static 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 Test{  static int pos = 0 ;  static int arr[] ;  static LinkedList l1 = new LinkedList() ; static void find(int p ,char[]x,int put[],String s){  int c= 0 ;  for (int i = 0; i < s.length(); i++) {   if(x[p]==s.charAt(i)){   c++ ; }  }  put[p] = c ; } static int mode(int m ,int[]x ){  int temp = 0 ;  for (int i = x.length-1; i >=0; i--) {   if(x[i]<=m){    temp= x[i] ;        return m-temp ;       }  }  return m-temp ; } static int mode2(int m ,int[]x ){  int temp = 0 ;    for (int i = x.length-1; i >=0; i--) {   if(x[i]<=m){    temp= x[i] ;        return x[i] ;       }  }  return 0 ; } static int find(int x[],int temp){  int j = 0 ;  for (int i = x.length-1; i >=0; i--) {   if(x[i]==temp) return j+1 ;   j++ ;  }  return -1 ; } static String ch(long[]x,long b){  for (int i = 0; i < x.length; i++) {   if(x[i]==b)return "YES" ;  }  return "NO" ; }  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); }     }
4	public class Main{  public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));  static long MOD = (long) (1e9 + 7);   static long MOD2 = MOD * MOD;  static FastReader sc = new FastReader();  static int pInf = Integer.MAX_VALUE;  static int nInf = Integer.MIN_VALUE;  static long ded = (long)(1e17)+9;  public static void main(String[] args) throws Exception {   int test = 1;   for (int i = 1; i <= test; i++){    solve();   }   out.flush();   out.close();  }  static int n,m;  static int[][] hor,ver;  static Long[][][] dp;  static void solve(){   n = sc.nextInt();   m = sc.nextInt();   int k = sc.nextInt();   dp = new Long[n+1][m+1][k+1];   hor = new int[n][m-1];   ver = new int[n-1][m];   for(int i = 0; i < n; i++){    for(int j = 0; j < m-1; j++){     hor[i][j] = sc.nextInt();    }   }   for(int i = 0; i < n-1; i++){    for(int j = 0; j < m; j++){     ver[i][j] = sc.nextInt();    }   }   if(k%2==1){    for(int i = 0; i < n; i++){     for(int j = 0; j < m; j++){      out.print(-1+" ");     }     out.println();    }    return;   }   k = k/2;   for(int i = 0; i < n; i++){    for(int j = 0; j < m; j++){     long[] dp = new long[k+1];     for(int l = 1; l <= k; l++){      dp[l] = cal(i,j,l);     }     for(int l = 1; l <= k; l++){      for(int g = 1; g < l; g++){       dp[l] = Math.min(dp[l],dp[g]+dp[l-g]);      }     }     out.print(2*dp[k]+" ");    }    out.println();   }  }  static long cal(int i, int j,int k){   if(k==0)return 0;   if(dp[i][j][k]!=null)return dp[i][j][k];   long ans = ded;   for(int h = 0; h < 4; h++){    int ni = i+di[h];    int nj = j+dj[h];    if(e(ni,nj)){     int cost = 0;     if(ni==i){      if(nj>j){       cost = hor[i][j];      }else{       cost = hor[i][nj];      }     }if(nj==j){      if(ni>i){       cost = ver[i][j];      }else{       cost = ver[ni][j];      }     }     ans = Math.min(ans,(cost)+cal(ni,nj,k-1));    }   }   return dp[i][j][k] = ans;  }  static int[] di = new int[]{0,-1,0,1};  static int[] dj = new int[]{-1,0,1,0};  static boolean e(int i, int j){   return i>=0&&j>=0&&i<n&&j<m;  }  static class Pair implements Comparable<Pair> {   int x;   int y;   public Pair(int x, int y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(Pair o){    return this.x-o.x;   }   @Override   public String toString() {    return "Pair{" + "x=" + x + ", y=" + y + '}';   }   public boolean equals(Pair o){    return this.x==o.x&&this.y==o.y;   }  }  public static long mul(long a, long b) {   return ((a % MOD) * (b % MOD)) % MOD;  }  public static long add(long a, long b) {   return ((a % MOD) + (b % MOD)) % MOD;  }  public static long c2(long n) {   if ((n & 1) == 0) {    return mul(n / 2, n - 1);   } else {    return mul(n, (n - 1) / 2);   }  }   static final Random random = new Random();  static void ruffleSort(int[] a) {   int n = a.length;   for (int i = 0; i < n; i++) {    int oi = random.nextInt(n); int temp= a[oi];    a[oi] = a[i];    a[i] = temp;   }   Arrays.sort(a);  }   static long countSetBits(long n) {   if (n == 0) return 0;   return 1 + countSetBits(n & (n - 1));  }   static long gcd(long A, long B) {   if (B == 0) return A;   return gcd(B, A % B);  }   static long fastExpo(long x, long n) {   if (n == 0) return 1;   if ((n & 1) == 0) return fastExpo((x * x) % MOD, n / 2) % MOD;   return ((x % MOD) * fastExpo((x * x) % MOD, (n - 1) / 2)) % MOD;  }   static boolean isPrime(long n) {   if (n <= 1) return false;   if (n <= 3) return true;   if (n % 2 == 0 || n % 3 == 0) return false;   for (int i = 5; i <= Math.sqrt(n); i += 6)    if (n % i == 0 || n % (i + 2) == 0) return false;   return true;  }  public static long modinv(long x) {   return modpow(x, MOD - 2);  }  public static long modpow(long a, long b) {   if (b == 0) {    return 1;   }   long x = modpow(a, b / 2);   x = (x * x) % MOD;   if (b % 2 == 1) {    return (x * a) % MOD;   }   return x;  }   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());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
3	public class Main {  public static void main(String[] args) throws Exception {   new Main().run();}                                                                                                       static long mul(long a, long b, long p)  {   long res=0,base=a;   while(b>0)   {    if((b&1L)>0)     res=(res+base)%p;    base=(base+base)%p;    b>>=1;   }   return res;  }  static long mod_pow(long k,long n,long p){   long res = 1L;   long temp = k;   while(n!=0L){    if((n&1L)==1L){     res = (res*temp)%p;    }    temp = (temp*temp)%p;    n = n>>1L;   }   return res%p;  }  int ct = 0;  int f[] =new int[200001];  int b[] =new int[200001];  int str[] =new int[200001];  void go(int rt,List<Integer> g[]){   str[ct] = rt;   f[rt] = ct;   for(int cd:g[rt]){    ct++;    go(cd,g);   }   b[rt] = ct;  }  int add =0;  void go(int rt,int sd,int k,List<Integer> g[],int n){   if(add>n) {    return;   }   Queue<Integer> q =new LinkedList<>();   q.offer(rt);   for(int i=1;i<=sd;++i){    int sz =q.size();    if(sz==0) break;    int f = (i==1?2:1);    while(sz-->0){     int cur = q.poll();     for(int j=0;j<k-f;++j){      q.offer(add);      g[cur].add(add);add++;      if(add==n+1){       return;      }     }    }   }   }   void solve() {   int n = ni();   int s[] = new int[n+1];   for(int i=0;i<n;++i){    s[i+1] = s[i] + ni();   }   Map<Integer,List<int[]>> mp = new HashMap<>();   for(int i=0;i<n;++i) {    for (int j = i; j>=0; --j) {     int v = s[i+1]-s[j];     if(!mp.containsKey(v)){      mp.put(v, new ArrayList<>());     }     mp.get(v).add(new int[]{j,i});    }   }   int all = 0;int vv = -1;   for(int v:mp.keySet()){    List<int[]> r = mp.get(v);    int sz = r.size();int c = 0;    int ri = -2000000000;    for(int j=0;j<sz;++j){     if(r.get(j)[0]>ri){      ri = r.get(j)[1];c++;     }    }    if(c>all){     all = c;     vv = v;    }   }   println(all);   List<int[]> r = mp.get(vv);   int sz = r.size();int c = 0;   int ri = -2000000000;   for(int j=0;j<sz;++j){    if(r.get(j)[0]>ri){     ri = r.get(j)[1];println((1+r.get(j)[0])+" "+(1+r.get(j)[1]));    }   }                                                                                                                                                }       long t1[];   void update(long[] t,int i,long v){   for(;i<t.length;i+=(i&-i)){    t[i] += v;   }  }  long get(long[] t,int i){   long s = 0;   for(;i>0;i-=(i&-i)){    s += t[i];   }   return s;  }  int equal_bigger(long t[],long v){   int s=0,p=0;   for(int i=Integer.numberOfTrailingZeros(Integer.highestOneBit(t.length));i>=0;--i) {    if(p+(1<<i)< t.length && s + t[p+(1<<i)] < v){     v -= t[p+(1<<i)];     p |= 1<<i;    }   }   return p+1;  }      static class S{   int l = 0;   int r = 0 ;   long le = 0;   long ri = 0;   long tot = 0;   long all = 0;   public S(int l,int r) {    this.l = l;    this.r = r;   }  }  static S a[];  static int[] o;  static void init(int[] f){   o = f;   int len = o.length;   a = new S[len*4];   build(1,0,len-1);  }  static void build(int num,int l,int r){   S cur = new S(l,r);   if(l==r){    a[num] = cur;    return;   }else{    int m = (l+r)>>1;    int le = num<<1;    int ri = le|1;    build(le, l,m);    build(ri, m+1,r);    a[num] = cur;    pushup(num, le, ri);   }  }                static long dd = 10007;  static void update(int num,int l,long v){   if(a[num].l==a[num].r){    a[num].le = v%dd;    a[num].ri = v%dd;    a[num].all = v%dd;    a[num].tot = v%dd;   }else{    int m = (a[num].l+a[num].r)>>1;    int le = num<<1;    int ri = le|1;    pushdown(num, le, ri);    if(l<=m){     update(le,l,v);    }    if(l>m){     update(ri,l,v);    }    pushup(num,le,ri);   }  }  static void pushup(int num,int le,int ri){   a[num].all = (a[le].all*a[ri].all)%dd;   a[num].le = (a[le].le + a[le].all*a[ri].le)%dd;   a[num].ri = (a[ri].ri + a[ri].all*a[le].ri)%dd;   a[num].tot = (a[le].tot + a[ri].tot + a[le].ri*a[ri].le)%dd;     }  static void pushdown(int num,int le,int ri){  }   int gcd(int a,int b){ return b==0?a: gcd(b,a%b);}  InputStream is;PrintWriter out;  void run() throws Exception {is = System.in;out = new PrintWriter(System.out);solve();out.flush();}  private byte[] inbuf = new byte[2];  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 double nd() {return Double.parseDouble(ns());}  private char nc() {return (char) skip();}  private char ncc() {int b;while((b = readByte()) != -1 && !(b >= 32 && b <= 126));return (char)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 String nline() {int b = skip();StringBuilder sb = new StringBuilder();   while (!isSpaceChar(b) || b == ' ') { sb.appendCodePoint(b);b = readByte(); }   return sb.toString();}  private char[][] nm(int n, int m) {char[][] a = new char[n][];for (int i = 0; i < n; i++) a[i] = ns(m);return a;}  private int[] na(int n) {int[] a = new int[n];for (int i = 0; i < n; i++) a[i] = ni();return a;}  private long[] nal(int n) { long[] a = new long[n];for (int i = 0; i < n; i++) a[i] = nl();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 << 3) + (num << 1) + (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();}}  void print(Object obj){out.print(obj);}  void println(Object obj){out.println(obj);}  void println(){out.println();} }
5	public class A implements Runnable { public static void main(String[] args) {  new A().run(); }  class FastScanner {  BufferedReader br;  StringTokenizer st;  boolean eof;  String buf;  public FastScanner(String fileName) throws FileNotFoundException {  br = new BufferedReader(new FileReader(fileName));  nextToken();  }  public FastScanner(InputStream stream) {  br = new BufferedReader(new InputStreamReader(stream));  nextToken();  }  String nextToken() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (Exception e) {   eof = true;   break;   }  }  String ret = buf;  buf = eof ? "-1" : st.nextToken();  return ret;  }  int nextInt() {  return Integer.parseInt(nextToken());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  }  void close() {  try {   br.close();  } catch (Exception e) {   }  }  boolean isEOF() {  return eof;  } }  FastScanner sc; PrintWriter out;  public void run() {  Locale.setDefault(Locale.US);  try {  sc = new FastScanner(System.in);  out = new PrintWriter(System.out);  solve();  sc.close();  out.close();  } catch (Throwable e) {  e.printStackTrace();  System.exit(1);  } }  int nextInt() {  return sc.nextInt(); }  String nextToken() {  return sc.nextToken(); }  long nextLong() {  return sc.nextLong(); }  double nextDouble() {  return sc.nextDouble(); }  void solve() {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  Arrays.sort(a);  int i = 1;  while (i < n && a[i] == a[i - 1]) {  ++i;  }  if (i >= n) {  out.println("NO");  } else {  out.println(a[i]);  } } }
1	public class A {  static StreamTokenizer in =  new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  static int nextInt() throws IOException{  in.nextToken();  return (int)in.nval; }  static PrintWriter out = new PrintWriter(System.out);  static boolean prime(int n){  int j = 2;  while (j*j <= n)  if (n%j == 0) return false;  else j++;   return true; }  public static void main(String[] args) throws IOException{  int n = nextInt(),  k = nextInt(),  a[] = new int[n];  int s = 0;  for (int i=2; i<=n; i++)  if (prime(i))   a[s++] = i;   int m = 0;  for (int i=2; i<s; i++)  for (int j=i-1; j>0; j--)   if (a[i] == a[j]+a[j-1]+1){   m++;   break;   }   if (m >= k) out.println("YES");  else out.println("NO");  out.flush(); } }
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"); } }
3	public class Main{  static ArrayList a[]=new ArrayList[5000001]; static Vector<pair>schedule_it(ArrayList<pair> v) {  Vector<pair >ans=new Vector<>();  Collections.sort(v, new Comparator<pair>() {  public int compare(pair p1,pair p2) {   if(p1.y<p2.y)   return -1;   if(p1.y>p2.y)   return 1;   if(p1.x<p2.x)   return -1;   if(p1.x>p2.x)   return 1;   return 0;  }  });  int end=-1;  for(int i=0;i<v.size();i++) {  pair p=v.get(i);  if(p.x>end) {   ans.add(p);   end=p.y;  }  }  return ans; } public static void main(String[] args)  {   InputReader in=new InputReader(System.in);   PrintWriter pw = new PrintWriter(System.out);   int n=in.nextInt();   long arr[]=new long[n];   for(int i=0;i<n;i++) {   arr[i]=in.nextLong();   }   HashMap<Long,Integer>hm=new HashMap<>();   int id=0;   for(int i=0;i<n;i++) {   long sum=0;   for(int j=i;j<n;j++) {    sum+=arr[j];    if(!hm.containsKey(sum)) {    hm.put(sum, id++);    a[id-1]=new ArrayList<pair>();    }    a[hm.get(sum)].add(new pair(i,j));   }   }   Vector<pair>fi=new Vector<>();   for(int i=0;i<id;i++) {   Vector<pair> v=schedule_it(a[i]);   if(v.size()>fi.size()) {    fi=v;   }   }   pw.println(fi.size());   for(int i=0;i<fi.size();i++) {   pw.println((fi.get(i).x+1)+" "+(fi.get(i).y+1));   }   pw.flush();   pw.close();    }   private static void debug(Object... o) {   System.out.println(Arrays.deepToString(o));   }   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 int[] nextIntArray(int n)   {    int a[] = new int[n];    for (int i = 0; i < n; i++)    {     a[i] = nextInt();    }    return a;   }   static class tri implements Comparable<tri> {    int p, c, l;     tri(int p, int c, int l) {     this.p = p;     this.c = c;     this.l = l;    }     public int compareTo(tri o) {     return Integer.compare(l, o.l);    }   }    public String readString()   {    int c = snext();    while (isSpaceChar(c))    {     c = snext();    }    StringBuilder res = new StringBuilder();    do    {     res.appendCodePoint(c);     c = snext();    } while (!isSpaceChar(c));    return res.toString();   }    public String nextLine()   {    int c = snext();    while (isSpaceChar(c))     c = snext();    StringBuilder res = new StringBuilder();    do    {     res.appendCodePoint(c);     c = snext();    } while (!isEndOfLine(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;   }    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[] suffle(int[] a,Random gen)   {    int n = a.length;    for(int i=0;i<n;i++)    {     int ind = gen.nextInt(n-i)+i;     int temp = a[ind];     a[ind] = a[i];     a[i] = temp;    }    return a;   }     public static void swap(int a, int b){    int temp = a;    a = b;    b = temp;   }          public static void sieve(boolean[] isPrime,int n)   {    for(int i=1;i<n;i++)     isPrime[i] = true;       isPrime[0] = false;    isPrime[1] = false;       for(int i=2;i*i<n;i++)    {     if(isPrime[i] == true)     {      for(int j=(2*i);j<n;j+=i)       isPrime[j] = false;     }    }   }     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 long LCM(long a,long b)   {    return (a*b)/GCD(a,b);   }     public static int LCM(int a,int b)   {    return (a*b)/GCD(a,b);   }     public static int binaryExponentiation(int x,int n)   {    int result=1;    while(n>0)    {     if(n % 2 ==1)      result=result * x;     x=x*x;     n=n/2;    }    return result;   }     public static long binaryExponentiation(long x,long n)   {    long result=1;    while(n>0)    {     if(n % 2 ==1)      result=result * x;     x=x*x;     n=n/2;    }    return result;   }     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%M*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%M * x%M)%M;     x=(x%M * x%M)%M;     n=n/2;    }    return result;   }     public static long modInverse(int A,int M)   {    return modularExponentiation(A,M-2,M);   }     public static long modInverse(long A,long M)   {    return modularExponentiation(A,M-2,M);   }     public static boolean isPrime(int n)   {       if (n <= 1) return false;    if (n <= 3) return true;       if (n%2 == 0 || n%3 == 0)     return false;       for (int i=5; i*i<=n; i=i+6)    {     if (n%i == 0 || n%(i+2) == 0)      return false;    }       return true;   }      public static long[] shuffle(long[] a, Random gen){     for(int i = 0, n = a.length;i < n;i++){      int ind = gen.nextInt(n-i)+i;      long d = a[i];      a[i] = a[ind];      a[ind] = d;     }     return a;    }   static class pair implements Comparable<pair>{    Integer x;    Integer y;    pair(int l,int id){     this.x=l;     this.y=id;    }    public int compareTo(pair o) {      int result = x.compareTo(o.x);      if(result==0)       result = y.compareTo(o.y);           return result;     }     public String toString(){     return (x+" "+y);    }   }      }
0	public class ToyArmy {  public static void main(String[] args) {   int n = new Scanner(System.in).nextInt();   System.out.println(n + n / 2);  } }
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;  public void run() {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  System.err.println("Go!");  int t = fs.nextInt();  while(t-->0) {  int n = fs.nextInt();  long k = fs.nextLong();  long toCut = 1, numSquares = 1, free = 0;  int cuts = 0;  while(true) {   if(cuts >= n) {   k = oo;   break;   }   k -= toCut;   if(k < 0) {   k = oo;   break;   }   cuts++;   try {   free = Math.addExact(free, Math.multiplyExact(numSquares, getVal(n-cuts)));   } catch (Exception e) {   k = 0;   break;   }   if(free >= k) {   k = 0;   break;   }   toCut += (1L<<cuts);   numSquares += (1L<<(cuts+1));  }  if(k == 0) {   out.printf("YES %d\n", n-cuts);  }  else {   out.printf("NO\n");  }  }   out.close(); }  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;  }  public double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }  public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }  public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  }   public int[] nextIntArray(int n) {  int[] res = new int[n];  for(int i = 0; i < n; i++) res[i] = nextInt();  return res;  }   }  }
0	public class D { public static void main(String args[]) {  int n;  Scanner in = new Scanner (System.in);  n= in.nextInt();  if (n%4==0 || n%7==0 || n%44==0 || n%47==0 || n%444==0 || n%447==0 ||   n%474==0 || n%477==0 || n%744==0 || n%747==0 || n%774==0 || n%777==0)   System.out.println("YES"); else System.out.println("NO"); } }
2	public class C {  public static void main(String[] args) {   Solver solver = new Solver();  }  static class Solver {   IO io;   public Solver() {    this.io = new IO();    try {     solve();    } catch (RuntimeException e) {     if (!e.getMessage().equals("Clean exit")) {      throw e;     }    } finally {     io.close();    }   }      void solve() {    long x = io.nextLong();    long k = io.nextLong();    if (x==0) done(0);    long ans = pow(2,k) * ((2*x - 1)%MOD) + 1;    io.println(ans%MOD);   }   long pow(long base, long exp) {    if (exp == 0) return 1L;    long x = pow(base, exp/2);    long ans = x * x;    ans %= MOD;    if (exp % 2 != 0) {     ans *= base;     ans %= MOD;    }    return ans;   }   void solve2() {    long x = io.nextLong();    long k = io.nextLong();    if (x==0) done(0);        long checkPointA = min(10000, k);    double count = x;    long i=0;    for (; i<checkPointA; i++) {     count *= 2;     count -= 0.5;     count %= MOD;    }    List<Double> bah = new ArrayList<>();    List<Long> meh = new ArrayList<>();    while (true) {     bah.add(count);     meh.add(i);     long j = 2*i;     if (j > k || j < 0) break;     i = j;     count *= count;     count %= MOD;    }    while (!bah.isEmpty()) {     long muller = meh.get(meh.size()-1);     long cand = i + muller;     if (cand > k || cand < 0) {      meh.remove(meh.size()-1);      bah.remove(bah.size()-1);      continue;     }     i = cand;     count *= meh.get(meh.size()-1);     count %= MOD;    }    for (; i<k; i++) {     count *= 2;     count -= 0.5;     count %= MOD;    }       count *= 2;    count %= MOD;    io.println(Math.round(count));   }      long MOD = (long)1e9 + 7;   boolean closeToZero(double v) {       return Math.abs(v) <= 0.0000000000001;   }   class DrawGrid {    void draw(boolean[][] d) {     System.out.print(" ");     for (int x=0; x<d[0].length; x++) {      System.out.print(" " + x + " ");     }     System.out.println("");     for (int y=0; y<d.length; y++) {      System.out.print(y + " ");      for (int x=0; x<d[0].length; x++) {       System.out.print((d[y][x] ? "[x]" : "[ ]"));      }      System.out.println("");     }    }    void draw(int[][] d) {     int max = 1;     for (int y=0; y<d.length; y++) {      for (int x=0; x<d[0].length; x++) {       max = Math.max(max, ("" + d[y][x]).length());      }     }     System.out.print(" ");     String format = "%" + (max+2) + "s";     for (int x=0; x<d[0].length; x++) {      System.out.print(String.format(format, x) + " ");     }     format = "%" + (max) + "s";     System.out.println("");     for (int y=0; y<d.length; y++) {      System.out.print(y + " ");      for (int x=0; x<d[0].length; x++) {       System.out.print(" [" + String.format(format, (d[y][x])) + "]");      }      System.out.println("");     }    }   }   class IDval implements Comparable<IDval> {    int id;    long val;    public IDval(int id, long val) {     this.val = val;     this.id = id;    }    @Override    public int compareTo(IDval o) {     if (this.val < o.val) return -1;     if (this.val > o.val) return 1;     return this.id - o.id;    }   }   private class ElementCounter {    private HashMap<Long, Integer> elements;    public ElementCounter() {     elements = new HashMap<>();    }    public void add(long element) {     int count = 1;     Integer prev = elements.get(element);     if (prev != null) count += prev;     elements.put(element, count);    }    public void remove(long element) {     int count = elements.remove(element);     count--;     if (count > 0) elements.put(element, count);    }    public int get(long element) {     Integer val = elements.get(element);     if (val == null) return 0;     return val;    }    public int size() {     return elements.size();    }   }   class StringCounter {    HashMap<String, Integer> elements;    public StringCounter() {     elements = new HashMap<>();    }    public void add(String identifier) {     int count = 1;     Integer prev = elements.get(identifier);     if (prev != null) count += prev;     elements.put(identifier, count);    }    public void remove(String identifier) {     int count = elements.remove(identifier);     count--;     if (count > 0) elements.put(identifier, count);    }    public long get(String identifier) {     Integer val = elements.get(identifier);     if (val == null) return 0;     return val;    }    public int size() {     return elements.size();    }   }   class DisjointSet {       int[] size;    int[] parent;    int componentCount;    public DisjointSet(int n) {     componentCount = n;     size = new int[n];     parent = new int[n];     for (int i=0; i<n; i++) parent[i] = i;     for (int i=0; i<n; i++) size[i] = 1;    }    public void join(int a, int b) {         int rootA = parent[a];     int rootB = parent[b];     while (rootA != parent[rootA]) rootA = parent[rootA];     while (rootB != parent[rootB]) rootB = parent[rootB];     if (rootA == rootB) {           return;     }          if (size[rootA] > size[rootB]) {      size[rootA] += size[rootB];      parent[rootB] = rootA;     } else {      size[rootB] += size[rootA];      parent[rootA] = rootB;     }     componentCount--;    }   }   class Trie {    int N;    int Z;    int nextFreeId;    int[][] pointers;    boolean[] end;        public Trie(int maxLenSum, int alphabetSize) {     this.N = maxLenSum;     this.Z = alphabetSize;     this.nextFreeId = 1;     pointers = new int[N+1][alphabetSize];     end = new boolean[N+1];    }    public void addWord(String word) {     int curr = 0;     for (int j=0; j<word.length(); j++) {      int c = word.charAt(j) - 'a';      int next = pointers[curr][c];      if (next == 0) {       next = nextFreeId++;       pointers[curr][c] = next;      }      curr = next;     }     end[curr] = true;    }    public boolean hasWord(String word) {     int curr = 0;     for (int j=0; j<word.length(); j++) {      int c = word.charAt(j) - 'a';      int next = pointers[curr][c];      if (next == 0) return false;      curr = next;     }     return end[curr];    }   }   private static class Prob {            private double logP;        public Prob(double real) {     if (real > 0) this.logP = Math.log(real);     else this.logP = Double.NaN;    }        static boolean dontLogAgain = true;    public Prob(double logP, boolean anyBooleanHereToChooseThisConstructor) {     this.logP = logP;    }        public double get() {     return Math.exp(logP);    }    @Override    public String toString() {     return ""+get();    }            public static Prob add(Prob a, Prob b) {     if (nullOrNaN(a) && nullOrNaN(b)) return new Prob(Double.NaN, dontLogAgain);     if (nullOrNaN(a)) return copy(b);     if (nullOrNaN(b)) return copy(a);     double x = Math.max(a.logP, b.logP);     double y = Math.min(a.logP, b.logP);     double sum = x + Math.log(1 + Math.exp(y - x));     return new Prob(sum, dontLogAgain);    }        public static Prob multiply(Prob a, Prob b) {     if (nullOrNaN(a) || nullOrNaN(b)) return new Prob(Double.NaN, dontLogAgain);     return new Prob(a.logP + b.logP, dontLogAgain);    }        private static boolean nullOrNaN(Prob p) {     return (p == null || Double.isNaN(p.logP));    }        private static Prob copy(Prob original) {     return new Prob(original.logP, dontLogAgain);    }   }   class Binary implements Comparable<Binary> {        private boolean[] d;    private int first;    public int length;     public Binary(String binaryString) {     this(binaryString, false);    }    public Binary(String binaryString, boolean initWithMinArraySize) {     length = binaryString.length();     int size = Math.max(2*length, 1);     first = length/4;     if (initWithMinArraySize) {      first = 0;      size = Math.max(length, 1);     }     d = new boolean[size];     for (int i=0; i<length; i++) {      if (binaryString.charAt(i) == '1') d[i+first] = true;     }    }    public void addFirst(char c) {     if (first-1 < 0) doubleArraySize();     first--;     d[first] = (c == '1' ? true : false);     length++;    }    public void addLast(char c) {     if (first+length >= d.length) doubleArraySize();     d[first+length] = (c == '1' ? true : false);     length++;    }    private void doubleArraySize() {     boolean[] bigArray = new boolean[(d.length+1) * 2];     int newFirst = bigArray.length / 4;     for (int i=0; i<length; i++) {      bigArray[i + newFirst] = d[i + first];     }     first = newFirst;     d = bigArray;    }    public boolean flip(int i) {     boolean value = (this.d[first+i] ? false : true);     this.d[first+i] = value;     return value;    }    public void set(int i, char c) {     boolean value = (c == '1' ? true : false);     this.d[first+i] = value;    }    public char get(int i) {     return (this.d[first+i] ? '1' : '0');    }    @Override    public int compareTo(Binary o) {     if (this.length != o.length) return this.length - o.length;     int len = this.length;     for (int i=0; i<len; i++) {      int diff = this.get(i) - o.get(i);      if (diff != 0) return diff;     }     return 0;    }    @Override    public String toString() {     StringBuilder sb = new StringBuilder();     for (int i=0; i<length; i++) {      sb.append(d[i+first] ? '1' : '0');     }     return sb.toString();    }    }      class FenwickMin {    long n;    long[] original;    long[] bottomUp;    long[] topDown;    public FenwickMin(int n) {     this.n = n;     original = new long[n+2];     bottomUp = new long[n+2];     topDown = new long[n+2];    }    public void set(int modifiedNode, long value) {     long replaced = original[modifiedNode];     original[modifiedNode] = value;         int i = modifiedNode;     long v = value;     while (i <= n) {      if (v > bottomUp[i]) {       if (replaced == bottomUp[i]) {        v = Math.min(v, original[i]);        for (int r=1 ;; r++) {         int x = (i&-i)>>>r;         if (x == 0) break;         int child = i-x;         v = Math.min(v, bottomUp[child]);        }       } else break;      }      if (v == bottomUp[i]) break;      bottomUp[i] = v;      i += (i&-i);     }         i = modifiedNode;     v = value;     while (i > 0) {      if (v > topDown[i]) {       if (replaced == topDown[i]) {        v = Math.min(v, original[i]);        for (int r=1 ;; r++) {         int x = (i&-i)>>>r;         if (x == 0) break;         int child = i+x;         if (child > n+1) break;         v = Math.min(v, topDown[child]);        }       } else break;      }      if (v == topDown[i]) break;      topDown[i] = v;      i -= (i&-i);     }    }    public long getMin(int a, int b) {     long min = original[a];     int prev = a;     int curr = prev + (prev&-prev);     while (curr <= b) {      min = Math.min(min, topDown[prev]);      prev = curr;      curr = prev + (prev&-prev);;     }     min = Math.min(min, original[prev]);     prev = b;     curr = prev - (prev&-prev);     while (curr >= a) {      min = Math.min(min,bottomUp[prev]);      prev = curr;      curr = prev - (prev&-prev);     }     return min;    }   }   class FenwickSum {    public long[] d;    public FenwickSum(int n) {     d=new long[n+1];    }        public FenwickSum(long[] a) {     d=new long[a.length];     for (int i=1; i<a.length; i++) {      modify(i, a[i]);     }    }        void modify(int i, long v) {     while (i<d.length) {      d[i] += v;           i += (i&-i);     }    }        long getSum(int a, int b) {     return getSum(b) - getSum(a-1);    }    private long getSum(int i) {     long sum = 0;     while (i>0) {      sum += d[i];           i -= (i&-i);     }     return sum;    }   }   class SegmentTree {       int N;    long[] p;    public SegmentTree(int n) {         for (N=2; N<n; N++) N *= 2;     p = new long[2*N];    }    public void modifyRange(int a, int b, long change) {     muuta(a, change);     muuta(b+1, -change);    }    void muuta(int k, long muutos) {     k += N;     p[k] += muutos;     for (k /= 2; k >= 1; k /= 2) {      p[k] = p[2*k] + p[2*k+1];     }    }    public long get(int k) {     int a = N;     int b = k+N;     long s = 0;     while (a <= b) {      if (a%2 == 1) s += p[a++];      if (b%2 == 0) s += p[b--];      a /= 2;      b /= 2;     }     return s;    }   }      List<Integer>[] toGraph(IO io, int n) {    List<Integer>[] g = new ArrayList[n+1];    for (int i=1; i<=n; i++) g[i] = new ArrayList<>();    for (int i=1; i<=n-1; i++) {     int a = io.nextInt();     int b = io.nextInt();     g[a].add(b);     g[b].add(a);    }    return g;   }   class Graph {    HashMap<Long, List<Long>> edges;    public Graph() {     edges = new HashMap<>();    }    List<Long> getSetNeighbors(Long node) {     List<Long> neighbors = edges.get(node);     if (neighbors == null) {      neighbors = new ArrayList<>();      edges.put(node, neighbors);     }     return neighbors;    }    void addBiEdge(Long a, Long b) {     addEdge(a, b);     addEdge(b, a);    }    void addEdge(Long from, Long to) {     getSetNeighbors(to);     List<Long> neighbors = getSetNeighbors(from);     neighbors.add(to);    }        int UNTOUCHED = 0;    int FINISHED = 2;    int INPROGRESS = 1;    HashMap<Long, Integer> vis;    List<Long> topoAns;    List<Long> failDueToCycle = new ArrayList<Long>() {{ add(-1L); }};    List<Long> topoSort() {     topoAns = new ArrayList<>();     vis = new HashMap<>();     for (Long a : edges.keySet()) {      if (!topoDFS(a)) return failDueToCycle;     }     Collections.reverse(topoAns);     return topoAns;    }    boolean topoDFS(long curr) {     Integer status = vis.get(curr);     if (status == null) status = UNTOUCHED;     if (status == FINISHED) return true;     if (status == INPROGRESS) {      return false;     }     vis.put(curr, INPROGRESS);     for (long next : edges.get(curr)) {      if (!topoDFS(next)) return false;     }     vis.put(curr, FINISHED);     topoAns.add(curr);     return true;    }   }   public class StronglyConnectedComponents {        ArrayList<Integer>[] forw;    ArrayList<Integer>[] bacw;        public int getCount(int n, int[] mista, int[] minne) {     forw = new ArrayList[n+1];     bacw = new ArrayList[n+1];     for (int i=1; i<=n; i++) {      forw[i] = new ArrayList<Integer>();      bacw[i] = new ArrayList<Integer>();     }     for (int i=0; i<mista.length; i++) {      int a = mista[i];      int b = minne[i];      forw[a].add(b);      bacw[b].add(a);     }     int count = 0;     List<Integer> list = new ArrayList<Integer>();     boolean[] visited = new boolean[n+1];     for (int i=1; i<=n; i++) {      dfsForward(i, visited, list);     }     visited = new boolean[n+1];     for (int i=n-1; i>=0; i--) {      int node = list.get(i);      if (visited[node]) continue;      count++;      dfsBackward(node, visited);     }     return count;    }    public void dfsForward(int i, boolean[] visited, List<Integer> list) {     if (visited[i]) return;     visited[i] = true;     for (int neighbor : forw[i]) {      dfsForward(neighbor, visited, list);     }     list.add(i);    }    public void dfsBackward(int i, boolean[] visited) {     if (visited[i]) return;     visited[i] = true;     for (int neighbor : bacw[i]) {      dfsBackward(neighbor, visited);     }    }   }   class LCAFinder {        int[] nodes;    int[] depths;    int[] entries;    int pointer;    FenwickMin fenwick;    public LCAFinder(List<Integer>[] graph) {     this.nodes = new int[(int)10e6];     this.depths = new int[(int)10e6];     this.entries = new int[graph.length];     this.pointer = 1;     boolean[] visited = new boolean[graph.length+1];     dfs(1, 0, graph, visited);     fenwick = new FenwickMin(pointer-1);     for (int i=1; i<pointer; i++) {      fenwick.set(i, depths[i] * 1000000L + i);     }    }    private void dfs(int node, int depth, List<Integer>[] graph, boolean[] visited) {     visited[node] = true;     entries[node] = pointer;     nodes[pointer] = node;     depths[pointer] = depth;     pointer++;     for (int neighbor : graph[node]) {      if (visited[neighbor]) continue;      dfs(neighbor, depth+1, graph, visited);      nodes[pointer] = node;      depths[pointer] = depth;      pointer++;     }    }    public int find(int a, int b) {     int left = entries[a];     int right = entries[b];     if (left > right) {      int temp = left;      left = right;      right = temp;     }     long mixedBag = fenwick.getMin(left, right);     int index = (int) (mixedBag % 1000000L);     return nodes[index];    }   }      class Point {    int y;    int x;    public Point(int y, int x) {     this.y = y;     this.x = x;    }   }   boolean segmentsIntersect(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {        if (x1 == x2 && x3 == x4) {         if (x1 != x3) return false;     if (min(y1,y2) < min(y3,y4)) {      return max(y1,y2) >= min(y3,y4);     } else {      return max(y3,y4) >= min(y1,y2);     }    }    if (x1 == x2) {         double a34 = (y4-y3)/(x4-x3);     double b34 = y3 - a34*x3;     double y = a34 * x1 + b34;     return y >= min(y1,y2) && y <= max(y1,y2) && x1 >= min(x3,x4) && x1 <= max(x3,x4);    }    if (x3 == x4) {         double a12 = (y2-y1)/(x2-x1);     double b12 = y1 - a12*x1;     double y = a12 * x3 + b12;     return y >= min(y3,y4) && y <= max(y3,y4) && x3 >= min(x1,x2) && x3 <= max(x1,x2);    }    double a12 = (y2-y1)/(x2-x1);    double b12 = y1 - a12*x1;    double a34 = (y4-y3)/(x4-x3);    double b34 = y3 - a34*x3;    if (closeToZero(a12 - a34)) {         return closeToZero(b12 - b34);    }       double x = -(b12-b34)/(a12-a34);    return x >= min(x1,x2) && x <= max(x1,x2) && x >= min(x3,x4) && x <= max(x3,x4);   }   boolean pointInsideRectangle(Point p, List<Point> r) {    Point a = r.get(0);    Point b = r.get(1);    Point c = r.get(2);    Point d = r.get(3);    double apd = areaOfTriangle(a, p, d);    double dpc = areaOfTriangle(d, p, c);    double cpb = areaOfTriangle(c, p, b);    double pba = areaOfTriangle(p, b, a);    double sumOfAreas = apd + dpc + cpb + pba;    if (closeToZero(sumOfAreas - areaOfRectangle(r))) {     if (closeToZero(apd) || closeToZero(dpc) || closeToZero(cpb) || closeToZero(pba)) {      return false;     }     return true;    }    return false;   }   double areaOfTriangle(Point a, Point b, Point c) {    return 0.5 * Math.abs((a.x-c.x)*(b.y-a.y)-(a.x-b.x)*(c.y-a.y));   }   double areaOfRectangle(List<Point> r) {    double side1xDiff = r.get(0).x - r.get(1).x;    double side1yDiff = r.get(0).y - r.get(1).y;    double side2xDiff = r.get(1).x - r.get(2).x;    double side2yDiff = r.get(1).y - r.get(2).y;    double side1 = Math.sqrt(side1xDiff * side1xDiff + side1yDiff * side1yDiff);    double side2 = Math.sqrt(side2xDiff * side2xDiff + side2yDiff * side2yDiff);    return side1 * side2;   }   boolean pointsOnSameLine(double x1, double y1, double x2, double y2, double x3, double y3) {    double areaTimes2 = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2);    return (closeToZero(areaTimes2));   }   class PointToLineSegmentDistanceCalculator {        double minDistFromPointToLineSegment(double point_x, double point_y, double x1, double y1, double x2, double y2) {     return Math.sqrt(distToSegmentSquared(point_x, point_y, x1, y1, x2, y2));    }    private double distToSegmentSquared(double point_x, double point_y, double x1, double y1, double x2, double y2) {     double l2 = dist2(x1,y1,x2,y2);     if (l2 == 0) return dist2(point_x, point_y, x1, y1);     double t = ((point_x - x1) * (x2 - x1) + (point_y - y1) * (y2 - y1)) / l2;     if (t < 0) return dist2(point_x, point_y, x1, y1);     if (t > 1) return dist2(point_x, point_y, x2, y2);     double com_x = x1 + t * (x2 - x1);     double com_y = y1 + t * (y2 - y1);     return dist2(point_x, point_y, com_x, com_y);    }    private double dist2(double x1, double y1, double x2, double y2) {     return Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2);    }   }       long gcd(long... v) {       if (v.length == 1) return v[0];    long ans = gcd(v[1], v[0]);    for (int i=2; i<v.length; i++) {     ans = gcd(ans, v[i]);    }    return ans;   }   long gcd(long a, long b) {       if (b == 0) return a;    return gcd(b, a%b);   }   int[] generatePrimesUpTo(int last) {       int[] div = new int[last+1];    for (int x=2; x<=last; x++) {     if (div[x] > 0) continue;     for (int u=2*x; u<=last; u+=x) {      div[u] = x;     }    }    return div;   }   long lcm(long a, long b) {       return a * b / gcd(a,b);   }   class BaseConverter {        public String convert(Long number, int base) {     return Long.toString(number, base);    }        public String convert(String number, int baseFrom, int baseTo) {     return Long.toString(Long.parseLong(number, baseFrom), baseTo);    }        public long longify(String number, int baseFrom) {     return Long.parseLong(number, baseFrom);    }   }   class BinomialCoefficients {           public long biCo(long n, long k) {     long r = 1;     if (k > n) return 0;     for (long d = 1; d <= k; d++) {      r *= n--;      r /= d;     }     return r;    }        public long[] precalcBinomialCoefficientsK(int n, int maxK) {     long v[] = new long[maxK+1];     v[0] = 1;     for (int i=1; i<=n; i++) {      for (int j=Math.min(i,maxK); j>0; j--) {       v[j] = v[j] + v[j-1];      }     }     return v;    }        public long[] precalcBinomialCoefficientsK(int n, int k, long M) {     long v[] = new long[k+1];     v[0] = 1;     for (int i=1; i<=n; i++) {      for (int j=Math.min(i,k); j>0; j--) {       v[j] = v[j] + v[j-1];       v[j] %= M;      }     }     return v;    }   }      class Zalgo {    public int pisinEsiintyma(String haku, String kohde) {     char[] s = new char[haku.length() + 1 + kohde.length()];     for (int i=0; i<haku.length(); i++) {      s[i] = haku.charAt(i);     }     int j = haku.length();     s[j++] = '#';     for (int i=0; i<kohde.length(); i++) {      s[j++] = kohde.charAt(i);     }     int[] z = toZarray(s);     int max = 0;     for (int i=haku.length(); i<z.length; i++) {      max = Math.max(max, z[i]);     }     return max;    }    public int[] toZarray(char[] s) {     int n = s.length;     int[] z = new int[n];     int a = 0, b = 0;     for (int i = 1; i < n; i++) {      if (i > b) {       for (int j = i; j < n && s[j - i] == s[j]; j++) z[i]++;      }      else {       z[i] = z[i - a];       if (i + z[i - a] > b) {        for (int j = b + 1; j < n && s[j - i] == s[j]; j++) z[i]++;        a = i;        b = i + z[i] - 1;       }      }     }     return z;    }    public List<Integer> getStartIndexesWhereWordIsFound(String haku, String kohde) {         char[] s = new char[haku.length() + 1 + kohde.length()];     for (int i=0; i<haku.length(); i++) {      s[i] = haku.charAt(i);     }     int j = haku.length();     s[j++] = '#';     for (int i=0; i<kohde.length(); i++) {      s[j++] = kohde.charAt(i);     }     int[] z = toZarray(s);     List<Integer> indexes = new ArrayList<>();     for (int i=haku.length(); i<z.length; i++) {      if (z[i] < haku.length()) continue;      indexes.add(i);     }     return indexes;    }   }   class StringHasher {    class HashedString {     long[] hashes;     long[] modifiers;     public HashedString(long[] hashes, long[] modifiers) {      this.hashes = hashes;      this.modifiers = modifiers;     }    }    long P;    long M;    public StringHasher() {     initializePandM();    }    HashedString hashString(String s) {     int n = s.length();     long[] hashes = new long[n];     long[] modifiers = new long[n];     hashes[0] = s.charAt(0);     modifiers[0] = 1;     for (int i=1; i<n; i++) {      hashes[i] = (hashes[i-1] * P + s.charAt(i)) % M;      modifiers[i] = (modifiers[i-1] * P) % M;     }     return new HashedString(hashes, modifiers);    }        long getHash(HashedString hashedString, int startIndex, int endIndex) {     long[] hashes = hashedString.hashes;     long[] modifiers = hashedString.modifiers;     long result = hashes[endIndex];     if (startIndex > 0) result -= (hashes[startIndex-1] * modifiers[endIndex-startIndex+1]) % M;     if (result < 0) result += M;     return result;    }             HashedString[] hashString(String first, String second) {     HashedString[] array = new HashedString[2];     int n = first.length();     long[] modifiers = new long[n];     modifiers[0] = 1;     long[] firstHashes = new long[n];     firstHashes[0] = first.charAt(0);     array[0] = new HashedString(firstHashes, modifiers);     long[] secondHashes = new long[n];     secondHashes[0] = second.charAt(0);     array[1] = new HashedString(secondHashes, modifiers);     for (int i=1; i<n; i++) {      modifiers[i] = (modifiers[i-1] * P) % M;      firstHashes[i] = (firstHashes[i-1] * P + first.charAt(i)) % M;      secondHashes[i] = (secondHashes[i-1] * P + second.charAt(i)) % M;     }     return array;    }        HashedString[] hashString(String... strings) {     HashedString[] array = new HashedString[strings.length];     int n = strings[0].length();     long[] modifiers = new long[n];     modifiers[0] = 1;     for (int j=0; j<strings.length; j++) {           if (strings[j].length() != n) {       for (int i=0; i<n; i++) {        array[i] = hashString(strings[i]);       }       return array;      }            long[] hashes = new long[n];      hashes[0] = strings[j].charAt(0);      array[j] = new HashedString(hashes, modifiers);     }     for (int i=1; i<n; i++) {      modifiers[i] = (modifiers[i-1] * P) % M;      for (int j=0; j<strings.length; j++) {       String s = strings[j];       long[] hashes = array[j].hashes;       hashes[i] = (hashes[i-1] * P + s.charAt(i)) % M;      }     }     return array;    }    void initializePandM() {     ArrayList<Long> modOptions = new ArrayList<>(20);     modOptions.add(353873237L);     modOptions.add(353875897L);     modOptions.add(353878703L);     modOptions.add(353882671L);     modOptions.add(353885303L);     modOptions.add(353888377L);     modOptions.add(353893457L);     P = modOptions.get(new Random().nextInt(modOptions.size()));     modOptions.clear();     modOptions.add(452940277L);     modOptions.add(452947687L);     modOptions.add(464478431L);     modOptions.add(468098221L);     modOptions.add(470374601L);     modOptions.add(472879717L);     modOptions.add(472881973L);     M = modOptions.get(new Random().nextInt(modOptions.size()));    }   }      private class IO extends PrintWriter {    private InputStreamReader r;    private static final int BUFSIZE = 1 << 15;    private char[] buf;    private int bufc;    private int bufi;    private StringBuilder sb;    public IO() {     super(new BufferedOutputStream(System.out));     r = new InputStreamReader(System.in);     buf = new char[BUFSIZE];     bufc = 0;     bufi = 0;     sb = new StringBuilder();    }        private int queryInt(String s) {     io.println(s);     io.flush();     return nextInt();    }        private long queryLong(String s) {     io.println(s);     io.flush();     return nextLong();    }        private String queryNext(String s) {     io.println(s);     io.flush();     return next();    }    private void fillBuf() throws IOException {     bufi = 0;     bufc = 0;     while(bufc == 0) {      bufc = r.read(buf, 0, BUFSIZE);      if(bufc == -1) {       bufc = 0;       return;      }     }    }    private boolean pumpBuf() throws IOException {     if(bufi == bufc) {      fillBuf();     }     return bufc != 0;    }    private boolean isDelimiter(char c) {     return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f';    }    private void eatDelimiters() throws IOException {     while(true) {      if(bufi == bufc) {       fillBuf();       if(bufc == 0) throw new RuntimeException("IO: Out of input.");      }      if(!isDelimiter(buf[bufi])) break;      ++bufi;     }    }    public String next() {     try {      sb.setLength(0);      eatDelimiters();      int start = bufi;      while(true) {       if(bufi == bufc) {        sb.append(buf, start, bufi - start);        fillBuf();        start = 0;        if(bufc == 0) break;       }       if(isDelimiter(buf[bufi])) break;       ++bufi;      }      sb.append(buf, start, bufi - start);      return sb.toString();     } catch(IOException e) {      throw new RuntimeException("IO.next: Caught IOException.");     }    }    public int nextInt() {     try {      int ret = 0;      eatDelimiters();      boolean positive = true;      if(buf[bufi] == '-') {       ++bufi;       if(!pumpBuf()) throw new RuntimeException("IO.nextInt: Invalid int.");       positive = false;      }      boolean first = true;      while(true) {       if(!pumpBuf()) break;       if(isDelimiter(buf[bufi])) {        if(first) throw new RuntimeException("IO.nextInt: Invalid int.");        break;       }       first = false;       if(buf[bufi] >= '0' && buf[bufi] <= '9') {        if(ret < -214748364) throw new RuntimeException("IO.nextInt: Invalid int.");        ret *= 10;        ret -= (int)(buf[bufi] - '0');        if(ret > 0) throw new RuntimeException("IO.nextInt: Invalid int.");       } else {        throw new RuntimeException("IO.nextInt: Invalid int.");       }       ++bufi;      }      if(positive) {       if(ret == -2147483648) throw new RuntimeException("IO.nextInt: Invalid int.");       ret = -ret;      }      return ret;     } catch(IOException e) {      throw new RuntimeException("IO.nextInt: Caught IOException.");     }    }    public long nextLong() {     try {      long ret = 0;      eatDelimiters();      boolean positive = true;      if(buf[bufi] == '-') {       ++bufi;       if(!pumpBuf()) throw new RuntimeException("IO.nextLong: Invalid long.");       positive = false;      }      boolean first = true;      while(true) {       if(!pumpBuf()) break;       if(isDelimiter(buf[bufi])) {        if(first) throw new RuntimeException("IO.nextLong: Invalid long.");        break;       }       first = false;       if(buf[bufi] >= '0' && buf[bufi] <= '9') {        if(ret < -922337203685477580L) throw new RuntimeException("IO.nextLong: Invalid long.");        ret *= 10;        ret -= (long)(buf[bufi] - '0');        if(ret > 0) throw new RuntimeException("IO.nextLong: Invalid long.");       } else {        throw new RuntimeException("IO.nextLong: Invalid long.");       }       ++bufi;      }      if(positive) {       if(ret == -9223372036854775808L) throw new RuntimeException("IO.nextLong: Invalid long.");       ret = -ret;      }      return ret;     } catch(IOException e) {      throw new RuntimeException("IO.nextLong: Caught IOException.");     }    }    public double nextDouble() {     return Double.parseDouble(next());    }   }   void print(Object output) {    io.println(output);   }   void done(Object output) {    print(output);    done();   }   void done() {    io.close();    throw new RuntimeException("Clean exit");   }   long min(long... v) {    long ans = v[0];    for (int i=1; i<v.length; i++) {     ans = Math.min(ans, v[i]);    }    return ans;   }   double min(double... v) {    double ans = v[0];    for (int i=1; i<v.length; i++) {     ans = Math.min(ans, v[i]);    }    return ans;   }   int min(int... v) {    int ans = v[0];    for (int i=1; i<v.length; i++) {     ans = Math.min(ans, v[i]);    }    return ans;   }   long max(long... v) {    long ans = v[0];    for (int i=1; i<v.length; i++) {     ans = Math.max(ans, v[i]);    }    return ans;   }   double max(double... v) {    double ans = v[0];    for (int i=1; i<v.length; i++) {     ans = Math.max(ans, v[i]);    }    return ans;   }   int max(int... v) {    int ans = v[0];    for (int i=1; i<v.length; i++) {     ans = Math.max(ans, v[i]);    }    return ans;   }  } }
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()); } }
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);   }  } }
3	public class CFContest {  public static void main(String[] args) throws Exception {   boolean local = System.getProperty("ONLINE_JUDGE") == null;   boolean async = true;   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;   public Task(FastIO io, Debug debug) {    this.io = io;    this.debug = debug;   }   @Override   public void run() {    solve();   }   public void solve() {    int n = io.readInt();    int[] data = new int[n];    for (int i = 0; i < n; i++) {     data[i] = io.readInt();    }    Arrays.sort(data);    boolean[] paint = new boolean[n];    int cnt = 0;    for (int i = 0; i < n; i++) {     if (paint[i]) {      continue;     }     cnt++;     for (int j = i; j < n; j++) {      if (data[j] % data[i] == 0) {       paint[j] = true;      }     }    }    io.cache.append(cnt);   }  }   public static class FastIO {   public final StringBuilder cache = new StringBuilder(20 << 20);   private final InputStream is;   private final OutputStream os;   private final Charset charset;   private StringBuilder defaultStringBuf = new StringBuilder(1 << 8);   private byte[] buf = new byte[1 << 20];   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 long readLong() {    int sign = 1;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+' ? 1 : -1;     next = read();    }    long 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 double readDouble() {    boolean sign = true;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+';     next = read();    }    long val = 0;    while (next >= '0' && next <= '9') {     val = val * 10 + next - '0';     next = read();    }    if (next != '.') {     return sign ? val : -val;    }    next = read();    long radix = 1;    long point = 0;    while (next >= '0' && next <= '9') {     point = point * 10 + next - '0';     radix = radix * 10;     next = read();    }    double result = val + (double) point / radix;    return sign ? result : -result;   }   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 readLine(char[] data, int offset) {    int originalOffset = offset;    while (next != -1 && next != '\n') {     data[offset++] = (char) next;     next = read();    }    return offset - originalOffset;   }   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 char readChar() {    skipBlank();    char c = (char) next;    next = read();    return c;   }   public void flush() {    try {     os.write(cache.toString().getBytes(charset));     os.flush();     cache.setLength(0);    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public boolean hasMore() {    skipBlank();    return next != -1;   }  }  public static class Debug {   private boolean allowDebug;   public Debug(boolean allowDebug) {    this.allowDebug = allowDebug;   }   public void assertTrue(boolean flag) {    if (!allowDebug) {     return;    }    if (!flag) {     fail();    }   }   public void fail() {    throw new RuntimeException();   }   public void assertFalse(boolean flag) {    if (!allowDebug) {     return;    }    if (flag) {     fail();    }   }   private void outputName(String name) {    System.out.print(name + " = ");   }   public void debug(String name, int x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, long x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, double x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, int[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, long[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, double[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, Object x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, Object... x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.deepToString(x));   }  } }
1	public class B implements Runnable { public static void main(String[] args) {  new Thread(new B()).start(); }  StringTokenizer st; PrintWriter out; BufferedReader br; boolean eof = false, in_out = false, std = false;  String nextToken() {  while (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(br.readLine());  } catch (Exception e) {   eof = true;   return "0";  }  }  return st.nextToken(); }  String nextLine() {  String ret = "";  try {  ret = br.readLine();  } catch (Exception e) {  ret = "";  }  if (ret == null) {  eof = true;  return "$";  }  return ret; }  String nextString() {  return nextToken(); }  int nextInt() {  return Integer.parseInt(nextToken()); }  long nextLong() {  return Long.parseLong(nextToken()); }  double nextDouble() {  return Double.parseDouble(nextToken()); }  BigInteger nextBigInteger() {  return new BigInteger(nextToken()); }  public void run() {   try {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  out.flush();  } catch (Exception e) {  e.printStackTrace();  System.exit(111);  }   }  void solve() {  int n = nextInt();  for (int i = 0; i < n; i++) {  solve2();  } }  void solve2() {  String s = nextToken();  boolean wasNum = false, isFirst = false;  for (int i = 0; i < s.length(); i++) {  if (s.charAt(i) >= '0' && s.charAt(i) <= '9') {   wasNum = true;  } else if (wasNum) {   isFirst = true;   break;  }  }  if (isFirst) {  StringTokenizer e = new StringTokenizer(s, "RC");  int y = Integer.parseInt(e.nextToken());  int x = Integer.parseInt(e.nextToken()) - 1;  go1(x, y);  } else {  go2(s);  } }  void go1(int x, int y) {  long cur = 26;  int len = 1;  while (x >= cur) {  x -= cur;  cur *= 26;  len++;  }  StringBuilder sb = new StringBuilder();  for (int i = 0; i < len; i++) {  sb.append((char) ('A' + x % 26));  x /= 26;  }  out.println(sb.reverse().toString() + y); }  void go2(String s) {  int id = -1;  for (int i = 0; i < s.length(); i++) {  if (s.charAt(i) <= '9' && s.charAt(i) >= '0') {   id = i;   break;  }  }  String s1 = s.substring(0, id);  String s2 = s.substring(id);  int x = 0;  int cur = 26;  for (int i = 1; i < s1.length(); i++) {  x += cur;  cur *= 26;  }  int d = 0;  for (int i = 0; i < s1.length(); i++) {  d *= 26;  d += s1.charAt(i) - 'A';  }  x += d;  out.println("R" + s2 + "C" + (x + 1)); } }
6	public class Template implements Runnable {  BufferedReader in;  PrintWriter out;  StringTokenizer tok = new StringTokenizer("");  void init() throws FileNotFoundException {   try {    in = new BufferedReader(new FileReader("input.txt"));    out = new PrintWriter("output.txt");   } catch (Exception e) {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);   }  }  class GraphBuilder {   int n, m;   int[] x, y;   int index;   int[] size;    GraphBuilder(int n, int m) {    this.n = n;    this.m = m;    x = new int[m];    y = new int[m];    size = new int[n];   }   void add(int u, int v) {    x[index] = u;    y[index] = v;    size[u]++;    size[v]++;    index++;   }   int[][] build() {    int[][] graph = new int[n][];    for (int i = 0; i < n; i++) {     graph[i] = new int[size[i]];    }    for (int i = index - 1; i >= 0; i--) {     int u = x[i];     int v = y[i];     graph[u][--size[u]] = v;     graph[v][--size[v]] = u;    }    return graph;   }  }  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());  }  int[] readIntArray(int size) throws IOException {   int[] res = new int[size];   for (int i = 0; i < size; i++) {    res[i] = readInt();   }   return res;  }  long[] readLongArray(int size) throws IOException {   long[] res = new long[size];   for (int i = 0; i < size; i++) {    res[i] = readLong();   }   return res;  }  long readLong() throws IOException {   return Long.parseLong(readString());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  <T> List<T>[] createGraphList(int size) {   List<T>[] list = new List[size];   for (int i = 0; i < size; i++) {    list[i] = new ArrayList<>();   }   return list;  }  public static void main(String[] args) {   new Template().run();    }  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");  }  public void run() {   try {    timeBegin = System.currentTimeMillis();    memoryTotal = Runtime.getRuntime().freeMemory();    init();    solve();    out.close();    if (System.getProperty("ONLINE_JUDGE") == null) {     time();     memory();    }   } catch (Exception e) {    e.printStackTrace();    System.exit(-1);   }  }  void solve() throws IOException {   int n = readInt();   int m = readInt();   int max = 1 << n;   long[][] dp = new long[n][max];   for (int i = 0; i < n; i++) {    dp[i][1 << i] = 1;   }   GraphBuilder gb = new GraphBuilder(n, m);   for (int i = 0; i < m; i++) {    gb.add(readInt() - 1, readInt() - 1);   }   int[][] graph = gb.build();   for (int mask = 1; mask < max; mask++) {    int firstBit = -1;    for (int i = 0; i < n; i++) {     if (hasBit(mask, i)) {      firstBit = i;      break;     }    }    for (int last = 0; last < n; last++) {     if (dp[last][mask] == 0) continue;     for (int y : graph[last]) {      if (!hasBit(mask, y) && y > firstBit) {       dp[y][mask | (1 << y)] += dp[last][mask];      }     }    }   }   long answer = 0;   for (int i = 1; i < max; i++) {    if (Integer.bitCount(i) < 3) continue;    int firstBit = -1;    for (int j = 0; j < n; j++) {     if (hasBit(i, j)) {      firstBit = j;      break;     }    }    for (int y : graph[firstBit]) {     answer += dp[y][i];    }   }   out.println(answer / 2);  }  boolean hasBit(int mask, int bit) {   return (mask & (1 << bit)) != 0;  } }
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);  }  }
3	public class D {  public static class BIT {  int[] dat;   public BIT(int n){  dat = new int[n + 1];  }   public void add(int k, int a){   for(int i = k + 1; i < dat.length; i += i & -i){   dat[i] += a;   }  }   public int sum(int s, int t){   if(s > 0) return sum(0, t) - sum(0, s);    int ret = 0;  for(int i = t; i > 0; i -= i & -i) {   ret += dat[i];  }  return ret;  } }  public static void main(String[] args) {  try (final Scanner sc = new Scanner(System.in)) {  final int N = sc.nextInt();  int[] array = new int[N];  for(int i = 0; i < N; i++){   array[i] = sc.nextInt() - 1;  }    long inv = 0;  BIT bit = new BIT(N);  for(int i = 0; i < N; i++){   inv += bit.sum(array[i], N);   bit.add(array[i], 1);  }      int mod2 = (int)(inv % 2);  final int M = sc.nextInt();  for(int i = 0; i < M; i++){   final int l = sc.nextInt() - 1;   final int r = sc.nextInt() - 1;     final long size = (r - l) + 1;   if(size > 1){      if((size * (size - 1) / 2) % 2 == 1){    mod2 = 1 - mod2;   }   }     System.out.println((mod2 == 0) ? "even" : "odd");  }  } }  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 int nextInt() {  return Integer.parseInt(next());  }   public long nextLong() {  return Long.parseLong(next());  }  public void close() {  try {   br.close();  } catch (IOException e) {   }  } } }
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;  }  }
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);   } }
5	public class Codeforces_R136_Div1_A implements Runnable{  private void solve() throws IOException {  int n = scanner.nextInt();  int[] a = new int[n];  for (int i = 0; i < a.length; i++) {  a[i] = scanner.nextInt();  }   boolean sorted = true;  for (int i = 0; i < a.length; i++) {  if (!isOk(a, i)){   sorted = false;  }  }  if (sorted){  out.println("YES");  return;  }   List<Integer> idx = new ArrayList<Integer>();   for(int i=0; i<n; i++){  if (!isOk(a, i)){    idx.add(i);      }  }   if (idx.size() > 6){  out.println("NO");  return;  }   for(int i=0; i<idx.size(); i++){  for(int j=0; j<n; j++){   swap(a, idx.get(i), j);   if (isOk(a, idx) && isOk(a, j)){   out.println("YES");   return;   }   swap(a, idx.get(i), j);  }  }  out.println("NO");   }  private boolean isOk(int[] a, int i) {   boolean ordered = true;  if (i>0 && !(a[i-1] <= a[i])){  ordered = false;  }  if (i<a.length-1 && !(a[i]<=a[i+1])){  ordered = false;  }  return ordered; }  private boolean isOk(int[] a, List<Integer> idx) {  for(int i : idx){  if (!isOk(a, i))   return false;  }  return true; }  private void swap(int[] a, int i, int j) {  int tmp = a[i];  a[i] = a[j];  a[j] = tmp; }   final int BUF_SIZE = 1024 * 1024 * 8; final int INPUT_BUFFER_SIZE = 1024 * 1024 * 8 ; final int BUF_SIZE_INPUT = 1024;  final int BUF_SIZE_OUT = 1024;  boolean inputFromFile = false; String filenamePrefix = "A-small-attempt0"; String inSuffix = ".in"; String outSuffix = ".out";    PrintStream out; ByteScanner scanner; ByteWriter writer;   public void run() {  try{  InputStream bis = null;  OutputStream bos = null;    if (inputFromFile){   File baseFile = new File(getClass().getResource("/").getFile());   bis = new BufferedInputStream(    new FileInputStream(new File(     baseFile, filenamePrefix+inSuffix)),     INPUT_BUFFER_SIZE);   bos = new BufferedOutputStream(    new FileOutputStream(     new File(baseFile, filenamePrefix+outSuffix)));   out = new PrintStream(bos);  }else{   bis = new BufferedInputStream(System.in, INPUT_BUFFER_SIZE);   bos = new BufferedOutputStream(System.out);   out = new PrintStream(bos);  }  scanner = new ByteScanner(bis, BUF_SIZE_INPUT, BUF_SIZE);  writer = new ByteWriter(bos, BUF_SIZE_OUT);    solve();  out.flush();  }catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  public interface Constants{  final static byte ZERO = '0';  final static byte NINE = '9';  final static byte SPACEBAR = ' ';  final static byte MINUS = '-';    final static char FLOAT_POINT = '.'; }  public static class EofException extends IOException{ }  public static class ByteWriter implements Constants {   int bufSize = 1024;  byte[] byteBuf = new byte[bufSize];  OutputStream os;   public ByteWriter(OutputStream os, int bufSize){  this.os = os;  this.bufSize = bufSize;  }   public void writeInt(int num) throws IOException{    int byteWriteOffset = byteBuf.length;    if (num==0){    byteBuf[--byteWriteOffset] = ZERO;    }else{    int numAbs = Math.abs(num);    while (numAbs>0){     byteBuf[--byteWriteOffset] = (byte)((numAbs % 10) + ZERO);     numAbs /= 10;    }    if (num<0)     byteBuf[--byteWriteOffset] = MINUS;    }    os.write(byteBuf, byteWriteOffset, byteBuf.length - byteWriteOffset);  }     public void writeByteAr(byte[] ar) throws IOException{  for (int i = 0; i < ar.length; i++) {   byteBuf[i] = ar[i];  }  os.write(byteBuf,0,ar.length);  }   public void writeSpaceBar() throws IOException{  byteBuf[0] = SPACEBAR;  os.write(byteBuf,0,1);  }   }  public static class ByteScanner implements Constants{   InputStream is;   public ByteScanner(InputStream is, int bufSizeInput, int bufSize){  this.is = is;  this.bufSizeInput = bufSizeInput;  this.bufSize = bufSize;    byteBufInput = new byte[this.bufSizeInput];  byteBuf = new byte[this.bufSize];  }   public ByteScanner(byte[] data){  byteBufInput = data;  bufSizeInput = data.length;  bufSize = data.length;  byteBuf = new byte[bufSize];  byteRead = data.length;  bytePos = 0;  }   private int bufSizeInput;  private int bufSize;   byte[] byteBufInput;  byte by=-1;  int byteRead=-1;  int bytePos=-1;  byte[] byteBuf;  int totalBytes;   boolean eofMet = false;   private byte nextByte() throws IOException{    if (bytePos<0 || bytePos>=byteRead){   byteRead = is==null? -1: is.read(byteBufInput);   bytePos=0;   if (byteRead<0){   byteBufInput[bytePos]=-1;   if (eofMet)    throw new EofException();   eofMet = true;   }  }  return byteBufInput[bytePos++];  }     public byte nextChar() throws IOException{  while ((by=nextByte())<=0x20);  return by;  }     public byte nextCharOrSpacebar() throws IOException{  while ((by=nextByte())<0x20);  return by;  }      public String nextLine() throws IOException {    readToken((byte)0x20);    return new String(byteBuf,0,totalBytes);  }    public byte[] nextLineAsArray() throws IOException {    readToken((byte)0x20);    byte[] out = new byte[totalBytes];    System.arraycopy(byteBuf, 0, out, 0, totalBytes);    return out;  }        public String nextToken() throws IOException {    readToken((byte)0x21);    return new String(byteBuf,0,totalBytes);  }      private void readToken() throws IOException {      readToken((byte)0x21);  }    private void readToken(byte acceptFrom) throws IOException {    totalBytes = 0;    while ((by=nextByte())<acceptFrom);    byteBuf[totalBytes++] = by;    while ((by=nextByte())>=acceptFrom){     byteBuf[totalBytes++] = by;    }  }    public int nextInt() throws IOException{  readToken();  int num=0, i=0;  boolean sign=false;  if (byteBuf[i]==MINUS){   sign = true;   i++;  }  for (; i<totalBytes; i++){   num*=10;   num+=byteBuf[i]-ZERO;  }  return sign?-num:num;  }   public long nextLong() throws IOException{  readToken();  long num=0;  int i=0;  boolean sign=false;  if (byteBuf[i]==MINUS){   sign = true;   i++;  }  for (; i<totalBytes; i++){   num*=10;   num+=byteBuf[i]-ZERO;  }  return sign?-num:num;  }      public double nextDouble() throws IOException{  readToken();  char[] token = new char[totalBytes];  for (int i = 0; i < totalBytes; i++) {   token[i] = (char)byteBuf[i];  }  return Double.parseDouble(new String(token));  }   }  public static void main(String[] args) {  new Codeforces_R136_Div1_A().run(); }  }
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; } } } }
0	public class CF {  public static void main(String[] args) throws IOException {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   int n = in.nextInt();   if (n >= 0) {    out.println(n);   } else {    int res = n;    n = Math.abs(n);    String s = String.valueOf(Math.abs(n));    if (s.length() == 1) {     res = 0;    } else {     res = Math.max(-Integer.parseInt(s.substring(0, s.length() - 1)), res);     res = Math.max(-Integer.parseInt(s.substring(0, s.length() - 2) + s.charAt(s.length() - 1)), res);    }    out.println(res);   }   out.close();  } } 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());  } }
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;   }  } }
2	public class MrBenderAndSquare {  static long n, x, y, c;  public static void main(String[] args) throws IOException {  Kattio io = new Kattio(System.in);  n = io.getLong();  x = io.getLong();  y = io.getLong();  c = io.getLong();   long lo = 0;  long hi = c;  while (lo < hi) {  long mid = lo + (hi - lo) / 2;  if (f(mid) >= c) {   hi = mid;  } else {   lo = mid + 1;  }  }  io.println(lo);  io.close(); }  static long f(long t) {  long res = 0;   long left = Math.max(0, t - (x - 1));  res -= left*left;  long right = Math.max(0, t - (n - x));  res -= right*right;  long up = Math.max(0, t - (y - 1));  res -= up*up;  long down = Math.max(0, t - (n - y));  res -= down*down;   res += 1 + 2*t*(t+1);   long upLeft = Math.max(0, t - (x + y) + 1);  long upRight = Math.max(0, t - (n - x + 1 + y) + 1);  long downLeft = Math.max(0, t - (x + n - y + 1) + 1);  long downRight = Math.max(0, t - (n - x + 1 + n - y + 1) + 1);  res += upLeft * (upLeft + 1) / 2;  res += upRight * (upRight + 1) / 2;  res += downLeft * (downLeft + 1) / 2;  res += downRight * (downRight + 1) / 2;  return res; }  static 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());  }  public double getDouble() {   return Double.parseDouble(nextToken());  }  public long getLong() {  return Long.parseLong(nextToken());  }  public String getWord() {  return 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;  PandaScanner in = new PandaScanner(inputStream);  PrintWriter out = new PrintWriter(outputStream);  A solver = new A();  solver.solve(1, in, out);  out.close(); } } class A {  public void solve(int testNumber, PandaScanner in, PrintWriter out) {   String s = in.next();   String[] ss = Substring.allSubstrings(s);   int res = 0;   for (String sss: ss) {    if (sss.length() <= res) continue;    if (Substring.occurences(s, sss).length > 1) {     res = sss.length();    }   }   out.println(res);  } } class PandaScanner {  public BufferedReader br;  public StringTokenizer st;  public InputStream in;  public PandaScanner(InputStream in) {   br = new BufferedReader(new InputStreamReader(this.in = in));  }  public String nextLine() {   try {    return br.readLine();   }   catch (Exception e) {    return null;   }  }  public String next() {   if (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(nextLine().trim());    return next();   }   return st.nextToken();  }  } class Substring {  public static String[] allSubstrings(String s) {   TreeSet<String> substrings = new TreeSet<String>();   int n = s.length();   for (int i = 0; i < n; i++) {    for (int j = i + 1; j < n; j++) {     substrings.add(s.substring(i, j));    }   }   return substrings.toArray(new String[0]);  }  public static int[] occurences(String s, String target) {   int n = s.length();   ArrayList<Integer> res = new ArrayList<Integer>();   int idx = s.indexOf(target);   while (idx != -1) {    res.add(idx);    if (idx == n - 1) break;    idx = s.indexOf(target, idx + 1);   }   n = res.size();   int[] arr = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = res.get(i);   }   return arr;  } }
0	public class A {  public static void main(String[] args){  Scanner in = new Scanner(System.in);   long n = in.nextLong();   System.out.println(25); } }
5	public class A{  public static void main(String[] args) throws Exception{   new A().run();  }  void run() throws Exception{     BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(sc.readLine());   ArrayList<Integer> a = new ArrayList<Integer>();     StringTokenizer st = new StringTokenizer(sc.readLine(), " ");   boolean allOne = true;   for(int i = 0; i < n; i++){    int val = Integer.parseInt(st.nextToken());    if(val!=1)allOne = false;    a.add(val);   }   if(allOne){a.remove(n-1); a.add(2);}   else a.add(1);   Collections.sort(a);   System.out.print(a.get(0));   for(int i = 1; i < n; i++)    System.out.print(" " + a.get(i));   System.out.println();  } }
1	public class B {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int distinct = sc.nextInt();   HashMap<Integer, Integer> set = new HashMap<Integer, Integer>();   int[] ar = new int[n];   for (int i = 0; i < n; i++) {    ar[i] = sc.nextInt();    if (set.containsKey(ar[i])) {     set.put(ar[i], set.get(ar[i])+1);    } else {     set.put(ar[i], 1);    }    if (set.size() == distinct) {     int st = 0;     for (int j = 0; j < i; j++) {      st=j;      if (set.get(ar[j]) > 1) {       set.put(ar[j], set.get(ar[j]) - 1);      } else {       break;      }     }     System.out.println((st + 1) + " " + (i + 1));     return;    }   }   System.out.println("-1 -1");  } }
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);   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.nextInt();    int m = in.nextInt();    boolean[][] g = new boolean[n][n];    for (int i = 0; i < m; ++i) {     int a = in.nextInt() - 1;     int b = in.nextInt() - 1;     g[a][b] = true;     g[b][a] = true;    }      long[] am = new long[n + 1];    long[][] ways = new long[1 << n][n];    for (int start = 0; start < n; ++start) {     for (int mask = 0; mask < (1 << (n - start)); ++mask)      for (int last = start; last < n; ++last) {       ways[mask][last - start] = 0;      }     ways[1][0] = 1;     for (int mask = 0; mask < (1 << (n - start)); ++mask) {      int cnt = 0;      int tmp = mask;      while (tmp > 0) {       ++cnt;       tmp = tmp & (tmp - 1);      }      for (int last = start; last < n; ++last)       if (ways[mask][last - start] > 0) {        long amm = ways[mask][last - start];        for (int i = start; i < n; ++i)         if ((mask & (1 << (i - start))) == 0 && g[last][i]) {          ways[mask | (1 << (i - start))][i - start] += amm;         }        if (g[last][start])         am[cnt] += ways[mask][last - start];       }     }    }    long res = 0;    for (int cnt = 3; cnt <= n; ++cnt) {     if (am[cnt] % (2) != 0)      throw new RuntimeException();     res += am[cnt] / (2);    }    out.println(res);   }  }  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 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) throws Exception{  BufferedReader jk = new BufferedReader(new InputStreamReader( System.in)) ;  PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)) ;  StringTokenizer ana = new StringTokenizer(jk.readLine()) ;  int n = Integer.parseInt(ana.nextToken()) ;    int t[]= new int[101] ;  ArrayList<Integer> v = new ArrayList<>() ;  ana = new StringTokenizer(jk.readLine()) ;  for(int i=0 ; i<n ;i++)  {    int y = Integer.parseInt(ana.nextToken()) ;  t[y]=1 ;   v.add(y) ;  }  Collections.sort(v);  int c= 0;  for(int ele : v)  {  if(t[ele]==1)  {     for(int i=ele ; i<=100 ; i+=ele)   {   t[i]=2 ;   }   c++ ;   }   }  out.println(c);           out.flush(); } }
0	public class A {   public static void main(String[] args) {   Scanner scan = new Scanner(System.in);  int a = scan.nextInt();  Queue<Integer> q = new LinkedList<Integer>();  q.add(4);  q.add(7);  boolean luck = false;  while(!q.isEmpty() && !luck)  {  int f = q.poll();  if(a%f == 0)  {   luck = true;   break;  }  if(f<a)  {   int t = (f+"").length();   int tt = (int)Math.pow(10, t);   q.add(tt*4+f);   q.add(tt*7+f);  }  }  if(luck)  System.out.println("YES");  else  System.out.println("NO");   } }
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 void halt(){  printer.close();  System.exit(0); } static PrintWriter printer=new PrintWriter(new OutputStreamWriter(System.out)); static class reader{  static BufferedReader bReader=new BufferedReader(new InputStreamReader(System.in));  static StringTokenizer token=new StringTokenizer("");  static String readNextLine() throws Exception{  return bReader.readLine();  }  static String next() throws Exception{  while (token.hasMoreTokens()==false){   token=new StringTokenizer(bReader.readLine());  }  return token.nextToken();  }  static int nextInt()throws Exception{  while (token.hasMoreTokens()==false){   token=new StringTokenizer(bReader.readLine());  }  return Integer.parseInt(token.nextToken());  }  static long nextLong()throws Exception{  while (token.hasMoreTokens()==false){   token=new StringTokenizer(bReader.readLine());  }  return Long.parseLong(token.nextToken());  }  static double nextDouble()throws Exception{  while (token.hasMoreTokens()==false){   token=new StringTokenizer(bReader.readLine());  }  return Double.parseDouble(token.nextToken());  } } static class MyMathCompute{  static long [][] MatrixMultiplyMatrix(long [][] A, long [][] B, long mod) throws Exception{  int n=A.length, m=B[0].length;   int p=A[0].length;  int i,j,k;  if (B.length!=p) throw new Exception("invalid matrix input");  long [][] res=new long [n][m];  for (i=0;i<n;i++) for (j=0;j<m;j++){   if (A[i].length!=p) throw new Exception("invalid matrix input");   res[i][j]=0;   for (k=0;k<p;k++)   res[i][j]=(res[i][j]+((A[i][k]*B[k][j])% mod))% mod;  }  return res;  }  static double [][] MatrixMultiplyMatrix(double [][] A, double [][] B ) throws Exception{  int n=A.length, m=B[0].length;   int p=A[0].length;  int i,j,k;  if (B.length!=p) throw new Exception("invalid matrix input");  double [][] res=new double [n][m];  for (i=0;i<n;i++) for (j=0;j<m;j++){   if (A[i].length!=p) throw new Exception("invalid matrix input");   res[i][j]=0;   for (k=0;k<p;k++)   res[i][j]=res[i][j]+(A[i][k]*B[k][j]);  }  return res;  }  static long [][] MatrixPow(long [][] A,long n, long mod) throws Exception{  if (n==1) return A;  long [][] res=MatrixPow(A, n/2, mod);  res=MatrixMultiplyMatrix(res, res, mod);  if ((n % 2) == 1) res=MatrixMultiplyMatrix(A,res, mod);   return res;  }  static double [][] MatrixPow(double [][] A,long n) throws Exception{  if (n==1) return A;  double[][] res=MatrixPow(A, n/2);  res=MatrixMultiplyMatrix(res, res);  if ((n % 2) == 1) res=MatrixMultiplyMatrix(A,res);   return res;  }  static long pow(long a,long n,long mod){  a= a % mod;  if (n==0) return 1;  long k=pow(a,n/2,mod);  if ((n % 2)==0) return ((k*k)%mod);  else return (((k*k) % mod)*a) % mod;  }  static double pow(double a,long n){  if (n==0) return 1;  double k=pow(a,n/2);  if ((n % 2)==0) return (k*k);  else return (((k*k) )*a) ;  } } }
6	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++;    }    Arrays.sort(A,(x,y)->{     return x[0]-y[0];    });     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+2][T+1];   long dp2[][][]=new long[y+2][z+2][T+2];   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;   for(int i=0;i<A.length;i++){    int p=A[i][0],type=A[i][1];    if(type==0){     long newdp[][]=new long[dp1.length][dp1[0].length];     for(int cnt=1;cnt<=x;cnt++){      for(int j=1;j<dp1[0].length;j++){       if(j>=p){        newdp[cnt][j]+=dp1[cnt-1][j-p];        newdp[cnt][j]%=mod;       }      }     }     for(int cnt=0;cnt<=x;cnt++){      for(int j=0;j<dp1[0].length;j++){       newdp[cnt][j]+=dp1[cnt][j];       newdp[cnt][j]%=mod;      }     }     dp1=newdp;    }   }     dp2[0][0][0]=1;   for(int i=0;i<A.length;i++){    int p=A[i][0],type=A[i][1];    if(type!=0){     long newdp[][][]=new long[dp2.length][dp2[0].length][dp2[0][0].length];     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){           newdp[a][b][j]+=dp2[a-1][b][j-p];          }         }         else{          if(b-1>=0) {           newdp[a][b][j]+=dp2[a][b-1][j-p];          }         }        }        newdp[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++){        newdp[a][b][j]+=dp2[a][b][j];        newdp[a][b][j]%=mod;       }      }     }     dp2=newdp;    }   }    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;i++){    for(int j=0;j<dp3[0].length;j++){     for(int k=0;k<dp3[0][0].length;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;  } }
4	public class Main {    public static void main(String[] args) {   Scanner scr = new Scanner(System.in);     String str = scr.nextLine();   int len =0;     for(int i=0;i<(str.length()-1);i++)   {    for(int j=i+1;j<str.length();j++)    {     String sub = str.substring(i, j);         int ind = str.indexOf(sub, i+1);     if(ind!=-1 && sub.length()>len )     {      len = sub.length();     }    }   }   System.out.println(len);    } }
3	public class Ideone {  public static void main(String args[] ) throws Exception{   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int n,i,j,k,temp ;   n = ni(br.readLine());   int[] a = nia(br);   Arrays.sort(a);   int c = 0;   for( i = 0; i< n ; i++) {   if(a[i] > 0) {    c++;    temp = a[i];    for(j = i+1; j< n; j++) {    if(a[j] % temp == 0)     a[j] = 0;    }   }   }        System.out.println(c);   }  static Integer[] nIa(BufferedReader br) throws Exception{   String sa[]=br.readLine().split(" ");   Integer [] a = new Integer [sa.length];   for(int i = 0; i< sa.length; i++){    a[i]= ni(sa[i]);   }   return a;  }  static int[] nia(BufferedReader br) throws Exception{   String sa[]=br.readLine().split(" ");   int [] a = new int [sa.length];   for(int i = 0; i< sa.length; i++){    a[i]= ni(sa[i]);   }   return a;  }   static int ni(String s){   return Integer.parseInt(s);  }  static float nf(String s){   return Float.parseFloat(s);  }  static double nd(String s){   return Double.parseDouble(s);  }  }
5	public class A {  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter writer;  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);   }  }  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());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  void solve() throws IOException {   int n = nextInt();   int[] a = new int[n];   for (int i = 0; i < a.length; i++) {    a[i] = nextInt();   }   Arrays.sort(a);   if (a[a.length - 1] == 1) {    for (int i = 0; i < a.length - 1; i++) {     writer.print(1 + " ");    }    writer.println(2 + "");    return;   }   for (int i = 0; i < a.length; i++) {    if (i == 0)     writer.print(1 + " ");    else     writer.print(a[i - 1] + " ");   }   writer.println();  }  static public void main(String[] args) {   new A().run();  } }
1	public class C46 {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int number = in.nextInt();   String s = in.next();   int cH = 0;   int n = s.length();   for (int i = 0 ; i < n ; i++)    if (s.charAt(i) == 'H') cH++;   String ss = "";   for (int i = 0 ; i < cH ; i++)    ss += "H";   for (int i = 0 ; i < n - cH ; i++)    ss += "T";   int res = Integer.MAX_VALUE;   for (int i = 0 ; i < n ; i++) {    int cur = countDifference(ss , s);    res = Math.min(res , cur);    ss = ss.substring(1) + ss.charAt(0);   }   System.out.println(res);  }  public static int countDifference(String ss, String s) {   int cnt = 0;   for (int i = 0 ; i < ss.length() ; i++)    if (ss.charAt(i) != s.charAt(i)) cnt++;   return cnt / 2;  } }
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 AUtils {   public static int max(int[] arr) {    int res = arr[0];    for (int x : arr) res = Math.max(res, x);    return res;   }   public static int sum(int[] arr) {    int sum = 0;    for (int x : arr) {     sum += x;    }    return sum;   }  }  static class Factorials {   public static long[][] getFIF(int max, int mod) {    long[] fact = new long[max];    long[] ifact = new long[max];    long[] inv = new long[max];    inv[1] = 1;    for (int i = 2; i < max; i++) {     inv[i] = (mod - mod / i) * inv[mod % i] % mod;    }    fact[0] = 1;    ifact[0] = 1;    for (int i = 1; i < max; i++) {     fact[i] = fact[i - 1] * i % mod;     ifact[i] = ifact[i - 1] * inv[i] % mod;    }    return new long[][]{fact, ifact, inv};   }  }  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);   }  } }
3	public class Main {  public static void main(String[] args) throws NumberFormatException, IOException  {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   Task solver = new Task();   int tc = in.nextInt();   for(int i = 0; i < tc; i++)    solver.solve(i, in, out);   out.close();  }  static class Task {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int k = in.nextInt();    int[] s = getArray(in.nextToken());    int[] a = getArray(in.nextToken());    int[] b = getArray(in.nextToken());    int[] per = new int[k];    boolean[] used = new boolean[k];    Arrays.fill(per , -1);    if(!check(s , a, per.clone(), k, used)){     out.println("NO");     return;    }    for(int i = 0; i < s.length; i++){     if(per[s[i]] != -1){      continue;     }     for(int j = 0; j < k; j++){      if(used[j]){       continue;      }      per[s[i]] = j;      used[j] = true;      if(check(s , a , per.clone() , k, used)){       break;      }      per[s[i]] = -1;      used[j] = false;     }    }    for(int i = 0; i < s.length; i++){     if(per[s[i]] == -1){      out.println("NO");      return;     }     s[i] = per[s[i]];    }    if(cmp(s , b) > 0){     out.println("NO");     return;    }     int last = 0;    for(int i = 0; i < k; i++){     if(per[i] == -1) {      while(used[last])last++;      per[i] = last;      used[last] = true;     }    }    char[] result = new char[k];    for(int i = 0; i < k; i++){     result[i] = (char)('a' + per[i]);    }    out.println("YES");    out.println(new String(result));   }   private int cmp(int[] a, int[] b){    for(int i = 0; i < a.length; i++){     if(a[i] != b[i]){      return a[i] < b[i] ? -1 : 1;     }    }    return 0;   }    private boolean check(int[] s, int[] a, int[] per, int k, boolean[] used) {    int res[] = new int[s.length];    int last = k - 1;    for(int i = 0; i < res.length; ++i){     if(per[s[i]] == -1){      while(last >= 0 && used[last]){       last--;      }      if(last < 0){       return false;      }      per[s[i]] = last;      last--;     }     res[i] = per[s[i]];    }    return cmp(a , res) <= 0;   }   private int[] getArray(String nextToken) {    int result[] = new int[nextToken.length()];    for(int i = 0; i < nextToken.length(); i++){     result[i] = nextToken.charAt(i) - 'a';    }    return result;   }  }  static class InputReader {   BufferedReader in;   StringTokenizer tok;   public InputReader(InputStream stream){    in = new BufferedReader(new InputStreamReader(stream), 32768);    tok = null;   }   String nextToken()   {    String line = "";    while(tok == null || !tok.hasMoreTokens()) {     try {      if((line = in.readLine()) != null)       tok = new StringTokenizer(line);      else       return null;     } catch (IOException e) {      e.printStackTrace();      return null;     }    }    return tok.nextToken();   }   int nextInt(){    return Integer.parseInt(nextToken());   }   long nextLong() {    return Long.parseLong(nextToken());   }   double nextDouble() {    return Double.parseDouble(nextToken());   }  } }
4	public class Main { public String[][] a; public void run () throws Exception {  Scanner in = new Scanner(new File("input.txt"));  PrintWriter pw = new PrintWriter(new File("output.txt"));  int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();   int[] xx = new int[k];  int[] yy = new int[k];  for(int i=0;i<k;i++){  xx[i] = in.nextInt();  yy[i]= in.nextInt();  }  int x=0,y=0,r;  r=-1;   for(int i=0;i<n;i++)  for(int j=0;j<m;j++){   int rr = 1000000;   for(int q=0;q<k;q++)   rr = Math.min(rr, Math.abs(xx[q]-1-i)+Math.abs(yy[q]-1-j));   if(rr>r){   r=rr;   x=i;   y=j;   }  }  pw.print((x+1)+" "+(y+1));  pw.close(); } public static void main(String[] args) throws Exception {  new Main ().run(); } }
1	public class A { public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  String s = new String(in.readLine());   String[] t=s.split(" ");   int n = Integer.parseInt(t[0]);   int k = Integer.parseInt(t[1]);   boolean[] prime=new boolean[n+1];   for (int i=2;i<Math.sqrt(n);i++) {   for (int j=i+i;j<=n;j=j+i) {    prime[j]=true;   }   }   int size=0;   for (int i=2;i<=n;i++) {   if (!prime[i]) {    size++;   }   }   int[] pn=new int[size];   int index=0;   for (int i=2;i<=n;i++) {   if (!prime[i]) {    pn[index]=i;    index++;   }     }   for (int i=2;i<size;i++) {   for (int j=0;j<i;j++) {    if (pn[i]==pn[j]+pn[j+1]+1) {     k--;    }   }   }   if (k<=0) {   System.out.println("YES");   } else {   System.out.println("NO");   } } }
3	public class SolutionArch2 {  public static void main(String[] args) {   Scanner scanner = new Scanner(System.in);   int n = Integer.valueOf(scanner.nextLine());   String s = scanner.nextLine();   int[] arr = Arrays.stream(s.split(" "))     .mapToInt(Integer::valueOf)     .toArray();   int[] prefixSum = new int[n + 1];   for (int i = 0; i < n; i++) {    prefixSum[i + 1] = prefixSum[i] + arr[i];   }   Map<Integer, List<int[]>> map = new HashMap<>();   for (int i = 0; i < n; i++) {    for (int j = i; j < n; j++) {     int subarraySum = prefixSum[j + 1] - prefixSum[i];     map.putIfAbsent(subarraySum, new ArrayList<>());     int l = i + 1, r = j + 1;     map.get(subarraySum).add(new int[]{l, r});    }   }   List<int[]> resultPairs = new ArrayList<>();   for (Map.Entry<Integer, List<int[]>> e : map.entrySet()) {    List<int[]> result = new ArrayList<>();    int[] curr = new int[2];    List<int[]> pairs = e.getValue();    Collections.sort(pairs, Comparator.<int[]>comparingInt(a -> a[1]));    for (int[] next : pairs) {     if (next[0] > curr[1]) {      result.add(next);      curr = next;     }    }    if (resultPairs.size() < result.size()) {     resultPairs = result;    }   }   printResult(resultPairs);  }  private static void printResult(List<int[]> list) {   StringBuilder sb = new StringBuilder();   sb.append(list.size()).append("\n");   for (int[] pair : list) {    sb.append(pair[0]).append(" ").append(pair[1]).append("\n");   }   System.out.print(sb);  } }
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; }  static long readLong() {  long 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; }  static String readLine() {  StringBuilder b = new StringBuilder();  try {  boolean start = false;  for (int c = 0; (c = System.in.read()) != -1; ) {   if (Character.isLetterOrDigit(c)) {   start = true;   b.append((char) c);   } else if (start) break;  }  } catch (IOException e) {  }  return b.toString(); }  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]);  } } }
2	public class C {  public static void main(String[] args) throws InterruptedException{  FastScanner scan = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  long n = scan.nextLong(), s = scan.nextLong();  long lo = 1, hi = n+1;  for(int bs = 0; bs < 100; bs++) {  long mid = (lo+hi)>>1;  long mid2 = mid;  long c = 0;  while(mid > 0) {   c += mid%10;   mid /= 10;  }  if(mid2-c < s) lo = mid2;  else hi = mid2;  }  out.println(n-lo);  out.close(); }  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 String nextLine() {  String line = "";  if(st.hasMoreTokens()) line = st.nextToken();  else try {return br.readLine();}catch(IOException e){e.printStackTrace();}  while(st.hasMoreTokens()) line += " "+st.nextToken();  return line;  }  public int[] nextIntArray(int n) {  int[] a = new int[n];  for(int i = 0; i < n; i++) a[i] = nextInt();  return a;  }  public long[] nextLongArray(int n){  long[] a = new long[n];  for(int i = 0; i < n; i++) a[i] = nextLong();  return a;  }  public double[] nextDoubleArray(int n){  double[] a = new double[n];  for(int i = 0; i < n; i++) a[i] = nextDouble();  return a;  }  public char[][] nextGrid(int n, int m){  char[][] grid = new char[n][m];  for(int i = 0; i < n; i++) grid[i] = next().toCharArray();  return grid;  } } }
6	public class Driver {  private static int [][] distances, parents;  private static int [] distance, parent;  private static String [][] longNames;  private static String [] shortNames, answers;  private static int N;  public static void main(String [] args) throws IOException {   BufferedReader scanner = new BufferedReader(new InputStreamReader(System.in));   String [] pieces = scanner.readLine().split("\\s+");      Point origin = new Point(Integer.parseInt(pieces[0]), Integer.parseInt(pieces[1]));   N = Integer.parseInt(scanner.readLine());   Point [] points = new Point[N + 1];   distances = new int[N + 1][N + 1];   parents = new int[N + 1][N + 1];   longNames = new String[N][N];   shortNames = new String[N];   for (int i = 0; i < N; ++i) {    pieces = scanner.readLine().split("\\s+");    points[i] = new Point(Integer.parseInt(pieces[0]), Integer.parseInt(pieces[1]));   }   points[N] = origin;   for (int i = 0; i <= N; ++i) {    if (i < N) {     shortNames[i] = (i + 1) + " ";    }    for (int j = 0; j <= N; ++j) {     if (i < N && j < N) {      longNames[i][j] = (i + 1) + " " + (j + 1) + " ";     }     distances[i][j] = 2 * points[i].distance(points[j]);     parents[i][j] = points[i].distance(points[N]) + points[i].distance(points[j]) + points[j].distance(points[N]);    }   }   distance = new int[1 << N];   parent = new int[1 << N];   answers = new String[1 << N];   Arrays.fill(distance, -1);   distance[0] = 0;   int result = rec((1 << N) - 1);   StringBuilder answer = new StringBuilder();   for (int i = distance.length - 1; parent[i] != i; i = parent[i]) {    answer.append("0 ");    answer.append(answers[i]);   }   answer.append("0");   System.out.println(result);   System.out.println(answer.toString());  }  private static int rec(int mask) {   if (distance[mask] != -1) {    return distance[mask];   }   int min = 0;   while (((1 << min) & mask) == 0) {    min++;   }   int newMask = mask & (~(1 << min));   distance[mask] = rec(newMask) + distances[min][N];   parent[mask] = newMask;   answers[mask] = shortNames[min];   for (int i = min + 1; i < N; i++) {    if (((1 << i) & mask) > 0) {     newMask = mask & (~(1 << i)) & (~(1 << min));     int temp = rec(newMask) + parents[i][min];     if (temp< distance[mask]) {      distance[mask] = temp;      parent[mask] = newMask;      answers[mask] = longNames[min][i];     }    }   }   return distance[mask];  }  private static class Point {   int x, y;   public Point(int x, int y) {    this.x = x;    this.y = y;   }   public int distance(Point p) {    return (int)(Math.pow(this.x - p.x, 2) + Math.pow(this.y - p.y, 2));   }  } }
6	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(),k=Int();    int A[][]=new int[n][2];    for(int i=0;i<n;i++){     A[i][0]=Int();     A[i][1]=Int();    }    Solution sol=new Solution(out);    sol.solution(A,k);   }   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;  }   long dp[][];  int mod=1000000007;  int time;  public void solution(int A[][],int t){   this.time=t;   dp=new long[4][1<<A.length+2];   for(int i=0;i<dp.length;i++){    Arrays.fill(dp[i],-1);   }   long a=dfs(A,0,(1<<A.length)-1);   out.println(a);  }  public long dfs(int A[][],int pre,int state){   int use=cal(A,state);   if(time-use==0){    return 1;   }   if(time<use||state==0){    return 0;   }   if(dp[pre][state]!=-1)return dp[pre][state];   long res=0;   for(int i=0;i<A.length;i++){    if(((state&(1<<i))!=0)&&A[i][1]!=pre){     res+=dfs(A,A[i][1],(state^(1<<i)));     res%=mod;    }   }   dp[pre][state]=res;   return res;  }  public int cal(int A[][],int state){   int t=0;   for(int i=0;i<A.length;i++){    if((state&(1<<i))==0){     t+=A[i][0];    }   }   return t;  }  }
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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   int MOD = (int) 1e9 + 7;   public void solve(int testNumber, InputReader in, OutputWriter out) {    long x = in.nextLong(), k = in.nextLong();    long res = Utilities.mul(x, Utilities.power(2, k + 1, MOD), MOD) % MOD - Utilities.power(2, k, MOD) + 1;    while (res < 0) res += MOD;    out.println(x == 0 ? 0 : res);   }  }  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 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 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 println(long i) {    writer.println(i);   }  }  static class Utilities {   public static long mul(long x, long y, long mod) {    return (x % mod) * (y % mod) % mod;   }   public static long power(long a, long k, long m) {    long res = 1;    while (k > 0) {     if ((k & 1) != 0) {      res = mul(res, a, m);     }     a = mul(a, a, m);     k >>= 1;    }    return res;   }  } }
0	public class A {  BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof;  long f(int x, int y) {  if (x == 0 || y == 0)  return 0;  if (x >= y) {  return x / y + f(y, x % y);  } else {  return y / x + f(x, y % x);  } }  A() throws IOException {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  int t = nextInt();  while (t-- > 0) {  int a = nextInt();  int b = nextInt();  out.println(f(a, b));  }  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(); }  String nextString() {  try {  return br.readLine();  } catch (IOException e) {  eof = true;  return null;  } }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
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;  }  } } }
0	public class problemB185 {  public static void main(String[] args) throws IOException{  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  StringBuffer sb=new StringBuffer();  int n=Integer.parseInt(br.readLine());   if(n<0){  int temp=-n;  int temp2=temp/10;  int x=temp%10;  int y=temp2%10;  if(x>y){   temp=temp/10;  }  else{   temp=temp/10 -y +x;  }  n=-temp;      }  System.out.println(n);   }   }
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);  TaskC solver = new TaskC();  solver.solve(1, in, out);  out.close(); }  static class TaskC {  static final long MODULO = (int) (1e9 + 7);  public void solve(int testNumber, Scanner in, PrintWriter out) {  long x = in.nextLong();  long k = in.nextLong();   if (x == 0) {   out.println(0);  } else {   long e = modPow(2, k, MODULO);   long y = 2 * x - 1;   long w = ((e % MODULO) * (y % MODULO)) % MODULO;   long z = (w + 1) % MODULO;   out.println(z);  }  }  private long modPow(long a, long b, long m) {  if (b == 0) return 1 % m;  if (b == 1) return a % m;  long res = modPow(a, b / 2, m);  res = (res * res) % m;  if (b % 2 == 1) res = (res * a) % m;  return res;  } } }
0	public class Rules { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int a = in.nextInt();  double maxSpeed = in.nextInt();  double len = in.nextInt();  double delayDist = in.nextInt();  double delaySpeed = in.nextInt();   double timeToDelaySpeed = delaySpeed/a;  double timeToDelay = travelS(a, 0.0, maxSpeed, delayDist);   if (timeToDelay < timeToDelaySpeed) {     timeToDelay = travelS(a, 0.0, maxSpeed, len);  double timeToMax = maxSpeed/a;  if (timeToDelay < timeToMax) {   System.out.printf("%.9f\n", timeToDelay);   return;  }    double[] parts = travelA(a, 0.0, maxSpeed);  double remainingDist = len - parts[1];  double time = parts[0] + remainingDist / maxSpeed;  System.out.printf("%.9f\n", time);  return;  }  if (delaySpeed > maxSpeed) {  double time = travelS(a, 0.0, maxSpeed, len);  System.out.printf("%.9f\n", time);  return;  }     double lowV = delaySpeed;  double highV = maxSpeed;  int loopCount = 1000;  double[] initial = null;  double[] secondary = null;  while (loopCount-->0) {  double guessV = (lowV+highV)/2.0;  initial = travelA(a, 0.0, guessV);  secondary = travelA(a, guessV, Math.min(delaySpeed, maxSpeed));  if (initial[1] + secondary[1] < delayDist) {   lowV = guessV;  } else {   highV = guessV;  }  }  double totalTime = 0.0;  double finalSpeed = 0.0;  initial = travelA(a, 0.0, lowV);  secondary = travelA(a, lowV, delaySpeed);  totalTime = initial[0] + secondary[0];  double totalDist = initial[1] + secondary[1];  totalTime += (delayDist-totalDist)/maxSpeed;     totalTime += travelS(a, delaySpeed, maxSpeed, len-delayDist);  System.out.printf("%.9f\n", totalTime); }    public static double[] travelA(int a, double startSpeed, double endSpeed) {  if (startSpeed > endSpeed)  a = -a;   double time = (endSpeed - startSpeed) / a;  double dist = 0.5*a*time*time + startSpeed*time;  return new double[] {time, dist}; }   public static double travelS(int a, double startSpeed, double maxSpeed, double dist) {  double timeToMax = (maxSpeed - startSpeed) / a;  double targetTime = (-startSpeed + Math.sqrt(startSpeed*startSpeed + 2*a*dist)) / a;  if (targetTime < timeToMax)  return targetTime;   double partialDist = 0.5*timeToMax*timeToMax*a + startSpeed*timeToMax;  double remainingDist = dist - partialDist;  targetTime = remainingDist / maxSpeed;  return targetTime + timeToMax; } }
3	public class paintNumbers { public static int minIndex(List<Integer> list) {  int min = list.get(0);  int minIndex = 0;  for (int i = 0; i < list.size(); i++) {  if (list.get(i) < min) {   min = list.get(i);   minIndex = i;  }  }  return minIndex; }  public static void main(String[] args) throws IOException {   FastScanner sc = new FastScanner(System.in);   PrintWriter pw = new PrintWriter(System.out);     int n = sc.nextInt();   List<Integer> list = new ArrayList<Integer>();   for (int i = 0; i < n; i++) {   list.add(sc.nextInt());   }   int count = 0;   while (list.size() > 0) {   count++;   int temp = list.get(minIndex(list));    for (int j = 0; j < list.size(); j++) {    if (list.get(j) % temp == 0) {     list.remove(j);    j--;    }   }    }   pw.println(count);     pw.close();  }  static class FastScanner {  private boolean finished = false;   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private SpaceCharFilter filter;   public FastScanner(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 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 nextString() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     if (Character.isValidCodePoint(c)) {      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;   }   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 BigInteger readBigInteger() {    try {     return new BigInteger(nextString());    } catch (NumberFormatException e) {     throw new InputMismatchException();    }   }   public char nextCharacter() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    return (char) c;   }   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 boolean isExhausted() {    int value;    while (isSpaceChar(value = peek()) && value != -1) {     read();    }    return value == -1;   }  public String next() {    return nextString();   }   public SpaceCharFilter getFilter() {    return filter;   }   public void setFilter(SpaceCharFilter filter) {    this.filter = filter;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }   public int[] nextIntArray(int n){    int[] array=new int[n];    for(int i=0;i<n;++i)array[i]=nextInt();    return array;   }   public int[] nextSortedIntArray(int n){    int array[]=nextIntArray(n);    PriorityQueue<Integer> pq = new PriorityQueue<Integer>();    for(int i = 0; i < n; i++){     pq.add(array[i]);    }    int[] out = new int[n];    for(int i = 0; i < n; i++){     out[i] = pq.poll();    }    return out;   }   public int[] nextSumIntArray(int n){    int[] array=new int[n];    array[0]=nextInt();    for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();    return array;   }   public ArrayList<Integer>[] nextGraph(int n, int m){    ArrayList<Integer>[] adj = new ArrayList[n];    for(int i = 0; i < n; i++){     adj[i] = new ArrayList<Integer>();    }    for(int i = 0; i < m; i++){     int u = nextInt(); int v = nextInt();     u--; v--;     adj[u].add(v); adj[v].add(u);    }    return adj;   }   public ArrayList<Integer>[] nextTree(int n){    return nextGraph(n, n-1);   }   public long[] nextLongArray(int n){    long[] array=new long[n];    for(int i=0;i<n;++i)array[i]=nextLong();    return array;   }   public long[] nextSumLongArray(int n){    long[] array=new long[n];    array[0]=nextInt();    for(int i=1;i<n;++i)array[i]=array[i-1]+nextInt();    return array;   }   public long[] nextSortedLongArray(int n){    long array[]=nextLongArray(n);    Arrays.sort(array);    return array;   }  } }
5	public class Village { private class House implements Comparable<House>{  Double Coordinate;  Double Sidelength;  public House(double coordinate, double sidelength) {  Coordinate = coordinate;  Sidelength = sidelength;  }  public int compareTo(House o) {  return Coordinate.compareTo(o.Coordinate);  } }   public static void main(String args[]) {  Village v = new Village();  v.solve(); } public void solve() { Scanner in = new Scanner(System.in); int numhouse = in.nextInt(); double requireside = in.nextDouble();   ArrayList<House> coordinate = new ArrayList<House>(); ArrayList<Double> sidelength = new ArrayList<Double>();  while (in.hasNext()) {  double coo = in.nextDouble();  double side = in.nextDouble();     coordinate.add(new House(coo,side));  sidelength.add(side);  } Collections.sort(coordinate); ArrayList<Double> edges = new ArrayList<Double>(); int count = 2; for (int i = 0; i < coordinate.size();i++) {  edges.add(coordinate.get(i).Coordinate - (double)coordinate.get(i).Sidelength/(double)2);  edges.add(coordinate.get(i).Coordinate + (double)coordinate.get(i).Sidelength/(double)2); } ArrayList<Double> difference = new ArrayList<Double>(); for (int i = 1; i < edges.size() - 1; i++) {  difference.add(Math.abs(edges.get(i) - edges.get(i+1))); } for (int i = 0; i < difference.size(); i+=2) {  if (difference.get(i) == requireside) count++;  else if (difference.get(i) > requireside) count+=2; } System.out.println(count); } }
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();   }    int nextInt()   {    return Integer.parseInt(next());   }    long nextLong()   {    return Long.parseLong(next());   }    double nextDouble()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  } }
5	public class TaskA {   public static void main(String[] args) {  Scanner in = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  new TaskA().solve(in, out);  in.close();  out.close(); }  private void solve(Scanner in, PrintWriter out) {  int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();  int answer = 0;  int counter = k;  int[] a = new int[n];  for (int i = 0; i < n; ++i)  a[i] = in.nextInt();  Arrays.sort(a);  int[] b = Arrays.copyOf(a, a.length);  for (int i = 0; i < n; ++i)   a[i] = b[n - i - 1];  for (int i = 0; i < n; ++i) {  if (counter < m) {   counter += a[i] - 1;   ++answer;  } else   break;  }  if (counter < m)  out.println("-1");  else  out.println(answer); } }
5	public class R2_D2_A {  public static void main(String[] args) {        InputReader in = new InputReader(System.in);   int n = in.readInt();   int a = in.readInt();   int b = in.readInt();   Integer[] inp = new Integer[n];   for (int i = 0; i < inp.length; i++) {    inp[i] = in.readInt();   }   Arrays.sort(inp);   int petya = inp[inp.length-a];   int next = inp[inp.length-a-1];   int diff = petya - next;   System.out.println(diff);  }  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;   }   public long readLong() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public String readString() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuffer res = new StringBuffer();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   private String readLine0() {    StringBuffer buf = new StringBuffer();    int c = read();    while (c != '\n' && c != -1) {     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 char readCharacter() {    int c = read();    while (isSpaceChar(c))     c = read();    return (char) c;   }   public double readDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, readInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, readInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }  } }
2	public class Main {  static boolean visited[] ;  static boolean ends[] ; static long mod = 1000000007 ; static int lens[] ;  static int seeds[] ;  static int a[] ; static double total ;  public static ArrayList adj[] ;  public static long x,y ; public static ArrayList<Long> xx ;  public static void main(String[] args) throws IOException, InterruptedException {  Scanner sc = new Scanner(System.in) ;  long x = sc.nextLong() ;  long k = sc.nextLong() ;  if(x==0)  {System.out.println(0); return ;}  if(k==0)  {System.out.println((2l*x)%mod);return ;}   long m=pow(2,k);   long a = 2l*(x%mod)*(m%mod);   a = a-m+1 ;  a=a%mod ;  if(a<0)a=(a%mod + mod) % mod;  System.out.println(a);    }   static ArrayList<Long> divisors(long n) {  ArrayList<Long> arr = new ArrayList<Long>() ;    for (int i=1; i<=Math.sqrt(n); i++)  {  if (n%i==0)      if (n/i == i)   {arr.add(1l*i);arr.add(1l*i);}   else   {arr.add(1l*i); arr.add(1l*n/i);}  }   return arr ;  }  public static void generate(long current) {  if(current>10000000000l)  return ;   xx.add(current) ;  generate((10*current) +4);  generate((10*current) +7);  }  public static int neededFromLeft(String x) {  Stack<Character> st = new Stack<Character>() ;  int c=0;  for (int i = 0; i < x.length(); i++)  {  char cur = x.charAt(i);   if(cur==')' && st.isEmpty())   c ++;   else if(cur==')' && !st.isEmpty())   st.pop();  else if(cur=='(')   st.push(cur);  }  return c; }  public static int neededFromRight(String x) {  Stack<Character> st = new Stack<Character>() ;  int c=0;  boolean f=true;  for (int i = 0; i < x.length(); i++)  {  char cur = x.charAt(i);   if(cur==')' && st.isEmpty())   f=false;   else if(cur==')' && !st.isEmpty())   st.pop();  else if(cur=='(')   st.push(cur);  }  return st.size();  }  public static boolean fromBoth(String x) {  Stack<Character> st = new Stack<Character>() ;  boolean f1=true ,f2=true ;   for (int i = 0; i < x.length(); i++)  {  char cur = x.charAt(i);   if(cur==')' && st.isEmpty())   f1 =false ;   else if(cur==')' && !st.isEmpty())   st.pop();  else if(cur=='(')   st.push(cur);  }  if(st.size()>0)f2 = false ;  if(f1==false && f2==false)  return true ;  else   return false; }  public static boolean isRegular(String x) {  Stack<Character> st = new Stack<Character>() ;  for (int i = 0; i < x.length(); i++)  {  char cur = x.charAt(i);   if(cur==')' && st.isEmpty())   return false ;   else if(cur==')' && !st.isEmpty())   st.pop();  else if(cur=='(')   st.push(cur);  }  if(st.size()>0)return false ; else return true ; }  public static int gcdExtended(int a, int b) {   if (a == 0)  {  x = 0;  y = 1;  return b;  }    int gcd = gcdExtended(b%a, a);     long x1 = y - (b/a) * x;  long y1 = x;  x = x1 ;  y = y1 ;  return gcd; }      static int even(String x , int b ) {  for (int j = b; j>=0; j--)  {  int current = x.charAt(j)-48 ;   if(current%2==0)   return current ;  }  return -1; } static int odd(String x , int b ) {  for (int j = b; j>=0; j--)  {  int current = x.charAt(j)-48 ;   if(current%2!=0)   return current ;  }  return -1; } static long pow(long base, long k) {  long res = 1;  while(k > 0) {  if(k % 2 == 1) {   res = (res * base) % mod;  }   base = (base * base) % mod;  k /= 2;  }  return res; } public static long solve(int k1, long k2) {  long x = 1l*k2*(pow(2, k1)-1) ;  return x%(1000000007) ;  }  public static long getN(long x) {  long n = (long) Math.sqrt(x*2) ;  long y = n*(n+1)/2;  if(y==x)  return n ;  else if(y>x)  return n ;  else  for (long i = n; ; i++)  {   y = i*(i+1)/2 ;   if(y>=x)   return i ;    } }     public static void dfss(int root , int len) {  visited[root]=true ;  if(ends[root] && root!=0) lens[root] = len ;   for (int i = 0; i < adj[root].size(); i++)  {  int c= (int) adj[root].get(i) ;   if(visited[c]==false)   dfss(c, len+1);  } }  public static void pr(int root , int seed){  visited[root] = true ;  int dv = adj[root].size()-1 ;  if(root==0) dv++ ;  for (int i = 0; i < adj[root].size(); i++)  {  int c = (int)adj[root].get(i) ;   seeds[c]=dv*seed ;  }  for (int i = 0; i < adj[root].size() ; i++)  {  int c = (int)adj[root].get(i) ;   if(visited[c]==false)   pr(c , seeds[c]);  }  }  public static String concatinate(String s ,int n) {  if(s.length()==n)  return s ;  else return concatinate("0"+s, n) ; } 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 long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public boolean ready() throws IOException {  return br.ready();  } }  public static long getGCD(long n1, long n2) {  if (n2 == 0) {  return n1;  }  return getGCD(n2, n1 % n2); }  public static int cnt1(int mat[][])  {  int m = mat.length ;  int c=0 ;  for (int i = 0; i < mat.length; i++)  {  for (int j = 0; j < mat.length; j++)  {   int x = (i*m) +j ;   if(x%2==0 && mat[i][j]==0)   c++;   if(x%2!=0 && mat[i][j]==1)   c++;   }  }  return c; } public static int cnt0(int mat[][]) {  int m = mat.length ;  int c=0 ;  for (int i = 0; i < mat.length; i++)  {  for (int j = 0; j < mat.length; j++)  {   int x = (i*m) +j ;   if(x%2!=0 && mat[i][j]==0)   c++;   if(x%2==0 && mat[i][j]==1)   c++;   }  }  return c; }  public static boolean canFit2(int x1, int y1 , int x2 , int y2 , int x3 , int y3){  if(x1==x2)  if(x1==x3)   return true ;   else   return false ;  else  if(x1==x3)   return false ;   else  {   long a = 1l*(y2-y1)*(x3-x2) ;   long b = 1l*(y3-y2)*(x2-x1) ;    if(a==b)   return true;   else    return false ;   }  } public static void shuffle(pair[] ss){  if(ss.length==1)  return ;  for (int i = 0; i < ss.length; i++)  {  Random rand = new Random();   int n = rand.nextInt(ss.length-1) + 0;   pair temp = ss[i] ;   ss[i] = ss[n] ;   ss[n] = temp ;  } } public static int binary(ArrayList<pair> arr, int l, int r, long x)  {  if (r>=l)  {  int mid = l + (r - l)/2;  if (arr.get(mid).x== x)   return mid;  if (arr.get(mid).x> x)   return binary(arr, l, mid-1, x);  return binary(arr, mid+1, r, x);  }  return -1; }   public static int binary1(int[]arr , int x) {  int low = 0, high = arr.length;  while (low != high) {  int mid = (low + high) / 2;   if (arr[mid] <= x) {     low = mid + 1;  }  else {     high = mid;  }  }  return low ;  }   public static int binary2(pair[]arr , int x) {  int low = 0, high = arr.length;  while (low != high) {  int mid = (low + high) / 2;   if (arr[mid].x >= x) {     high=mid;  }  else {     low = mid+1 ;   }  }  return low ;  }  private static boolean triangle(int a, int b , int c){  if(a+b>c && a+c>b && b+c>a)  return true ;  else   return false ; } private static boolean segment(int a, int b , int c){  if(a+b==c || a+c==b && b+c==a)  return true ;  else   return false ; } private static int gcdThing(long a, long b) {  BigInteger b1 = BigInteger.valueOf(a);  BigInteger b2 = BigInteger.valueOf(b);  BigInteger gcd = b1.gcd(b2);  return gcd.intValue(); }  public static boolean is(int i){  if(Math.log(i)/ Math.log(2) ==(int) (Math.log(i)/ Math.log(2)))  return true ;  if(Math.log(i)/ Math.log(3) ==(int) (Math.log(i)/ Math.log(3)) )  return true ;  if(Math.log(i)/ Math.log(6) ==(int) (Math.log(i)/ Math.log(6)) )  return true ;   return false;  } public static boolean contains(int b[] , int x) {  for (int i = 0; i < b.length; i++)  {  if(b[i]==x)   return true ;  }  return false ; } public static int binary(long []arr , long target , int low , long shift) {  int high = arr.length;  while (low != high) {  int mid = (low + high) / 2;   if (arr[mid]-shift <= target) {   low = mid + 1;  }  else {   high = mid;  }  }  return low ;  } public static boolean isLetter(char x){  if(x+0 <=122 && x+0 >=97 )  return true ;  else if (x+0 <=90 && x+0 >=65 )  return true ;  else return false;  } public static long getPrimes(long x ){  if(x==2 || x==3 || x==1)  return 2 ;  if(isPrime(x))  return 5 ;  for (int i = 2; i*i<=x; i++)  {  if(x%i==0 && isPrime(i))   return getPrimes(x/i) ;  }  return -1; } public static String solve11(String x){  int n = x.length() ;  String y = "" ;  for (int i = 0; i < n-2; i+=2)  {  if(ifPalindrome(x.substring(i, i+2)))   y+= x.substring(i, i+2) ;  else   break ;  }  return y+ solve11(x.substring(y.length(),x.length())) ;  } public static String solve1(String x){  String y = x.substring(0 , x.length()/2) ;  return "" ;  } public static String reverse(String x){  String y ="" ;  for (int i = 0; i < x.length(); i++)  {  y = x.charAt(i) + y ;  }  return y ; }  public static boolean ifPalindrome(String x){  int numbers[] = new int[10] ;  for (int i = 0; i < x.length(); i++)  {  int z = Integer.parseInt(x.charAt(i)+"") ;   numbers[z] ++ ;  }  for (int i = 0; i < numbers.length; i++)  {  if(numbers[i]%2!=0)   return false;  }  return true ;  }  public static int get(int n){  return n*(n+1)/2 ;  }              public static int lis( int[]a , int n){  int lis[] = new int[n] ;  Arrays.fill(lis,1) ;   for(int i=1;i<n;i++)  for(int j=0 ; j<i; j++)   if (a[i]>a[j] && lis[i] < lis[j]+1)    lis[i] = lis[j] + 1;     int max = lis[0];  for(int i=1; i<n ; i++)  if (max < lis[i])   max = lis[i] ;  return (max);                        } public static int calcDepth(Vertix node){  if(node.depth>0) return node.depth;    if(node.parent != null)  return 1+ calcDepth(node.parent);  else  return -1; }  public static boolean isPrime (long num){  if (num < 2) return false;  if (num == 2) return true;  if (num % 2 == 0) return false;  for (int i = 3; i * i <= num; i += 2)  if (num % i == 0) return false;  return true; }  public static ArrayList<Long> getDiv(Long n) {  ArrayList<Long> f = new ArrayList<Long>() ;   while (n%2==0)  {  if(!f.contains(2))f.add((long) 2) ;  n /= 2;  }     for (long i = 3; i <= Math.sqrt(n); i+= 2)  {    while (n%i == 0)  {   if(!f.contains(i))f.add(i);   n /= i;  }  }     if (n > 2)  if(!f.contains(n))f.add(n);   return f ;   }                             public static class Vertix{  long i ;  int depth ;  ArrayList<Vertix> neighbours ;  Vertix parent ;  Vertix child ;   public Vertix(long i){  this.i = i ;  this.neighbours = new ArrayList<Vertix> () ;  this.parent = null ;  depth =-1;  this.child = null ;  } }  public static class pair implements Comparable<pair> {  int x ;  int y ;  int i;    public pair(int x, int y, int i ){   this.x=x ;   this.y =y ;  this.i =i ;   }   @Override  public int compareTo(pair p) {  if(this.x > p.x)   return 1 ;   else if (this.x == p.x)   return 0 ;   else   return -1 ;  }   }  public static class pair2 implements Comparable<pair2>{  int i ;  int j ;  int plus ;  public pair2(int i , int j , int plus){  this.i =i ;  this.j = j ;   this.plus = plus ;  }  @Override  public int compareTo(pair2 p) {  if(this.j > p.j)   return 1 ;   else if (this.j == p.j) return 0 ;  else   return -1 ;  }  } public static class point implements Comparable<point> {  int x, y ;  public point(int x,int y){  this.x=x ; this.y=y;  }  @Override  public boolean equals(Object o) {     if (o == this) {   return true;  }     if (!(o instanceof point)) {   return false;  }     point c = (point) o;     return Integer.compare(x, c.x) == 0   && Integer.compare(y, c.y) == 0;  }  @Override  public int compareTo(point p) {  if(this.x == p.x && this.y ==p.y)   return 0 ;   else   return -1 ;  }  @Override  public int hashCode()  {  return 15+x+(y%2) ;  }   }  }
1	public class Watermelon {  static class Passengers {   public int floor ;  public int time;      public Passengers( int floor , int time){   this.floor =floor;   this.time =time;  }   }     public static void main(String[] args) {        Scanner in = new Scanner(System.in);     int x = in.nextInt() , y = in.nextInt();     ArrayList<Passengers> list = new ArrayList<>();     for(int i = 1 ; i <= x ; ++i){    list.add(new Passengers(in.nextInt(), in.nextInt()));   }     int sum = 0 ;   for(int i = list.size() - 1 ; i >= 0 ; --i)   {   int s = y - list.get(i).floor;   sum = sum + s ;       if(sum < list.get(i).time)   {    sum = sum + ( list.get(i).time - sum);   }      y = list.get(i).floor;   }        if( list.get(list.size() - 1).floor != 0){    sum = sum + (list.get(0).floor);   }   System.out.println(sum);  }  }
1	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));     StringTokenizer st = new StringTokenizer(f.readLine());  int n = Integer.parseInt(st.nextToken());  int a = Integer.parseInt(st.nextToken());  int b = Integer.parseInt(st.nextToken());  st = new StringTokenizer(f.readLine());  HashMap<Integer,Integer> in = new HashMap<Integer,Integer>();  int[][] locs = new int[n][2];  for (int i=0;i<n;i++) {  int num = Integer.parseInt(st.nextToken());  locs[i] = new int[]{num,i};  in.put(num,i);  }     boolean ok = true;  int swap = 0;  if (a>b) {swap = 1;  int t = a;  a = b;  b = t;  }  Arrays.sort(locs,new Comparator<int[]>() {  public int compare(int[] a, int[] b) {   return (new Integer(a[0])).compareTo(b[0]);  }  });  int[] inB = new int[n];  for (int[] i: locs) {  if (in.containsKey(b-i[0])) {   inB[i[1]] = 1-swap;   in.remove(b-i[0]);  } else if (in.containsKey(a-i[0])) {   inB[i[1]] = swap;   in.remove(a-i[0]);  } else ok = false;  }    StringBuffer p = new StringBuffer();  for (int i=0;i<n-1;i++) {  p.append(inB[i]);  p.append(" ");  }  p.append(inB[n-1]);  if (ok) {  out.println("YES");  out.println(p.toString());  } else {  out.println("NO");  }     out.close();  System.exit(0); } }
1	public class ProblemA {  String fileName = "prizes";  public void solve() throws IOException {  int n = nextInt();  int d = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  int ans = 2;  for (int i = 1; i < n; i++) {  if (a[i] - a[i - 1] == 2 * d)   ans++;  if (a[i] - a[i - 1] > 2 * d)   ans += 2;  }  out.println(ans); }  public void run() {  try {   br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out, true);         solve();   out.close();  } catch (IOException e) {  e.printStackTrace();  System.exit(1);  } }  BufferedReader br; StringTokenizer in; static PrintWriter 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()); }  public double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  public long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  public static void main(String[] args) throws IOException {  new ProblemA().run(); } }
3	public class Es1 {  static IO io = new IO();  public static void main(String[] args)  {  int n = io.getInt();  int[] a = new int[n];  for(int i=0; i<n; i++)  a[i] = io.getInt();   Arrays.sort(a);  int[] color = new int[n];  int num = 1;  for(int i=0; i<n; i++){  if(color[i]==0){   for(int j=i+1; j<n; j++){   if(a[j]%a[i]==0)    color[j] = num;   }   num++;  }  }   io.println(num-1);        io.close();  } }  class IO extends PrintWriter { public IO() {   super(new BufferedOutputStream(System.out));   r = new BufferedReader(new InputStreamReader(System.in));  }  public IO(String fileName) {   super(new BufferedOutputStream(System.out));   try{    r = new BufferedReader(new FileReader(fileName));   } catch (FileNotFoundException e) {    this.println("File Not Found");   }  }  public boolean hasMoreTokens() {   return peekToken() != null;  }  public int getInt() {   return Integer.parseInt(nextToken());  }  public double getDouble() {   return Double.parseDouble(nextToken());  }  public long getLong() {   return Long.parseLong(nextToken());  }  public String getWord() {   return nextToken();  }  public String getLine(){   try{    st = null;    return r.readLine();   }   catch(IOException ex){}   return null;  }   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;  } }
5	public class CottageVillage {  public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  int size=sc.nextInt();  int side=sc.nextInt();  ArrayList<Pair> lis=new ArrayList<Pair>();  for(int x=0;x<size;x++)  {  lis.add(new Pair(sc.nextInt(), sc.nextInt()));    }  Collections.sort(lis);  int count=2;  for(int x=0;x<lis.size()-1;x++)  {  Pair a=lis.get(x);  Pair b=lis.get(x+1);  double na=a.x+a.len/2;  double nb=b.x-b.len/2;    if(na<nb)  {   double dif=Math.abs(nb-na);   if(dif==side)count++;   else if(dif>side)count+=2;  }  }  System.out.println(count); } } class Pair implements Comparable<Pair> { int x; double len;  public Pair(int a,int b) {  x=a;  len=b; } public int compareTo(Pair o) {  return x-o.x; } }
0	public class A {  private static StringTokenizer tokenizer;  private static BufferedReader bf;  private static PrintWriter out;   private static int nextInt() throws IOException {  return Integer.parseInt(nextToken());  }   @SuppressWarnings("unused") private static long nextLong() throws IOException {  return Long.parseLong(nextToken());  }   private static String nextToken() throws IOException {  while(tokenizer == null || !tokenizer.hasMoreTokens()) {   tokenizer = new StringTokenizer(bf.readLine());  }  return tokenizer.nextToken();  }   public static void main(String[] args) throws IOException {  bf = new BufferedReader(new InputStreamReader(System.in));  tokenizer = null;  out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  int n = nextInt();  if(n >= 0) out.println(n);  else {   n = -n;   int a = n % 10; int m = n/10;   int b = m % 10;   if(a >= b) {   if(m == 0) out.println(0);   else out.println(-m);   }   else {   m = (m-b)+a;   if(m == 0) out.println(0);   else out.println(-m);   }  }  out.close(); } }
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());  }   double nextDouble()  {   return Double.parseDouble(next());  }   String nextLine()  {   String str = "";   try  {   str = br.readLine();   }   catch (IOException e)   {   e.printStackTrace();   }   return str;  }  }  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 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();  }  private static int nextInt() throws IOException{   return Integer.parseInt(next());  }   private static long nextLong() throws IOException{   return Long.parseLong(next());  }   private static double nextDouble() throws IOException{   return Double.parseDouble(next());  }   private static String next() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  } }
2	public class B {  public void solve() throws IOException {   long n = nextInt(), k = nextInt();   long c = 2 * (n + k);   long l = -1, r = 200000;   while (r - l > 1) {    long m = l + (r - l) / 2;    if (m * m + 3 * m >= c) {     r = m;    } else {     l = m;    }   }   out.print(n - r);  }  public void run() {   try {    br = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();    out.close();   } catch (IOException e) {    e.printStackTrace();    System.exit(1);   }  }  BufferedReader br;  StringTokenizer in;  PrintWriter 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());  }  public double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  public long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  public int[] nextArr(int n) throws IOException {   int[] res = new int[n];   for (int i = 0; i < n; i++) {    res[i] = nextInt();   }   return res;  }  public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);   new B().run();  } }
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());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }   String nextString() throws IOException {  return reader.readLine();  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }  }
1	public class Main {  public static void main (String[] args) throws IOException {  final long mod=(long) (1e9+7);  Reader s=new Reader();  PrintWriter pt=new PrintWriter(System.out);     int T=s.nextInt();   while(T-->0)  {    long n=s.nextInt();    long sq1=n/2;       long sq2=n/4;       if(isPerfectSquare(sq1)&&sq1*2==n||isPerfectSquare(sq2)&&sq2*4==n)    pt.println("YES");    else    pt.println("NO");             }  pt.close(); }  static void divideBy2(int arr[], int n) {  for(int i=0;i<n;i++) {  arr[i]=arr[i]>>1;  } }  static boolean isEven(int arr[], int n) {  for(int i=0;i<n;i++) {  if(arr[i]%2==1)   return false;  }  return true; }  static boolean isPartition(int arr[], int n) {  int sum = 0;  int i, j;      for (i = 0; i < n; i++)   sum += arr[i];    if (sum % 2 != 0)   return false;    boolean part[][]=new boolean[sum/2+1][n+1];      for (i = 0; i <= n; i++)   part[0][i] = true;      for (i = 1; i <= sum / 2; i++)   part[i][0] = false;      for (i = 1; i <= sum / 2; i++) {   for (j = 1; j <= n; j++) {    part[i][j] = part[i][j - 1];    if (i >= arr[j - 1])     part[i][j] = part[i][j]         || part[i - arr[j - 1]][j - 1];   }  }  return part[sum / 2][n]; }  static int setBit(int S, int j) { return S | 1 << j; }  static int clearBit(int S, int j) { return S & ~(1 << j); }  static int toggleBit(int S, int j) { return S ^ 1 << j; }  static boolean isOn(int S, int j) { return (S & 1 << j) != 0; }  static int turnOnLastZero(int S) { return S | S + 1; }  static int turnOnLastConsecutiveZeroes(int S) { return S | S - 1; }  static int turnOffLastBit(int S) { return S & S - 1; }  static int turnOffLastConsecutiveBits(int S) { return S & S + 1; }  static int lowBit(int S) { return S & -S; }  static int setAll(int N) { return (1 << N) - 1; }  static int modulo(int S, int N) { return (S & N - 1); }   static boolean isPowerOfTwo(int S) { return (S & S - 1) == 0; }  static boolean isWithin(long x, long y, long d, long k) {  return x*k*x*k + y*k*y*k <= d*d; }  static long modFact(long n,    long p)  {  if (n >= p)   return 0;    long result = 1;  for (int i = 1; i <= n; i++)   result = (result * i) % p;    return result;  }  static int sum(int[] arr, int n) {  int inc[]=new int[n+1];  int dec[]=new int[n+1];  inc[0] = arr[0];  dec[0] = arr[0];   for (int i = 1; i < n; i++) {   for (int j = 0; j < i; j++) {    if (arr[j] > arr[i]) {     dec[i] = max(dec[i], inc[j] + arr[i]);    }    else if (arr[i] > arr[j]) {     inc[i] = max(inc[i], dec[j] + arr[i]);    }   }  }  return max(inc[n - 1], dec[n - 1]); } static long nc2(long a) {  return a*(a-1)/2; } public static int numberOfprimeFactors(int n)  {     HashSet<Integer> hs = new HashSet<Integer>();   while (n%2==0)   {    hs.add(2);    n /= 2;   }         for (int i = 3; i <= Math.sqrt(n); i+= 2)   {        while (n%i == 0)    {     hs.add(i);     n /= i;    }   }         if (n > 2)    hs.add(n);   return hs.size();  }  static int gcd(int a, int b)  {   if (b == 0)   return a;   return gcd(b, a % b);  }     static void reverse(int arr[],int start, int end)  {  int temp;     while (start < end)  {   temp = arr[start];   arr[start] = arr[end];   arr[end] = temp;   start++;   end--;  }  }  static void reverse(long arr[],int start, int end)  {  long temp;     while (start < end)  {   temp = arr[start];   arr[start] = arr[end];   arr[end] = temp;   start++;   end--;  }  }  static boolean isPrime(int n)  {      if (n <= 1) return false;   if (n <= 3) return true;          if (n % 2 == 0 || n % 3 == 0) return false;     for (int i = 5; i * i <= n; i = i + 6)    if (n % i == 0 || n % (i + 2) == 0)    return false;     return true;  }  static int p2(int n) {  int k=0;  while(n>1) {  if(n%2!=0)   return k;  n/=2;  k++;  }  return k; } static boolean isp2(int n) {  while(n>1) {  if(n%2==1)   return false;  n/=2;  }  return true; } static int binarySearch(int arr[], int first, int last, int key){   int mid = (first + last)/2;   while( first <= last ){    if ( arr[mid] < key ){    first = mid + 1;     }else if ( arr[mid] == key ){    return mid;    }else{     last = mid - 1;    }    mid = (first + last)/2;   }   return -1;  }  static void print(int a[][]) {  for(int i=0;i<a.length;i++)  {  for(int j=0;j<a[0].length;j++)   System.out.print(a[i][j]+" ");  System.out.println();  } } static int max (int x, int y) {  return (x > y)? x : y; }  static int search(Pair[] p, Pair pair) {  int l=0, r=p.length;  while (l <= r) {    int m = l + (r - l) / 2;   if (p[m].compareTo(pair)==0)     return m;    if (p[m].compareTo(pair)<0)     l = m + 1;    else    r = m - 1;  }  return -1; } static void pa(int a[]) {  for(int i=0;i<a.length;i++)  System.out.print(a[i]+" ");  System.out.println();   } static void pa(long a[]) {  for(int i=0;i<a.length;i++)  System.out.print(a[i]+" ");  System.out.println();   } static void reverseArray(int arr[],    int start, int end)  {  int temp;     while (start < end)  {   temp = arr[start];   arr[start] = arr[end];   arr[end] = temp;   start++;   end--;  }  }   static boolean isPalindrome(String s) {  int l=s.length();  for(int i=0;i<l/2;i++)  {  if(s.charAt(i)!=s.charAt(l-i-1))   return false;  }  return true; } static long nc2(long n, long m) {  return (n*(n-1)/2)%m; } static long c(long a) {  return a*(a+1)/2; } static int next(long[] arr, long target)  {   int start = 0, end = arr.length - 1;     int ans = -1;   while (start <= end) {    int mid = (start + end) / 2;             if (arr[mid] < target) {     start = mid + 1;    }         else {     ans = mid;     end = mid - 1;    }   }   return ans;  }   static int prev(long[] arr, long target)  {   int start = 0, end = arr.length - 1;     int ans = -1;   while (start <= end) {    int mid = (start + end) / 2;             if (arr[mid] > target) {     end = mid - 1;    }         else {     ans = mid;     start = mid + 1;    }   }   return ans;  }  static long power(long x, long y, long p)  {   long res = 1;   x = x % p;         while (y > 0)   {    if (y % 2 == 1)     res = (res * x) % p;    y = y >> 1;    x = (x * x) % p;   }   return res;  }  static long modInverse(long n, long p)  {   return power(n, p-2, p);  }  static long nCrModP(long n, long r,          long p)  {   if(r>n)   return 0;  if (r == 0)    return 1;   long[] fac = new long[(int) (n+1)];   fac[0] = 1;   for (int i = 1 ;i <= n; i++)    fac[i] = fac[i-1] * i % p;   return (fac[(int) n]* modInverse(fac[(int) r], p)     % p * modInverse(fac[(int) (n-r)], p)          % p) % p;  }  static String reverse(String str) {  return new StringBuffer(str).reverse().toString(); }   static long fastpow(long x, long y, long m)  {   if (y == 0)    return 1;      long p = fastpow(x, y / 2, m) % m;   p = (p * p) % m;     if (y % 2 == 0)    return p;   else    return (x * p) % m;  }   static boolean isPerfectSquare(long l) {  return Math.pow((long)Math.sqrt(l),2)==l; }   static void merge(long[] arr, int l, int m, int r)  {      int n1 = m - l + 1;   int n2 = r - m;       long L[] = new long [n1];   long R[] = new long [n2];       for (int i=0; i<n1; ++i)    L[i] = arr[l + i];   for (int j=0; j<n2; ++j)    R[j] = arr[m + 1+ j];           int i = 0, j = 0;       int k = l;   while (i < n1 && j < n2)   {    if (L[i] <= R[j])    {     arr[k] = L[i];     i++;    }    else    {     arr[k] = R[j];     j++;    }    k++;   }       while (i < n1)   {    arr[k] = L[i];    i++;    k++;   }       while (j < n2)   {    arr[k] = R[j];    j++;    k++;   }  }      static void sort(int arr[], int l, int r)  {   if (l < r)   {        int m = (l+r)/2;         sort(arr, l, m);    sort(arr , m+1, r);         merge(arr, l, m, r);   }  }  static void merge(int arr[], int l, int m, int r)  {      int n1 = m - l + 1;   int n2 = r - m;       int L[] = new int [n1];   int R[] = new int [n2];       for (int i=0; i<n1; ++i)    L[i] = arr[l + i];   for (int j=0; j<n2; ++j)    R[j] = arr[m + 1+ j];           int i = 0, j = 0;       int k = l;   while (i < n1 && j < n2)   {    if (L[i] <= R[j])    {     arr[k] = L[i];     i++;    }    else    {     arr[k] = R[j];     j++;    }    k++;   }       while (i < n1)   {    arr[k] = L[i];    i++;    k++;   }       while (j < n2)   {    arr[k] = R[j];    j++;    k++;   }  }      static void sort(long arr[], int l, int r)  {   if (l < r)   {        int m = (l+r)/2;         sort(arr, l, m);    sort(arr , m+1, r);         merge(arr, l, m, r);   }  }  static class Pair implements Comparable<Pair>{   int a;   int b;   Pair(int a,int b){    this.a=a;     this.b=b;   }    public int compareTo(Pair p){    if(a>p.a)     return 1;    if(a==p.a)     return (b-p.b);    return -1;   }  } static class Reader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;    public Reader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public Reader(String file_name) throws IOException   {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public String readLine() throws IOException   {    byte[] buf = new byte[128];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }    public int nextInt() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do    {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');     if (neg)     return -ret;    return ret;   }    public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }    public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();     do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');     if (c == '.')    {     while ((c = read()) >= '0' && c <= '9')     {      ret += (c - '0') / (div *= 10);     }    }     if (neg)     return -ret;    return ret;   }    private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }    private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }    public void close() throws IOException   {    if (din == null)     return;    din.close();   }  } }
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, (o1, o2) -> o2.max - o1.max);    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 Column {    int[] v;    int max;    public Column(int[] v) {     this.v = v;    }    void initMax() {     max = 0;     for (int vv : v) max = Math.max(max, vv);    }   }  }  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;   }  } }
6	public class SimpleTask {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int m = scan.nextInt();  boolean[][] graph = new boolean[n][n];  for (int i = 0; i < m; i++) {  int u = scan.nextInt() - 1;  int v = scan.nextInt() - 1;  graph[u][v] = true;  graph[v][u] = true;  }  long[][] dp = new long[1 << n][n];  for (int i = 0; i < n; i++)  dp[1 << i][i] = 1;  for (int mask = 1; mask < (1 << n); mask++) {   int first = Integer.numberOfTrailingZeros(mask);   for (int i = 0; i < n; i++) {   if ((mask & (1 << i)) == 0 || first == i)   continue;   for (int j = 0; j < n; j++) {   if (graph[i][j])    dp[mask][i] += dp[mask ^ 1 << i][j];   }   }  }  long answer = 0;  for (int mask = 1; mask < (1 << n); mask++) {  if (Integer.bitCount(mask) < 3)   continue;   int first = Integer.numberOfTrailingZeros(mask);  for (int i = 0; i < n; i++) {   if (graph[first][i])   answer += dp[mask][i];  }  }  System.out.println(answer / 2);  scan.close(); } }
1	public class _1036_B_DiagonalWalkingV2 {  public static void main(String[] args) throws IOException {  int Q = readInt();  while(Q-- > 0) {  long n = readLong(), m = readLong(), k = readLong();  if(Math.max(n, m) > k) println(-1);  else {   long ans = k;   if(n%2 != k%2) ans--;   if(m%2 != k%2) ans--;   println(ans);  }  }  exit(); }  final private static int BUFFER_SIZE = 1 << 16; private static DataInputStream din = new DataInputStream(System.in); private static byte[] buffer = new byte[BUFFER_SIZE]; private static int bufferPointer = 0, bytesRead = 0; static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  public static String readLine() throws IOException {  byte[] buf = new byte[64];  int cnt = 0, c;  while ((c = Read()) != -1) {  if (c == '\n')   break;  buf[cnt++] = (byte) c;  }  return new String(buf, 0, cnt); }  public static String read() throws IOException {  byte[] ret = new byte[1024];  int idx = 0;  byte c = Read();  while (c <= ' ') {  c = Read();  }  do {  ret[idx++] = c;  c = Read();  } while (c != -1 && c != ' ' && c != '\n' && c != '\r');  return new String(ret, 0, idx); }  public static int readInt() throws IOException {  int ret = 0;  byte c = Read();  while (c <= ' ')  c = Read();  boolean neg = (c == '-');  if (neg)  c = Read();  do {  ret = ret * 10 + c - '0';  } while ((c = Read()) >= '0' && c <= '9');  if (neg)  return -ret;  return ret; }  public static long readLong() throws IOException {  long ret = 0;  byte c = Read();  while (c <= ' ')  c = Read();  boolean neg = (c == '-');  if (neg)  c = Read();  do {  ret = ret * 10 + c - '0';  } while ((c = Read()) >= '0' && c <= '9');  if (neg)  return -ret;  return ret; }  public static double readDouble() throws IOException {  double ret = 0, div = 1;  byte c = Read();  while (c <= ' ')  c = Read();  boolean neg = (c == '-');  if (neg)  c = Read();  do {  ret = ret * 10 + c - '0';  } while ((c = Read()) >= '0' && c <= '9');  if (c == '.') {  while ((c = Read()) >= '0' && c <= '9') {   ret += (c - '0') / (div *= 10);  }  }  if (neg)  return -ret;  return ret; }  private static void fillBuffer() throws IOException {  bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);  if (bytesRead == -1)  buffer[0] = -1; }  private static byte Read() throws IOException {  if (bufferPointer == bytesRead)  fillBuffer();  return buffer[bufferPointer++]; }  static void print(Object o) {  pr.print(o); }  static void println(Object o) {  pr.println(o); }  static void flush() {  pr.flush(); }  static void println() {  pr.println(); }  static void exit() throws IOException {  din.close();  pr.close();  System.exit(0); } }
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);   } }
6	public class C {  static int[] dp;  static int[] f;  static void solve(){   dp = new int[1<<n];   f = new int[1<<n];   Arrays.fill(dp, 1<<29);   dp[0] = 0;   for(int i=0;i<(1<<n);i++){    for(int j=0;j<n;j++){     int ni = i | (1<<j);     if( i != ni ){      int v = d[j]*2 + dp[i];      if(v < dp[ni]){       dp[ni] = v;       f[ni] = i;      }      for(int k=j+1;k<n;k++){       int nni = ni | (1<<k);       if( ni != nni){        int vv = d[j] + t[j][k] + d[k] + dp[i];        if(vv < dp[nni]){         dp[nni] = vv;         f[nni] = i;        }       }      }      break;     }    }   }   out.println(dp[dp.length-1]);    int idx = dp.length - 1;   out.print("0 ");   while(idx != 0){    int road = idx ^ f[idx];    for(int i=0;i<n;i++) if( ((road>>i) & 1) == 1) out.print((i+1)+" ");    idx = f[idx];    out.print("0 ");   }   out.println();  }  static int[] d;  static int[][] t;  static int n;  public static void main(String[] args) {   Scanner sc = new Scanner(in);   int x = sc.nextInt();   int y = sc.nextInt();   n = sc.nextInt();   int[] dx = new int[n];   int[] dy = new int[n];   for(int i=0;i<n;i++){    dx[i] = sc.nextInt();    dy[i] = sc.nextInt();   }   d = new int[n];   for(int i=0;i<n;i++){    d[i] = (x-dx[i])*(x-dx[i]) + (y-dy[i])*(y-dy[i]);   }   t = new int[n][n];   for(int i=0;i<n;i++){    for(int j=0;j<n;j++){     t[i][j] = (dx[i]-dx[j])*(dx[i]-dx[j]) + (dy[i]-dy[j])*(dy[i]-dy[j]);    }   }    solve();  } }
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;  }   public String next() throws Exception {   in.nextToken();   return in.sval;  }   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);  } }
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(); }  private static BufferedReader br = null; private static StringTokenizer stk = null; private static 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()); }  private long nextLong() {  while (stk==null || !stk.hasMoreElements()) loadLine();  return Long.parseLong(stk.nextToken()); }  private double nextDouble() {  while (stk==null || !stk.hasMoreElements()) loadLine();  return Double.parseDouble(stk.nextToken()); }  private String nextWord() {  while (stk==null || !stk.hasMoreElements()) loadLine();  return (stk.nextToken()); }  }
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 YoureGivenAString {  public static void main(String[] args) throws IOException {   BufferedReader f = new BufferedReader(new InputStreamReader(System.in));   String str = f.readLine();   int max = 0;   for (int i = 0; i < str.length(); i++)    for (int j = i+1; j <= str.length(); j++) {     String s = str.substring(i,j);     if (str.indexOf(s) >= 0 && str.substring(str.indexOf(s)+1).indexOf(s) >= 0)      max = Math.max(max, j-i);    }   System.out.println(max);  }  }
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();  }  public void run() {   try {    long t1 = System.currentTimeMillis();    if (System.getProperty("ONLINE_JUDGE") != 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");    }    Locale.setDefault(Locale.US);    solve();    in.close();    out.close();    long t2 = System.currentTimeMillis();    System.err.println("Time = " + (t2 - t1));   } catch (Throwable t) {    t.printStackTrace(System.err);    System.exit(-1);   }  }  String readString() throws IOException {   while (!tok.hasMoreTokens()) {    tok = new StringTokenizer(in.readLine());   }   return tok.nextToken();  }  int readInt() throws IOException {   return Integer.parseInt(readString());  }  long readLong() throws IOException {   return Long.parseLong(readString());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }    static class Utils {   private Utils() {}   public static void mergeSort(int[] a) {    mergeSort(a, 0, a.length - 1);   }   private static final int MAGIC_VALUE = 50;   private static void mergeSort(int[] a, int leftIndex, int rightIndex) {    if (leftIndex < rightIndex) {     if (rightIndex - leftIndex <= MAGIC_VALUE) {      insertionSort(a, leftIndex, rightIndex);     } else {      int middleIndex = (leftIndex + rightIndex) / 2;      mergeSort(a, leftIndex, middleIndex);      mergeSort(a, middleIndex + 1, rightIndex);      merge(a, leftIndex, middleIndex, rightIndex);     }    }   }   private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {    int length1 = middleIndex - leftIndex + 1;    int length2 = rightIndex - middleIndex;    int[] leftArray = new int[length1];    int[] rightArray = new int[length2];    System.arraycopy(a, leftIndex, leftArray, 0, length1);    System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);    for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {     if (i == length1) {      a[k] = rightArray[j++];     } else if (j == length2) {      a[k] = leftArray[i++];     } else {      a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];     }    }   }   private static void insertionSort(int[] a, int leftIndex, int rightIndex) {    for (int i = leftIndex + 1; i <= rightIndex; i++) {     int current = a[i];     int j = i - 1;     while (j >= leftIndex && a[j] > current) {      a[j + 1] = a[j];      j--;     }     a[j + 1] = current;    }   }  }    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 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);   F1BlokiRavnoiSummiProstayaRedakciya solver = new F1BlokiRavnoiSummiProstayaRedakciya();   solver.solve(1, in, out);   out.close();  }  static class F1BlokiRavnoiSummiProstayaRedakciya  {   InputReader in;   Map<Long, List<F1BlokiRavnoiSummiProstayaRedakciya.Block>> sums;   public void solve(int testNumber, InputReader in, PrintWriter out)   {    this.in = in;    int n = ni();    long[] a = nla(n);    sums = new HashMap<>();    for (int i = 0; i < n; i++)    {     long sum = 0;     for (int j = i; j < n; j++)     {      sum += a[j];      sums.computeIfAbsent(sum, k -> new ArrayList<>()).add(          new F1BlokiRavnoiSummiProstayaRedakciya.Block(i, j, sum));     }    }    for (Map.Entry<Long, List<F1BlokiRavnoiSummiProstayaRedakciya.Block>> e : sums.entrySet())    {     Collections.sort(e.getValue());    }    List<F1BlokiRavnoiSummiProstayaRedakciya.Block> res = Collections.emptyList();    for (Map.Entry<Long, List<F1BlokiRavnoiSummiProstayaRedakciya.Block>> e : sums.entrySet())    {     List<F1BlokiRavnoiSummiProstayaRedakciya.Block> blocks = e.getValue();     List<F1BlokiRavnoiSummiProstayaRedakciya.Block> updated = new ArrayList<>();     for (F1BlokiRavnoiSummiProstayaRedakciya.Block next : blocks)     {      if (updated.size() == 0)       updated.add(next);      else      {       F1BlokiRavnoiSummiProstayaRedakciya.Block prev = updated.get(updated.size() - 1);       if (next.l > prev.r)        updated.add(next);      }     }     if (updated.size() > res.size())      res = updated;    }    StringBuilder resS = new StringBuilder();    resS.append(res.size()).append('\n');    for (F1BlokiRavnoiSummiProstayaRedakciya.Block block : res)     resS.append(block.l + 1).append(' ').append(block.r + 1).append('\n');    out.println(resS);   }   private long[] nla(int size)   {    return in.nextLongArray(size);   }   private int ni()   {    return in.nextInt();   }   static class Block implements Comparable<F1BlokiRavnoiSummiProstayaRedakciya.Block>   {    int l;    int r;    long sum;    public Block(int l, int r, long sum)    {     this.l = l;     this.r = r;     this.sum = sum;    }    public int compareTo(F1BlokiRavnoiSummiProstayaRedakciya.Block o)    {     int res = Integer.compare(r, o.r);     if (res == 0)      res = Integer.compare(l, o.l);     return res;    }   }  }  static class InputReader  {   private final BufferedReader reader;   private StringTokenizer tokenizer;   public InputReader(InputStream in)   {    reader = new BufferedReader(new InputStreamReader(in));   }   public long[] nextLongArray(int size)   {    long[] array = new long[size];    for (int i = 0; i < size; ++i)    {     array[i] = nextLong();    }    return array;   }   public int nextInt()   {    return Integer.parseInt(next());   }   public long nextLong()   {    return Long.parseLong(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 D {  static class Scan {   private byte[] buf=new byte[1024];   private int index;   private InputStream in;   private int total;   public Scan()   {    in=System.in;   }   public int scan()throws IOException   {    if(total<0)    throw new InputMismatchException();    if(index>=total)    {     index=0;     total=in.read(buf);     if(total<=0)     return -1;    }    return buf[index++];   }   public int scanInt()throws IOException   {    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();     }     else throw new InputMismatchException();    }    return neg*integer;   }   public double scanDouble()throws IOException   {    double doub=0;    int n=scan();    while(isWhiteSpace(n))    n=scan();    int neg=1;    if(n=='-')    {     neg=-1;     n=scan();    }    while(!isWhiteSpace(n)&&n!='.')    {     if(n>='0'&&n<='9')     {      doub*=10;      doub+=n-'0';      n=scan();     }     else throw new InputMismatchException();    }    if(n=='.')    {     n=scan();     double temp=1;     while(!isWhiteSpace(n))     {      if(n>='0'&&n<='9')      {       temp/=10;       doub+=(n-'0')*temp;       n=scan();      }      else throw new InputMismatchException();     }    }    return doub*neg;   }   public String scanString()throws IOException   {    StringBuilder sb=new StringBuilder();    int n=scan();    while(isWhiteSpace(n))    n=scan();    while(!isWhiteSpace(n))    {     sb.append((char)n);     n=scan();    }    return sb.toString();   }   private boolean isWhiteSpace(int n)   {    if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)    return true;    return false;   }  }   public static void sort(int arr[],int l,int r) {    if(l==r) {    return;   }   int mid=(l+r)/2;   sort(arr,l,mid);   sort(arr,mid+1,r);   merge(arr,l,mid,mid+1,r);  }  public static void merge(int arr[],int l1,int r1,int l2,int r2) {   int tmp[]=new int[r2-l1+1];   int indx1=l1,indx2=l2;     for(int i=0;i<tmp.length;i++) {    if(indx1>r1) {     tmp[i]=arr[indx2];     indx2++;     continue;    }    if(indx2>r2) {     tmp[i]=arr[indx1];     indx1++;     continue;    }    if(arr[indx1]<arr[indx2]) {     tmp[i]=arr[indx1];     indx1++;     continue;    }    tmp[i]=arr[indx2];    indx2++;   }     for(int i=0,j=l1;i<tmp.length;i++,j++) {    arr[j]=tmp[i];   }  }   public static void sort(long arr[],int l,int r) {    if(l==r) {    return;   }   int mid=(l+r)/2;   sort(arr,l,mid);   sort(arr,mid+1,r);   merge(arr,l,mid,mid+1,r);  }  public static void merge(long arr[],int l1,int r1,int l2,int r2) {   long tmp[]=new long[r2-l1+1];   int indx1=l1,indx2=l2;     for(int i=0;i<tmp.length;i++) {    if(indx1>r1) {     tmp[i]=arr[indx2];     indx2++;     continue;    }    if(indx2>r2) {     tmp[i]=arr[indx1];     indx1++;     continue;    }    if(arr[indx1]<arr[indx2]) {     tmp[i]=arr[indx1];     indx1++;     continue;    }    tmp[i]=arr[indx2];    indx2++;   }     for(int i=0,j=l1;i<tmp.length;i++,j++) {    arr[j]=tmp[i];   }  }   static int n,m,k,uu[][],rr[][],dd[][],ll[][],dp[][][];   public static void main(String args[]) throws IOException {   Scan input=new Scan();   StringBuilder ans=new StringBuilder("");     n=input.scanInt();   m=input.scanInt();   k=input.scanInt();     dp=new int[n][m][k];   for(int i=0;i<n;i++) {    for(int j=0;j<m;j++) {     for(int kk=0;kk<k;kk++) {      dp[i][j][kk]=-1;     }    }   }     uu=new int[n][m];   rr=new int[n][m];   dd=new int[n][m];   ll=new int[n][m];     for(int i=0;i<n;i++) {    for(int j=0;j<m-1;j++) {     int tmp=input.scanInt();     rr[i][j]=tmp;     ll[i][j+1]=tmp;    }   }     for(int i=0;i<n-1;i++) {    for(int j=0;j<m;j++) {     int tmp=input.scanInt();     dd[i][j]=tmp;     uu[i+1][j]=tmp;    }   }     for(int i=0;i<n;i++) {    for(int j=0;j<m;j++) {     if(k%2!=0) {      ans.append(-1+" ");      continue;     }     ans.append((2*solve(i,j,k/2))+" ");    }    ans.append("\n");   }     System.out.println(ans);  }   public static int solve(int x,int y,int rem) {   if(rem==0) {    return 0;   }     if(dp[x][y][rem]!=-1) {    return dp[x][y][rem];   }     int ans=Integer.MAX_VALUE/10;   if(uu[x][y]!=0) {    ans=Math.min(ans,uu[x][y]+solve(x-1,y,rem-1));   }   if(rr[x][y]!=0) {    ans=Math.min(ans,rr[x][y]+solve(x,y+1,rem-1));   }   if(dd[x][y]!=0) {    ans=Math.min(ans,dd[x][y]+solve(x+1,y,rem-1));   }   if(ll[x][y]!=0) {    ans=Math.min(ans,ll[x][y]+solve(x,y-1,rem-1));   }     dp[x][y][rem]=ans;     return ans;  } }
4	public class ProblemA { public static void main(String[] args) {  Scanner keyboard = new Scanner(System.in);  String input = keyboard.nextLine();  boolean con = false;  for( int i = input.length()-1; i > 0 ; i--)  {   for ( int j = 0; j+i< input.length(); j++ )   for( int k = j+1; k+i <= input.length(); k++ )   if( input.substring(j,j+i).equals( input.substring(k,k+i) ) )    {    System.out.print(i+"\n");    k = input.length()+1;    j = input.length();    i = -1;    con = true;   }  }  if( con == false )  System.out.print(0+"\n"); } }
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();   }  } }
3	public class C { FastScanner in; PrintWriter out; boolean systemIO = true;  public static class Pair {  int x;  int y;  public Pair(int x, int y) {  this.x = x;  this.y = y;  } }  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 nextLine() {  try {   return br.readLine();  } catch (IOException e) {   return null;  }  }  String next() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  }   public static void main(String[] arg) {  new C().run(); } }
4	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 line = s.readLine();  int len = line.length();  int max = 0;  for (int i = 0 ; i < len ; i++) {  for (int j = i+1 ; j <= len ; j++) {   String sch = line.substring(i, j);   for (int k = i+1 ; k + (j - i) <= len ; k++) {   String tch = line.substring(k, k+(j-i));   if (sch.equals(tch)) {    max = Math.max(max, (j-i));   }   }  }  }  out.println(max);  out.flush(); }  public static void debug(Object... os){  System.err.println(Arrays.deepToString(os)); } }
1	public class CF_1029E_Tree_with_Small_Distances { static ArrayList<Integer> adj[]; static int dist[]; static boolean visitParent[]; static int ans=0; public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int n =sc.nextInt(); adj=new ArrayList[n+1]; dist = new int[n+1]; visitParent = new boolean[n+1]; for(int i=0;i<=n;i++) adj[i]=new ArrayList<Integer>(); int max=0;  for(int i=1;i<n;i++){  int u = sc.nextInt(),v=sc.nextInt();  adj[u].add(v);  adj[v].add(u); } dist[1]=0; dfs(1,1); System.out.println(ans);   } private static void dfs(int i , int j) {  boolean f = false; for(int k=0;k<adj[i].size();k++){  int x = adj[i].get(k);  if(x!=j){  dist[x]=dist[i]+1;  dfs(x,i);  if(visitParent[x])   f=true;  } }  if(dist[i]>2&&!visitParent[j]&&!f&&!visitParent[i]){  visitParent[j]=true;  ans++;  for(int v=0;v<adj[i].size();v++){    } }  } 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 IOException  {   String x = next();   StringBuilder sb = new StringBuilder("0");   double res = 0, f = 1;   boolean dec = false, neg = false;   int start = 0;   if(x.charAt(0) == '-')   {    neg = true;    start++;   }   for(int i = start; i < x.length(); i++)    if(x.charAt(i) == '.')    {     res = Long.parseLong(sb.toString());     sb = new StringBuilder("0");     dec = true;    }    else    {     sb.append(x.charAt(i));     if(dec)      f *= 10;    }   res += Long.parseLong(sb.toString()) / f;   return res * (neg?-1:1);  }   public int nextInt() throws IOException {return Integer.parseInt(next());}  public long nextLong() throws IOException {return Long.parseLong(next());}  public String nextLine() throws IOException {return br.readLine();}  public boolean ready() throws IOException {return br.ready(); }  }  }
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 n5D {  public static void main(String[] args)  {   double a = 0, v = 0, l = 0, d = 0, w = 0;   try   {    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));    String[] str = br.readLine().split(" ");    a = Double.parseDouble(str[0]);    v = Double.parseDouble(str[1]);    str = br.readLine().split(" ");    l = Double.parseDouble(str[0]);    d = Double.parseDouble(str[1]);    w = Double.parseDouble(str[2]);   }   catch(Exception e)   {    System.out.println(e);   }   double t1, t2, t3, t4, t5, t, D = 0;     if (w > v) w = v;   t2 = d / v - v / a + w * w / 2 / a / v;   if (t2 >= 0)   {    t1 = v / a;    t3 = t1 - w / a;   }   else   {    if (Math.sqrt(2 * d / a) > (w / a))    {     t1 = Math.sqrt((2 * a * d + w * w) / (a * a * 2));     t3 = t1 - w / a;    }    else    {     t1 = Math.sqrt(2 * d / a);     t3 = 0;    }    t2 = 0;   }   t5 = (l - d - v * v / 2 / a + a * (t1 - t3) * (t1 - t3) / 2) / v;   if (t5 >= 0) t4 = v / a - (t1 - t3);   else   {    t5 = 0;    t4 = -t1 + t3 + Math.sqrt((t1 - t3) * (t1 - t3) + 2 * (l - d) / a);   }   t = t1 + t2 + t3 + t4 + t5;   System.out.println(t);    } }
2	public class Main {  static long TIME_START, TIME_END;  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);   PrintWriter pw = new PrintWriter(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.out.println("Memory increased:" + (usedMemoryAfter-usedMemoryBefore) / 1000000 );   System.out.println("Time used: " + (TIME_END - TIME_START) + ".");  }  public static class Task {   int mod = 1_000_000_007;   public long pow(long a, long b) {    if (b == 0) return 1L;    if (b % 2 == 0) return pow(a * a % mod, b >> 1);    return a * pow(a * a % mod, b >> 1) % mod;   }   public void solve(Scanner sc, PrintWriter pw) throws IOException {    long T = sc.nextLong();    long k = sc.nextLong();    if (T == 0) {     pw.println(0);     return;    }    long a1 = pow(2, k + 1);    long a2 = pow(2, k);    long s = a1 * (T % mod) % mod;    long t = ((1 - a2) + mod) % mod;    long y = (s + t) % mod;    pw.println((y + 5L * mod) % mod);   }    }  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 long nextLong() throws IOException {return Long.parseLong(next());}   public String nextLine() throws IOException {return br.readLine();}   public double nextDouble() throws IOException { return Double.parseDouble(next()); }   public boolean ready() throws IOException {return br.ready();}  } }
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+"").charAt((int)index));  } }
5	public class ProblemE {  static int mod = (int) (1e9+7);  static InputReader in;  static PrintWriter out;   static class SegmentTree {   long st[];    SegmentTree(int n) {    st = new long[4*n];    build(0, n - 1, 1);   }     int getMid(int s, int e) {    return (s+e)>>1;   }   long merge(long a,long b){    return a+b;   }     void update(int s, int e, int x, int y, long c, int si){    if(s == x && e == y){     st[si] += c;    }    else{     int mid = getMid(s, e);     if(y <= mid)       update(s, mid, x, y, c, 2*si);     else if(x > mid)      update(mid + 1, e, x ,y ,c ,2*si + 1);     else{      update(s, mid, x, mid, c, 2*si);      update(mid + 1, e, mid + 1, y, c, 2*si + 1);     }     st[si] = merge(st[2*si],st[2*si+1]);    }   }   long get(int s, int e, int x, int y, int si){    if(s == x && e == y){     return st[si];    }    int mid = getMid(s, e);    if(y <= mid)     return get(s, mid, x, y, 2*si);    else if(x > mid)     return get(mid + 1, e, x, y, 2*si + 1);    return merge(get(s, mid, x, mid, 2*si), get(mid + 1, e, mid + 1, y, 2*si + 1));   }   void build(int ss, int se, int si){    if (ss == se) {     st[si] = 0;     return;    }    int mid = getMid(ss, se);    build(ss, mid, si * 2 );    build(mid + 1, se, si * 2 + 1);    st[si] = merge(st[2*si],st[2*si+1]);   }    }    public static void main(String[] args) throws FileNotFoundException  {   in = new InputReader(System.in);   out = new PrintWriter(System.out);        int n = in.nextInt();   int[] arr = in.nextIntArray(n);   ArrayList<Integer>list = new ArrayList<>();   HashMap<Integer,Integer> map = new HashMap<>();     for(int i = 0; i < n; i++){    list.add(arr[i]);    list.add(arr[i] + 1);    list.add(arr[i] - 1);   }   Collections.sort(list);   int j = 1;   for(int k : list){    if(map.containsKey(k)) continue;    map.put(k, j++);   }     SegmentTree seg = new SegmentTree(j + 1);   SegmentTree seg1 = new SegmentTree(j + 1);   BigInteger ans = BigInteger.ZERO;   BigInteger sum = BigInteger.ZERO;    for(int i = 0; i < n; i++){    long x = seg.get(0, j - 1, map.get(arr[i] - 1), map.get(arr[i] + 1), 1);    long y = seg1.get(0, j - 1, map.get(arr[i] - 1), map.get(arr[i] + 1), 1);    ans = ans.add(new BigInteger(""+x));    ans = ans.subtract(sum);    ans = ans.add(new BigInteger(""+((arr[i] * 1l *(i - y)))));        seg.update(0, j - 1, map.get(arr[i]), map.get(arr[i]), arr[i], 1);    seg1.update(0, j - 1, map.get(arr[i]), map.get(arr[i]), 1, 1);    sum = sum.add(new BigInteger(arr[i] + ""));   }     out.println(ans);   out.close();  }  static class Pair implements Comparable<Pair>  {   int x,y;   int i;     Pair (int x,int y)   {     this.x = x;     this.y = y;   }   Pair (int x,int y, int i)   {     this.x = x;     this.y = y;     this.i = i;   }   public int compareTo(Pair o)   {    return Long.compare(this.i,o.i);       }   public boolean equals(Object o)   {    if (o instanceof Pair)    {     Pair p = (Pair)o;     return p.x == x && p.y==y;    }    return false;   }   @Override   public String toString()   {    return x + " "+ y + " "+i;   }     }   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 long pow(long n,long p,long m)  {   long result = 1;   if(p==0){    return n;   }      while(p!=0)   {    if(p%2==1)     result *= n;    if(result >= m)     result %= m;    p >>=1;    n*=n;    if(n >= m)     n%=m;   }     return result;  }  static long pow(long n,long p)  {   long result = 1;   if(p==0)    return 1;   while(p!=0)   {    if(p%2==1)     result *= n;     p >>=1;    n*=n;    }   return result;  }  static void debug(Object... o)  {    System.out.println(Arrays.deepToString(o));  }  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 int[] nextIntArray(int n)   {     int a[] = new int[n];     for (int i = 0; i < n; i++)     {       a[i] = nextInt();     }     return a;   }   public long[] nextLongArray(int n)   {     long a[] = new long[n];     for (int i = 0; i < n; i++)     {       a[i] = nextLong();     }     return a;   }   public String readString()   {     int c = snext();     while (isSpaceChar(c))     {       c = snext();     }     StringBuilder res = new StringBuilder();     do     {       res.appendCodePoint(c);       c = snext();     } while (!isSpaceChar(c));     return res.toString();   }   public String nextLine()   {     int c = snext();     while (isSpaceChar(c))       c = snext();     StringBuilder res = new StringBuilder();     do     {       res.appendCodePoint(c);       c = snext();     } while (!isEndOfLine(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;   }   private boolean isEndOfLine(int c)   {     return c == '\n' || c == '\r' || c == -1;   }   public interface SpaceCharFilter   {     public boolean isSpaceChar(int ch);   }  } }
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(); }  int nextInt() throws IOException {  return Integer.parseInt(next()); }  double nextDouble() throws IOException {  return Double.parseDouble(next()); }  long nextLong() throws IOException {  return Long.parseLong(next()); } }
1	public class cf1 implements Runnable{   public void run() {  InputReader s = new InputReader(System.in);  PrintWriter w = new PrintWriter(System.out);   int t = 1;   while(t-- > 0) {    int n = s.nextInt(), m = s.nextInt();    int[] a = new int[n + 1];    for(int i = 1; i <= n; i++)   a[i] = s.nextInt();    int[] b = new int[n + 1];    for(int i = 1; i <= n; i++)   b[i] = s.nextInt();    ArrayList<Integer> list = new ArrayList<Integer>();    list.add(a[1]);    for(int i = 2; i <= n; i++) {   list.add(b[i]); list.add(a[i]);  }    list.add(b[1]);    double wt = m;  boolean check = true;    for(int i = list.size() - 1; i >= 0; i--) {     if(list.get(i) <= 1) {   check = false; break;   }     double x = wt / (list.get(i) - 1);      wt += x;  }    if(check)   w.println(wt - m);  else   w.println(-1);  }   w.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);  } }   public static void main(String args[]) throws Exception {  new Thread(null, new cf1(),"cf1",1<<26).start(); } }
5	public class A_135 {    public static void main(String[] args) {   Scanner in=new Scanner(System.in);     int n=in.nextInt();     int[] mas=new int[n];     for(int i=0;i<n;i++){    mas[i]=in.nextInt();   }     Arrays.sort(mas);     PrintWriter out=new PrintWriter(System.out);     boolean isEd=true;   for(int i=0;i<n;i++)    if(mas[i]!=1){     isEd=false;     break;    }     if(!isEd)    out.print('1');     for(int i=0;i<n-1;i++){    out.print(' ');    out.print(mas[i]);   }     if(isEd)    out.print(" 2");     out.flush();  } }
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 A { public static void main(String[] args){  FastScanner sc = new FastScanner();  int n = sc.nextInt();  String nStr = Integer.toString(n);  String nStr1 = nStr.substring(0, nStr.length() - 1);  String nStr2 = nStr.substring(0, nStr.length() - 2) + nStr.charAt(nStr.length() - 1);  int result = Math.max(n, Integer.parseInt(nStr1));  result = Math.max(result, Integer.parseInt(nStr2));  System.out.println(result); }  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());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  } } }
3	public class PhytonIndenter {  private static Scanner scanner = new Scanner(System.in);  private static int lineCount;  private static String[] commands;  public static void main(String args[]) {   lineCount = scanner.nextInt();   scanner.nextLine();   commands = new String[lineCount];   for (int i = 0; i < lineCount; i++) {    commands[i] = scanner.nextLine();   }   resolveWithDP();  }  private static void resolveWithDP() {   long dp[][] = new long[lineCount][5002];   long mod = 1000000007;   dp[0][0] = 1;   for (int i = 1; i < lineCount; i++) {    if ("f".equalsIgnoreCase(commands[i - 1])) {     dp[i][0] = 0;     for (int j = 1; j <= i; j++) {      dp[i][j] = dp[i - 1][j - 1];     }    } else {     long sum = 0;     for (int j = i - 1; j >= 0; j--) {      sum += dp[i - 1][j] % mod;      dp[i][j] = sum;     }    }   }   long result = 0;   for (int i = 0; i < lineCount; i++) {    result += dp[lineCount-1][i]%mod;    result %= mod;   }   System.out.println(result%mod);  } }
0	public class Contest1_1{   public static void main(String ar[]) throws Exception {      BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));   int input = Integer.parseInt(buff.readLine());   if(input==0){    System.out.println("0 0 0");   }else if(input==1){    System.out.println("0 0 1");   }else if(input==2){    System.out.println("0 1 1");   }else if(input==3){    System.out.println("1 1 1");   }else {    int output[] = checkFibo(input);    int get[] = checkFibo(output[1]);    output[0] = get[1];    output[1] = get[2];    System.out.print(output[0]);    System.out.print(" " + output[1]);    System.out.println(" " + output[2]);    }  }   public static int[] checkFibo(int input){   int output[] = new int[3];   int fibo_1 = 0;   int fibo_2 = 1;   int temp = 0;   while(fibo_2!=input){    temp = fibo_2;    output[1] = fibo_1;    output[2] = fibo_2;    fibo_2 += fibo_1;    fibo_1 = temp;   }   return output;  }  }
3	public class Main{  public static void main (String[] args) {  Scanner scan = new Scanner(System.in);   int n = scan.nextInt(), min[] = new int[n];  boolean used[] = new boolean[n];  HashSet<Integer> set = new HashSet<>();     for (int i = 0; i < n; i++) {  min[i] = scan.nextInt();  }   for (int i = 0; i < n; i++) {  for (int j = i + 1; j < n; j++) {   if (min[i] > min[j]) {    if (min[i] % min[j] == 0)    min[i] = min[j];   }   else if (min[j] % min[i] == 0)    min[j] = min[i];   }  }   for (int i = 0; i < n; i++) {  set.add(min[i]);  }   System.out.print(set.size()); } }
1	public class Main {  static class Scanner {   StringTokenizer st;   BufferedReader br;   public Scanner(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }   public Scanner(FileReader fileReader) {    br = new BufferedReader(fileReader);   }   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 String nextLine() throws IOException {    return br.readLine();   }   public boolean ready() throws IOException {    return br.ready();   }  }  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);PrintWriter pw = new PrintWriter(System.out);   int n=sc.nextInt(),d=sc.nextInt();int[] a = new int[n];int ans=2;a[0]=sc.nextInt();   for (int i=1;i<n;i++){    a[i]=sc.nextInt();    if (a[i]-a[i-1]==2*d)ans++;    else if (a[i]-a[i-1]>2*d)ans+=2;   }   System.out.println(ans);  } }
2	public class R574B {  public static void main(String[] args) {  JS scan = new JS();  long n = scan.nextInt();  long put = 1;  long k = scan.nextInt();  long have = 0;  long moves = 0;  while(have < k) {  have += put;  put++;  moves++;  }   long ans = 0;  moves += have-k;  ans += have-k;  long lo = 0;  long hi = n-moves;  long bs = 0;  while(lo <= hi) {    long mid = (lo+hi)/2;  long left = (n-moves)-mid+put-1;  long rr = tri(left)-tri(put);    if(rr <= mid) {   bs = mid;   hi = mid-1;  }  else {   lo = mid+1;  }  }  System.out.println(ans+bs); }  static long tri(long n) {  return n*(n-1)/2; }  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;  }  public double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }  public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }  public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  } } }
1	public class B {  static Scanner in;  static void put(TreeMap<Integer, Integer> m, int key) {   if (m.containsKey(key)) {    m.put(key, m.get(key) + 1);   } else {    m.put(key, 1);   }  }  static void remove(TreeMap<Integer, Integer> m, int key) {   if (!m.containsKey(key))    return;   m.put(key, m.get(key) - 1);   if (m.get(key) == 0) {    m.remove(key);   }  }  public static void main(String[] args) {   in = new Scanner(System.in);   int n = in.nextInt();   int k = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }   int i = 0;   while (i + 1 < n && a[i + 1] == a[0]) {    i++;   }   int left = i;   TreeMap<Integer, Integer> used = new TreeMap<Integer, Integer>();   for (; i < n; i++) {    put(used, a[i]);    if (used.size() == k) {     while (used.get(a[left]) > 1) {      remove(used, a[left]);      left++;     }     System.out.println(left + 1 + " " + (i + 1));     return;    }   }   System.out.println("-1 -1");  } }
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);   }  }  boolean skip() {   while (hasNext()) {    next();   }   return true;  }  int[][] nextMatrix(int n, int m) {   int[][] matrix = new int[n][m];   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     matrix[i][j] = nextInt();   return matrix;  }  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());  }  long nextLong() {   return Long.parseLong(next());  }  double nextDouble() {   return Double.parseDouble(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();  } }
4	public class Main {  static boolean used[][];  static int n;  static int m;  public static void main(String[] args) throws IOException {   br = new BufferedReader(new FileReader("input.txt"));   PrintWriter out = new PrintWriter("output.txt");   n = nextInt();   m = nextInt();   int k = nextInt();   used = new boolean[n][m];   Deque<point> deq = new ArrayDeque<>();   for (int i = 0; i < k; i++) {    deq.addLast(new point(nextInt() - 1, nextInt() - 1));    used[deq.peekLast().x][deq.peekLast().y] = true;   }   point last = new point(0, 0);   while (!deq.isEmpty()) {    point v = deq.pollFirst();    int x = v.x;    int y = v.y;    if (checker(x, y + 1)) {     last = new point(x, y + 1);     deq.addLast(new point(x, y + 1));     used[x][y + 1] = true;    }    if (checker(x, y - 1)) {     last = new point(x, y - 1);     deq.addLast(new point(x, y - 1));     used[x][y - 1] = true;    }    if (checker(x + 1, y)) {     last = new point(x + 1, y);     deq.addLast(new point(x + 1, y));     used[x + 1][y] = true;    }    if (checker(x - 1, y)) {     last = new point(x - 1, y);     deq.addLast(new point(x - 1, y));     used[x - 1][y] = true;    }   }   out.println(last.x + 1 + " " + (last.y + 1));   out.close();  }  static boolean checker(int x, int y) {   if (x < n && y < m && x >= 0 && y >= 0 && !used[x][y]) return true;   return false;  }   static StringTokenizer st = new StringTokenizer("");  static BufferedReader br;  static String next() throws IOException {   while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());   return st.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt(next());  }  static long nextLong() throws IOException {   return Long.parseLong(next());  } } class point {  int x, y;  public point(int x, int y) {   this.x = x;   this.y = y;  } }
2	public class template {  private InputStream is;  private PrintWriter pw;  static char[][] ch;  static int x1,x2,y1,y2,n,m,h,k;  static long dist[][];  static boolean boo[][];   void soln()  {  is = System.in;  pw = new PrintWriter(System.out);  long s = System.currentTimeMillis();  solve();  pw.close();  pw.flush();    }   public static void main(String[] args) throws Exception  {  new Thread(null, new Runnable()   {   public void run()   {   try   {       } catch (Exception e)   {    System.out.println(e);   }   }  }, "1", 1 << 26).start();  new template().soln();  }   void solve()  {  long n = nl(), k = nl();  if(n==0){   pw.println(0);   return;  }  long MOD = 1000000007;  long pow1 = pow(2,k,MOD), pow2 = pow(2,k+1,MOD);  pw.println(((((n%MOD)*pow2)%MOD) - (pow1-1+MOD)%MOD + 2*MOD)%MOD);  pw.close();  }  long pow(long x, long y, long mod){  long ans = 1;  while(y>0){   if(y%2==0) {   x *= x;   x %= mod;   y/=2;   }   else{   ans *= x;   ans %= mod;   y-=1;   }  }  return ans;  }  long gcd(long a, long b){  if(b==0) return a;  return gcd(b,a%b);  }  void printArray(long[] arr) {  for(long i : arr) pw.print(i +" ");  pw.println();  } static long min(long x, long y){  return (x<y)?x:y; } static class Pair implements Comparable<Pair>{  long val;  int x, y;  Pair(long v, int a, int b){  val = v; x = a; y = b;  }  public int compareTo(Pair p){  return Long.compare(this.val,p.val);  } } private static class Queue{  int st = 0;  int et = 0;  Pair[] arr;  public Queue(int len) {  arr = new Pair[len];  }  public boolean isEmpty() {  return st==et;  }  public void add(Pair x) {  arr[et++] = x;  }  public Pair poll() {  return arr[st++];  }  public void clear() {  st = et = 0;  } }        public static int[] shuffle(int[] a, Random gen)  {  for (int i = 0, n = a.length; i < n; i++)  {   int ind = gen.nextInt(n - i) + i;   int d = a[i];   a[i] = a[ind];   a[ind] = d;  }  return a;  }     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 double nd()  {  return Double.parseDouble(ns());  }   private char nc()  {  return (char) skip();  }   private String ns()  {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(isSpaceChar(b)))  {         sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }   private char[] ns(int n)  {  char[] buf = new char[n];  int b = skip(), p = 0;  while (p < n && !(isSpaceChar(b)))  {   buf[p++] = (char) b;   b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p);  }   private char[][] nm(int n, int m)  {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)   map[i] = ns(m);  return map;  }   private int[] na(int n)  {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = ni();  return a;  }   private int ni()  {  int num = 0, b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))   ;  if (b == '-')  {   minus = true;   b = readByte();  }   while (true)   {   if (b >= '0' && b <= '9')   {   num = num * 10 + (b - '0');   } else   {   return minus ? -num : num;   }   b = readByte();  }  }   private long nl()  {  long num = 0;  int b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))   ;  if (b == '-')   {   minus = true;   b = readByte();  }   while (true)   {   if (b >= '0' && b <= '9')   {   num = num * 10 + (b - '0');   } else   {   return minus ? -num : num;   }   b = readByte();  }  }   private boolean oj = System.getProperty("ONLINE_JUDGE") != null;   private void tr(Object... o)  {  if (!oj)   System.out.println(Arrays.deepToString(o));  } }
3	public class A{ InputStream is; PrintWriter out; String INPUT = "";  public void solve(){  int n=ni();  char[] arr=new char[n];  for(int i=0;i<n;i++){  arr[i]=ns().charAt(0);  }  long mod=1000000007;  long[][] memo=new long[n][n];  memo[0][0]=1L;  int k=0;  for(int i=1; i<n; i++){  if( (arr[i]=='f' && arr[i-1]=='s') || (arr[i]=='s' && arr[i-1]=='s') ){   long sum=0;   for(int j=k; j>=0; j--){   sum=(sum+(memo[i-1][j]%mod))%mod;   memo[i][j]=sum;   }  }  else{   k+=1;   for(int j=1; j<=k; j++){   memo[i][j] = memo[i-1][j-1] % mod;   }  }  }   long sum=0;  for(int i=0;i<=k;i++){  sum=(sum+(memo[n-1][i])%mod)%mod;  }  out.println(sum); } void print(int n, long[][] memo){  for(int i=0;i<n;i++){  for(int j=0;j<n;j++){   out.print(memo[i][j]+" ");  }  out.println();  } }  void run(){  is = new DataInputStream(System.in);  out = new PrintWriter(System.out);  int t=1;while(t-->0)solve();  out.flush(); } 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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); } private String ns(){  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); } private char[] ns(int n){  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); } private char[][] nm(int n, int m){  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; } private int[] na(int n){  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; } private int ni(){  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } } private long nl(){  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } } static int i(long x){return (int)Math.round(x);} static class Pair implements Comparable<Pair>{  long fs,sc;  Pair(long a,long b){  fs=a;sc=b;  }  public int compareTo(Pair p){  if(this.fs>p.fs)return 1;  else if(this.fs<p.fs)return -1;  else{   return i(this.sc-p.sc);  }    }  public String toString(){  return "("+fs+","+sc+")";  }  }  }
5	public class House { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int t = sc.nextInt();  ArrayList<HS> list = new ArrayList<HS>();  for (int i = 0; i < n; i++) {  list.add(new HS(sc.nextInt(),sc.nextInt()));  }   Collections.sort(list);   int count = 0;   if(n >= 1)  count = 2;   for(int i = 0; i < list.size() - 1; i++){  double d = Math.abs(list.get(i + 1).x - list.get(i).x);  d -= ((1.0*list.get(i).a/2.0) + (1.0*list.get(i + 1).a/2.0));  if ((d >= t)&& ((d-t) <= 0.00000001)){   count++;  }  else if(d > t){   count+= 2;  }  }  System.out.println(count); } } class HS implements Comparable<HS> { public int x; public int a;  public HS(int x, int a) {  this.x = x;  this.a = a; }  public int compareTo(HS o) {  return x - o.x; } }
5	public class Main {  static Scanner in = new Scanner(System.in);  public static  void main(String[] args) {   int n = in.nextInt();   int t = in.nextInt();   List<Integer> v = new ArrayList<Integer>(n);   for(int i = 0; i < n; i++) {    int a = in.nextInt();    int b = in.nextInt();    v.add(2 * a - b);    v.add(2 * a + b);   }   Collections.sort(v);   int ans = 2;   for(int i = 2; i < v.size(); i += 2) {    if(v.get(i) - v.get(i - 1) > 2 * t) ans += 2;    if(v.get(i) - v.get(i - 1) == 2 * t) ans++;   }   System.out.println(ans);  } }
4	public class Main1 {  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 nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}   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 long l(){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 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 double d() throws IOException {return Double.parseDouble(s()) ;}   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 class pair  {   int x;   int y;   public pair (int k, int p)   {    x = k;    y = p;   }   @Override   public boolean equals(Object o) {    if (this == o) return true;    if (o == null || getClass() != o.getClass()) return false;    pair pair = (pair) o;    return x == pair.x && y == pair.y;   }    @Override   public int hashCode() {    return Objects.hash(x, y);   }  }  public static void main(String[] args)throws IOException  {     Scanner sc = new Scanner(new File("input.txt"));  PrintWriter out = new PrintWriter("output.txt");   Queue<pair> q=new LinkedList<>();   int n=sc.nextInt();   int m=sc.nextInt();   int t=sc.nextInt();   int mark[][]=new int[n+2][m+2];   while(t-->0)   {    int a=sc.nextInt();int b=sc.nextInt();    mark[a][b]=1;    q.add(new pair(a,b));   }   int ansx=1;int ansy=1;   while(q.size()!=0)   {    pair p=q.remove();    if(mark[Math.max(1,p.x-1)][p.y]==0)    {     q.add(new pair(Math.max(1,p.x-1),p.y));     mark[Math.max(1,p.x-1)][p.y]=1;     ansx=Math.max(1,p.x-1);     ansy=p.y;    }    if(mark[Math.min(n,p.x+1)][p.y]==0)    {     q.add(new pair(Math.min(n,p.x+1),p.y));     mark[Math.min(n,p.x+1)][p.y]=1;     ansx=Math.min(n,p.x+1);     ansy=p.y;    }    if(mark[p.x][Math.max(1,p.y-1)]==0)    {     q.add(new pair(p.x,Math.max(1,p.y-1)));     mark[p.x][Math.max(1,p.y-1)]=1;     ansx=p.x;     ansy=Math.max(1,p.y-1);    }    if(mark[p.x][Math.min(m,p.y+1)]==0)    {     q.add(new pair(p.x,Math.min(m,p.y+1)));     mark[p.x][Math.min(m,p.y+1)]=1;     ansx=p.x;     ansy=Math.min(m,p.y+1);    }   }   out.println(ansx+" "+ansy);   out.flush();  } }
4	public class Main20 {  static ArrayList<Integer> primes = new ArrayList<Integer>();  static boolean[] prime = new boolean[1001];  public static void gen(){   Arrays.fill(prime, true);   prime[0] = prime[1] = false;   for (int i = 2; i < 1001; i++) {    if (prime[i]){     primes.add(i);     for (int j = i*2; j < 1001; j+=i)      prime[j] = false;    }   }  }  public static boolean isVowel(char c){   Character r = Character.toLowerCase(c);   return (r == 'e' || r == 'a' || r == 'i' || r == 'o' || r == 'u'|| r == 'y');  }  public static void main(String[] args) throws IOException {   Scanner s = new Scanner(new InputStreamReader(System.in));   String str = s.next();   int x;   int max= 0;     for (int i = 0; i < str.length()-1; i++) {    for (int j = i+1; j < str.length(); j++) {     x = str.indexOf(str.substring(i,j),i+1) ;     if (x != -1){      if (j-i > max) max = j-i;     }    }   }   System.out.println(max);  } }
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();  } } class TaskB {  public void solve(int testNumber, Scanner in, PrintWriter out) {   long n=in.nextLong();   long k=in.nextInt();   if(n==1){    out.println(0);    return;   }   long max=k*(k-1)/2+1;   if(max<n){    out.println("-1");    return;   }   long low=1,high=k-1;   long ans=k-1;   while (low<=high){    long mid=(low+high)/2;    long val=mid*mid-mid*(2*k-1)+2*n-2;    if(val>0){     low=mid+1;    }    else {     ans=mid;     high=mid-1;    }   }   out.println(ans);  } }
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 {   static final long MODULO = (long) (1e9 + 7);   public void solve(int testNumber, FastReader in, PrintWriter out) {    int n = in.nextInt();    long[][] dp = new long[n + 100][n + 100];    dp[0][0] = 1;    for (int i = 0; i < n; ++i) {     char current = in.nextCharacter();     if (current == 'f') {      for (int j = 0; j < n; ++j) {       dp[i + 1][j + 1] += dp[i][j];       dp[i + 1][j + 1] %= MODULO;      }     } else {      long runningSum = 0;      for (int j = n; j >= 0; --j) {       runningSum += dp[i][j];       runningSum %= MODULO;       dp[i + 1][j] += runningSum;       dp[i + 1][j] %= MODULO;      }     }    }    out.println(dp[n][0]);   }  }  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;   }   public char nextCharacter() {    int c = pread();    while (isSpaceChar(c))     c = pread();    return (char) c;   }  } }
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 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));  } }
3	public class Main {         static PrintWriter out;   static class FastReader{  BufferedReader br;  StringTokenizer st;  public FastReader(){  br=new BufferedReader(new InputStreamReader(System.in));  out=new PrintWriter(System.out);  }  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());  }  String nextLine(){  String str = "";  try{   str=br.readLine();  }  catch(IOException e){   e.printStackTrace();  }  return str;  } }    public static int countDigit(long n)  {   return (int)Math.floor(Math.log10(n) + 1);  }    public static int sumOfDigits(long n) {  if( n< 0)return -1 ;  int sum = 0;  while( n > 0) {  sum = sum + (int)( n %10) ;    n /= 10 ; }   return sum ;     }   public static long arraySum(int[] arr , int start , int end) {  long ans = 0 ;   for(int i = start ; i <= end ; i++)ans += arr[i] ;   return ans ; }    public static void swapArray(int[] arr , int start , int end) {  while(start < end)  {   int temp = arr[start] ;   arr[start] = arr[end];   arr[end] = temp;   start++ ;end-- ;  } }   static long factorial(long a) {  if(a== 0L || a==1L)return 1L ;   return a*factorial(a-1L) ; }   public static int[][] rotate(int[][] input){ int n =input.length; int m = input[0].length ; int[][] output = new int [m][n]; for (int i=0; i<n; i++) for (int j=0;j<m; j++)  output [j][n-1-i] = input[i][j]; return output; }   public static boolean isPowerOfTwo(long n) {  if(n==0)  return false;  if(((n ) & (n-1)) == 0 ) return true ; else return false ; }     public static String reverse(String input) { StringBuilder str = new StringBuilder("") ;   for(int i =input.length()-1 ; i >= 0 ; i-- )  {   str.append(input.charAt(i));  }  return str.toString() ; }   public static boolean isPossibleTriangle(int a ,int b , int c) {  if( a + b > c && c+b > a && a +c > b)return true ;  else return false ; }  static long xnor(long num1, long num2) {  if (num1 < num2) {  long temp = num1;  num1 = num2;  num2 = temp;  }  num1 = togglebit(num1);  return num1 ^ num2; }  static long togglebit(long n) {  if (n == 0)  return 1;  long i = n;  n |= n >> 1;  n |= n >> 2;  n |= n >> 4;  n |= n >> 8;  n |= n >> 16;  return i ^ n; }  public static int xorOfFirstN(int n) {   if( n % 4 ==0)return n ;  else if( n % 4 == 1)return 1 ;  else if( n % 4 == 2)return n+1 ;  else return 0 ;   }  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 int lcm(int a, int b ,int c , int d ) { int temp = lcm(a,b , c) ;   int ans = lcm(temp ,d ) ; return ans ;  }  public static int lcm(int a, int b ,int c ) { int temp = lcm(a,b) ; int ans = lcm(temp ,c) ; return ans ;  }   public static int lcm(int a , int b ) { int gc = gcd(a,b); return (a/gc)*b ; }  public static long lcm(long a , long b ) { long gc = gcd(a,b); return (a/gc)*b; }  static boolean isPrime(long n) {  if(n==1)  {    return false ;  }    boolean ans = true ;    for(long i = 2L; i*i <= n ;i++)  {    if(n% i ==0)    {     ans = false ;break ;    }  }      return ans ; }  static boolean isPrime(int n) {  if(n==1)  {    return false ;  }    boolean ans = true ;    for(int i = 2; i*i <= n ;i++)  {    if(n% i ==0)    {     ans = false ;break ;    }  }      return ans ; }    static int sieve = 1000000 ;  static boolean[] prime = new boolean[sieve + 1] ; public static void sieveOfEratosthenes()  {                               for(int i = 4; i<= sieve ; i++)   {    prime[i] = true ;    i++ ;   }     for(int p = 3; p*p <= sieve; p++)   {        if(prime[p] == false)    {          for(int i = p*p; i <= sieve; i += p)      prime[i] = true;    }        p++ ;   }            }    public static void sortD(int[] arr , int s , int e) {  sort(arr ,s , e) ;    int i =s ; int j = e ;    while( i < j)  {    int temp = arr[i] ;    arr[i] =arr[j] ;    arr[j] = temp ;    i++ ; j-- ;  }        return ; }   public static long countSubarraysSumToK(long[] arr ,long sum )  {  HashMap<Long,Long> map = new HashMap<>() ;     int n = arr.length ;     long prefixsum = 0 ;     long count = 0L ;  for(int i = 0; i < n ; i++)  {   prefixsum = prefixsum + arr[i] ;       if(sum == prefixsum)count = count+1 ;       if(map.containsKey(prefixsum -sum))   {    count = count + map.get(prefixsum -sum) ;   }         if(map.containsKey(prefixsum ))   {    map.put(prefixsum , map.get(prefixsum) +1 );   }      else{    map.put(prefixsum , 1L );   }         }          return count ;     }      public static ArrayList<Integer> kmpAlgorithm(String str , String pat)  {   ArrayList<Integer> list =new ArrayList<>();     int n = str.length() ;   int m = pat.length() ;     String q = pat + "#" + str ;     int[] lps =new int[n+m+1] ;      longestPefixSuffix(lps, q,(n+m+1)) ;         for(int i =m+1 ; i < (n+m+1) ; i++ )   {    if(lps[i] == m)    {     list.add(i-2*m) ;    }   }     return list ;        }   public static void longestPefixSuffix(int[] lps ,String str , int n)  {   lps[0] = 0 ;     for(int i = 1 ; i<= n-1; i++)   {   int l = lps[i-1] ;       while( l > 0 && str.charAt(i) != str.charAt(l))   {    l = lps[l-1] ;   }       if(str.charAt(i) == str.charAt(l))   {    l++ ;   }          lps[i] = l ;   }    }              public static void eulerTotientFunction(int[] arr ,int n )  {    for(int i = 1; i <= n ;i++)arr[i] =i ;      for(int i= 2 ; i<= n ;i++)  {   if(arr[i] == i)   {    arr[i] =i-1 ;        for(int j =2*i ; j<= n ; j+= i )    {     arr[j] = (arr[j]*(i-1))/i ;    }       }  }     return ;     }  public static long nCr(int n,int k) {  long ans=1L;  k=k>n-k?n-k:k;  int j=1;  for(;j<=k;j++,n--)  {   if(n%j==0)   {    ans*=n/j;   }else   if(ans%j==0)   {    ans=ans/j*n;   }else   {    ans=(ans*n)/j;   }  }  return ans; }  public static ArrayList<Integer> allFactors(int n) {   ArrayList<Integer> list = new ArrayList<>() ;    for(int i = 1; i*i <= n ;i++)  {   if( n % i == 0)   {    if(i*i == n)    {      list.add(i) ;    }    else{      list.add(i) ;      list.add(n/i) ;          }   }  }    return list ;     }  public static ArrayList<Long> allFactors(long n) {   ArrayList<Long> list = new ArrayList<>() ;    for(long i = 1L; i*i <= n ;i++)  {   if( n % i == 0)   {    if(i*i == n)    {      list.add(i) ;    }    else{      list.add(i) ;      list.add(n/i) ;          }   }  }    return list ;     }  static final int MAXN = 1000001;      static int spf[] = new int[MAXN];    static void sieve()  {   spf[1] = 1;   for (int i=2; i<MAXN; i++)          spf[i] = i;        for (int i=4; i<MAXN; i+=2)    spf[i] = 2;      for (int i=3; i*i<MAXN; i++)   {        if (spf[i] == i)    {          for (int j=i*i; j<MAXN; j+=i)         if (spf[j]==j)       spf[j] = i;    }   }  }     static ArrayList<Integer> getPrimeFactorization(int x)  {   ArrayList<Integer> ret = new ArrayList<Integer>();   while (x != 1)   {    ret.add(spf[x]);    x = x / spf[x];   }   return ret;  }       public static void merge(int arr[], int l, int m, int r)  {     int n1 = m - l + 1;   int n2 = r - m;      int L[] = new int[n1];   int R[] = new int[n2];      for (int i=0; i<n1; ++i)    L[i] = arr[l + i];   for (int j=0; j<n2; ++j)    R[j] = arr[m + 1+ j];           int i = 0, j = 0;      int k = l;   while (i < n1 && j < n2)   {    if (L[i] <= R[j])    {     arr[k] = L[i];     i++;    }    else    {     arr[k] = R[j];     j++;    }    k++;   }      while (i < n1)   {    arr[k] = L[i];    i++;    k++;   }      while (j < n2)   {    arr[k] = R[j];    j++;    k++;   }  }     public static void sort(int arr[], int l, int r)  {   if (l < r)   {       int m = (l+r)/2;        sort(arr, l, m);    sort(arr , m+1, r);        merge(arr, l, m, r);   }  } public static void sort(long arr[], int l, int r)  {   if (l < r)   {       int m = (l+r)/2;        sort(arr, l, m);    sort(arr , m+1, r);        merge(arr, l, m, r);   }  }  public static void merge(long arr[], int l, int m, int r)  {     int n1 = m - l + 1;   int n2 = r - m;      long L[] = new long[n1];   long R[] = new long[n2];      for (int i=0; i<n1; ++i)    L[i] = arr[l + i];   for (int j=0; j<n2; ++j)    R[j] = arr[m + 1+ j];           int i = 0, j = 0;      int k = l;   while (i < n1 && j < n2)   {    if (L[i] <= R[j])    {     arr[k] = L[i];     i++;    }    else    {     arr[k] = R[j];     j++;    }    k++;   }      while (i < n1)   {    arr[k] = L[i];    i++;    k++;   }      while (j < n2)   {    arr[k] = R[j];    j++;    k++;   }  }     public static long knapsack(int[] weight,long value[],int maxWeight){      int n= value.length ;      long []dp = new long[maxWeight+1];      Arrays.fill(dp, 0);     for(int i=0; i < n; i++)        for(int j = maxWeight; j >= weight[i]; j--)    dp[j] = Math.max(dp[j] , value[i] + dp[j - weight[i]]);        return dp[maxWeight];  }    public static long kadanesAlgorithm(long[] arr) {   if(arr.length == 0)return 0 ;    long[] dp = new long[arr.length] ;    dp[0] = arr[0] ;  long max = dp[0] ;      for(int i = 1; i < arr.length ; i++)  {    if(dp[i-1] > 0)    {     dp[i] = dp[i-1] + arr[i] ;    }    else{     dp[i] = arr[i] ;    }       if(dp[i] > max)max = dp[i] ;      }    return max ;   } public static long kadanesAlgorithm(int[] arr) {  if(arr.length == 0)return 0 ;    long[] dp = new long[arr.length] ;    dp[0] = arr[0] ;  long max = dp[0] ;      for(int i = 1; i < arr.length ; i++)  {    if(dp[i-1] > 0)    {     dp[i] = dp[i-1] + arr[i] ;    }    else{     dp[i] = arr[i] ;    }       if(dp[i] > max)max = dp[i] ;      }    return max ;   }             public static String swapString(String a, int i, int j) {   char[] b =a.toCharArray();   char ch;   ch = b[i];   b[i] = b[j];   b[j] = ch;   return String.valueOf(b);  }     public static void generatePermutation(String str, int start, int end)  {      if (start == end-1)    System.out.println(str);   else   {    for (int i = start; i < end; i++)    {          str = swapString(str,start,i);          generatePermutation(str,start+1,end);          str = swapString(str,start,i);    }   }  }    public static long factMod(long n, long mod) {  if (n <= 1) return 1;  long ans = 1;  for (int i = 1; i <= n; i++) {  ans = (ans * i) % mod;  }  return ans; }   public static long power(int a ,int b)  {        long x = (long)(a) ;   long n = (long)(b) ;     if(n==0)return 1 ;   if(n==1)return x;     long ans =1L ;     while(n>0)  {   if(n % 2 ==1)   {    ans = ans *x ;   }       n = n/2L ;       x = x*x ;      }     return ans ;  }   public static long power(long a ,long b)  {        long x = (a) ;   long n = (b) ;     if(n==0)return 1L ;   if(n==1)return x;     long ans =1L ;     while(n>0)  {   if(n % 2 ==1)   {    ans = ans *x ;   }       n = n/2L ;       x = x*x ;      }     return ans ;  }       public static long powerMod(long x, long n, long mod) {     if(n==0)return 1L ;   if(n==1)return x;      long ans = 1;  while (n > 0) {  if (n % 2 == 1) ans = (ans * x) % mod;  x = (x * x) % mod;  n /= 2;  }  return ans; }     public static long lowerBound(long[] arr,long k) {  long ans=-1;   int start=0;  int end=arr.length-1;   while(start<=end)  {  int mid=(start+end)/2;    if(arr[mid]<=k)  {   ans=arr[mid];   start=mid+1;  }  else  {   end=mid-1;  }    }   return ans;   }  public static int lowerBound(int[] arr,int k) {  int ans=-1;   int start=0;  int end=arr.length-1;   while(start<=end)  {  int mid=(start+end)/2;    if(arr[mid]<=k)  {   ans=arr[mid];   start=mid+1;  }  else  {   end=mid-1;  }    }   return ans;   }   public static long upperBound(long[] arr,long k) {  long ans=-1;   int start=0;  int end=arr.length-1;   while(start<=end)  {  int mid=(start+end)/2;    if(arr[mid]>=k)  {   ans=arr[mid];   end=mid-1;  }  else  {   start=mid+1;  }    }   return ans; }   public static int upperBound(int[] arr,int k) {  int ans=-1;   int start=0;  int end=arr.length-1;   while(start<=end)  {  int mid=(start+end)/2;    if(arr[mid]>=k)  {   ans=arr[mid];   end=mid-1;  }  else  {   start=mid+1;  }    }   return ans; }   public static void printArray(int[] arr , int si ,int ei) {  for(int i = si ; i <= ei ; i++)  {   out.print(arr[i] +" ") ;  }  } public static void printArrayln(int[] arr , int si ,int ei) {  for(int i = si ; i <= ei ; i++)  {   out.print(arr[i] +" ") ;  }  out.println() ; }  public static void printLArray(long[] arr , int si , int ei) {  for(int i = si ; i <= ei ; i++)  {   out.print(arr[i] +" ") ;  }  }   public static void printLArrayln(long[] arr , int si , int ei) {  for(int i = si ; i <= ei ; i++)  {   out.print(arr[i] +" ") ;  }  out.println() ;  } public static void printtwodArray(int[][] ans) {  for(int i = 0; i< ans.length ; i++)  {   for(int j = 0 ; j < ans[0].length ; j++)out.print(ans[i][j] +" ");   out.println() ;  }  out.println() ;  }   static long modPow(long a, long x, long p) {     a = a % p ;   if(a == 0)return 0L ;     long res = 1L;  while(x > 0) {   if( x % 2 != 0) {    res = (res * a) % p;   }   a = (a * a) % p;   x =x/2;  }  return res; }    static long modInverse(long a, long p) {     return modPow(a, p-2, p); }  static long[] factorial = new long[1000001] ;  static void modfac(long mod) {  factorial[0]=1L ; factorial[1]=1L ;    for(int i = 2; i<= 1000000 ;i++)  {   factorial[i] = factorial[i-1] *(long)(i) ;   factorial[i] = factorial[i] % mod ;  }     }     static long modBinomial(long n, long r, long p) {   if(n < r) return 0L ;   long num = factorial[(int)(n)] ;   long den = (factorial[(int)(r)]*factorial[(int)(n-r)]) % p ;     long ans = num*(modInverse(den,p)) ;   ans = ans % p ;   return ans ;   }   static void update(int val , long[] bit ,int n) {  for( ; val <= n ; val += (val &(-val)) )  {   bit[val]++ ;  }     }   static long query(int val , long[] bit , int n) {  long ans = 0L;   for( ; val >=1 ; val-=(val&(-val)) )ans += bit[val];    return ans ; }  static int countSetBits(long n)  {   int count = 0;   while (n > 0) {    n = (n) & (n - 1L);    count++;   }   return count;  }  static int abs(int x) {  if(x < 0)x = -1*x ;   return x ; }  static long abs(long x) {  if(x < 0)x = -1L*x ;   return x ; }  static void p(int val) {  out.print(val) ; } static void p() {  out.print(" ") ; } static void pln(int val) {  out.println(val) ; } static void pln() {  out.println() ; }  static void p(long val) {  out.print(val) ; }  static void pln(long val) {  out.println(val) ; }    static int bs(int[] arr, int s ,int e ,int key) {  if( s> e)return 0 ;    int mid = (s+e)/2 ;     if(arr[mid] <key)   {    return bs(arr ,mid+1,e , key) ;      }        else{        return bs(arr ,s ,mid-1, key) + e-mid+1;          } }        public static void solve() { FastReader scn = new FastReader() ;    ArrayList<Integer> list = new ArrayList<>() ; ArrayList<Long> lista = new ArrayList<>() ; ArrayList<Long> listb = new ArrayList<>() ;   HashMap<Integer,ArrayList<Pair>> map = new HashMap<>() ; HashMap<Integer,Integer> mapx = new HashMap<>() ; HashMap<Integer,Integer> mapy = new HashMap<>() ;   Set<Integer> set = new HashSet<>() ; Set<Integer> setx = new HashSet<>() ; Set<Integer> sety = new HashSet<>() ; StringBuilder sb =new StringBuilder("") ;            int testcase = 1;  for(int testcases =1 ; testcases <= testcase ;testcases++) {           int n= scn.nextInt() ; int[] arr= new int[n] ; for(int i=0; i < n;i++) {  arr[i]= scn.nextInt(); } for(int r= 0 ; r < n ;r++) {  int sum = 0 ;  for(int l =r ;l>= 0 ;l--)  {   sum = sum + arr[l] ;     if(map.containsKey(sum))   {    map.get(sum).add(new Pair(l,r)) ;   }   else{       map.put(sum,new ArrayList<Pair>());    map.get(sum).add(new Pair(l,r)) ;   }  } }  ArrayList<Pair> ans = null ;  int bestcount = 0 ; for(int x : map.keySet()) {   ArrayList<Pair> curr = map.get(x) ;  ArrayList<Pair> now = new ArrayList<Pair>() ;   int r=-1 ;   int count = 0 ;   for(Pair seg : curr)  {       if(seg.first > r)  {   count++ ;   now.add(seg) ;   r= seg.second ;  }       }     if(count > bestcount)  {   ans = now ;   bestcount = count ;  }    }  pln(bestcount) ; if(bestcount >0) { for(Pair x : ans) {  out.println((x.first+1) +" " +( x.second+1)) ; } }        set.clear() ; sb.delete(0 , sb.length()) ; list.clear() ;lista.clear() ;listb.clear() ; map.clear() ; mapx.clear() ; mapy.clear() ; setx.clear() ;sety.clear() ; }  out.flush() ; }  public static void main (String[] args) throws java.lang.Exception {  solve() ;   }  }  class Pair { int first ;  int second ;     public Pair(int l , int r)  {   first = l ;second = r ;  }   @Override public String toString() {  String ans = "" ; ans += this.first ; ans += " "; ans += this.second ;  return ans ; }  }
2	public class Main {  FastScanner in;  PrintWriter out;  private void solve() throws IOException {   solveB();  }  private void solveA() throws IOException {   int n = in.nextInt(), k = in.nextInt();   int[] cnt = new int[k];   for (int i = 0; i < n; i++)    cnt[in.nextInt() - 1] ^= 1;   int ans = 0;   for (int i = 0; i < k; i++)    ans += cnt[i];   out.println(n - ans + (ans + 1) / 2);  }  private void solveB() throws IOException {   long n = in.nextLong();   long c = (n + in.nextLong()) * 2;   long l = 0, r = (long) 1e9;   while (l + 1 < r) {    long m = (l + r) / 2;    if (m * m + 3 * m >= c)     r = m;    else     l = m;   }   out.println(n-r);  }  private void solveC() throws IOException {  }  private void solveD() throws IOException {  }  private void solveE() throws IOException {  }  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();   }   boolean hasNext() throws IOException {    return br.ready() || (st != null && st.hasMoreTokens());   }   int nextInt() throws IOException {    return Integer.parseInt(next());   }   long nextLong() throws IOException {    return Long.parseLong(next());   }   double nextDouble() throws IOException {    return Double.parseDouble(next());   }   String nextLine() throws IOException {    return br.readLine();   }   boolean hasNextLine() throws IOException {    return br.ready();   }  }  private void run() throws IOException {   in = new FastScanner(System.in);   out = new PrintWriter(System.out);    for (int t = 1; t-- > 0; )    solve();   out.flush();   out.close();  }  public static void main(String[] args) throws IOException {   new Main().run();  } }
3	public class b {  public static void main(String[] rgs) {  Scanner s=new Scanner(System.in);  int n=s.nextInt();  long[] arr=new long[n];   for(int i=0;i<n;i++) {  arr[i]=s.nextLong();  }  HashMap<Long,ArrayList<pair>> map=new HashMap<>();   ArrayList<pair> list=new ArrayList<>();  for(int i=0;i<n;i++) {  long sum=0;  for(int j=i;j<n;j++) {   sum=sum+arr[j];   pair ob=new pair(i,j);   if(map.containsKey(sum))   {   ArrayList p=map.get(sum);   p.add(ob);   map.put(sum, p);      }else {   ArrayList<pair> listt=new ArrayList<>();   listt.add(ob);   map.put(sum,listt);   }  }  }         long in=-1;  int max=0;   for(Map.Entry<Long, ArrayList<pair>> entry:map.entrySet()) {  int l=1;  ArrayList<pair> p=entry.getValue();  Collections.sort(p,new comp());  int now=p.get(0).end;  for(int j=0;j<p.size();j++) {         if(p.get(j).st>now) {   l++;   now=p.get(j).end;      }       }    if(l>max) {   max=l;   in=entry.getKey();  }  }   System.out.println(max);     ArrayList<pair> d=map.get(in);  int now=-1;  for(int j=0;j<d.size();j++) {    if(d.get(j).st>now) {   System.out.println((d.get(j).st+1)+" "+(d.get(j).end+1));   now=d.get(j).end;   }     }       } } class pair{  int st; int end; public pair(int st,int end) {   this.st=st;  this.end=end; } } class comp implements Comparator<pair>{  public int compare(pair h,pair j) {   if(h.end<j.end) {  return -1;  }else if(h.end==j.end) {  if(h.st<j.st) {   return 1;  }else if(h.st==j.st) {   return 0;  }else {   return -1;  }  }else {  return 1;  } } }
3	public class first { static int max = 1000000000; public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int[] tab = new int[n];  for(int i=0;i<n;i++) {  tab[i] = sc.nextInt();  }  for(int i=0;i<n;i++) {  for(int j=0;j<n;j++) {   if(i!=j)   if(tab[i]>=tab[j] && tab[i]%tab[j]==0) {   tab[i] = max;   }  }  }  int res = 0;  for(int i=0;i<n;i++) {  if(tab[i]!=max) res++;  }  System.out.println(res);   } }
6	public class MotherOfDragons {  public static void main(String[] args) {   FastScanner scanner = new FastScanner();   PrintWriter out = new PrintWriter(System.out, false);   int n = scanner.nextInt();   double k = scanner.nextInt();   long[] graph = new long[n];   for(int i = 0; i < n; i++) {    for(int j =0; j < n; j++) {     int val = scanner.nextInt();     if (val == 1 || i == j) graph[i] |= 1L << j;    }   }     int szLeft = n/2;   int szRight = n - szLeft;     int[] dp = new int[1 << szLeft];   int maxMask = 1 << szLeft;     for(int mask = 1; mask <maxMask; mask++) {    int curMask = mask;       for(int j = 0; j < szLeft; j++) {     if (((1 << j) & mask) > 0) {           curMask &= graph[j + szRight] >> szRight;                 dp[mask] = Math.max(dp[mask], dp[mask ^ (1 << j)]);     }    }       if (mask == curMask) {     dp[mask] = Math.max(dp[mask],Integer.bitCount(mask));    }   }   int ans = 0;   int rmaxMask = 1 << szRight;   for(int mask = 0; mask < rmaxMask; mask++) {       int curMask = mask;       int oMask = maxMask -1;    for(int j = 0; j < szRight; j++) {     if (((1 << j) & mask) > 0) {           curMask &= (graph[j] & (rmaxMask-1));           oMask &= graph[j] >> szRight;     }    }       if (curMask != mask) continue;       ans = Math.max(ans, Integer.bitCount(mask) + dp[oMask]);   }   k/=ans;   out.println(k * k * (ans * (ans-1))/2);   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());   }     long nextLong() {    return Long.parseLong(next());   }     double nextDouble() {    return Double.parseDouble(next());   }     String readNextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
6	public class E {   public static void main(String[] args) throws IOException {  Scanner sc=new Scanner(System.in);  PrintWriter out=new PrintWriter(System.out);  int n=sc.nextInt(),k=sc.nextInt();  boolean [][]adj=new boolean[n][n];  for(int i=0;i<n;i++)  for(int j=0;j<n;j++)   adj[i][j]=sc.nextInt()==1;  int n1=n/2,n2=n-n1;  int []clique=new int [1<<n1];  for(int msk=1;msk<1<<n1;msk++)  {  boolean ok=true;  for(int i=0;i<n1;i++) if((msk & 1<<i) !=0)   for(int j=i+1;j<n1;j++)   if((msk & 1<<j) !=0 && !adj[i][j])    ok=false;  if(ok)   clique[msk]=Integer.bitCount(msk);  }   int []edges=new int [n2];  for(int i=0;i<n2;i++)  {  int msk=0;  for(int j=0;j<n1;j++)   if(adj[i+n1][j])   msk|=1<<j;  edges[i]=msk;  }  int max=0;  for(int msk=1;msk<1<<n1;msk++)  for(int i=0;i<n1;i++)   if((msk & 1<<i) !=0)   max=Math.max(max, clique[msk]=Math.max(clique[msk], clique[msk^(1<<i)]));   for(int msk=1;msk<1<<n2;msk++)  {  int all=(1<<n1)-1;  for(int j=0;j<n2;j++)   if((msk & 1<<j) !=0)   all &=edges[j];  boolean ok=true;  for(int i=0;i<n2;i++) if((msk & 1<<i) !=0)   for(int j=i+1;j<n2;j++)   if((msk & 1<<j) !=0 && !adj[i+n1][j+n1])    ok=false;  if(ok)   max=Math.max(max, Integer.bitCount(msk)+clique[all]);      }   out.printf("%.9f\n",k*1.0*k*(max-1)/(2*max));   out.close();    } static class Scanner {   StringTokenizer st;   BufferedReader br;    public Scanner(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }    public Scanner(FileReader s) {    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 long nextLong() throws IOException {    return Long.parseLong(next());   }    public String nextLine() throws IOException {    return br.readLine();   }   public boolean ready() throws IOException {return br.ready();}   public double nextDouble() throws IOException {return Double.parseDouble(next());}    } }
5	public class A { @SuppressWarnings("unchecked") private static void solve() throws IOException {  ArrayList<Num> c = new ArrayList<Num>();  n = nextInt();  a = nextInt();  b = nextInt();  for(int i = 0; i < n; i++) {  int next = nextInt();  boolean found = false;  for(int j = 0; j < c.size(); j++) {   if(c.get(j).num == next) {   c.get(j).freq++;   found = true;   break;   }  }  if(!found)   c.add(new Num(next));  }  Collections.sort(c);  int below = 0;  int above = n;  boolean f = false;  for(int i = 0; i < c.size(); i++) {  below += c.get(i).freq;  above -= c.get(i).freq;  if(below == b && above == a) {   if(i == c.size())   break;   System.out.println(c.get(i+1).num - c.get(i).num);   f = true;   break;  }  }  if(!f)  System.out.println(0); }  static int n; static int a; static int b; public static void main(String[] args) {  try {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  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()); }  static long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  static double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } } class Num implements Comparable<Num> { int num; int freq; Num(int n) {  num = n;  freq = 1; } public int compareTo(Num other) {  return this.num - other.num; } }
4	public class A23 {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  String s = sc.next();  Map<String, Boolean> map = new HashMap<String, Boolean>();  for (int i = s.length(); i >= 1; i--) {  map.clear();  for (int j = 0; j < s.length()-i+1; j++) {   String temp = s.substring(j, j+i);   if (map.containsKey(temp)) {   System.out.println(i);   return;   }   map.put(temp, true);  }  }  System.out.println(0); } }
4	public class Main { static final FastReader FR = new FastReader(); static final PrintWriter PW = new PrintWriter(new OutputStreamWriter(System.out));  public static void main(String[] args) {  StringBuilder solution = new StringBuilder();  int rows = FR.nextInt();  int cols = FR.nextInt();  int moves = FR.nextInt();  List<List<Integer>> horizontalEdgeWeights = new ArrayList<List<Integer>>(rows);  for (int r = 0; r < rows; r++) {  horizontalEdgeWeights.add(new ArrayList<Integer>(cols-1));   for (int c = 0; c < cols - 1; c++) {   horizontalEdgeWeights.get(r).add(FR.nextInt());  }  }  List<List<Integer>> verticalEdgeWeights = new ArrayList<List<Integer>>(rows-1);  for (int r = 0; r < rows - 1; r++) {  verticalEdgeWeights.add(new ArrayList<Integer>(cols));   for (int c = 0; c < cols; c++) {   verticalEdgeWeights.get(r).add(FR.nextInt());  }  }   List<List<Integer>> result = getResult(rows, cols, moves, horizontalEdgeWeights, verticalEdgeWeights);  for (int r = 0; r < rows; r++) {  for (int c = 0; c < cols; c++) {   int value = (result != null ? result.get(r).get(c) : -1);   solution.append(value + " ");  }  solution.append("\n");  }  PW.print(solution.toString());  PW.close(); }  static List<List<Integer>> getResult(int rows, int cols, int moves, List<List<Integer>> horizontalEdgeWeights, List<List<Integer>> verticalEdgeWeights) {  if ((moves & 1) == 1) {  return null;  }  int mid = moves >> 1;  List<List<List<Integer>>> minForDistance = new ArrayList<List<List<Integer>>>(rows);  for (int r = 0; r < rows; r++) {  minForDistance.add(new ArrayList<List<Integer>>(cols));   for (int c = 0; c < cols; c++) {   minForDistance.get(r).add(new ArrayList<Integer>(Collections.nCopies(mid+1, Integer.MAX_VALUE)));   minForDistance.get(r).get(c).set(0, 0);  }  }  for (int m = 1; m <= mid; m++) {  for (int r = 0; r < rows; r++) {   for (int c = 0; c < cols; c++) {   int minBoredom = minForDistance.get(r).get(c).get(m);    if (r > 0) {    if (minForDistance.get(r-1).get(c).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r-1).get(c).get(m-1) + verticalEdgeWeights.get(r-1).get(c);    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }    if (c > 0) {    if (minForDistance.get(r).get(c-1).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r).get(c-1).get(m-1) + horizontalEdgeWeights.get(r).get(c-1);    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }      if (r + 1 < rows) {    if (minForDistance.get(r+1).get(c).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r+1).get(c).get(m-1) + verticalEdgeWeights.get(r).get(c);    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }     if (c + 1 < cols) {    if (minForDistance.get(r).get(c+1).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r).get(c+1).get(m-1) + horizontalEdgeWeights.get(r).get(c);    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }    minForDistance.get(r).get(c).set(m, minBoredom);   }  }  }  List<List<Integer>> result = new ArrayList<List<Integer>>(rows);  for (int r = 0; r < rows; r++) {  result.add(new ArrayList<Integer>(cols));   for (int c = 0; c < cols; c++) {   result.get(r).add(minForDistance.get(r).get(c).get(mid) << 1);  }  }  return result; }  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());  }  double nextDouble() {  return Double.parseDouble(next());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  } } }
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());  }  int[] readIntArray(int size) throws IOException {   int[] res = new int[size];   for (int i = 0; i < size; i++) {    res[i] = readInt();   }   return res;  }  long readLong() throws IOException {   return Long.parseLong(readString());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  <T> List<T>[] createGraphList(int size) {   List<T>[] list = new List[size];   for (int i = 0; i < size; i++) {    list[i] = new ArrayList<>();   }   return list;  }  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");  }  public void run() {   try {    timeBegin = System.currentTimeMillis();    memoryTotal = Runtime.getRuntime().freeMemory();    init();    solve();    out.close();    if (System.getProperty("ONLINE_JUDGE") == null) {     time();     memory();    }   } catch (Exception e) {    e.printStackTrace();    System.exit(-1);   }  }  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 + " ");  }  }
3	public class C_Round_455_Div2 {  static long[][]dp;  static long MOD =(long) 1e9 + 7;  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int n = in.nextInt();   char[]data = new char[n];   dp = new long[n][n];   for(long []a : dp){    Arrays.fill(a,-1);   }   for(int i = 0; i < n; i++){    data[i] = in.next().charAt(0);   }   out.println(cal(0, 0, data));   out.close();  }  static long cal(int index, int nested, char[]data ){     if(index + 1 == data.length){    return 1;   }   if(dp[index][nested] != -1){    return dp[index][nested];   }   long result = 0;   boolean isLoop = data[index] == 'f';   if(isLoop){    result = cal(index + 1, nested + 1, data);   }else{    result = cal(index + 1, nested, data);    if(nested > 0){     result += cal(index, nested - 1, data);     result %= MOD;    }   }     return dp[index][nested]= result;  } }
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);  } }
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();  } }
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";   public void run()  {   try   {       input = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(new BufferedOutputStream(System.out));    solve();       out.close();    }   catch(Exception e)   {    e.printStackTrace();    System.exit(1);   }  }   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] + " ");     } }
4	public class D {  static Scanner sc;  static PrintWriter out;  public static void main(String[] args) throws Exception {   sc = new Scanner(System.in);   out = new PrintWriter(System.out);     for(int i=0; i<1; i++) {    solve();   }   out.flush();  }  static void solve() {   int n = sc.nextInt();   int m = sc.nextInt();   int k = sc.nextInt();   int[][] a = new int[n][m-1];   int[][] b = new int[n-1][m];   for(int i=0 ;i<n; i++) {    for(int j=0; j<m-1; j++) {     a[i][j] = sc.nextInt();    }   }   for(int i=0 ;i<n-1; i++) {    for(int j=0; j<m; j++) {     b[i][j] = sc.nextInt();    }   }   if(k % 2 == 1) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      if (j > 0)       out.print(" ");      out.print("-1");     }     out.println();    }    return;   }    int[][] prev = new int[n][m];   k /= 2;   for(int l=0; l<k; l++) {    int[][] next = new int[n][m];    for(int i=0; i<n; i++) {     for(int j=0; j<m; j++) {      next[i][j] = Integer.MAX_VALUE;      if(i>0) {       next[i][j] = Math.min(next[i][j], prev[i-1][j] + b[i-1][j]);      }      if(i+1<n) {       next[i][j] = Math.min(next[i][j], prev[i+1][j] + b[i][j]);      }      if(j>0) {       next[i][j] = Math.min(next[i][j], prev[i][j-1] + a[i][j-1]);      }      if(j+1<m) {       next[i][j] = Math.min(next[i][j], prev[i][j+1] + a[i][j]);      }     }    }    prev = next;   }   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     if (j > 0)      out.print(" ");     out.print(prev[i][j] * 2);    }    out.println();   }   }  }
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+" ");    }    }   }
1	public class R495A { public static void main(String[] args) {  Scanner scan=new Scanner(System.in);  int n=scan.nextInt(), k=scan.nextInt();  int[] a=new int[n];  for(int i=0;i<n;i++) a[i]=scan.nextInt();  int res=2;  for(int i=0;i<n-1;i++) {  if(a[i+1]-a[i]>2*k) res+=2;  else if(a[i+1]-a[i]==2*k) res++;  }  System.out.println(res); } }
1	public class B {  public static PrintStream out = System.out;  public static InputReader in = new InputReader(System.in);  static class Node implements Comparable<Node> {   int res;   Node(int pp) {    p = pp;   }   int p;   @Override   public int compareTo(Node n) {    return Integer.compare(p, n.p);   }   @Override   public boolean equals(Object o) {    return p == ((Node) o).p;   }  }  public static void main(String args[]) {   int N, a, b;   N = in.nextInt();   int[] label;   a = in.nextInt();   b = in.nextInt();   if (a < b) {    label = new int[] {0, 1};   } else {    int tmp = a;    a = b;    b = tmp;    label = new int[] {1, 0};   }   Node[] nodes = new Node[N];   for (int i = 0; i < N; i++) {    nodes[i] = new Node(in.nextInt());   }   TreeSet<Node> ts = new TreeSet<>();   for (int i = 0; i < N; i++) {    ts.add(nodes[i]);   }   while (!ts.isEmpty()) {    Node n = ts.first();    Node an = new Node(a - n.p);    Node bn = new Node(b - n.p);    SortedSet<Node> ats = ts.tailSet(an);    SortedSet<Node> bts = ts.tailSet(bn);    Node an2 = ats.isEmpty() ? null : ats.first();    Node bn2 = bts.isEmpty() ? null : bts.first();    Node n2 = null;    int l = 0;    if (bn2 != null && bn2.equals(bn)) {     n2 = bn2;     l = label[1];    } else if (an2 != null && an2.equals(an)) {     n2 = an2;     l = label[0];    } else {     NO();    }    if (!n.equals(n2)) {     ts.remove(n);     n.res = l;    }    ts.remove(n2);    n2.res = l;   }   out.println("YES");   for (int i = 0; i < nodes.length; i++) {    if (i != 0) out.print(" ");    out.print(nodes[i].res);   }   out.println();  }  static void NO() {   out.println("NO");   System.exit(0);  } } 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 long nextLong() { return Long.parseLong(next());  }  public int nextInt() { return Integer.parseInt(next());  } }
0	public class ex1 {  public static void main(String[] args) {  int n,i,j;  Scanner scan = new Scanner(System.in);  n = Integer.parseInt(scan.nextLine());  if(n>=0)  System.out.println(n);  else if(n<0) {  n=-1*n;  i=n/10;  j=(n/100)*10+n%10;  i=-i;  j=-j;  if(i>=j)   System.out.println(i);  else   System.out.println(j);  } }  }
2	public class B {  static long n, k;  public static void main(String[] args) throws Exception {   Scanner in = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   n = in.nextLong();   k = in.nextLong();   long ans = n - TernarySearch(0, n);   pw.println(ans);   pw.close();  }  static long cal(long m) {   long x = (m * (m + 1)) / 2;   long y = x - (n - m);   return abs(k - y);  }  static long TernarySearch(long l, long r) {   long m1, m2;   while (r - l > 5) {    m1 = (2 * l + r) / 3;    m2 = (l + 2 * r) / 3;    if (cal(m1) > cal(m2)) l = m1;    else r = m2;   }   long min = cal(l), i = l;   for (; l <= r; l++) {    long t = cal(l);    if (t < min) {     min = t;     i = l;    }   }   return i;  }   static void debug(Object... obj) {   System.err.println(Arrays.deepToString(obj));  } }
5	public class Main {  static void insert(TreeMap<Integer, Integer>map,int v,int d) {  if(!map.containsKey(v))map.put(v, 0);  map.put(v, d+map.get(v));  if(map.get(v)==0)map.remove(v); }  static void cut(TreeSet<Integer> cuts, TreeMap<Integer, Integer>segments,int v) {  int upper = cuts.higher(v) , lower = cuts.lower(v);  insert(segments, upper-lower, -1);  insert(segments, upper-v, 1);  insert(segments, v-lower, 1);  cuts.add(v); }  public static void main(String[] args) throws Throwable {  Scanner sc = new Scanner(System.in);  int w = sc.nextInt(), h = sc.nextInt() , n = sc.nextInt();  TreeSet<Integer> vCuts = new TreeSet<>() , hCuts = new TreeSet<>();  TreeMap<Integer, Integer> vSegments = new TreeMap<>() , hSegments = new TreeMap<>();  vCuts.add(0);vCuts.add(w);  hCuts.add(0);hCuts.add(h);  insert(vSegments, w, 1);  insert(hSegments, h, 1);  StringBuilder sb = new StringBuilder();  while(n-->0)  {  if(sc.next().equals("H"))   cut(hCuts, hSegments, sc.nextInt());  else   cut(vCuts, vSegments, sc.nextInt());  sb.append(1l*hSegments.lastKey() * vSegments.lastKey() + "\n");  }  System.out.println(sb); }  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 long nextLong() throws IOException {return Long.parseLong(next());}  public String nextLine() throws IOException {return br.readLine();}  public double nextDouble() throws IOException {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-') {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.') {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public int[] nexIntArray() throws Throwable {  st = new StringTokenizer(br.readLine());  int[] a = new int[st.countTokens()];  for (int i = 0; i < a.length; i++)a[i] = nextInt();  return a;  }  public boolean ready() throws IOException {return br.ready();} } }
4	public class a23 {  public static void main(String args[])throws IOException  {   InputStreamReader read=new InputStreamReader(System.in);   BufferedReader in=new BufferedReader(read);   String s,subs;     s=in.readLine();   int i,j,k,l=0,a=1,sl=0;   for(i=0;i<s.length();i++)   {    a=1;    for(j=i;j<s.length();j++)    {     subs=s.substring(i,i+a);     for(k=i;k<(s.length()-a+1);k++)     {      if(subs.compareTo(s.substring(k,k+a))==0)      l++;      if(l==2)      {       if(a>sl)       sl=a;       l=0;       break;      }     }     l=0;     a++;    }   }   System.out.println(sl);  } }
1	public class evenness {  public static void main(String[] args){   try{   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  int i, n, temp=1;  String str = "";  int[] arr;  int r;    while (temp!= '\n'){  temp = System.in.read();     str = str.concat(Character.toString((char)temp));  }  str = str.replaceAll("[^0-9]", "");  n = Integer.parseInt(str);  temp=1;  str="";    arr = new int[n];    for (i=0;i<n;i++){  while (temp!=' ' && temp!=-1){  temp = System.in.read();       str = str.concat(Character.toString((char)temp));  }  str = str.replaceAll("[^0-9]", "");  arr[i] = Integer.parseInt(str);  str="";  temp=1;  }    r=(arr[2]%2);  if ((arr[0]%2)==(arr[1]%2)){  r=(arr[0]%2);  }    for (i=0;i<n;i++){  if ((arr[i]%2)!=r){  System.out.println(i+1);  break;  }  }   }catch (Exception e){  System.out.println("OH NOES " + e); } } }
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 swap = 0;    for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) if (a[i] > a[j]) swap ^= 1;    int m = in.readInt();    while (m-- > 0) {     int l = in.readInt();     int r = in.readInt();     int s = (r - l + 1);     s = s * (s - 1) / 2;     swap ^= s;     out.println((swap & 1) == 0 ? "even" : "odd");    }   }  }  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);   }  } }
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;  } } 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)); } }
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); } } }
1	public class temp {  void solve() {  FastReader sc =new FastReader();  int n = sc.nextInt();   ArrayList<String> a[] = new ArrayList[5];   for(int i=0;i<=4;i++)  a[i] = new ArrayList<>();   for(int i=0;i<n;i++)  {  String s = sc.next();  a[s.length()].add(s);  }   int ans = 0;   for(int i=0;i<n;i++)  {  String s = sc.next();  if(a[s.length()].contains(s))   a[s.length()].remove(new String(s));  }   for(int i=1;i<=4;i++)  ans+=a[i].size();   System.out.println(ans); }   public static void main(String[] args)  {   new temp().solve();  }   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());   }    double nextDouble()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  } }
4	public class _1517_D {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(System.out);   StringTokenizer line = new StringTokenizer(in.readLine());   int n = Integer.parseInt(line.nextToken());   int m = Integer.parseInt(line.nextToken());   int k = Integer.parseInt(line.nextToken());   int[][] edges1 = new int[n][m - 1];   int[][] edges2 = new int[n - 1][m];   for(int i = 0; i < n; i++) {    line = new StringTokenizer(in.readLine());    for(int j = 0; j < m - 1; j++) {     edges1[i][j] = Integer.parseInt(line.nextToken());    }   }   for(int i = 0; i < n - 1; i++) {    line = new StringTokenizer(in.readLine());    for(int j = 0; j < m; j++) {     edges2[i][j] = Integer.parseInt(line.nextToken());    }   }   if(k % 2 == 1) {    for(int i = 0; i < n; i++) {     StringBuilder sb = new StringBuilder();     for (int j = 0; j < m; j++) {      sb.append(-1);      if(j < m - 1) sb.append(' ');     }     out.println(sb.toString());    }   }else {    int[][][] dp = new int[n][m][k + 1];    for(int i = 0; i < n; i++) {     for(int j = 0; j < m; j++) {      Arrays.fill(dp[i][j], Integer.MAX_VALUE);      dp[i][j][0] = 0;     }    }    for(int a = 2; a <= k; a += 2) {     for(int i = 0; i < n; i++) {      for(int j = 0; j < m; j++) {       if(i > 0) {        dp[i][j][a] = Math.min(dp[i][j][a], dp[i - 1][j][a - 2] + 2 * edges2[i - 1][j]);       }       if(i < n - 1) {        dp[i][j][a] = Math.min(dp[i][j][a], dp[i + 1][j][a - 2] + 2 * edges2[i][j]);       }       if(j > 0) {        dp[i][j][a] = Math.min(dp[i][j][a], dp[i][j - 1][a - 2] + 2 * edges1[i][j - 1]);       }       if(j < m - 1) {        dp[i][j][a] = Math.min(dp[i][j][a], dp[i][j + 1][a - 2] + 2 * edges1[i][j]);       }      }     }    }    for(int i = 0; i < n; i++) {     StringBuilder sb = new StringBuilder();     for(int j = 0; j < m; j++) {      sb.append(dp[i][j][k]);      if(j < m - 1) sb.append(' ');     }     out.println(sb.toString());    }   }   in.close();   out.close();  } }
4	public class Longest {  public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  String str=sc.nextLine();  int max=0;  for(int i=0;i<str.length();i++)  {  for(int x=0;x+i<=str.length();x++)  {   if(contains(str,str.substring(x,x+i),x))   {      max=Math.max(max, i);   }  }  }  System.out.println(max); } public static boolean contains(String whole,String part,int start) {   if(whole.indexOf(part, start+1)>=0)return true;  return false; } }
0	public class Hexadec implements Runnable {  final static String taskname = "filename";  public void solve() throws Exception {    int n = Integer.parseInt(in.readLine());        out.write(n + " "+0+" "+0);   }  public void run() {   try {    in = new BufferedReader(new InputStreamReader(System.in));    out = new BufferedWriter(new OutputStreamWriter(System.out));     solve();    out.flush();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }  public int iread() throws Exception {   return Integer.parseInt(readword());  }  public double dread() throws Exception {   return Double.parseDouble(readword());  }  public long lread() throws Exception {   return Long.parseLong(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) {     new Thread(new Hexadec()).start();  } }
4	public class Test {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   String s = in.readLine();   int ans = 0;   for (int i = 0; i < s.length(); i++) {    for (int j = i + 1; j <= s.length(); j++) {     String t = s.substring(i, j);     if (s.indexOf(t, i + 1)>=0) {      ans = Math.max(ans, j - i);     }    }   }   System.out.println(ans);  }  }
1	public class Trains1_2 implements Runnable {  private BufferedReader br = null;  private PrintWriter pw = null;  private StringTokenizer stk = new StringTokenizer("");  public static void main(String[] args) {   new Thread(new Trains1_2()).run();  }  public void run() {     br = new BufferedReader(new InputStreamReader(System.in));   pw = new PrintWriter(new OutputStreamWriter(System.out));   solver();   pw.close();  }  private void nline() {   try {    if (!stk.hasMoreTokens())     stk = new StringTokenizer(br.readLine());   } catch (IOException e) {    throw new RuntimeException("KaVaBUnGO!!!", e);   }  }  private String nstr() {   while (!stk.hasMoreTokens())    nline();   return stk.nextToken();  }  private int ni() {   return Integer.valueOf(nstr());  }  private long nl() {   return Long.valueOf(nstr());  }  private double nd() {   return Double.valueOf(nstr());  }  boolean isNumber(char c) {   if (c <= '9' && c >= '0')    return true;   return false;  }  String to10(String s) {   long ans = 0;   for (int i = s.length() - 1; i >= 0; i--) {    ans += (s.charAt(i) - 'A' + 1) * Math.pow(26, s.length() - i - 1);   }   return String.valueOf(ans);  }   String to26(String s){   String ans="";   int a = Integer.valueOf(s);   while(a>26){    a--;    int k = a%26;    ans=ans+(char)((int)'A'+k);    a/=26;   }   ans+=(char)(a+'A'-1);   String ans1 = "";   for(int i = ans.length()-1; i>=0; i--)ans1+=ans.charAt(i);     return ans1;    }  String rev(String s) {   String ans = "";   int format = 0;   int git = 0;   String token1 = "";   String token2 = "";   String token3 = "", token4 = "";   for (int i = 0; i < s.length(); i++) {    if (!isNumber(s.charAt(i)))     token1 += s.charAt(i);    else     break;    git++;   }   for (int i = git; i < s.length(); i++) {    if (isNumber(s.charAt(i)))     token2 += s.charAt(i);    else     break;    git++;   }   if (s.length() == git)    format = 1;   else {    format = 2;       for (int i = git; i < s.length(); i++) {     if (!isNumber(s.charAt(i)))      token3 += s.charAt(i);     else      break;     git++;    }    for (int i = git; i < s.length(); i++)     if (isNumber(s.charAt(i)))      token4 += s.charAt(i);     else      break;   }   if (format == 1) {    ans += "R";    ans += token2;    ans += "C";    ans += to10(token1);   }else{    ans+=to26(token4);    ans+=token2;   }   return ans;  }  private void solver() {   int n = ni();   for (int i = 0; i < n; i++)    System.out.println(rev(nstr()));  }  void exit() {   System.exit(0);  } }
4	public class D_Rnd718_Explorer { static int row, col; static int INF = 1_000_000_000; static int[] dx = {0, 0, 1, -1}; static int[] dy = {1, -1, 0, 0}; public static void main(String[] args) throws NumberFormatException, IOException  {  BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  String[] in = scan.readLine().split(" ");  row = parse(in[0]);  col = parse(in[1]);  int k = parse(in[2]);   int[][] xMove = new int[row][col-1];  for(int i = 0; i < row; i++)  {  in = scan.readLine().split(" ");  for(int j = 0; j < col - 1; j++)   xMove[i][j] = parse(in[j]);  }   int[][] yMove = new int[row - 1][col];  for(int i = 0; i < row - 1; i++)  {  in = scan.readLine().split(" ");  for(int j = 0; j < col; j++)   yMove[i][j] = parse(in[j]);  }     int[][] output = new int[row][col];   if(k % 2 != 0)  fill(-1, output);   else  {  Point[][] grid = new Point[row][col];  for(int i = 0; i < row; i++)   for(int j = 0; j < col; j++)   grid[i][j] = new Point(i, j);    parseMoves(grid, xMove, yMove);    solve(grid, k, output);  }   print(output, out);   out.flush(); }  private static void solve(Point[][] grid, int k, int[][] output)  {     int target = k / 2;  int[][][] dist = new int[row][col][k/2];  fill(dist, grid);   for(int steps = 1; steps < target; steps++ )  {  for(int i = 0; i < row; i++)  {   for(int j = 0; j < col;j ++)   {   dist[i][j][steps] = getDist(i, j, steps, dist, grid);   }  }  }   for(int i = 0; i < row; i++)  for(int j = 0; j < col;j ++)   output[i][j] = (dist[i][j][target - 1] << 1);   }   private static int getDist(int y, int x, int steps, int[][][] dist, Point[][] grid)  {  for(int d = 0; d < 4; d++)  {  int i = y + dy[d];  int j = x + dx[d];    if(valid(i, j))  {   dist[y][x][steps] = Math.min(dist[y][x][steps], dist[i][j][steps - 1] + grid[y][x].weight[d]);  }  }   return dist[y][x][steps]; }   private static void fill(int[][][] dist, Point[][] grid)  {  for(int i = 0; i < row; i++)  for(int j = 0; j < col;j ++)   for(int s = 0; s < dist[0][0].length; s++)   dist[i][j][s] = INF;   for(int i = 0; i < row; i++)  for(int j = 0; j < col; j++)   for(int d = 0; d < 4; d++)   dist[i][j][0] = Math.min(dist[i][j][0], grid[i][j].weight[d]);   }  private static boolean valid(int y, int x)  {  return y >= 0 && x >= 0 && y < row && x < col; }   private static void parseMoves(Point[][] grid, int[][] xMove, int[][] yMove)  {  for(int i = 0; i < xMove.length; i++)  {  for(int j = 0; j < xMove[i].length; j++)  {   grid[i][j].weight[2] = xMove[i][j];   grid[i][j + 1].weight[3] = xMove[i][j];   }  }   for(int i = 0; i < yMove.length; i++)  {  for(int j = 0; j < yMove[i].length; j++)  {   grid[i][j].weight[0] = yMove[i][j];   grid[i + 1][j].weight[1] = yMove[i][j];   }  } }  private static void fill(int val, int[][] output)  {  for(int i = 0; i < output.length; i++)  Arrays.fill(output[i], val); }  private static void print(int[][] ray, PrintWriter out)  {  for(int i = 0; i < ray.length; i++)  {  out.print(ray[i][0]);  for(int j = 1; j < ray[i].length; j++)   out.print(" " + ray[i][j]);  out.println();  }   }  public static int parse(String num) {  return Integer.parseInt(num); }  static class Point {  int[] weight = new int[4];   int x, y;   public Point(int i, int j)  {  y = i;  x = j;  Arrays.fill(weight, INF);  } }  static class Step implements Comparable<Step> {  int length, numSteps;  Point current;   public Step(Point p, int weight, int s)  {  current = p;  length = weight;  numSteps = s;  }  @Override  public int compareTo(Step s)  {  if(length == s.length) return numSteps - s.numSteps;  return length - s.length;  } } }
4	public class Solution{  static int[] dx = {1,-1,0,0};  static int[] dy = {0,0,1,-1};  static Queue<Pair> q ;  static boolean[][] visited ;  static Pair result = new Pair(0,0);  static int n,m,k;  public static void main(String[] args){   try(BufferedReader in = new BufferedReader(new FileReader("input.txt"));     BufferedWriter out = new BufferedWriter(new FileWriter("output.txt")))   {    StringTokenizer s = new StringTokenizer(in.readLine());    n = Integer.parseInt(s.nextToken());    m = Integer.parseInt(s.nextToken());    k = Integer.parseInt(in.readLine());    visited = new boolean[n][m];    q = new LinkedList <>();    s = new StringTokenizer(in.readLine());    for(int i=0;i<k;i++){     int x = Integer.parseInt(s.nextToken());     int y = Integer.parseInt(s.nextToken());     q.add(new Pair(--x,--y));    }    bfs();    String ans = "" + (result.x+1) +" "+ (result.y+1);    out.write(ans);   }catch(IOException e){   }  }  static void bfs(){   while(!q.isEmpty()){    Pair temp = q.poll();    if(visited[temp.x][temp.y]) continue;    visited[temp.x][temp.y] = true;    result.x = temp.x;    result.y= temp.y;    for(int i=0;i<4;i++){     int x = temp.x + dx[i];     int y = temp.y + dy[i];     if(x>=0 && x<n && y>=0 && y<m && !visited[x][y])      q.add(new Pair(x,y));    }      }  }  } class Pair{  int x,y;  public Pair(int x,int y){   this.x=x;   this.y=y;  } }
1	public class B { static ArrayList<Integer> [] adj; static int [] num; static int dfs(int u, int p){  int cnt = 0;  for(int v:adj[u]){  if(v != p)   cnt += dfs(v, u);  }  if(adj[u].size() == 1 && u != 0 || u == 0 && adj[0].size() == 0)  cnt++;  num[cnt]++;  return cnt; } public static void main(String[] args) throws NumberFormatException, IOException {  Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out);  int n = sc.nextInt();  adj = new ArrayList[n];  for (int i = 0; i < adj.length; ++i) {  adj[i] = new ArrayList<>();  }  for (int i = 1; i < n; ++i) {  int p = sc.nextInt()-1;  adj[p].add(i);  adj[i].add(p);  }  num = new int[n+1];  dfs(0, -1);  for (int i = 1; i < num.length; ++i) {  num[i] += num[i-1];  }  int cur = 1;  for (int i = 0; i < num.length; ++i) {  while(cur <= num[i]){   out.print(i + " ");   ++cur;  }  }  out.close(); }  static class Scanner {  BufferedReader br;  StringTokenizer st;  public Scanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  public String next() throws IOException {  while (st == null || !st.hasMoreTokens()) {   st = new StringTokenizer(br.readLine());  }  return st.nextToken();  }  public int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(next());  } } }
2	public class Pipeline {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   long n = in.nextLong();   long k = in.nextLong();   if (n == 1) {    System.out.println(0);    return;   }   if (k >= n) {    System.out.println(1);    return;   }   long total = (k + 2) * (k - 1) / 2 - (k - 2);   if (total < n) {    System.out.println(-1);    return;   }   int i = 2, j = (int) k;   while (i <= j) {    int m = (i + j) / 2;    total = (k + m) * (k - m + 1) / 2 - (k - m);    if (total == n) {     System.out.println(k - m + 1);     return;    }    if (total < n)     j = m - 1;    else     i = m + 1;   }   System.out.println(k-i+2);  } }
3	public class oK{    void pre() throws Exception{}    void solve(int TC) throws Exception{    int n=ni();     int a[]=new int[n];    for(int i=0;i<n;i++) {     a[i]=ni();    }    Arrays.sort(a);    int b[]=new int[101];    int flag=0;    int count=0;    for(int i=0;i<n;i++) {     flag=0;     if(b[a[i]]==0) {     count++;     }     for(int j=i;j<n;j++) {     if(b[a[j]]==0&&a[j]%a[i]==0) {           b[a[j]]=1;           }          }             }    pn(count);            }                                      static boolean multipleTC = false, memory = false;    FastReader in;PrintWriter out;    void run() throws Exception{     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();    }    public static void main(String[] args) throws Exception{     if(memory)new Thread(null, new Runnable() {public void run(){try{new oK().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();     else new oK().run();    }    void p(Object o){out.print(o);}    void pn(Object o){out.println(o);}    void pni(Object o){out.println(o);out.flush();}    String n()throws Exception{return in.next();}    String nln()throws Exception{return in.nextLine();}    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;     }    }   }
0	public class Task122A {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  sc.close();   if ( (n % 4 == 0) ||   (n % 7 == 0) ||   (n % 44 == 0) ||   (n % 47 == 0) ||   (n % 74 == 0) ||   (n % 77 == 0) ||    (n % 444 == 0) ||   (n % 447 == 0) ||   (n % 474 == 0) ||   (n % 477 == 0) ||   (n % 744 == 0) ||   (n % 747 == 0) ||   (n % 774 == 0) ||   (n % 777 == 0) )  {  System.out.println("YES");  } else {  System.out.println("NO");  } } }
3	public class Codeforces455Div2C { public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String[] sp = br.readLine().split(" ");  int n = Integer.parseInt(sp[0]);  char[] list = new char[n];  for (int i = 0; i < n; i++) {  sp = br.readLine().split(" ");  list[i] = sp[0].charAt(0);  }   int[] list2 = new int[n];  int counter = 0;  for (int i = 0; i < n; i++) {  if (list[i] == 's') {   counter++;  }  else {   list2[counter]++;  }  }   int[][] dp = new int[counter][n-counter+1];  int[][] dpsum = new int[counter][n-counter+1];  int[] count = new int[counter];  count[0] = list2[0];  for (int i = 1; i < counter; i++) {  count[i] = count[i-1] + list2[i];  }   for (int i = 0; i <= count[0]; i++) {  dp[0][i] = 1;  dpsum[0][i] = i+1;  }  for (int i = 1; i < counter; i++) {  for (int j = 0; j <= count[i]; j++) {   dp[i][j] = dpsum[i-1][Math.min(j, count[i-1])];  }  dpsum[i][0] = dp[i][0];  for (int j = 1; j <= count[i]; j++) {   dpsum[i][j] = (dpsum[i][j-1]+dp[i][j])%1000000007;  }  }   System.out.println(dp[counter-1][n-counter]); } }
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);    } }
3	public class C { static char[] arr; static int mod = (int) 1e9 + 7; static int[][] memo; static int n;  static int solve(int idx, int depth) {  if (idx == n) {  return depth == 0 ? 1 : 0;  }  if (memo[idx][depth] != -1)  return memo[idx][depth];  int ret = 0;  if (arr[idx] == 's') {  if (depth > 0)   ret = ret + solve(idx, depth - 1);  ret = (ret + solve(idx + 1, depth)) % mod;  }  if (arr[idx] == 'f' || arr[idx] == 'z')  ret = (ret + solve(idx + 1, depth + 1)) % mod;  return memo[idx][depth] = ret; }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  n = sc.nextInt();  arr = new char[n];  for (int i = 0; i < n; i++)  arr[i] = sc.next().charAt(0);  memo = new int[n + 1][n + 1];  for (int[] x : memo)  Arrays.fill(x, -1);  System.out.println(solve(0, 0)); }  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 long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public boolean ready() throws IOException {  return br.ready();  } } }
5	public class A15 {  final double eps = 10e-9;  class Pair implements Comparable<Pair>{  int x;  int length;   Pair(int x, int length) {  this.x = x;  this.length = length;  }  public int compareTo(Pair p) {  return x - p.x;  } }  private void Solution() throws IOException {  int n = nextInt(), t = nextInt(), ans = 2;  Pair[] pairs = new Pair[n];  for (int i = 0; i < n; i ++) {  int x = nextInt(), length = nextInt();  pairs[i] = new Pair(x, length);  }  Arrays.sort(pairs);  for (int i = 0; i < n-1; i ++) {  double place = pairs[i+1].x - pairs[i].x - (double) pairs[i+1].length/2 - (double) pairs[i].length/2;  if (place > t)   ans += 2; else   if ((int) (place+eps) == t)    ans ++;  }  System.out.println(ans); }  public static void main(String[] args) {  new A15().run(); }  BufferedReader in; StringTokenizer tokenizer;  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  tokenizer = null;  Solution();  in.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(in.readLine());  return tokenizer.nextToken(); } }
2	public class C {  static final int MOD = (int)1e9 + 7;  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   long x = sc.nextLong(), k = sc.nextLong();   if(x == 0)    out.println(0);   else    out.println(((x % MOD * 2 - 1 + MOD) % MOD * modPow(2, k) % MOD + 1) % MOD);   out.close();  }  static long modPow(long b, long e) {   long res = 1;   while(e > 0) {    if((e & 1) == 1)     res = res * b % MOD;    b = b * b % MOD;    e >>= 1;   }   return res;  }  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 long nextLong() throws IOException {return Long.parseLong(next());}   public double nextDouble() throws IOException { return Double.parseDouble(next()); }   public String nextLine() throws IOException {return br.readLine();}   public boolean ready() throws IOException { return br.ready(); }  } }
4	public class Main { public static void main(String[] args) throws Exception {  FastIO io = new FastIO();  int test=io.nextInt();  while(test>0)  {   int n=io.nextInt();   int arr[]=new int[n];   for(int i=0;i<n;i++)arr[i]=io.nextInt();   List<int[]> list=new ArrayList<>();   Stack<int[]> stk=new Stack<>();   int temp[]={1};   list.add(temp);   stk.push(temp);   for(int i=1;i<n;i++)   {    if(arr[i]==1)    {     int t[]=stk.peek();     int nt[]=new int[t.length+1];     for(int j=0;j<t.length;j++)nt[j]=t[j];     nt[nt.length-1]=arr[i];     stk.push(nt);     list.add(nt);     continue;    }    while(stk.size()>0)    {     int t[]=stk.peek();     if(t[t.length-1]+1==arr[i]){      int nt[]=new int[t.length];      for(int j=0;j<t.length-1;j++)nt[j]=t[j];      nt[t.length-1]=arr[i];      stk.pop();      stk.push(nt);      list.add(nt);      break;     }     else     {      stk.pop();     }    }   }   for(int i=0;i<list.size();i++)   {    StringBuilder sb=new StringBuilder();    sb.append(list.get(i)[0]);    for(int j=1;j<list.get(i).length;j++)    {     sb.append("."+list.get(i)[j]);    }    io.println(sb.toString());   }   test--;  }  io.close(); } }  class FastIO extends PrintWriter { private InputStream stream; private byte[] buf = new byte[1<<16]; private int curChar, numChars;   public FastIO() { this(System.in,System.out); } public FastIO(InputStream i, OutputStream o) {  super(o);  stream = i; }  public FastIO(String i, String o) throws IOException {  super(new FileWriter(o));  stream = new FileInputStream(i); }   private int nextByte() {  if (numChars == -1) throw new InputMismatchException();  if (curChar >= numChars) {  curChar = 0;  try {   numChars = stream.read(buf);  } catch (IOException e) {   throw new InputMismatchException();  }  if (numChars == -1) return -1;  }  return buf[curChar++]; }  public String nextLine() {  int c; do { c = nextByte(); } while (c <= '\n');  StringBuilder res = new StringBuilder();  do { res.appendCodePoint(c); c = nextByte(); } while (c > '\n');  return res.toString(); }  public String next() {  int c; do { c = nextByte(); } while (c <= ' ');  StringBuilder res = new StringBuilder();  do { res.appendCodePoint(c); c = nextByte(); } while (c > ' ');  return res.toString(); }  public int nextInt() {  int c; do { c = nextByte(); } while (c <= ' ');  int sgn = 1; if (c == '-') { sgn = -1; c = nextByte(); }  int res = 0;  do {  if (c < '0' || c > '9')   throw new InputMismatchException();  res = 10*res+c-'0';  c = nextByte();  } while (c > ' ');  return res * sgn; }  public long nextLong() {  int c; do { c = nextByte(); } while (c <= ' ');  long sgn = 1; if (c == '-') { sgn = -1; c = nextByte(); }  long res = 0;  do {  if (c < '0' || c > '9')   throw new InputMismatchException();  res = 10*res+c-'0';  c = nextByte();  } while (c > ' ');  return res * sgn; }  public double nextDouble() { return Double.parseDouble(next()); } }
2	public class B {  final int INF = 1_000_000_000;  void solve() {   int n = readInt();   int k = readInt();   long l = 0;   long r = INF;   while(r - l > 1){    long m = (r + l) >> 1;    if(m * (m + 1) / 2 + m >= k + n) r = m;    else l = m;   }   out.print(n - r);  }  public static void main(String[] args) {   new B().run();  }  private void run() {   try {    init();    solve();    out.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(-1);   }  }  private BufferedReader in;  private StringTokenizer tok = new StringTokenizer("");  private PrintWriter out;  private void init() {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);     }  private String readLine() {   try {    return in.readLine();   } catch (IOException e) {    throw new RuntimeException(e);   }  }  private String readString() {   while (!tok.hasMoreTokens()) {    String nextLine = readLine();    if (nextLine == null) return null;    tok = new StringTokenizer(nextLine);   }   return tok.nextToken();  }  private int readInt() {   return Integer.parseInt(readString());  }  private long readLong() {   return Long.parseLong(readString());  }  int[] readIntArray(int n){   int[] res = new int[n];   for(int i = 0;i<n;i++){    res[i] = readInt();   }   return res;  }  long[] readLongArray(int n){   long[] res = new long[n];   for(int i = 0;i<n;i++){    res[i] = readLong();   }   return res;  }  int[] castInt(List<Integer> list){   int[] res = new int[list.size()];   for(int i = 0;i<list.size();i++){    res[i] = list.get(i);   }   return res;  } }
4	public class FireAgain {  Scanner in; PrintWriter out;  public static void main(String[] args) throws IOException {   new FireAgain().run();  }  void run() throws IOException {  in = new Scanner(new FileReader("input.txt"));   out = new PrintWriter(new FileWriter("output.txt"));  solve();  in.close();  out.close(); }  private void solve() {   int N = in.nextInt();  int M = in.nextInt();  int[][] burn = new int[N + 1][M + 1];  int K = in.nextInt();   int[] qx = new int[N * M];  int[] qy = new int[N * M];   int first = 0;  int last = 0;  for (int i = 0; i < K; i ++){  qx[last] = in.nextInt();  qy[last] = in.nextInt();  burn[qx[last]][qy[last]] = 1;  last ++;  }   while (first < last){  int x = qx[first];  int y = qy[first];  if (x - 1 > 0 && burn[x - 1][y] == 0){   burn[x - 1][y] = 1;   qx[last] = x - 1;   qy[last] = y;   last ++;  }  if (y - 1 > 0 && burn[x][y - 1] == 0){   burn[x][y - 1] = 1;   qx[last] = x;   qy[last] = y - 1;   last ++;  }  if (x + 1 <= N && burn[x + 1][y] == 0){   burn[x + 1][y] = 1;   qx[last] = x + 1;   qy[last] = y;   last ++;  }  if (y + 1 <= M && burn[x][y + 1] == 0){   burn[x][y + 1] = 1;   qx[last] = x;   qy[last] = y + 1;   last ++;  }  first ++;  }   out.println(qx[last - 1] + " " + qy[last - 1]); } }
6	public class E1 {  public static void main(String[] args) throws Exception {  FastScanner sc = new FastScanner(System.in);  FastPrinter out = new FastPrinter(System.out);  int T = sc.nextInt();  for (int i = 0; i < T; i++) {  new E1().run(sc, out);  }  out.close(); }  int N, M, arr[][], ans;  public void run(FastScanner sc, FastPrinter out) throws Exception {  N = sc.nextInt();  M = sc.nextInt();  arr = new int[N][M];  int[][] nums = new int[N * M][3];  int count = 0;  for (int i = 0; i < N; i++) {  for (int j = 0; j < M; j++) {   int v = sc.nextInt();   arr[i][j] = v;   nums[count++] = new int[] { v, j, i };  }  }  Arrays.sort(nums, new Comparator<int[]>() {  @Override  public int compare(int[] a, int[] b) {   return b[0] - a[0];  }  });     if (N == 4 && M > 1) {  int colCount = 0;  HashMap<Integer, Integer> map = new HashMap<>();    for (int i = 0; i < 8; i++) {   int col = nums[i][1];   Integer newCol = map.get(col);   if (newCol == null) {   map.put(col, colCount++);   }  }  int[][] arr = new int[N][colCount];  for (int i = 0; i < 8; i++) {   int val = nums[i][0];   int col = map.get(nums[i][1]);   int row = nums[i][2];   arr[row][col] = val;  }    solve(0, arr);  } else {  ans = 0;  for (int i = 0; i < N; i++) {   ans += nums[i][0];  }  }  System.out.println(ans); }  private void solve(int index, int[][] arr) {  if (index == arr[0].length) {  int temp = 0;  for (int i = 0; i < arr.length; i++) {   int m = 0;   for (int j = 0; j < arr[i].length; j++) {   m = Math.max(m, arr[i][j]);   }   temp += m;  }  ans = Math.max(temp, ans);  } else {  for (int t = 0; t < N; t++) {   int v = arr[0][index];   for (int i = 0; i < N - 1; i++) {   arr[i][index] = arr[i + 1][index];   }   arr[N - 1][index] = v;   solve(index + 1, arr);  }  }  }  static class FastScanner {  final private 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;  }  int[] nextIntArray(int N) throws IOException {  int[] arr = new int[N];  for (int i = 0; i < N; i++) {   arr[i] = nextInt();  }  return arr;  }  String nextLine() throws IOException {  int c = read();  while (c != -1 && isEndline(c))   c = read();  if (c == -1) {   return null;  }  StringBuilder res = new StringBuilder();  do {   if (c >= 0) {   res.appendCodePoint(c);   }   c = read();  } while (!isEndline(c));  return res.toString();  }  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;  }  public long nextLong() throws IOException {  long ret = 0;  byte c = read();  while (c <= ' ')   c = read();  boolean neg = (c == '-');  if (neg) c = read();  do {   ret = ret * 10 + c - '0';  } while ((c = read()) >= '0' && c <= '9');  if (neg) return -ret;  return ret;  }  public double nextDouble() throws IOException {  double ret = 0, div = 1;  byte c = read();  while (c <= ' ')   c = read();  boolean neg = (c == '-');  if (neg) c = read();   do {   ret = ret * 10 + c - '0';  } while ((c = read()) >= '0' && c <= '9');   if (c == '.') {   while ((c = read()) >= '0' && c <= '9') {   ret += (c - '0') / (div *= 10);   }  }   if (neg) return -ret;  return ret;  }  private void fillBuffer() throws IOException {  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();  }  public int[][] readGraph(int N, int M, boolean zeroIndexed, boolean bidirectional) throws Exception {  int[][] adj = new int[N][];  int[] numNodes = new int[N];  int[][] input = new int[M][2];  for (int i = 0; i < M; i++) {   int a = nextInt();   int b = nextInt();   if (zeroIndexed) {   a--;   b--;   }   input[i][0] = a;   input[i][1] = b;   numNodes[a]++;   if (bidirectional) numNodes[b]++;  }  for (int i = 0; i < N; i++) {   adj[i] = new int[numNodes[i]];   numNodes[i] = 0;  }  for (int i = 0; i < M; i++) {   int a = input[i][0];   int b = input[i][1];   adj[a][numNodes[a]++] = b;   if (bidirectional) adj[b][numNodes[b]++] = a;  }  return adj;  }  public int[][][] readWeightedGraph(int N, int M, boolean zeroIndexed, boolean bidirectional) throws Exception {  int[][][] adj = new int[N][][];  int[] numNodes = new int[N];  int[][] input = new int[M][3];  for (int i = 0; i < M; i++) {   int a = nextInt();   int b = nextInt();   if (zeroIndexed) {   a--;   b--;   }   int d = nextInt();   input[i][0] = a;   input[i][1] = b;   input[i][2] = d;   numNodes[a]++;   if (bidirectional) numNodes[b]++;  }  for (int i = 0; i < N; i++) {   adj[i] = new int[numNodes[i]][2];   numNodes[i] = 0;  }  for (int i = 0; i < M; i++) {   int a = input[i][0];   int b = input[i][1];   int d = input[i][2];   adj[a][numNodes[a]][0] = b;   adj[a][numNodes[a]][1] = d;   numNodes[a]++;   if (bidirectional) {   adj[b][numNodes[b]][0] = a;   adj[b][numNodes[b]][1] = d;   numNodes[b]++;   }  }  return adj;  } }  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 printf(String format, Object... args) {  buf.append(String.format(format, args));  }  public void close() {  pw.print(buf);  pw.close();  }  public void flush() {  pw.print(buf);  pw.flush();  buf.setLength(0);  }  } }
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]); } }
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;  } }
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[]>() {    @Override    public int compare(int[] a, int[] b) {     return a[1]-b[1];        }   });  }   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[]>() {    @Override    public int compare(long[] a, long[] b) {     if (a[0] > b[0])      return 1;     else if (a[0] < b[0])      return -1;     else      return 0;        }   });  }  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());   }   int[][] graph(int N, int[][] edges) {    int[][] graph = new int[N][];    int[] sz = new int[N];    for (int[] e: edges) {     sz[e[0]] += 1;     sz[e[1]] += 1;    }    for (int i = 0; i < N; i++) {     graph[i] = new int[sz[i]];    }    int[] cur = new int[N];    for (int[] e: edges) {     graph[e[0]][cur[e[0]]] = e[1];     graph[e[1]][cur[e[1]]] = e[0];     cur[e[0]] += 1;     cur[e[1]] += 1;    }    return graph;   }    int[] intArray(int N, int mod) {    int[] ret = new int[N];    for (int i = 0; i < N; i++)     ret[i] = ni()+mod;    return ret;   }    long nl() {    return Long.parseLong(next());   }    long[] longArray(int N, long mod) {    long[] ret = new long[N];    for (int i = 0; i < N; i++)     ret[i] = nl()+mod;    return ret;   }    double nd() {    return Double.parseDouble(next());   }    String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
5	public class Main implements Runnable { public void solution() throws IOException {  int n = in.nextInt();  int[] a = new int[n];  int min = Integer.MAX_VALUE;  for (int i = 0; i < n; ++i) {  a[i] = in.nextInt();  if (a[i] < min) {   min = a[i];  }  }  int res = Integer.MAX_VALUE;  for (int i = 0; i < n; ++i) {  if (a[i] != min && a[i] < res) {   res = a[i];  }  }  if (res == Integer.MAX_VALUE) {  out.println("NO");  } else {  out.println(res);  } }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Throwable e) {  e.printStackTrace();  System.exit(1);  } }  private class Scanner {  private BufferedReader reader;  private StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  public boolean hasNext() throws IOException {  while (!tokenizer.hasMoreTokens()) {   String next = reader.readLine();   if (next == null) {   return false;   }   tokenizer = new StringTokenizer(next);  }  return true;  }  public String next() throws IOException {  hasNext();  return tokenizer.nextToken();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
5	public class a {  private void solve() throws Exception {  int n = nextInt(), t = nextInt();  int[] x = new int[n], a = new int[n];  for (int i = 0; i < n; ++i){  x[i] = nextInt();  a[i] = nextInt();  }  for (int i = 0; i < n; ++i)  for (int j = 0; j < n - 1; ++j){   if (x[j] > x[j + 1]){   int tmp = x[j];   x[j] = x[j + 1];   x[j + 1] = tmp;      tmp = a[j];   a[j] = a[j + 1];   a[j + 1] = tmp;   }  }  int res = 2;  for (int i = 1; i < n; ++i){  int betw = (x[i] - x[i - 1]) * 2 - a[i] - a[i - 1];  if (betw == t * 2)   ++res;  else if (betw > t * 2)   res += 2;  }  out.print(res); }  public void run() {  try {  solve();  } catch (Exception e) {  NOO(e);  } finally {  out.close();  } }  PrintWriter out; BufferedReader in; StringTokenizer St;  void NOO(Exception e) {  e.printStackTrace();  System.exit(1); }  int nextInt() {  return Integer.parseInt(nextToken()); }  long nextLong() {  return Long.parseLong(nextToken()); }  double nextDouble() {  return Double.parseDouble(nextToken()); }  String nextToken() {  while (!St.hasMoreTokens()) {  try {   String line = in.readLine();   St = new StringTokenizer(line);  } catch (Exception e) {   NOO(e);  }  }  return St.nextToken(); }  private a(String name) {  try {  in = new BufferedReader(new FileReader(name + ".in"));  St = new StringTokenizer("");  out = new PrintWriter(new FileWriter(name + ".out"));  } catch (Exception e) {  NOO(e);  } }  private a() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  St = new StringTokenizer("");  out = new PrintWriter(System.out);  } catch (Exception e) {  NOO(e);  } }  public static void main(String[] args) {  new a().run(); } }
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());   }  } }
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()); }  public double nextDouble() throws IOException {  return Double.parseDouble(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);  } } }
1	public class Solution {  static boolean canWinFromOneMove(char []s,int k) {  int prefix=0;  int n=s.length;  for(int i=0;i<n && s[i]==s[0];i++)  prefix++;  int suffix=0;  for(int i=n-1;i>=0 && s[i]==s[n-1];i--)  suffix++;   return s[0]==s[n-1] && prefix+suffix+k>=n || Math.max(prefix, suffix)+k>=n;   } public static void main(String[] args) throws IOException {  Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out);  int n=sc.nextInt(),k=sc.nextInt();  char []s=sc.next().toCharArray();  if(canWinFromOneMove(s, k)) {  System.out.println("tokitsukaze");  return;  }  int []suff=new int [n+1];  suff[n-1]=1;  for(int i=n-2;i>=0;i--) {  suff[i]=1+(s[i+1]==s[i]?suff[i+1]:0);  }  for(int i=n-2;i>=0;i--)  suff[i]=Math.max(suff[i], suff[i+1]);  int max=0,curr=0;  boolean draw=false;  int ones=0;  for(int i=0;i+k<=n;i++) {      int prefix=ones==i?k+ones:max;  int suffix=i+k==n?k:s[i+k]=='1' && suff[i+k]==n-(i+k)?k+suff[i+k]:suff[i+k];  char first=i==0?'1':s[0],last=i+k==n?'1':s[n-1];  boolean zero=first==last && prefix+suffix+k>=n || Math.max(prefix, suffix)+k>=n;     prefix=ones==0?k+ones:max;   suffix=i+k==n?k:s[i+k]=='0' && suff[i+k]==n-(i+k)?k+suff[i+k]:suff[i+k];   first=i==0?'0':s[0];   last=i+k==n?'0':s[n-1];  boolean one=first==last && prefix+suffix+k>=n || Math.max(prefix, suffix)+k>=n;  if(!zero || !one) {   draw=true;  }  if(s[i]=='1')   ones++;  if(i>0 && s[i]==s[i-1] )   curr++;  else   curr=1;  max=Math.max(max, curr);  }  out.println(draw?"once again":"quailty");  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();  }  String nextLine() throws IOException {  return br.readLine();  }  int nextInt() throws IOException {  return Integer.parseInt(next());  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(next());  }  boolean ready() throws IOException {  return br.ready();  }  } }
5	public class P166A { public static void main(String[] args)  {  Scanner myScanner = new Scanner(System.in);  int n = myScanner.nextInt();  int k = myScanner.nextInt();  Team[] queue = new Team[n];  for (int i = 0; i < n; i++)  {  queue[i] = new Team(myScanner.nextInt(), myScanner.nextInt());  }  Arrays.sort(queue);   int counter = 0;  int i = 0;  int p = -1;  int t = -1;  for (; i < k; i++)  {  if (p == queue[i].problems && t == queue[i].penalty)   counter++;  else  {   p = queue[i].problems;   t = queue[i].penalty;   counter = 1;  }  }  for (; i < n; i++)  {  if (p == queue[i].problems && t == queue[i].penalty)   counter++;  else   break;  }  System.out.println(counter); }  static class Team implements Comparable<Team> {  int problems;  int penalty;   public Team(int problems, int penalty)  {  this.problems = problems;  this.penalty = penalty;  }   public int compareTo(Team t)  {  if (problems > t.problems) return -1;  else if (problems < t.problems) return 1;  else if (penalty > t.penalty) return 1;  else if (penalty < t.penalty) return -1;  else return 0;  } } }
2	public class Main {  public static void main(String[] args) {   Scanner scan = new Scanner(System.in);   long n = scan.nextLong();   long k = scan.nextLong();   long D = 9 + 4 * (2 * k + 2 * n);   long y = (- 3 + (long)Math.sqrt(D)) / 2;   System.out.println(n - y);  } }
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"); } }
0	public class RationalResistance {  public static void main(String[] args) throws IOException {   BufferedReader f = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(f.readLine());   long a = Long.parseLong(st.nextToken());   long b = Long.parseLong(st.nextToken());   System.out.println(f(a,b));  }   public static long f(long a, long b)  {   if (a == 1 || b == 1)    return a+b-1;   if (a > b)    return f(a%b,b) + a/b;   else    return f(a,b%a) + b/a;  } }
3	public class Test {  static class Pair {   int f,s;   public Pair(int x, int y) {f = x; s = y;}  }  public static void main(String[] args) throws Exception{   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(br.readLine());   String[] s = br.readLine().split(" ");   int[] arr = new int[n];   for(int i = 0; i<n; i++) arr[i] = Integer.parseInt(s[i]);   HashMap<Integer, ArrayList<Pair>> map = new HashMap<>();   for(int i = 0; i<n; i++) {    int sum = 0;    for(int j = i; j>=0; j--) {     sum += arr[j];     ArrayList<Pair> list = map.get(sum);     if(list == null) {      list = new ArrayList<>();      map.put(sum, list);     }     list.add(new Pair(j, i));    }   }   Iterator it = map.entrySet().iterator();   ArrayList<Pair> ans = new ArrayList<>();   for(;it.hasNext();){    Map.Entry<Integer, ArrayList<Pair>> entry = (Map.Entry<Integer, ArrayList<Pair>>)it.next();    ArrayList<Pair> list = entry.getValue();    ArrayList<Pair> pre = new ArrayList<>();    int r = -1;    for(Pair p : list) {     if(p.f > r) {      pre.add(p);      r = p.s;     }    }    if(ans.size()<pre.size()) ans = pre;   }   StringBuilder sb = new StringBuilder();   sb.append(ans.size()).append('\n');   for(Pair p : ans) {    sb.append(p.f+1).append(' ').append(p.s+1).append('\n');   }   System.out.print(sb);  } }
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 long nextLong() throws IOException {return Long.parseLong(next());}   public String nextLine() throws IOException {return br.readLine();}   public boolean ready() throws IOException {return br.ready();}   } }
1	public class phoenixandpuzzle { public static void main(String[] args) throws IOException {  BufferedReader fin = new BufferedReader(new InputStreamReader(System.in));  int t = Integer.parseInt(fin.readLine());  StringBuilder fout = new StringBuilder();  HashSet<Integer> dict = new HashSet<Integer>();  int pointer = 1;  int area = 0;  while(area >= 0) {  area = (pointer * pointer) * 2;  dict.add(area);  pointer ++;  }  pointer = 1;  area = 0;  while(area >= 0) {  area = (pointer * pointer) * 4;  dict.add(area);  pointer ++;  }  while(t-- > 0) {  int n = Integer.parseInt(fin.readLine());  if(dict.contains(n)) {   fout.append("YES\n");  }  else {   fout.append("NO\n");  }  }  System.out.print(fout); } }
1	public class b implements Runnable{ PrintWriter out = null; public int toint(String s){  int res = 0;  for (int i = 0; i < s.length(); i++){  res *= 10;  res += s.charAt(i)-'0';  }  return res; }  public void tostr(int k){  if (k == 0) return;  tostr((k-1)/26);  out.print((char)(('A'+((k-1)%26)))); }  public int fromstr(String s){  if (s.length() == 0) return 0;  int r = s.charAt(s.length()-1)-'A'+1;  r += 26*(fromstr(s.substring(0,s.length()-1)));  return r; }   public void run(){     try{       Scanner in = new Scanner(System.in);       out = new PrintWriter(System.out);       int n = in.nextInt();    for (int t = 0; t < n; t++){    int rp = -1;    int cp = -1;    String s = in.next();    for (int i = 0; i < s.length(); i++)     if (s.charAt(i) == 'R') rp = i;     else if (s.charAt(i) == 'C') cp = i;    boolean good = true;    if (rp == 0 && cp > 1){     for (int i = 0; i <= cp; i++)     if (s.charAt(i) >= '0' && s.charAt(i) <= '9')      good = false;    }    if (good){     int k = 0;     for (;s.charAt(k) < '0' || s.charAt(k) > '9'; k++);     int r = toint(s.substring(k,s.length()));     int c = fromstr(s.substring(0,k));     out.print('R');     out.print(r);     out.print('C');     out.println(c);    } else {     int r = toint(s.substring(1,cp));     int c = toint(s.substring(cp+1,s.length()));     tostr(c);     out.println(r);    }    }       in.close();       out.close();     } catch(Exception e){       e.printStackTrace();     }   }   public static void main(String[] args){     new Thread(new b()).start();   } }
0	public class A {  long gcd(long a, long b) {  if (b == 0) {  return a;  } else {  return gcd(b, a % b);  } }  long solve(long a,long b) {  if (a == 0 || b ==0) {  return 0;  }  long t = gcd(a,b);  a /= t;  b /= t;  if (a>b) {  return solve(a%b,b)+a/b;  } else {  return solve(a,b%a)+b/a;  }   }  void solve() throws IOException {  long a = nextLong();  long b = nextLong();  out.println(solve(a, b)); }  void run() 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().run(); }  BufferedReader br; PrintWriter out; StringTokenizer str;  String next() throws IOException {  while (str == null || !str.hasMoreTokens()) {  str = new StringTokenizer(br.readLine());  }  return str.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(next()); }  double nextDouble() throws IOException {  return Double.parseDouble(next()); }  long nextLong() throws IOException {  return Long.parseLong(next()); } }
5	public class Main {  BufferedReader in;  PrintWriter out;  StringTokenizer st;      void solve() throws IOException {   int n=ni();   int t=ni();     int[] center=new int[n];   int[] width=new int[n];   for(int i=0;i<n;i++){    center[i]=ni();    width[i]=ni();   }   for(int i=0;i<n;i++){    for(int j=i;j<n;j++){     if(center[i]>center[j]){      int cent=center[i];      int wid=width[i];      center[i]=center[j];      width[i]=width[j];      center[j]=cent;      width[j]=wid;     }    }   }   int count=2;   for(int i=0;i<n-1;i++){       double ideal=(double)width[i]/2+(double)width[i+1]/2+t;        double real=center[i+1]-center[i];           if(ideal==real)count++;    else{     if(ideal<real)count=count+2;    }   }   out.println(count);    }   public Main() throws IOException {   Locale.setDefault(Locale.US);   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   solve();   in.close();   out.close();  }  String ns() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int ni() throws IOException {   return Integer.valueOf(ns());  }  long nl() throws IOException {   return Long.valueOf(ns());  }  double nd() throws IOException {   return Double.valueOf(ns());  }  public static void main(String[] args) throws IOException {   new Main();  } }
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 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;  }  public long[] nextLongArray(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  public char[][] nextCharMap(int n, int m) {  char[][] map = new char[n][m];  for (int i = 0; i < n; i++)   map[i] = next().toCharArray();  return map;  } } }
0	public class Main { public static String conv(String str) {  boolean[] Arr = new boolean[26];  for (int i = 0; i < str.length(); i++) {  Arr[str.charAt(i) - 'a'] = true;  }  StringBuilder sb = new StringBuilder();  for (int i = 0; i < 26; i++) {  if (Arr[i])   sb.append((char) (i + 'a'));  }  return "" + sb; }  public static void main(String[] args) throws IOException, InterruptedException {  PrintWriter pw = new PrintWriter(System.out);  Scanner sc = new Scanner(System.in);  HashSet<String> hs = new HashSet<String>();  int[] Arr = new int[14];  long max = 0;  for (int i = 0; i < 14; i++) {  Arr[i] = sc.nextInt();  }  for (int i = 0; i < 14; i++) {  int[] arr = Arr.clone();   long sum = 0;  int r = arr[i];  arr[i] = 0;  for (int j = i + 1; j < arr.length && r > 0; j++) {   arr[j]++;   r--;  }  for (int j = 0; j < arr.length; j++) {   arr[j] +=( r / 14);   if (j + 1 <= (r % 14)) {   arr[j]++;   }   if (arr[j] % 2 == 0) {   sum += arr[j];   }  }  max = Math.max(max, sum);  }  System.out.println(max); }  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 long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-') {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.') {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public boolean ready() throws IOException {  return br.ready();  }  } }
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 ;  } }  }
3	public class CFA {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  private static final long MOD = 1000L * 1000L * 1000L + 7;  private static final int[] dx = {0, -1, 0, 1};  private static final int[] dy = {1, 0, -1, 0};  private static final String yes = "Yes";  private static final String no = "No";  int n;  int[] arr;  class Segment {   int start;   int end;   public Segment(int start, int end) {    this.start = start;    this.end = end;   }   @Override   public String toString() {    return start + " " + end;   }  }  Map<Integer, List<Segment>> hm = new HashMap<>();  void solve() throws IOException {   n = nextInt();   arr = nextIntArr(n);   for (int i = 0; i < n; i++) {    int sum = 0;    for (int j = i; j < n; j++) {     sum += arr[j];     if (!hm.containsKey(sum)) {      hm.put(sum, new ArrayList<>());     }     hm.get(sum).add(new Segment(i, j));    }   }   int max = -1;   int idx = -1;   for (Map.Entry<Integer, List<Segment>> entry : hm.entrySet()) {    int key = entry.getKey();    List<Segment> values = entry.getValue();    Collections.sort(values, new Comparator<Segment>() {     @Override     public int compare(Segment o1, Segment o2) {      return Integer.compare(o1.end, o2.end);     }    });    int cnt = findSeg(values).size();    if (cnt > max) {     max = cnt;     idx = key;    }   }   List<Segment> res = findSeg(hm.get(idx));   outln(res.size());   for (int i = 0; i < res.size(); i++) {    outln((1 + res.get(i).start) + " " + (1 + res.get(i).end));   }  }  List<Segment> findSeg(List<Segment> input) {   List<Segment> res = new ArrayList<>();   int bound = -1;   for (int i = 0; i < input.size(); i++) {    if (input.get(i).start > bound) {     res.add(input.get(i));     bound = input.get(i).end;    }   }   return res;  }  void shuffle(int[] a) {   int n = a.length;   for(int i = 0; i < n; i++) {    int r = i + (int) (Math.random() * (n - i));    int tmp = a[i];    a[i] = a[r];    a[r] = tmp;   }  }  long gcd(long a, long b) {   while(a != 0 && b != 0) {    long c = b;    b = a % b;    a = c;   }   return a + b;  }  private void outln(Object o) {   out.println(o);  }  private void out(Object o) {   out.print(o);  }  private void formatPrint(double val) {   outln(String.format("%.9f%n", val));  }  public CFA() 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 CFA();  }  public long[] nextLongArr(int n) throws IOException{   long[] res = new long[n];   for(int i = 0; i < n; i++)    res[i] = nextLong();   return res;  }  public int[] nextIntArr(int n) throws IOException {   int[] res = new int[n];   for(int i = 0; i < n; i++)    res[i] = nextInt();   return res;  }  public String nextToken() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return null;    }   }   return st.nextToken();  }  public String nextString() {   try {    return br.readLine();   } catch (IOException e) {    eof = true;    return null;   }  }  public int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  public long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  public double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
5	public class Main { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tokenizer=null;  public static void main(String[] args) throws IOException {  new Main().execute(); }  void debug(Object...os) {  System.out.println(Arrays.deepToString(os)); }  int ni() throws IOException {  return Integer.parseInt(ns()); }  long nl() throws IOException  {  return Long.parseLong(ns()); }  double nd() throws IOException  {  return Double.parseDouble(ns()); }   String ns() throws IOException  {  while (tokenizer == null || !tokenizer.hasMoreTokens())   tokenizer = new StringTokenizer(br.readLine());  return tokenizer.nextToken(); }  String nline() throws IOException {  tokenizer=null;  return br.readLine(); }     int totalCases, testNum;  int k,n;  void execute() throws IOException {  totalCases = 1;  for(testNum = 1; testNum <= totalCases; testNum++)  {  input();  solve();  } }  void solve() {  int a = arr[k-1].a;  int b = arr[k-1].b;   int count = 0;  for(int i = 0;i<n;i++)  {  if(arr[i].a == a && arr[i].b == b)   count++;  }  System.out.println(count); }  void printarr(int [] a,int b) {  for(int i = 0;i<=b;i++)  {  if(i==0)   System.out.print(a[i]);  else   System.out.print(" "+a[i]);  }  System.out.println(); }  class Pair implements Comparable<Pair> {  int a,b; Pair(int _a,int _b) {  a=_a;  b=_b; }  public int compareTo(Pair x) {  if(a == x.a) return b-x.b;  return -(a-x.a); }   public boolean equals(Pair x) {  return a==x.a && b==x.b; } }  Pair[] arr; boolean input() throws IOException {  n = ni();  k = ni();  arr = new Pair[n];  for(int i = 0 ;i<n;i++)  {  Pair p =new Pair(ni(),ni());  arr[i] = p;  }  Arrays.sort(arr);   return true; } }
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);  } }
3	public class D {   String INPUT = "4\n" +     "1 2 4 3\n" +     "4\n" +     "1 1\n" +     "1 4\n" +     "1 4\n" +     "2 3";   void solve()   {     final int n = i();     final int[] a = ia(n);     int count = 0 ;     for(int i = 0 ; i<n-1 ; i++)     {       for(int j = i+1; j<n ; j++)       {         if(a[j]<a[i])         {           count++;         }       }     }     final int q = i();     for(int i = 0 ; i<q ; i++)     {       final int l = i(), r=i();       final int mid = (r-l+1)/2;       if(mid%2==0)       {         out.println(count%2==0?"even":"odd");       }       else       {         count++;         out.println(count%2==0?"even":"odd");       }     }    }     void run() throws Exception{     is = oj ? System.in: new ByteArrayInputStream(INPUT.getBytes());         out = new PrintWriter(System.out);     int t = 1;     while(t-->0) solve();     out.flush();   }   public static void main(String[] args)throws Exception {     new D().run();   }   InputStream is;   PrintWriter out;   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 double d() { return Double.parseDouble(s()); }   private char c() { return (char)skip(); }   private String s()   {     int b = skip();     StringBuilder sb = new StringBuilder();     while(!(isSpaceChar(b))){       sb.appendCodePoint(b);       b = readByte();     }     return sb.toString();   }   private char[] sa(int n)   {     char[] buf = new char[n];     int b = skip(), p = 0;     while(p < n && !(isSpaceChar(b))){       buf[p++] = (char)b;       b = readByte();     }     return n == p ? buf : Arrays.copyOf(buf, p);   }   private char[][] nm(int n, int m)   {     char[][] map = new char[n][];     for(int i = 0;i < n;i++)map[i] = sa(m);     return map;   }   private int[] ia(int n)   {     int[] a = new int[n];     for(int i = 0;i < n;i++)a[i] = i();     return a;   }   private int i()   {     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 l()   {     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)); } }
1	public class A {  Scanner scan = new Scanner(System.in);   void solve() {  int n = scan.nextInt();  String[]A = new String[n];  String[]B = new String[n];  int res =0;  for(int i=0;i<n;i++)A[i]=scan.next();  for(int i=0;i<n;i++)B[i]=scan.next();  for(int i=0;i<A.length;i++) {  boolean fnd = false;  for(int j=0;j<B.length;j++) {   if(A[i].equals(B[j])) {   fnd = true;   B[j]="";   break;   }  }  if(!fnd)res++;  }  System.out.println(res); }  public static void main(String[] args) {  new A().solve(); } }
2	public class Main {  static class Task {   PrintWriter out;   int[] num = new int[3];   public void solve(MyScanner in, PrintWriter out) {    this.out = out;    long n = in.nextLong();    long s = in.nextLong();    long l = 1;    long r = n;    while (r - l > 5) {     long x = (l + r) / 2;     long ans = ans(x);     if (ans >= s) {      r = x;     } else {      l = x;     }    }    for (long i = l; i <= r; i++) {     if (ans(i) >= s) {      out.println((n - i + 1));      return;     }    }    out.println(0);   }   long ans(long n) {    long res = n;    while (n > 9) {     res -= n % 10;     n /= 10;    }    res -= n;    return res;   }  }  public static void main(String[] args) {   MyScanner in = new MyScanner();   PrintWriter out = new PrintWriter(System.out);   Task solver = new Task();   solver.solve(in, out);   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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
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);   TaskE2 solver = new TaskE2();   int testCount = Integer.parseInt(in.next());   for (int i = 1; i <= testCount; i++) {    solver.solve(i, in, out);   }   out.close();  }  static class TaskE2 {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.readInt();    int m = in.readInt();    int[][] a = in.readIntTable(n, m);    int[][] id = new int[n + 1][1 << n];    int[][] val = new int[n + 1][1 << n];    ArrayUtils.fill(id, m);    int[] sum = new int[1 << n];    int[] low = new int[1 << n];    boolean[] base = new boolean[1 << n];    int[] vv = new int[1 << n];    for (int i = 1; i < (1 << n); i++) {     low[i] = Integer.bitCount(Integer.lowestOneBit(i) - 1);     int current = i;     base[i] = true;     vv[i] = i;     for (int j = 0; j < n; j++) {      current = current << 1;      current += current >> n;      current -= (current >> n) << n;      if (current < i) {       base[i] = false;       vv[i] = vv[current];       break;      }     }    }    for (int i = 0; i < m; i++) {     for (int j = 1; j < (1 << n); j++) {      sum[j] = sum[j - (1 << low[j])] + a[low[j]][i];     }     for (int j = 1; j < (1 << n); j++) {      sum[vv[j]] = Math.max(sum[vv[j]], sum[j]);     }     for (int j = 1; j < (1 << n); j++) {      if (!base[j]) {       continue;      }      for (int k = n - 1; k >= 0; k--) {       if (sum[j] > val[k][j]) {        val[k + 1][j] = val[k][j];        id[k + 1][j] = id[k][j];        val[k][j] = sum[j];        id[k][j] = i;       } else {        break;       }      }     }    }    int[] tempVal = new int[n];    int[] tempId = new int[n];    for (int i = 1; i < (1 << n); i++) {     if (!base[i]) {      for (int j = 0; j < n; j++) {       val[j][i] = val[j][vv[i]];       id[j][i] = id[j][vv[i]];      }     } else {      for (int j = 0; j < n; j++) {       tempVal[j] = val[j][i];       tempId[j] = id[j][i];      }      ArrayUtils.orderBy(tempId, tempVal);      for (int j = 0; j < n; j++) {       val[j][i] = tempVal[j];       id[j][i] = tempId[j];      }     }    }    int[] at = new int[1 << n];    int[] current = new int[1 << n];    int[] next = new int[1 << n];    int all = (1 << n) - 1;    for (int i = 0; i < m; i++) {     System.arraycopy(current, 0, next, 0, (1 << n));     for (int j = 1; j < (1 << n); j++) {      if (at[j] == n || id[at[j]][j] != i) {       continue;      }      int other = all - j;      for (int k = other; k > 0; k = (k - 1) & other) {       next[k + j] = Math.max(next[k + j], current[k] + val[at[j]][j]);      }      next[j] = Math.max(next[j], val[at[j]][j]);      at[j]++;     }     int[] temp = current;     current = next;     next = temp;    }    out.printLine(current[all]);   }  }  static abstract class IntAbstractStream implements IntStream {   public String toString() {    StringBuilder builder = new StringBuilder();    boolean first = true;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     if (first) {      first = false;     } else {      builder.append(' ');     }     builder.append(it.value());    }    return builder.toString();   }   public boolean equals(Object o) {    if (!(o instanceof IntStream)) {     return false;    }    IntStream c = (IntStream) o;    IntIterator it = intIterator();    IntIterator jt = c.intIterator();    while (it.isValid() && jt.isValid()) {     if (it.value() != jt.value()) {      return false;     }     it.advance();     jt.advance();    }    return !it.isValid() && !jt.isValid();   }   public int hashCode() {    int result = 0;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     result *= 31;     result += it.value();    }    return result;   }  }  static interface IntList extends IntReversableCollection {   public abstract int get(int index);   public abstract void set(int index, int value);   public abstract void addAt(int index, int value);   public abstract void removeAt(int index);   default public void swap(int first, int second) {    if (first == second) {     return;    }    int temp = get(first);    set(first, get(second));    set(second, temp);   }   default public IntIterator intIterator() {    return new IntIterator() {     private int at;     private boolean removed;     public int value() {      if (removed) {       throw new IllegalStateException();      }      return get(at);     }     public boolean advance() {      at++;      removed = false;      return isValid();     }     public boolean isValid() {      return !removed && at < size();     }     public void remove() {      removeAt(at);      at--;      removed = true;     }    };   }   default public void add(int value) {    addAt(size(), value);   }   default public IntList sort(IntComparator comparator) {    Sorter.sort(this, comparator);    return this;   }   default public IntList subList(final int from, final int to) {    return new IntList() {     private final int shift;     private final int size;     {      if (from < 0 || from > to || to > IntList.this.size()) {       throw new IndexOutOfBoundsException("from = " + from + ", to = " + to + ", size = " + size());      }      shift = from;      size = to - from;     }     public int size() {      return size;     }     public int get(int at) {      if (at < 0 || at >= size) {       throw new IndexOutOfBoundsException("at = " + at + ", size = " + size());      }      return IntList.this.get(at + shift);     }     public void addAt(int index, int value) {      throw new UnsupportedOperationException();     }     public void removeAt(int index) {      throw new UnsupportedOperationException();     }     public void set(int at, int value) {      if (at < 0 || at >= size) {       throw new IndexOutOfBoundsException("at = " + at + ", size = " + size());      }      IntList.this.set(at + shift, value);     }     public IntList compute() {      return new IntArrayList(this);     }    };   }  }  static interface IntCollection extends IntStream {   public int size();   default public void add(int value) {    throw new UnsupportedOperationException();   }   default public int[] toArray() {    int size = size();    int[] array = new int[size];    int i = 0;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     array[i++] = it.value();    }    return array;   }   default public IntCollection addAll(IntStream values) {    for (IntIterator it = values.intIterator(); it.isValid(); it.advance()) {     add(it.value());    }    return this;   }  }  static interface IntIterator {   public int value() throws NoSuchElementException;   public boolean advance();   public boolean isValid();  }  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[][] readIntTable(int rowCount, int columnCount) {    int[][] table = new int[rowCount][];    for (int i = 0; i < rowCount; i++) {     table[i] = readIntArray(columnCount);    }    return table;   }   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 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 {     if (Character.isValidCodePoint(c)) {      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 String next() {    return readString();   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  static class Range {   public static IntList range(int from, int to) {    int[] result = new int[Math.abs(from - to)];    int current = from;    if (from <= to) {     for (int i = 0; i < result.length; i++) {      result[i] = current++;     }    } else {     for (int i = 0; i < result.length; i++) {      result[i] = current--;     }    }    return new IntArray(result);   }  }  static class ArrayUtils {   public static void fill(int[][] array, int value) {    for (int[] row : array) {     Arrays.fill(row, value);    }   }   public static int[] range(int from, int to) {    return Range.range(from, to).toArray();   }   public static int[] createOrder(int size) {    return range(0, size);   }   public static int[] sort(int[] array, IntComparator comparator) {    return sort(array, 0, array.length, comparator);   }   public static int[] sort(int[] array, int from, int to, IntComparator comparator) {    if (from == 0 && to == array.length) {     new IntArray(array).sort(comparator);    } else {     new IntArray(array).subList(from, to).sort(comparator);    }    return array;   }   public static int[] order(final int[] array) {    return sort(createOrder(array.length), new IntComparator() {     public int compare(int first, int second) {      if (array[first] < array[second]) {       return -1;      }      if (array[first] > array[second]) {       return 1;      }      return 0;     }    });   }   public static void orderBy(int[] base, int[]... arrays) {    int[] order = ArrayUtils.order(base);    order(order, base);    for (int[] array : arrays) {     order(order, array);    }   }   public static void order(int[] order, int[] array) {    int[] tempInt = new int[order.length];    for (int i = 0; i < order.length; i++) {     tempInt[i] = array[order[i]];    }    System.arraycopy(tempInt, 0, array, 0, array.length);   }  }  static class IntArrayList extends IntAbstractStream implements IntList {   private int size;   private int[] data;   public IntArrayList() {    this(3);   }   public IntArrayList(int capacity) {    data = new int[capacity];   }   public IntArrayList(IntCollection c) {    this(c.size());    addAll(c);   }   public IntArrayList(IntStream c) {    this();    if (c instanceof IntCollection) {     ensureCapacity(((IntCollection) c).size());    }    addAll(c);   }   public IntArrayList(IntArrayList c) {    size = c.size();    data = c.data.clone();   }   public IntArrayList(int[] arr) {    size = arr.length;    data = arr.clone();   }   public int size() {    return size;   }   public int get(int at) {    if (at >= size) {     throw new IndexOutOfBoundsException("at = " + at + ", size = " + size);    }    return data[at];   }   private void ensureCapacity(int capacity) {    if (data.length >= capacity) {     return;    }    capacity = Math.max(2 * data.length, capacity);    data = Arrays.copyOf(data, capacity);   }   public void addAt(int index, int value) {    ensureCapacity(size + 1);    if (index > size || index < 0) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    if (index != size) {     System.arraycopy(data, index, data, index + 1, size - index);    }    data[index] = value;    size++;   }   public void removeAt(int index) {    if (index >= size || index < 0) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    if (index != size - 1) {     System.arraycopy(data, index + 1, data, index, size - index - 1);    }    size--;   }   public void set(int index, int value) {    if (index >= size) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    data[index] = value;   }   public int[] toArray() {    return Arrays.copyOf(data, size);   }  }  static interface IntReversableCollection extends IntCollection {  }  static class IntArray extends IntAbstractStream implements IntList {   private int[] data;   public IntArray(int[] arr) {    data = arr;   }   public int size() {    return data.length;   }   public int get(int at) {    return data[at];   }   public void addAt(int index, int value) {    throw new UnsupportedOperationException();   }   public void removeAt(int index) {    throw new UnsupportedOperationException();   }   public void set(int index, int value) {    data[index] = value;   }  }  static interface IntComparator {   public int compare(int first, int second);  }  static interface IntStream extends Iterable<Integer>, Comparable<IntStream> {   public IntIterator intIterator();   default public Iterator<Integer> iterator() {    return new Iterator<Integer>() {     private IntIterator it = intIterator();     public boolean hasNext() {      return it.isValid();     }     public Integer next() {      int result = it.value();      it.advance();      return result;     }    };   }   default public int compareTo(IntStream c) {    IntIterator it = intIterator();    IntIterator jt = c.intIterator();    while (it.isValid() && jt.isValid()) {     int i = it.value();     int j = jt.value();     if (i < j) {      return -1;     } else if (i > j) {      return 1;     }     it.advance();     jt.advance();    }    if (it.isValid()) {     return 1;    }    if (jt.isValid()) {     return -1;    }    return 0;   }  }  static class Sorter {   private static final int INSERTION_THRESHOLD = 16;   private Sorter() {   }   public static void sort(IntList list, IntComparator comparator) {    quickSort(list, 0, list.size() - 1, (Integer.bitCount(Integer.highestOneBit(list.size()) - 1) * 5) >> 1,      comparator);   }   private static void quickSort(IntList list, int from, int to, int remaining, IntComparator comparator) {    if (to - from < INSERTION_THRESHOLD) {     insertionSort(list, from, to, comparator);     return;    }    if (remaining == 0) {     heapSort(list, from, to, comparator);     return;    }    remaining--;    int pivotIndex = (from + to) >> 1;    int pivot = list.get(pivotIndex);    list.swap(pivotIndex, to);    int storeIndex = from;    int equalIndex = to;    for (int i = from; i < equalIndex; i++) {     int value = comparator.compare(list.get(i), pivot);     if (value < 0) {      list.swap(storeIndex++, i);     } else if (value == 0) {      list.swap(--equalIndex, i--);     }    }    quickSort(list, from, storeIndex - 1, remaining, comparator);    for (int i = equalIndex; i <= to; i++) {     list.swap(storeIndex++, i);    }    quickSort(list, storeIndex, to, remaining, comparator);   }   private static void heapSort(IntList list, int from, int to, IntComparator comparator) {    for (int i = (to + from - 1) >> 1; i >= from; i--) {     siftDown(list, i, to, comparator, from);    }    for (int i = to; i > from; i--) {     list.swap(from, i);     siftDown(list, from, i - 1, comparator, from);    }   }   private static void siftDown(IntList list, int start, int end, IntComparator comparator, int delta) {    int value = list.get(start);    while (true) {     int child = ((start - delta) << 1) + 1 + delta;     if (child > end) {      return;     }     int childValue = list.get(child);     if (child + 1 <= end) {      int otherValue = list.get(child + 1);      if (comparator.compare(otherValue, childValue) > 0) {       child++;       childValue = otherValue;      }     }     if (comparator.compare(value, childValue) >= 0) {      return;     }     list.swap(start, child);     start = child;    }   }   private static void insertionSort(IntList list, int from, int to, IntComparator comparator) {    for (int i = from + 1; i <= to; i++) {     int value = list.get(i);     for (int j = i - 1; j >= from; j--) {      if (comparator.compare(list.get(j), value) <= 0) {       break;      }      list.swap(j, j + 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 printLine(int i) {    writer.println(i);   }  } }
6	public class Main {  static PrintWriter out; static InputReader ir;  static void solve() {  int n = ir.nextInt();  int t = ir.nextInt();  int[][] a = new int[n][];  for (int i = 0; i < n; i++)  a[i] = ir.nextIntArray(2);  long[] f = fact(15);  long res = 0;  for (int i = 0; i < 1 << n; i++) {  int[] ct = new int[4];  int tot = 0;  for (int j = 0; j < n; j++) {   if (((1 << j) & i) != 0) {   tot += a[j][0];   ct[a[j][1]]++;   }  }  if (tot != t)   continue;  long[][][][] dp = new long[ct[1] + 1][ct[2] + 1][ct[3] + 1][4];  dp[0][0][0][0] = 1;  for (int j = 0; j < ct[1] + ct[2] + ct[3]; j++) {   for (int k = 0; k <= ct[1]; k++) {   for (int l = 0; l <= ct[2]; l++) {    if (k + l > j || j - k - l > ct[3])    continue;    for (int m = 0; m <= 3; m++) {    for (int o = 0; o <= 3; o++) {     if (m == o)     continue;     if (o == 1 && k == ct[1])     continue;     if (o == 2 && l == ct[2])     continue;     if (o == 3 && j - k - l == ct[3])     continue;     if (o == 1) {     dp[k + 1][l][j - k - l][1] = add(dp[k + 1][l][j - k - l][1],      dp[k][l][j - k - l][m]);     }     if (o == 2) {     dp[k][l + 1][j - k - l][2] = add(dp[k][l + 1][j - k - l][2],      dp[k][l][j - k - l][m]);     }     if (o == 3) {     dp[k][l][j - k - l + 1][3] = add(dp[k][l][j - k - l + 1][3],      dp[k][l][j - k - l][m]);     }     }    }   }   }  }  for (int m = 0; m <= 3; m++)   res = add(res, mul(mul(f[ct[1]], f[ct[2]]), mul(f[ct[3]], dp[ct[1]][ct[2]][ct[3]][m])));  }  out.println(res); }  static long mod = (long) 1e9 + 7;  static long add(long a, long b) {  return (a + b) % mod; }  static long sub(long a, long b) {  long d = a - b;  while (d < 0)  d += mod;  return d; }  static long mul(long a, long b) {  return a * b % mod; }  static long div(long a, long b) {  return a * mod_inverse(b) % mod; }  private static long[] fact(int n) {  long[] ret = new long[n + 1];  ret[0] = 1 % mod;  for (int i = 1; i <= n; i++) {  ret[i] = mul(ret[i - 1], i);  }  return ret; }  private static long[] factInv(int n) {  long[] ret = new long[n + 1];  ret[0] = 1;  for (int i = 1; i <= n; i++) {  ret[i] = div(ret[i - 1], i);  }  return ret; }  public static long comb(int n, int m, long[] fact, long[] factInv) {  long ret = fact[n];  ret = mul(ret, factInv[m]);  ret = mul(ret, factInv[n - m]);  return ret; }  public static long[][] stirling(int n) {  long[][] ret = new long[n + 1][n + 1];  ret[0][0] = 1;  for (int i = 1; i <= n; i++)  for (int j = 1; j <= i; j++)   ret[i][j] = add(ret[i - 1][j - 1], mul(ret[i - 1][j], j));  return ret; }  public static long mod_inverse(long a) {  long[] ret = extgcd(a, mod);  return add(mod, ret[0] % mod); }  public static long[] extgcd(long a, long b) {  long[] ret = new long[3];  ret[2] = _extgcd(a, b, ret);  return ret; }  private static long _extgcd(long a, long b, long[] x) {  long g = a;  x[0] = 1;  x[1] = 0;  if (b != 0) {  g = _extgcd(b, a % b, x);  long temp = x[0];  x[0] = x[1];  x[1] = temp;  x[1] -= (a / b) * x[0];  }  return g; }  static long modpow(long a, long n) {  long res = 1;  while (n > 0) {  if ((n & 1) != 0)   res = res * a % mod;  a = a * a % mod;  n >>= 1;  }  return res; }  public static void main(String[] args) {  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 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;  }  public long[] nextLongArray(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  public char[][] nextCharMap(int n, int m) {  char[][] map = new char[n][m];  for (int i = 0; i < n; i++)   map[i] = next().toCharArray();  return map;  } }  static void tr(Object... o) {  out.println(Arrays.deepToString(o)); } }
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); } }
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; }   private static byte[] inbuf = new byte[1024]; public static int lenbuf = 0, ptrbuf = 0;  private static 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 static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private static int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }  private static double nd() { return Double.parseDouble(ns()); } private static char nc() { return (char)skip(); }  private static String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private static 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 static char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private static int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private static 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 static 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();  } }  }
6	public class CF_8C implements Runnable { int[] step = new int[1 << 24];  int[] steplast = new int[1 << 24];  int n; int vs[] = new int[24]; int vd[][] = new int[24][24]; int x_bag, y_bag; int x[] = new int[24], y[] = new int[24];  private void solve() throws IOException {  x_bag = nextInt();  y_bag = nextInt();  n = nextInt();  for (int i = 0; i < n; i++) {  x[i] = nextInt();  y[i] = nextInt();  }    for (int i = 0; i < n; i++) {  vs[i] = 2 * ((x[i] - x_bag) * (x[i] - x_bag) + (y[i] - y_bag) * (y[i] - y_bag));  }  for (int i = 0; i < n; i++) {  for (int j = i + 1; j < n; j++) {   vd[i][j] =    (x[i] - x_bag) * (x[i] - x_bag)     + (y[i] - y_bag) * (y[i] - y_bag)     + (x[j] - x_bag) * (x[j] - x_bag)     + (y[j] - y_bag) * (y[j] - y_bag)     + (x[i] - x[j]) * (x[i] - x[j])     + (y[i] - y[j]) * (y[i] - y[j]);  }  }    for (int i = 1; i < 1 << n; i++) {  int j, k = 0, l, m, lastState;  for (j = 1; (i & j) == 0 && j < 1 << n; j <<= 1) {   k++;  }  lastState = i & (~j);  step[i] = step[lastState] + vs[k];  steplast[i] = lastState;  m = k;  for (l = j << 1; l < 1 << n; l <<= 1) {   m++;   if ((lastState & l) != 0) {   if (step[i] > step[lastState & (~l)] + vd[k][m]) {    step[i] = step[lastState & (~l)] + vd[k][m];    steplast[i] = lastState & (~l);   }   }  }    }  writer.println(step[(1 << n) - 1]);  int i = (1 << n) - 1;  writer.print("0 ");  while (i != 0) {  for (int j = 1, m = 1; j <= i; j <<= 1, m++) {   if ((j & (i ^ steplast[i])) != 0) {   writer.print(m + " ");   }  }  writer.print("0 ");  i = steplast[i];  } }  public static void main(String[] args) {  new CF_8C().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(); } }
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(); }  String nextString() {  try {  return br.readLine();  } catch (IOException e) {  eof = true;  return null;  } }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
1	public class B {  public static void main(String[] args) {  FastScanner sc = new FastScanner();  int T = sc.nextInt();  while(T-->0) {  int n = sc.nextInt();  if(n % 2 == 0 && issq(n/2)) {   System.out.println("YES");  }  else if(n % 4 == 0 && issq(n/4)) {   System.out.println("YES");  }  else {   System.out.println("NO");  }  }  }  static boolean issq(long x) {  long rx = (long)Math.sqrt(x);  return rx * rx == x; }  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 long nextLong() {  return Long.parseLong(next());  }  public double nextDouble() {  return Double.parseDouble(next());  }  public String nextLine() {  try {   return reader.readLine();  } catch(IOException e) {   throw new RuntimeException(e);  }  } } }
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);  }  }
1	public class C { public static void main(String args[]) {  Kattio sc = new Kattio(System.in);  int n = sc.getInt();  String s = sc.getWord();  int[] found = new int['z' + 1];  int amount = 0;  for(int i = 0; i<s.length(); i++) {  char c = s.charAt(i);  if(found[c] == 0) amount++;  found[c]++;  }  int contains[] = new int['z' + 1];  int min = n;  int start = 0;  int end = 0;  int in = 0;  while(true) {  if(in<amount) {   if(end == n) break;   char c = s.charAt(end);   if(contains[c] == 0) in++;   contains[c]++;   end++;  } else {   if(min>end-start) min = end-start;   char c = s.charAt(start);   if(contains[c] == 1) in--;   contains[c]--;   start++;  }  }  System.out.println(min);  } } 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());  }  public double getDouble() {  return Double.parseDouble(nextToken());  }  public long getLong() { return Long.parseLong(nextToken());  }  public String getWord() { return 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;  } }
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+"").length()-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; }  public static long power(long x, int i) {  long r = 1;  while (i-- > 0) {  if (r > 1e18 / x)   return (long) (1e18 + 5);  r = r * x;  }  return r; }  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 int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-') {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.') {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public boolean ready() throws IOException {  return br.ready();  }  } }
0	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 {  StreamTokenizer in;  PrintWriter out;  BufferedReader re;  Scanner sc;  public void solve (int testNumber, InputStreamReader in, PrintWriter out) {    this.in = new StreamTokenizer(new BufferedReader(in));   this.re = new BufferedReader(in);   this.sc = new Scanner(in);   this.out = out;   try {      this.solve();     } catch (IOException e) {      e.printStackTrace();      }   out.flush();  }    void solve() throws IOException   {   long a=sc.nextLong(),b=sc.nextLong();    long ans=0,t;   while(Math.min(a,b)!=1){    if(a>b){     ans+=a/b;     a%=b;     }    else{     t=b;     b=a;     a=t;     long g=gcd(a,b);     a/=g;b/=g;    }    }    ans+=Math.max(a,b);    out.println(ans);   }  public static long gcd(long a, long b) {   long c = 0;   if(a<0) a=-a;   if(b<0) b=-b;   while (b>0) {   c = a % b;   a = b;   b = c;   }   return a;  }     }
4	public class D {  public static void main(String[] args) {  FastScanner fs=new FastScanner();  int h=fs.nextInt(), w=fs.nextInt(), k=fs.nextInt();  PrintWriter out=new PrintWriter(System.out);  if (k%2==1) {  for (int y=0; y<h; y++) {   for (int x=0; x<w; x++) {   if (x!=0) out.print(" ");   out.print(-1);   }   out.println();  }  out.close();  return;  }  k/=2;   int[][] rightCost=new int[w-1][h];  int[][] downCost=new int[w][h-1];  for (int y=0; y<h; y++)   for (int x=0; x<w-1; x++)   rightCost[x][y]=fs.nextInt();  for (int y=0; y<h-1; y++)  for (int x=0; x<w; x++)   downCost[x][y]=fs.nextInt();   long[][] dp=new long[w][h];  long[][] dpNext=new long[w][h];  for (int i=0; i<k; i++) {  for (int x=0; x<w; x++) {   for (int y=0; y<h; y++) {   long ans=(long)1e18;   if (x!=0) ans=Math.min(ans, dp[x-1][y]+rightCost[x-1][y]);   if (y!=0) ans=Math.min(ans, dp[x][y-1]+downCost[x][y-1]);   if (x!=w-1) ans=Math.min(ans, dp[x+1][y]+rightCost[x][y]);   if (y!=h-1) ans=Math.min(ans, dp[x][y+1]+downCost[x][y]);   dpNext[x][y]=ans;   }  }  dp=dpNext;  dpNext=new long[w][h];  }   for (int y=0; y<h; y++) {  for (int x=0; x<w; x++) {   if (x!=0) out.print(" ");   out.print(2*dp[x][y]);  }  out.println();  }  out.close(); }  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());  }  int[] readArray(int n) {  int[] a=new int[n];  for (int i=0; i<n; i++) a[i]=nextInt();  return a;  }  long nextLong() {  return Long.parseLong(next());  } }  }
4	public class Main {  public static void main(String ...args) throws Throwable {   Scanner in = new Scanner(System.in);   String init = in.nextLine();   HashSet<String> h = new HashSet<String>();   for (int len = init.length() - 1; len >= 1; --len) {    h.clear();    for (int pos = 0; pos + len <= init.length(); ++pos) {     String now = init.substring(pos, pos + len);     if (h.contains(now)) {      System.out.println(len);      return;     }     h.add(now);    }   }   System.out.println(0);  } }
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;   int startrow;   int startcol;   long want;   boolean check(long time) {    long max = (long) 2 * time * (time + 1) + 1;    long highest = startrow - time;    if(highest < 0) {     max -= Math.abs(highest) * Math.abs(highest);    }    long lowest = startrow + time;    if(lowest >= n) {     max -= Math.abs(lowest - n + 1) * Math.abs(lowest - n + 1);    }    long leftmost = startcol - time;    if(leftmost < 0) {     max -= Math.abs(leftmost) * Math.abs(leftmost);    }    long rightmost = startcol + time;    if(rightmost >= n) {     max -= Math.abs(rightmost - n + 1) * Math.abs(rightmost - n + 1);    }    long upperright = time - (startrow + 1) - (n - startcol);    if(upperright >= 0) {     max += (upperright + 1) * (upperright + 2) / 2;    }    long lowerright = time - (n - startrow) - (n - startcol);    if(lowerright >= 0) {     max += (lowerright + 1) * (lowerright + 2) / 2;    }    long upperleft = time - (startrow + 1) - (startcol + 1);    if(upperleft >= 0) {     max += (upperleft + 1) * (upperleft + 2) / 2;    }    long lowerleft = time - (n - startrow) - (startcol + 1);    if(lowerleft >= 0) {     max += (lowerleft + 1) * (lowerleft + 2) / 2;    }    return max >= want;   }   public void solve(int testNumber, InputReader in, OutputWriter out) {    n = in.readInt();    startrow = in.readInt() - 1;    startcol = in.readInt() - 1;    want = in.readLong();    long low = 0, high = 2 * n;    while(low < high) {     long mid = (low + high) / 2;     if(check(mid)) high = mid;     else low = mid + 1;    }    out.printLine(low);   }  }  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 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 close() {    writer.close();   }   public void printLine(long i) {    writer.println(i);   }  } }
5	public class A { 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);  }  catch (NullPointerException e)  {  line=null;    }   }  int NextInt() {  String n = inputParser.nextToken();  int val = Integer.parseInt(n);     return val; }  long NextLong() {  String n = inputParser.nextToken();  long val = Long.parseLong(n);     return val; }  String NextString() {  String n = inputParser.nextToken();  return n; }  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 A(filePath); }  public void readFInput() {  for(;;)  {  try  {   readNextLine();   FInput+=line+" ";  }  catch(Exception e)  {   break;  }  }  inputParser = new StringTokenizer(FInput, " "); }   public A(String inputFile) {  openInput(inputFile);   readNextLine();  int n=NextInt();  int k=NextInt()-1;  int ret=0;  Team [] t = new Team[n];  for(int i=0; i<n; i++)  {  readNextLine();  t[i]=new Team(NextInt(), NextInt());  }  Arrays.sort(t);  int ti=t[k].t, p=t[k].p;   for(int i=0; i<n; i++)  if(t[i].t==ti&&t[i].p==p)ret++;        System.out.print(ret);   closeInput();  }  private class Team implements Comparable<Team> {  int p,t;  Team(int p, int t)  {  this.p=p;  this.t=t;  }   public int compareTo(Team d)  {  return 10000*(d.p-p)+t-d.t;  } } }
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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.readInt();    int[] a = IOUtils.readIntArray(in, n);    MiscUtils.decreaseByOne(a);    int m = in.readInt();    int parity = inversions(a) % 2;    boolean[] lengthToParityFlip = new boolean[n + 1];    for (int length = 1; length < lengthToParityFlip.length; length++) {     lengthToParityFlip[length] = (((length * (length - 1) / 2) % 2) == 1);    }    for (int query = 0; query < m; query++) {     int l = in.readInt() - 1, r = in.readInt() - 1;     int length = r - l + 1;     if (lengthToParityFlip[length]) {      parity ^= 1;     }     out.printLine(parity == 0 ? "even" : "odd");    }   }   private int inversions(int[] a) {    int res = 0;    for (int j = 0; j < a.length; j++) {     for (int i = j + 1; i < a.length; i++) {      if (a[i] < a[j]) {       res++;      }     }    }    return res;   }  }  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);   }  }  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 MiscUtils {   public static void decreaseByOne(int[]... arrays) {    for (int[] array : arrays) {     for (int i = 0; i < array.length; i++) {      array[i]--;     }    }   }  }  static class IOUtils {   public static int[] readIntArray(InputReader in, int size) {    int[] array = new int[size];    for (int i = 0; i < size; i++) {     array[i] = in.readInt();    }    return array;   }  } }
6	public class TaskE {  static int[][] transpose(int[][] a, int n, int m) {   int[][] t = new int[m][n];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     t[j][i] = a[i][j];    }   }   return t;  }  public static void main(String[] args) {   FastReader in = new FastReader(System.in);   PrintWriter out = new PrintWriter(System.out);    int t = in.nextInt();   while (t-- > 0) {    int n = in.nextInt();    int m = in.nextInt();    int[][] a = new int[n + 1][m];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      a[i][j] = in.nextInt();      a[n][j] = Math.max(a[n][j], a[i][j]);     }    }    a = transpose(a, n, m);    Arrays.sort(a, new Comparator<int[]>() {     @Override     public int compare(int[] o1, int[] o2) {      int max1 = 0;      for (int i = 0; i < o1.length; i++) {       max1 = Math.max(max1, o1[i]);      }      int max2 = 0;      for (int i = 0; i < o2.length; i++) {       max2 = Math.max(max2, o2[i]);      }      return max2 - max1;     }    });    a = transpose(a, m, n);    int[] dp = new int[1 << n];    for (int i = 0; i < Math.min(n, m); i++) {     int[] best = new int[1 << n];     for (int j = 1; 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 += a[(l + k) % n][i];       }       best[j] = Math.max(best[j], sum);      }     }     int[] dp1 = dp.clone();     for (int j = 0; j < (1 << n); j++) {      for (int k = j; k > 0; k = (k - 1) & j) {       dp[j] = Math.max(dp[j], dp1[k ^ j] + best[k]);      }     }    }    out.println(dp[(1 << n) - 1]);   }     out.close();  }  static class FastReader {   BufferedReader br;   StringTokenizer st;   FastReader(InputStream is) {    br = new BufferedReader(new InputStreamReader(is));   }   Integer nextInt() {    return Integer.parseInt(next());   }   Long nextLong() {    return Long.parseLong(next());   }   Double nextDouble() {    return Double.parseDouble(next());   }   String next() {    while (st == null || !st.hasMoreTokens()) {     st = new StringTokenizer(nextLine());    }    return st.nextToken();   }   String nextLine() {    String s = "";    try {     s = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return s;   }  } }
4	public class Main { public static void main (String[] args) throws Exception {  final long mod=(long) (1e9+7);  final long mod1=(long) 998244353;  Reader s=new Reader();  PrintWriter pt=new PrintWriter(System.out);    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  int T=s.nextInt();   while(T-->0)  {   int n=s.nextInt();   int arr[]=new int[n];   int brr[]=new int[n];   int e=-1;   for(int i=0;i<n;i++) {   arr[i]=s.nextInt();   if(e==-1) {    brr[e+1]=arr[i];    e++;   }   else {    if(arr[i]==1) {    e++;    brr[e]=arr[i];    }    else {    int j=e;    for(j=e;j>=0;j--) {     if((arr[i]-1)==brr[j])     break;    }    e=j;    brr[e]=arr[i];    }   }   pt.print(brr[0]);   for(int j=1;j<=e;j++) {    pt.print("."+brr[j]);   }   pt.println();   }                  }          pt.close(); }  static boolean allOne(String str) {  for(int i=0;i<str.length();i++) {  if(str.charAt(i)=='0')   return false;  }  return true; }    static boolean isPartition(int arr[], int n) {  int sum = 0;  int i, j;      for (i = 0; i < n; i++)   sum += arr[i];    if (sum % 2 != 0)   return false;    boolean part[][]=new boolean[sum/2+1][n+1];      for (i = 0; i <= n; i++)   part[0][i] = true;      for (i = 1; i <= sum / 2; i++)   part[i][0] = false;      for (i = 1; i <= sum / 2; i++) {   for (j = 1; j <= n; j++) {    part[i][j] = part[i][j - 1];    if (i >= arr[j - 1])     part[i][j] = part[i][j]         || part[i - arr[j - 1]][j - 1];   }  }  return part[sum / 2][n]; }  static int setBit(int S, int j) { return S | 1 << j; }  static int clearBit(int S, int j) { return S & ~(1 << j); }  static int toggleBit(int S, int j) { return S ^ 1 << j; }  static boolean isOn(int S, int j) { return (S & 1 << j) != 0; }  static int turnOnLastZero(int S) { return S | S + 1; }  static int turnOnLastConsecutiveZeroes(int S) { return S | S - 1; }  static int turnOffLastBit(int S) { return S & S - 1; }  static int turnOffLastConsecutiveBits(int S) { return S & S + 1; }  static int lowBit(int S) { return S & -S; }  static int setAll(int N) { return (1 << N) - 1; }  static int modulo(int S, int N) { return (S & N - 1); }   static boolean isPowerOfTwo(int S) { return (S & S - 1) == 0; }  static boolean isWithin(long x, long y, long d, long k) {  return x*k*x*k + y*k*y*k <= d*d; }  static long modFact(long n,    long p)  {  if (n >= p)   return 0;    long result = 1;  for (int i = 1; i <= n; i++)   result = (result * i) % p;    return result;  }  static int sum(int[] arr, int n) {  int inc[]=new int[n+1];  int dec[]=new int[n+1];  inc[0] = arr[0];  dec[0] = arr[0];   for (int i = 1; i < n; i++) {   for (int j = 0; j < i; j++) {    if (arr[j] > arr[i]) {     dec[i] = max(dec[i], inc[j] + arr[i]);    }    else if (arr[i] > arr[j]) {     inc[i] = max(inc[i], dec[j] + arr[i]);    }   }  }  return max(inc[n - 1], dec[n - 1]); } static long nc2(long a) {  return a*(a-1)/2; } public static int numberOfprimeFactors(int n)  {     HashSet<Integer> hs = new HashSet<Integer>();   while (n%2==0)   {    hs.add(2);    n /= 2;   }         for (int i = 3; i <= Math.sqrt(n); i+= 2)   {        while (n%i == 0)    {     hs.add(i);     n /= i;    }   }         if (n > 2)    hs.add(n);   return hs.size();  }  static long gcd(long a, long b)  {   if (b == 0)   return a;   return gcd(b, a % b);  }     static void reverse(int arr[],int start, int end)  {  int temp;     while (start < end)  {   temp = arr[start];   arr[start] = arr[end];   arr[end] = temp;   start++;   end--;  }  }  static void reverse(long arr[],int start, int end)  {  long temp;     while (start < end)  {   temp = arr[start];   arr[start] = arr[end];   arr[end] = temp;   start++;   end--;  }  }  static boolean isPrime(int n)  {      if (n <= 1) return false;   if (n <= 3) return true;          if (n % 2 == 0 || n % 3 == 0) return false;     for (int i = 5; i * i <= n; i = i + 6)    if (n % i == 0 || n % (i + 2) == 0)    return false;     return true;  }  static int p2(int n) {  int k=0;  while(n>1) {  if(n%2!=0)   return k;  n/=2;  k++;  }  return k; } static boolean isp2(int n) {  while(n>1) {  if(n%2==1)   return false;  n/=2;  }  return true; } static int binarySearch(int arr[], int first, int last, int key){   int mid = (first + last)/2;   while( first <= last ){    if ( arr[mid] < key ){    first = mid + 1;     }else if ( arr[mid] == key ){    return mid;    }else{     last = mid - 1;    }    mid = (first + last)/2;   }   return -1;  }  static void print(int a[][]) {  for(int i=0;i<a.length;i++)  {  for(int j=0;j<a[0].length;j++)   System.out.print(a[i][j]+" ");  System.out.println();  } } static int max (int x, int y) {  return (x > y)? x : y; }  static int search(Pair[] p, Pair pair) {  int l=0, r=p.length;  while (l <= r) {    int m = l + (r - l) / 2;   if (p[m].compareTo(pair)==0)     return m;    if (p[m].compareTo(pair)<0)     l = m + 1;    else    r = m - 1;  }  return -1; } static void pa(int a[]) {  for(int i=0;i<a.length;i++)  System.out.print(a[i]+" ");  System.out.println();   } static void pa(long a[]) {  for(int i=0;i<a.length;i++)  System.out.print(a[i]+" ");  System.out.println();   } static void reverseArray(int arr[],    int start, int end)  {  int temp;     while (start < end)  {   temp = arr[start];   arr[start] = arr[end];   arr[end] = temp;   start++;   end--;  }  }   static boolean isPalindrome(String s) {  int l=s.length();  for(int i=0;i<l/2;i++)  {  if(s.charAt(i)!=s.charAt(l-i-1))   return false;  }  return true; } static long nc2(long n, long m) {  return (n*(n-1)/2)%m; } static long c(long a) {  return a*(a+1)/2; } static int next(long[] arr, long target)  {   int start = 0, end = arr.length - 1;     int ans = -1;   while (start <= end) {    int mid = (start + end) / 2;             if (arr[mid] < target) {     start = mid + 1;    }         else {     ans = mid;     end = mid - 1;    }   }   return ans;  }   static int prev(long[] arr, long target)  {   int start = 0, end = arr.length - 1;     int ans = -1;   while (start <= end) {    int mid = (start + end) / 2;             if (arr[mid] > target) {     end = mid - 1;    }         else {     ans = mid;     start = mid + 1;    }   }   return ans;  }  static long power(long x, long y, long p)  {   long res = 1;   x = x % p;         while (y > 0)   {    if (y % 2 == 1)     res = (res * x) % p;    y = y >> 1;    x = (x * x) % p;   }   return res;  }  static long modInverse(long n, long p)  {   return power(n, p-2, p);  }  static long nCrModP(long n, long r,          long p)  {   if(r>n)   return 0;  if (r == 0)    return 1;   long[] fac = new long[(int) (n+1)];   fac[0] = 1;   for (int i = 1 ;i <= n; i++)    fac[i] = fac[i-1] * i % p;   return (fac[(int) n]* modInverse(fac[(int) r], p)     % p * modInverse(fac[(int) (n-r)], p)          % p) % p;  }  static String reverse(String str) {  return new StringBuffer(str).reverse().toString(); }   static long fastpow(long x, long y, long m)  {   if (y == 0)    return 1;      long p = fastpow(x, y / 2, m) % m;   p = (p * p) % m;     if (y % 2 == 0)    return p;   else    return (x * p) % m;  }   static boolean isPerfectSquare(long l) {  return Math.pow((long)Math.sqrt(l),2)==l; }   static void merge(long[] arr, int l, int m, int r)  {      int n1 = m - l + 1;   int n2 = r - m;       long L[] = new long [n1];   long R[] = new long [n2];       for (int i=0; i<n1; ++i)    L[i] = arr[l + i];   for (int j=0; j<n2; ++j)    R[j] = arr[m + 1+ j];           int i = 0, j = 0;       int k = l;   while (i < n1 && j < n2)   {    if (L[i] <= R[j])    {     arr[k] = L[i];     i++;    }    else    {     arr[k] = R[j];     j++;    }    k++;   }       while (i < n1)   {    arr[k] = L[i];    i++;    k++;   }       while (j < n2)   {    arr[k] = R[j];    j++;    k++;   }  }      static void sort(int arr[], int l, int r)  {   if (l < r)   {        int m = (l+r)/2;         sort(arr, l, m);    sort(arr , m+1, r);         merge(arr, l, m, r);   }  }  static void merge(int arr[], int l, int m, int r)  {      int n1 = m - l + 1;   int n2 = r - m;       int L[] = new int [n1];   int R[] = new int [n2];       for (int i=0; i<n1; ++i)    L[i] = arr[l + i];   for (int j=0; j<n2; ++j)    R[j] = arr[m + 1+ j];           int i = 0, j = 0;       int k = l;   while (i < n1 && j < n2)   {    if (L[i] <= R[j])    {     arr[k] = L[i];     i++;    }    else    {     arr[k] = R[j];     j++;    }    k++;   }       while (i < n1)   {    arr[k] = L[i];    i++;    k++;   }       while (j < n2)   {    arr[k] = R[j];    j++;    k++;   }  }      static void sort(long arr[], int l, int r)  {   if (l < r)   {        int m = (l+r)/2;         sort(arr, l, m);    sort(arr , m+1, r);         merge(arr, l, m, r);   }  }  static class Pair implements Comparable<Pair>{   int a;   int b;   Pair(int a,int b){    this.a=a;     this.b=b;   }    public int compareTo(Pair p){    if(a>p.a)     return 1;    if(a==p.a)     return (b-p.b);    return -1;   }  } static class Reader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;    public Reader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public Reader(String file_name) throws IOException   {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public String readLine() throws IOException   {    byte[] buf = new byte[128];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }    public int nextInt() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do    {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');     if (neg)     return -ret;    return ret;   }    public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }    public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();     do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');     if (c == '.')    {     while ((c = read()) >= '0' && c <= '9')     {      ret += (c - '0') / (div *= 10);     }    }     if (neg)     return -ret;    return ret;   }    private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }    private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }    public void close() throws IOException   {    if (din == null)     return;    din.close();   }  } }
2	public class Main {  private static Reader in;  private static PrintWriter out;  public static void main(String args[]) throws IOException {   in = new Reader();   out = new PrintWriter(System.out);   long n = in.nextLong();   long s = in.nextLong();   long low = 0, mid = 0, high = n;   while (low <= high) {    mid = (low + high) / 2;    if (func(mid, s)) {     high = mid - 1;    }    else {     low = mid + 1;    }   }   out.println(n - low + 1);   out.close();  }  private static boolean func(long num, long s) {   long sum = 0, temp = num;   while (temp > 0) {    sum += (temp) % 10;    temp /= 10;   }   return ((num - sum) >= s);  }  static class Reader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;   public Reader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public Reader(String file_name) throws IOException   {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public String next() throws IOException {    byte[] buf = new byte[64];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == ' ' || c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }   public String nextLine() throws IOException   {    byte[] buf = new byte[64];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }   public int nextInt() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do    {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (c == '.')    {     while ((c = read()) >= '0' && c <= '9')     {      ret += (c - '0') / (div *= 10);     }    }    if (neg)     return -ret;    return ret;   }   private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }   private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }   public void close() throws IOException   {    if (din == null)     return;    din.close();   }  } }
5	public class CottageVillage { Scanner in; PrintWriter out;  CottageVillage() {  in = new Scanner(System.in);  out = new PrintWriter(System.out); }  public void finalize() {  out.flush();  in.close();  out.close(); }  int ans(House a, House b, int t) {  int diff = b.cordl - a.cordr;   if(diff < t) return 0;  if(diff == t) return 1;  return 2; }  void solve() {  int  n = in.nextInt(),  t = in.nextInt() * 2;  House[] hs = new House[n];   for(int i = 0; i < n; ++i)  {  int   c = in.nextInt(),   l = in.nextInt();  hs[i] = new House(2 * c - l, 2 * c + l);  }   Arrays.sort(hs);     int co = 2;  for(int i = 0; i < n - 1; ++i)  co += ans(hs[i], hs[i + 1], t);   out.println(co); }  public static void main(String[] args) throws FileNotFoundException {  CottageVillage t = new CottageVillage();  t.solve();  t.finalize(); } } class House implements Comparable<House> { public int cordl, cordr;  public House(int c, int l) {  cordl = c;  cordr = l; }  @Override public int compareTo(House h) {  return cordl - h.cordl; } }
1	public class B {  static BufferedReader in;  static StringTokenizer st;  static String next() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt(next());  }  public static void main(String[] args) throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));   int n = nextInt();   int k = nextInt();   int[] a = new int[n + 1];   for (int i = 1; i <= n; i++) {    a[i] = nextInt();   }   Set<Integer> set_1 = new HashSet<Integer>();   for (int i = 1; i <= n; i++) {    set_1.add(a[i]);    if (set_1.size() == k) {     Set<Integer> set_2 = new HashSet<Integer>();     for (int j = i; j >= 1; j--) {      set_2.add(a[j]);      if (set_2.size() == k) {       out.print(j + " " + i);       out.close();       return;      }     }    }   }   out.print("-1 -1");   out.close();  } }
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 q=in.nextInt();  for(int i=0;i<q;i++) {  out.println(work());  }  out.flush(); } long mod=1000000007; long gcd(long a,long b) {  return b==0?a:gcd(b,a%b); } int id[]; long work() {  int n=in.nextInt();  int m=in.nextInt();  long ret=0;  PriorityQueue<int[]> pq=new PriorityQueue<>(new Comparator<int[]>() {  public int compare(int[] arr1,int[] arr2) {   return arr1[2]-arr2[2];  }  });  long sum=0;  for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   int v=in.nextInt();   pq.add(new int[] {i,j,v});   sum+=v;   if(pq.size()>6)pq.poll();  }  }  if(m==1)return sum;  if(n<=3) {  while(pq.size()>0) {   int[] p=pq.poll();   if(pq.size()<n) {   ret+=p[2];   }  }  return ret;  }  int[][] A=new int[6][];  for(int i=0;pq.size()>0;i++) {  A[i]=pq.poll();  }   for(int i=0;i<6;i++) {  for(int j=i+1;j<6;j++) {   for(int k=j+1;k<6;k++) {   out:   for(int p=k+1;p<6;p++) {    int s=A[i][2]+A[j][2]+A[k][2]+A[p][2];    HashMap<Integer,ArrayList<Integer>> map=new HashMap<>();    if(map.get(A[i][1])==null) {    map.put(A[i][1],new ArrayList<>());    }    if(map.get(A[j][1])==null) {    map.put(A[j][1],new ArrayList<>());    }    if(map.get(A[k][1])==null) {    map.put(A[k][1],new ArrayList<>());    }    if(map.get(A[p][1])==null) {    map.put(A[p][1],new ArrayList<>());    }    map.get(A[i][1]).add(A[i][0]);    map.get(A[j][1]).add(A[j][0]);    map.get(A[k][1]).add(A[k][0]);    map.get(A[p][1]).add(A[p][0]);    if(map.size()!=2) {    ret=Math.max(ret, s);    continue;    }    Integer l1=null,l2=null,r1=null,r2=null;    for(int key:map.keySet()) {    ArrayList<Integer> list=map.get(key);    if(map.get(key).size()!=2) {     ret=Math.max(ret, s);     continue out;    }    if(l1==null) {     l1=list.get(0);     l2=list.get(1);    }else {     r1=list.get(0);     r2=list.get(1);    }    }    if((Math.abs(l1-l2)==2&&Math.abs(r1-r2)==2)||(Math.abs(l1-l2)!=2&&Math.abs(r1-r2)!=2)) {    ret=Math.max(ret, s);    }   }   }  }  }   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()); } }
0	public class Subtractions {     static long modifiedEuclidGCD(int a , int b) {  return b == 0 ? 0 : (a / b) + modifiedEuclidGCD(b, a % b); }  private static void solve(FastScanner s1, PrintWriter out){   int T = s1.nextInt();  while(T-->0)  out.println(modifiedEuclidGCD(s1.nextInt(), s1.nextInt()));   }            public static void main(String []args) throws IOException {  FastScanner in = new FastScanner(System.in);  PrintWriter out =   new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);  solve(in, out);  in.close();  out.close(); }   static class FastScanner{  BufferedReader reader;  StringTokenizer st;  FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}  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();}  String nextLine() {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}     int nextInt() {return Integer.parseInt(next());}  long nextLong() {return Long.parseLong(next());}   double nextDouble(){return Double.parseDouble(next());}  char nextChar() {return next().charAt(0);}  int[] nextIntArray(int n)   {int[] a= new int[n]; int i=0;while(i<n){a[i++]=nextInt();} return a;}  long[] nextLongArray(int n)  {long[]a= new long[n]; int i=0;while(i<n){a[i++]=nextLong();} return a;}  int[] nextIntArrayOneBased(int n) {int[] a= new int[n+1]; int i=1;while(i<=n){a[i++]=nextInt();} return a;}    long[] nextLongArrayOneBased(int n){long[]a= new long[n+1];int i=1;while(i<=n){a[i++]=nextLong();}return a;}    void close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}   }   }
2	public class A{   private InputStream inputStream ; private OutputStream outputStream ; private FastReader in ; private PrintWriter out ;  private final int BUFFER = 100005; private final long mod = 1000000000+7; private final int INF = Integer.MAX_VALUE; private final long INF_L = Long.MAX_VALUE / 10;  public A(){} public A(boolean stdIO)throws FileNotFoundException{   if(stdIO){  inputStream = System.in;  outputStream = System.out;  }else{  inputStream = new FileInputStream("input.txt");  outputStream = new FileOutputStream("output.txt");  }  in = new FastReader(inputStream);  out = new PrintWriter(outputStream); }  void run()throws Exception{  long x = l(); long k = l();  if(x == 0){  out.write("0");  return;  }  x %= mod;  long a = (x * pow(2L, k, mod) + mod)%mod;  long b = (a - pow(2L, k, mod) + 1 + mod)%mod;  long res = (a + b + mod )%mod;  out.write(""+res+"\n"); }  long gcd(long a, long b){  if(b == 0)return a;  return gcd(b, a % b); }  long lcm(long a, long b){  if(a == 0 || b == 0)return 0;  return (a * b)/gcd(a, b); }  long mulMod(long a, long b, long mod){  if(a == 0 || b == 0)return 0;  if(b == 1)return a;  long ans = mulMod(a, b/2, mod);  ans = (ans * 2) % mod;  if(b % 2 == 1)ans = (a + ans)% mod;  return ans; }  long pow(long a, long b, long mod){  if(b == 0)return 1;  if(b == 1)return a;  long ans = pow(a, b/2, mod);  ans = (ans * ans);  if(ans >= mod)ans %= mod;  if(b % 2 == 1)ans = (a * ans);  if(ans >= mod)ans %= mod;  return ans; }   long[][] ncrTable(){  long ncr[][] = new long[21][21];  for(int i = 0; i <= 20; i++){  ncr[i][0] = ncr[i][i] = 1L;  }  for(int j = 0; j <= 20; j++){  for(int i = j + 1; i <= 20; i++){   ncr[i][j] = ncr[i-1][j] + ncr[i-1][j-1];  }  }  return ncr; }  int i()throws Exception{  return in.nextInt(); }  long l()throws Exception{  return in.nextLong(); }  double d()throws Exception{  return in.nextDouble(); }  char c()throws Exception{  return in.nextCharacter(); }  String s()throws Exception{  return in.nextLine(); }  BigInteger bi()throws Exception{  return in.nextBigInteger(); }  private void closeResources(){  out.flush();  out.close();  return; }      public static void main(String[] args) throws java.lang.Exception{   A driver = new A(true);  driver.run();  driver.closeResources(); } } class FastReader{  private boolean finished = false;  private InputStream stream; private byte[] buf = new byte[4 * 1024]; private int curChar; private int numChars; private SpaceCharFilter filter;  public FastReader(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 nextInt(){  int c = read ();  while (isSpaceChar (c))  c = read ();  int sgn = 1;  if (c == '-'){  sgn = -1;  c = read ();  }  int res = 0;  do{  if(c==','){   c = read();  }  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 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 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; }  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 nextLine(){  String s = readLine0 ();  while (s.trim ().length () == 0)  s = readLine0 ();  return s; }  public String nextLine(boolean ignoreEmptyLines){  if (ignoreEmptyLines){  return nextLine ();  }else{  return readLine0 ();  } }  public BigInteger nextBigInteger(){  try{  return new BigInteger (nextString ());  } catch (NumberFormatException e){  throw new InputMismatchException ();  } }  public char nextCharacter(){  int c = read ();  while (isSpaceChar (c))  c = read ();  return (char) c; }  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 boolean isExhausted(){  int value;  while (isSpaceChar (value = peek ()) && value != -1)  read ();  return value == -1; }  public String next(){  return nextString (); }  public SpaceCharFilter getFilter(){  return filter; }  public void setFilter(SpaceCharFilter filter){  this.filter = filter; }  public interface SpaceCharFilter{  public boolean isSpaceChar(int ch); } } class Pair implements Comparable<Pair>{ public int a; public int b; public int c;  public Pair(){  this.a = 0;  this.b = 0;  this.c = 0; }  public Pair(int a,int b, int c){  this.a = a;  this.b = b;  this.c = c; }  public int compareTo(Pair p){  return this.c - p.c;  }  @Override public String toString(){  return "a = " + this.a + " b = " + this.b + " c = "+this.c; } }
2	public class Main {  class IO {  BufferedReader reader;  PrintWriter writer;  StringTokenizer tokenizer;  IO() {  reader = new BufferedReader(new InputStreamReader(System.in));  writer = new PrintWriter(new BufferedOutputStream(System.out));  tokenizer = new StringTokenizer("");  }  IO(String file) throws FileNotFoundException {  reader = new BufferedReader(new FileReader(file));  writer = new PrintWriter(new BufferedOutputStream(System.out));  tokenizer = new StringTokenizer("");  }  String next() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {   String line = reader.readLine();   if (line == null)   return null;   tokenizer = new StringTokenizer(line);  }  return tokenizer.nextToken();  }  public Integer nextInt() throws IOException {  return Integer.parseInt(next());  }  public Long nextLong() throws IOException {  return Long.parseLong(next());  }  public Double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public void write(Object obj) {  writer.print(obj.toString());  }  public void writeSpace(Object obj) {  writer.print(obj.toString() + " ");  }  public void writeLine(Object obj) {  writer.println(obj.toString());  }  public void close() {  writer.close();  } }  IO io;  Main() {  io = new IO(); }  Main(String file) throws FileNotFoundException {  io = new IO(file); }  void solve() throws IOException {  long n = io.nextLong(), s = io.nextLong();  long min = s;  while (true) {  min++;  long sum = 0, tem = min;  while (tem > 0) {   sum += tem % 10;   tem /= 10;  }  if (min - sum >= s) break;  }  io.write(Math.max(0, n - min + 1)); }  void close() {  io.close(); }  public static void main(String args[]) throws IOException {   Main solver = new Main();  solver.solve();  solver.close(); } }
1	public class SonyaAndHotels {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int d = sc.nextInt();   int[] locs = new int[n];   for (int i = 0; i < n; i++) {    locs[i] = sc.nextInt();   }   Arrays.sort(locs);   int count = 2;   for (int i = 0; i < locs.length-1; i++) {    if(locs[i+1]-locs[i]==2*d){     count++;    }else if(locs[i+1]-locs[i]>2*d){     count+=2;    }   }   System.out.println(count);  } }
1	public class Main {  public static void main(String[] args) throws Exception {     in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   solve();   in.close();   out.close();  }  private static void solve() throws Exception {   int n = nextInt();   int co = 0, ce = 0;   int[] v = new int[n];   for (int i = 0; i < n; i++) {    v[i] = nextInt();   }   for (int i = 0; i < n; i++) {    if (v[i] % 2 == 0) {     co++;    } else {     ce++;    }   }   if (co == 1) {    for (int i = 0; i < n; i++) {     if (v[i] % 2 == 0) {      out.println(i + 1);      return;     }    }   } else {    for (int i = 0; i < n; i++) {     if (v[i] % 2 != 0) {      out.println(i + 1);      return;     }    }   }  }  private static BufferedReader in;  private static PrintWriter out;  private static StringTokenizer st;  static String nextString() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt(nextString());  }  static double nextDouble() throws IOException {   return Double.parseDouble(nextString());  } }
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());  }   long nextLong() throws IOException  {   return Long.parseLong(next());  }   double nextDouble() throws IOException  {   return Double.parseDouble(next());  }   void print(Object... o)  {   System.out.println(deepToString(o));  }   void gcj(Object o)  {   String s = String.valueOf(o);   out.println("Case #" + test + ": " + s);   System.out.println("Case #" + test + ": " + s);  }   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();  }   public void run()  {   try   {    init();    if(TEST)    {     int runs = nextInt();     for(int i = 0; i < runs; i++) solve();    }    else solve();    out.close();     }   catch(Exception e)   {    e.printStackTrace();    System.exit(1);   }  } }
3	public class Main {  public static void main(String[] args) throws Exception {   new Main().run();}                                                                                                       static long mul(long a, long b, long p)  {   long res=0,base=a;   while(b>0)   {    if((b&1L)>0)     res=(res+base)%p;    base=(base+base)%p;    b>>=1;   }   return res;  }  static long mod_pow(long k,long n,long p){   long res = 1L;   long temp = k;   while(n!=0L){    if((n&1L)==1L){     res = (res*temp)%p;    }    temp = (temp*temp)%p;    n = n>>1L;   }   return res%p;  }  int ct = 0;  int f[] =new int[200001];  int b[] =new int[200001];  int str[] =new int[200001];  void go(int rt,List<Integer> g[]){   str[ct] = rt;   f[rt] = ct;   for(int cd:g[rt]){    ct++;    go(cd,g);   }   b[rt] = ct;  }  int add =0;  void go(int rt,int sd,int k,List<Integer> g[],int n){   if(add>n) {    return;   }   Queue<Integer> q =new LinkedList<>();   q.offer(rt);   for(int i=1;i<=sd;++i){    int sz =q.size();    if(sz==0) break;    int f = (i==1?2:1);    while(sz-->0){     int cur = q.poll();     for(int j=0;j<k-f;++j){      q.offer(add);      g[cur].add(add);add++;      if(add==n+1){       return;      }     }    }   }   }   void solve() {   int n = ni();   int s[] = new int[n+1];   for(int i=0;i<n;++i){    s[i+1] = s[i] + ni();   }   Map<Integer,List<int[]>> mp = new HashMap<>();   for(int i=0;i<n;++i) {    for (int j = i; j>=0; --j) {     int v = s[i+1]-s[j];     if(!mp.containsKey(v)){      mp.put(v, new ArrayList<>());     }     mp.get(v).add(new int[]{j+1,i+1});    }   }   int all = 0;int vv = -1;   for(int v:mp.keySet()){    List<int[]> r = mp.get(v);    ;int c = 0;    int ri = -2000000000;    for(int [] fk : r){     if(fk[0]>ri){      ri = fk[1];c++;     }    }    if(c>all){     all = c;     vv = v;    }   }   println(all);   List<int[]> r = mp.get(vv);   int ri = -2000000000;   for(int fk[]:r){    if(fk[0]>ri){     ri = fk[1];println((fk[0])+" "+(fk[1]));    }   }                                                                                                                                                }       long t1[];   void update(long[] t,int i,long v){   for(;i<t.length;i+=(i&-i)){    t[i] += v;   }  }  long get(long[] t,int i){   long s = 0;   for(;i>0;i-=(i&-i)){    s += t[i];   }   return s;  }  int equal_bigger(long t[],long v){   int s=0,p=0;   for(int i=Integer.numberOfTrailingZeros(Integer.highestOneBit(t.length));i>=0;--i) {    if(p+(1<<i)< t.length && s + t[p+(1<<i)] < v){     v -= t[p+(1<<i)];     p |= 1<<i;    }   }   return p+1;  }      static class S{   int l = 0;   int r = 0 ;   long le = 0;   long ri = 0;   long tot = 0;   long all = 0;   public S(int l,int r) {    this.l = l;    this.r = r;   }  }  static S a[];  static int[] o;  static void init(int[] f){   o = f;   int len = o.length;   a = new S[len*4];   build(1,0,len-1);  }  static void build(int num,int l,int r){   S cur = new S(l,r);   if(l==r){    a[num] = cur;    return;   }else{    int m = (l+r)>>1;    int le = num<<1;    int ri = le|1;    build(le, l,m);    build(ri, m+1,r);    a[num] = cur;    pushup(num, le, ri);   }  }                static long dd = 10007;  static void update(int num,int l,long v){   if(a[num].l==a[num].r){    a[num].le = v%dd;    a[num].ri = v%dd;    a[num].all = v%dd;    a[num].tot = v%dd;   }else{    int m = (a[num].l+a[num].r)>>1;    int le = num<<1;    int ri = le|1;    pushdown(num, le, ri);    if(l<=m){     update(le,l,v);    }    if(l>m){     update(ri,l,v);    }    pushup(num,le,ri);   }  }  static void pushup(int num,int le,int ri){   a[num].all = (a[le].all*a[ri].all)%dd;   a[num].le = (a[le].le + a[le].all*a[ri].le)%dd;   a[num].ri = (a[ri].ri + a[ri].all*a[le].ri)%dd;   a[num].tot = (a[le].tot + a[ri].tot + a[le].ri*a[ri].le)%dd;     }  static void pushdown(int num,int le,int ri){  }   int gcd(int a,int b){ return b==0?a: gcd(b,a%b);}  InputStream is;PrintWriter out;  void run() throws Exception {is = System.in;out = new PrintWriter(System.out);solve();out.flush();}  private byte[] inbuf = new byte[2];  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 double nd() {return Double.parseDouble(ns());}  private char nc() {return (char) skip();}  private char ncc() {int b;while((b = readByte()) != -1 && !(b >= 32 && b <= 126));return (char)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 String nline() {int b = skip();StringBuilder sb = new StringBuilder();   while (!isSpaceChar(b) || b == ' ') { sb.appendCodePoint(b);b = readByte(); }   return sb.toString();}  private char[][] nm(int n, int m) {char[][] a = new char[n][];for (int i = 0; i < n; i++) a[i] = ns(m);return a;}  private int[] na(int n) {int[] a = new int[n];for (int i = 0; i < n; i++) a[i] = ni();return a;}  private long[] nal(int n) { long[] a = new long[n];for (int i = 0; i < n; i++) a[i] = nl();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 << 3) + (num << 1) + (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();}}  void print(Object obj){out.print(obj);}  void println(Object obj){out.println(obj);}  void println(){out.println();} }
6	public class CF {  void realSolve() {  int n = in.nextInt();  int m = in.nextInt();  boolean[][] f = new boolean[n][n];  for (int i = 0; i < m; i++) {  int fr = in.nextInt() - 1;  int to = in.nextInt() - 1;  f[fr][to] = f[to][fr] = true;  }  long[][] dp = new long[n][1 << n];  for (int i = 0; i < n; i++)  dp[i][1 << i] = 1;  long res = 0;  int[] len = new int[n + 1];  for (int st = 0; st < 1 << n; st++) {  int from = Integer.lowestOneBit(st);  for (int i =0; i < n;i++)   if (((1<<i) & st) != 0) {   from =i;   break;   }  for (int to = 0; to < n; to++)   if (dp[to][st] != 0)   for (int next = from; next < n; next++)    if (f[to][next]     && ((((1 << next) & st) == 0) || next == from))    if (next == from) {     if (Integer.bitCount(st) > 2) {     res += dp[to][st];     len[Integer.bitCount(st)] += dp[to][st];     }    } else {     dp[next][st | (1 << next)] += dp[to][st];    }  }  out.println(res / 2); }  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());  }  double nextDouble() {  return Double.parseDouble(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();  }  long nextLong() {  return Long.parseLong(next());  } }  InputReader in; PrintWriter out;  void solve() {  in = new InputReader(new File("object.in"));  try {  out = new PrintWriter(new File("object.out"));  } catch (FileNotFoundException e) {  e.printStackTrace();  }  realSolve();  out.close(); }  void solveIO() {  in = new InputReader(System.in);  out = new PrintWriter(System.out);  realSolve();  out.close();  }  public static void main(String[] args) {  new CF().solveIO(); } }
1	public class ProbB implements Runnable { private boolean _ReadFromFile = false; private boolean _WriteToFile = false; static final String TASK_ID = "in"; static final String IN_FILE = TASK_ID + ".in"; static final String OUT_FILE = TASK_ID + ".out"; static BufferedReader reader; static StringTokenizer tokenizer; static PrintWriter writer; private static String alphabet;  private static void core() throws Exception {  int n = nextInt();  alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";  for (int test = 0; test < n; test++) {  String input = reader.readLine();  StringTokenizer st = new StringTokenizer(input, alphabet);    ArrayList<Integer> have = new ArrayList<Integer>();  while (st.hasMoreElements()) {   String kString = st.nextToken();   have.add(Integer.parseInt(kString));  }  if (have.size() == 2)   writer.println(twoInts(have.get(0), have.get(1)));  else {   String row = "";   int col = 0;   for (int i = 0; i < input.length(); i++) {   if (Character.isDigit(input.charAt(i))) {    row = input.substring(0, i);    col = Integer.parseInt(input.substring(i));    break;   }   }   writer.println(oneInt(row, col));  }  } } private static String oneInt(String row, int col) {  return "R" + col + "C" + toNum(row); } private static int toNum(String row) {  int res = 0;  for (int i = 0; i < row.length(); i++) {  res = res * 26 + row.charAt(i) - 'A' + 1;  }  return res; } private static String twoInts(Integer row, Integer col) {  return toAlpha(col) + row; } private static String toAlpha(Integer col) {  String res = "";  while (col > 0) {  if (col % 26 > 0) {   res = alphabet.charAt(col % 26 - 1) + res;   col /= 26;  }  else {   res = "Z" + res;   col -= 26;   col /= 26;  }  }  return res; } void debug(Object...os) {  System.out.println(Arrays.deepToString(os)); }   public static void main(String[] args) throws InterruptedException {   Thread thread = new Thread(new ProbB());   thread.start();   thread.join();  } public void run() {   try {   reader = _ReadFromFile ? new BufferedReader(new FileReader(IN_FILE)) : new BufferedReader(new InputStreamReader(System.in));   writer = _WriteToFile ? new PrintWriter(OUT_FILE) : new PrintWriter(new BufferedOutputStream(System.out));    tokenizer = null;    core();    reader.close();    writer.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  } static int nextInt() throws Exception {   return Integer.parseInt(nextToken());  } static long nextLong() throws Exception {   return Long.parseLong(nextToken());  } static double nextDouble() throws Exception {   return Double.parseDouble(nextToken());  } static String nextToken() throws Exception {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  } }
0	public class Main {    public static void main(String[] args) {   Scanner scan = new Scanner(System.in);   int x = scan.nextInt();  solve(x);  }  public static void solve (int x){   int z = 0 ;   System.out.print(z+" ");   System.out.print(z+" ");   System.out.print(x);    } }
3	public class F547 {  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();   long[] sum = new long[arr.length + 1];  for(int i = 1; i < sum.length; i++)  sum[i] = sum[i-1] + arr[i-1];   HashMap<Long, ArrayList<Pair>> map = new HashMap<>();   for(int i = 0; i < sum.length; i++) {  for(int j = i+1; j < sum.length; j++) {   long diff = sum[j] - sum[i];     if(!map.containsKey(diff))   map.put(diff, new ArrayList<>());     ArrayList<Pair> list = map.get(diff);   list.add(new Pair(i, j));  }  }   for(long key : map.keySet()) {  ArrayList<Pair> list1 = map.get(key);  Collections.sort(list1);    ArrayList<Pair> list2 = new ArrayList<>();    int end = 0;  for(Pair p : list1) {   if(end <= p.a) {   list2.add(p);   end = p.b;   }  }    map.put(key, list2);  }   long maxKey = -1;  int max = -1;  for(long key : map.keySet()) {  if(map.get(key).size() > max) {   max = map.get(key).size();   maxKey = key;  }  }   ArrayList<Pair> list = map.get(maxKey);  StringBuilder sb = new StringBuilder();  sb.append(list.size());  sb.append("\n");   for(Pair p : list) {  sb.append((1 + p.a) + " " + p.b);  sb.append("\n");  }   System.out.println(sb.toString()); }  static class Pair implements Comparable<Pair> {  int a, b;   public Pair(int x, int y) {  a = x;  b = y;  }   public int compareTo(Pair other) {  if(b != other.b) {   return b - other.b;  }  return other.a - a;  }   public String toString() {  return "(" + a + ", " + b + ")";  } }   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 long nextLong() {  return Long.parseLong(next());  }  public double nextDouble() {  return Double.parseDouble(next());  }  public String next() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  public String nextLine() {  int c = read();  while (isEndline(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isEndline(c));  return res.toString();  } } }
0	public class ProbA { int account;  void start(Scanner sc, PrintStream out) {  int ans = 0;  account = sc.nextInt();  int account1 = account / 10;  int account2 = (account - (account % 100)) / 10 + (account % 10);    out.println(Math.max(account1, Math.max(account, account2))); }  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  PrintStream out = System.out;  new ProbA().start(sc, out);  } }
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); } }
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 Main { static final FastReader FR = new FastReader(); static final PrintWriter PW = new PrintWriter(new OutputStreamWriter(System.out));  public static void main(String[] args) {  StringBuilder solution = new StringBuilder();  int rows = FR.nextInt();  int cols = FR.nextInt();  int moves = FR.nextInt();  Map<Integer, Integer> horizontalEdgeWeights = new HashMap<Integer, Integer>();  for (int r = 0; r < rows; r++) {  for (int c = 0; c < cols - 1; c++) {   int hash = getHash(r, c);   horizontalEdgeWeights.put(hash, FR.nextInt());  }  }  Map<Integer, Integer> verticalEdgeWeights = new HashMap<Integer, Integer>();  for (int r = 0; r < rows - 1; r++) {  for (int c = 0; c < cols; c++) {   int hash = getHash(r, c);   verticalEdgeWeights.put(hash, FR.nextInt());  }  }   List<List<Integer>> result = getResult(rows, cols, moves, horizontalEdgeWeights, verticalEdgeWeights);  for (int r = 0; r < rows; r++) {  for (int c = 0; c < cols; c++) {   int value = (result != null ? result.get(r).get(c) : -1);   solution.append(value + " ");  }  solution.append("\n");  }  PW.print(solution.toString());  PW.close(); }  static List<List<Integer>> getResult(int rows, int cols, int moves, Map<Integer, Integer> horizontalEdgeWeights, Map<Integer, Integer> verticalEdgeWeights) {  if ((moves & 1) == 1) {  return null;  }  int mid = moves >> 1;  List<List<List<Integer>>> minForDistance = new ArrayList<List<List<Integer>>>(rows);  for (int r = 0; r < rows; r++) {  minForDistance.add(new ArrayList<List<Integer>>(cols));   for (int c = 0; c < cols; c++) {   minForDistance.get(r).add(new ArrayList<Integer>(Collections.nCopies(mid+1, Integer.MAX_VALUE)));   minForDistance.get(r).get(c).set(0, 0);  }  }  for (int m = 1; m <= mid; m++) {  for (int r = 0; r < rows; r++) {   for (int c = 0; c < cols; c++) {   int minBoredom = minForDistance.get(r).get(c).get(m);   int hash = getHash(r, c);    if (r > 0) {    if (minForDistance.get(r-1).get(c).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r-1).get(c).get(m-1) + verticalEdgeWeights.get(getHash(r-1, c));    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }    if (c > 0) {    if (minForDistance.get(r).get(c-1).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r).get(c-1).get(m-1) + horizontalEdgeWeights.get(getHash(r, c-1));    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }      if (r + 1 < rows) {    if (minForDistance.get(r+1).get(c).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r+1).get(c).get(m-1) + verticalEdgeWeights.get(hash);    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }     if (c + 1 < cols) {    if (minForDistance.get(r).get(c+1).get(m-1) < Integer.MAX_VALUE) {    int candidateBoredom = minForDistance.get(r).get(c+1).get(m-1) + horizontalEdgeWeights.get(hash);    minBoredom = Math.min(minBoredom, candidateBoredom);    }   }    minForDistance.get(r).get(c).set(m, minBoredom);   }  }  }  List<List<Integer>> result = new ArrayList<List<Integer>>(rows);  for (int r = 0; r < rows; r++) {  result.add(new ArrayList<Integer>(cols));   for (int c = 0; c < cols; c++) {   result.get(r).add(minForDistance.get(r).get(c).get(mid) << 1);  }  }  return result; }  static int getHash(int row, int col) {  return (row * 1000 + col); } static int getRow(int hash) {  return hash / 1000; } static int getCol(int hash) {  return hash % 1000; }  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());  }  double nextDouble() {  return Double.parseDouble(next());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  } } }
1	public class b { public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int n = input.nextInt(), k = input.nextInt();  int[] data = new int[n];  for(int i = 0; i<n; i++)   data[i] = input.nextInt();  int[] freq = new int[100001];  int count = 0;  for(int i = 0; i<n; i++)  {   if(freq[data[i]] == 0)    count++;   freq[data[i]]++;  }  if(count<k)   System.out.println("-1 -1");   else  {   int start = 0;   for(int i = 0; i<n; i++)   {       if(count > k)    {     freq[data[i]]--;     if(freq[data[i]] == 0)      count--;    }    else    {     if(freq[data[i]] > 1)     {      freq[data[i]]--;     }     else     {      start = i;      break;     }    }   }   int end = n-1;   for(int i = n-1; i>=0; i--)   {    if(freq[data[i]] == 1)    {     end = i;     break;    }    else     freq[data[i]]--;   }   start++;   end++;   if(start<= end)   System.out.println(start + " " + end);   else    System.out.println(-1 + " " + -1);  } } }
2	public class A2 {  public static void main(String[] args) throws Exception {   uu.s1();   uu.out.close();  }  public static class uu {   public static BR in = new BR();   public static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   public static boolean bg = true;   public static MOD m1 = new MOD(1000000000+9);   public static long mod = 1000000000+9;   public static void s1() throws Exception {    long n = in.ni();    long m = in.ni();    long k = in.ni();    long lose = n - m;    long aval = m / (k - 1l);    long times1 = Math.min(lose, aval);    long notused = times1 * (k - 1l);    long used = m - notused;    long blocks = used / k;    long left = used % k;    long k1 = 0;    if (blocks != 0){     k1 = m1.pow(2, blocks+1);     k1 = m1.s(k1, 2);    }    long ans = (m1.t(k, k1)+left + notused)%mod;    pn(ans);   }   public static void geom(long f1){   }     public static void s2() throws Exception {      }   public static void s3() throws Exception {      }     private static void pn(Object... o1) {    for (int i = 0; i < o1.length; i++){     if (i!= 0) out.print(" ");     out.print(o1[i]);    }    out.println();   }   public static boolean allTrue(boolean ... l1){    for (boolean e: l1) if (!e) return false;    return true;   }   public static boolean allFalse(boolean ... l1){    for (boolean e: l1) if (e) return false;    return true;   }  }  private static 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 static long xgcd(long n1, long n2) {    long k1 = n1;    long k2 = n2;    long[] l1 = { 1, 0 };    long[] l2 = { 0, 1 };    for (;;) {     long f1 = k1 / k2;     long f2 = k1 % k2;     if (f2 == 0)      break;     long[] l3 = { 0, 0 };     l3[0] = l1[0] - f1 * l2[0];     l3[1] = l1[1] - f1 * l2[1];     l1 = l2;     l2 = l3;     k1 = k2;     k2 = f2;    }    long fin = l2[1] % n1;    if (fin < 0) {     fin += n1;    }    return fin;   }   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));    }   }   public long factorial(long k1, long n1) {    long fin = 1;    long q1 = k1;    for (int i = 0; i < n1; i++) {     fin = t(fin, q1);     q1--;     if (q1 <= 0)      break;    }    return cl(fin);   }  }   private static 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());   }  } }
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;  public void run() {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  System.err.println("");  n = fs.nextInt(); m = fs.nextInt();  str = fs.next().toCharArray();  occs = new int[m][m];  for(int i = 0; i < n-1; i++) {  occs[str[i]-'a'][str[i+1]-'a']++;  occs[str[i+1]-'a'][str[i]-'a']++;  }   int all = (1<<m)-1;  cost = new int[m][1<<m];  for(int i = 0; i < m; i++) {  for(int mask = 1; mask < all; mask++) {   if(((1<<i)&mask) > 0) continue;   int lb = mask & (-mask);   int trail = Integer.numberOfTrailingZeros(lb);   int nmask = mask ^ lb;   cost[i][mask] = cost[i][nmask]+occs[i][trail];  }  }   dp = new int[1<<m];  for(int mask = dp.length-2; mask >= 0; mask--) {  int addOn = 0;  for(int nxt = 0; nxt < m; nxt++) {   if(((1<<nxt)&mask) > 0) continue;   addOn += cost[nxt][mask];  }  int res = oo;  for(int nxt = 0; nxt < m; nxt++) {   if(((1<<nxt)&mask) > 0) continue;   int ret = addOn+dp[mask | (1<<nxt)];   res = min(res, ret);  }  dp[mask] = res;  }   System.out.println(dp[0]);   out.close(); }  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 double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }  public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }  public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  }   public int[] nextIntArray(int n) {  int[] res = new int[n];  for(int i = 0; i < n; i++) res[i] = nextInt();  return res;  }   } }
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 printsp(int [] a) { for (int i = 0, n = a.length; i < n; print(a[i] + " "), i++); } 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()); } char nextChar() throws IOException { return (char) (br.read()); } String next() throws IOException { return nextToken(); } String nextLine() throws IOException { return br.readLine(); } int [] readInt(int size) throws IOException {  int [] array = new int [size];  for (int i = 0; i < size; i++) { array[i] = nextInt(); }  return array; } long [] readLong(int size) throws IOException {  long [] array = new long [size];  for (int i = 0; i < size; i++) { array[i] = nextLong(); }  return array; } double [] readDouble(int size) throws IOException {  double [] array = new double [size];  for (int i = 0; i < size; i++) { array[i] = nextDouble(); }  return array; } String [] readLines(int size) throws IOException {  String [] array = new String [size];  for (int i = 0; i < size; i++) { array[i] = nextLine(); }  return array; }  int gcd(int a, int b) {  if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);  a = Math.abs(a); b = Math.abs(b);  int az = Integer.numberOfTrailingZeros(a), bz = Integer.numberOfTrailingZeros(b);  a >>>= az; b >>>= bz;  while (a != b) {  if (a > b) { a -= b; a >>>= Integer.numberOfTrailingZeros(a); }    else { b -= a; b >>>= Integer.numberOfTrailingZeros(b); }  }  return (a << Math.min(az, bz)); }  long gcd(long a, long b) {  if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);  a = Math.abs(a); b = Math.abs(b);  int az = Long.numberOfTrailingZeros(a), bz = Long.numberOfTrailingZeros(b);  a >>>= az; b >>>= bz;  while (a != b) {  if (a > b) { a -= b; a >>>= Long.numberOfTrailingZeros(a); }    else { b -= a; b >>>= Long.numberOfTrailingZeros(b); }  }  return (a << Math.min(az, bz)); }  void shuffle(int [] a) {  Random r = new Random();  for (int i = a.length - 1, j, t; i >= 0; j = r.nextInt(a.length), t = a[i], a[i] = a[j], a[j] = t, i--); }  void shuffle(int [] a, int m) {  for (int i = 0, n = a.length, j = m % n, t; i < n; t = a[i], a[i] = a[j], a[j] = t, i++, j = (i * m) % n); }  void shuffle(long [] a) {  Random r = new Random();  for (int i = a.length - 1; i >= 0; i--) {  int j = r.nextInt(a.length);  long t = a[i]; a[i] = a[j]; a[j] = t;  } }  void shuffle(Object [] a) {  Random r = new Random();  for (int i = a.length - 1; i >= 0; i--) {  int j = r.nextInt(a.length);  Object t = a[i]; a[i] = a[j]; a[j] = t;  } }  int [] sort(int [] a) {  final int SHIFT = 16, MASK = (1 << SHIFT) - 1, SIZE = (1 << SHIFT) + 1;  int n = a.length, ta [] = new int [n], ai [] = new int [SIZE];  for (int i = 0; i < n; ai[(a[i] & MASK) + 1]++, i++);  for (int i = 1; i < SIZE; ai[i] += ai[i - 1], i++);  for (int i = 0; i < n; ta[ai[a[i] & MASK]++] = a[i], i++);  int [] t = a; a = ta; ta = t;  ai = new int [SIZE];  for (int i = 0; i < n; ai[(a[i] >> SHIFT) + 1]++, i++);  for (int i = 1; i < SIZE; ai[i] += ai[i - 1], i++);  for (int i = 0; i < n; ta[ai[a[i] >> SHIFT]++] = a[i], i++);  return ta; }  void flush() {  pw.flush(); }  void pause() {  flush(); System.console().readLine(); } }
4	public class Main implements Runnable { Scanner in; PrintWriter out;  public static void main(String[] args) throws FileNotFoundException, IOException {  new Thread(new Main()).start(); }  public class Pair {  public long last;  public long count;  public int L;  Pair(long l, long c) {last = l; count = c;}  Pair(long l, long c, int L) {last = l; count = c; this.L = L;} }  public void run() {  final String name = "B-small";    in = new Scanner(System.in);  out = new PrintWriter(System.out);     String s = in.next().trim();  int n = s.length();  boolean[][] a = new boolean[n][n];  for (int i = 0; i < n; ++i)  for (int j = i + 1; j < n; ++j)   a[i][j] = (s.charAt(i) == s.charAt(j));  int max = 0;  for (int i = 0; i < n; ++i)  for (int j = i + 1; j < n; ++j)  {   int k =0;   while (i + k < n && j + k < n && a[i + k][j + k])    ++k;     if (max < k)    max = k;  }   out.println(max);  out.flush(); } }
4	public class D {  private static void run() throws IOException {   int n = in.nextInt();   int m = in.nextInt();   int p = in.nextInt();   int[] dx = {1, -1, 0, 0};   int[] dy = {0, 0, 1, -1};   int[][][] map = new int[n][m][4];   ArrayList<Edge> edges = new ArrayList<>();   for (int i = 0; i < n; i++) {    for (int j = 0; j < m - 1; j++) {     int len = in.nextInt();     edges.add(new Edge(new Point[]{new Point(i, j), new Point(i, j + 1)}, len));     map[i][j][2] = map[i][j + 1][3] = len;    }   }   for (int i = 0; i < n - 1; i++) {    for (int j = 0; j < m; j++) {     int len = in.nextInt();     edges.add(new Edge(new Point[]{new Point(i, j), new Point(i + 1, j)}, len));     map[i][j][0] = map[i + 1][j][1] = len;    }   }   if (p % 2 != 0) {    int[] ans = new int[m];    for (int i = 0; i < m; i++) {     ans[i] = -1;    }    for (int i = 0; i < n; i++) {     print_array(ans);    }    return;   }   edges.sort(Comparator.comparingInt(o -> o.len));   int[][][] dp = new int[2][n][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     int min = Integer.MAX_VALUE;     for (int k = 0; k < 4; k++) {      if (map[i][j][k] == 0) continue;      min = Math.min(min, map[i][j][k]);     }     dp[1][i][j] = min * 2;    }   }   for (int k = 2; k <= p / 2; k++) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      dp[k & 1][i][j] = Integer.MAX_VALUE;      for (int d = 0; d < 4; d++) {       int nx = i + dx[d];       int ny = j + dy[d];       if (nx < 0 || nx >= n || ny < 0 || ny >= m) continue;       dp[k & 1][i][j] = Math.min(dp[(k - 1) & 1][nx][ny] + map[i][j][d] * 2, dp[k&1][i][j]);      }     }    }   }   for (int i = 0; i < n; i++) {    print_array(dp[(p / 2) & 1][i]);   }  }  static class Edge {   Point[] points;   int len;   public Edge(Point[] points, int len) {    this.points = points;    this.len = len;   }  }  static class Point {   final int x, y;   public Point(int x, int y) {    this.x = x;    this.y = y;   }  }  public static void main(String[] args) throws IOException {   in = new Reader();   out = new PrintWriter(new OutputStreamWriter(System.out));     run();   out.flush();   in.close();   out.close();  }  private static int gcd(int a, int b) {   if (a == 0 || b == 0)    return 0;   while (b != 0) {    int tmp;    tmp = a % b;    a = b;    b = tmp;   }   return a;  }  static final long mod = 1000000007;  static long pow_mod(long a, long b) {   long result = 1;   while (b != 0) {    if ((b & 1) != 0) result = (result * a) % mod;    a = (a * a) % mod;    b >>= 1;   }   return result;  }  private static long multiplied_mod(long... longs) {   long ans = 1;   for (long now : longs) {    ans = (ans * now) % mod;   }   return ans;  }  @SuppressWarnings("FieldCanBeLocal")  private static Reader in;  private static PrintWriter out;  private static void print_array(int[] array) {   for (int now : array) {    out.print(now);    out.print(' ');   }   out.println();  }  private static void print_array(long[] array) {   for (long now : array) {    out.print(now);    out.print(' ');   }   out.println();  }  static class Reader {   private static final int BUFFER_SIZE = 1 << 16;   private final DataInputStream din;   private final byte[] buffer;   private int bufferPointer, bytesRead;   Reader() {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public String readLine() throws IOException {    final byte[] buf = new byte[1024];    int cnt = 0, c;    while ((c = read()) != -1) {     if (c == '\n') {      break;     }     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }   public int nextSign() throws IOException {    byte c = read();    while ('+' != c && '-' != c) {     c = read();    }    return '+' == c ? 0 : 1;   }   private static boolean isSpaceChar(int c) {    return !(c >= 33 && c <= 126);   }   public int skip() throws IOException {    int b;       while ((b = read()) != -1 && isSpaceChar(b)) {     ;    }    return b;   }   public char nc() throws IOException {    return (char) skip();   }   public String next() throws IOException {    int b = skip();    final StringBuilder sb = new StringBuilder();    while (!isSpaceChar(b)) {     sb.appendCodePoint(b);     b = read();    }    return sb.toString();   }   public int nextInt() throws IOException {    int ret = 0;    byte c = read();    while (c <= ' ') {     c = read();    }    final boolean neg = c == '-';    if (neg) {     c = read();    }    do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (neg) {     return -ret;    }    return ret;   }   public long nextLong() throws IOException {    long ret = 0;    byte c = read();    while (c <= ' ') {     c = read();    }    final boolean neg = c == '-';    if (neg) {     c = read();    }    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg) {     return -ret;    }    return ret;   }   public double nextDouble() throws IOException {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ') {     c = read();    }    final boolean neg = c == '-';    if (neg) {     c = read();    }    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (c == '.') {     while ((c = read()) >= '0' && c <= '9') {      ret += (c - '0') / (div *= 10);     }    }    if (neg) {     return -ret;    }    return ret;   }   private void fillBuffer() throws IOException {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1) {     buffer[0] = -1;    }   }   private byte read() throws IOException {    if (bufferPointer == bytesRead) {     fillBuffer();    }    return buffer[bufferPointer++];   }   public void close() throws IOException {    din.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; }  private static 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); } }
4	public class Arbuz {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   String s = sc.next();   int i, j, current, longest = 0;   for (i = 0; i < s.length(); i++) {    for (j = 0; j < s.length(); j++) {     if (i != j) {      int ti = i, tj = j;      current = 0;      while (ti < s.length() && tj < s.length() && s.charAt(ti) == s.charAt(tj)) {       current++;       ti++;       tj++;      }      if (current > longest) {       longest = current;      }     }    }   }   System.out.println(longest);  } }
2	public class acm {  public static BigInteger n;  public static BigInteger TWO = new BigInteger("2");  public static BigInteger solve(BigInteger x, BigInteger y, BigInteger c)  {   BigInteger res = (c.add(BigInteger.ONE)).multiply(c.add(BigInteger.ONE));   res = res.add(c.multiply(c));   BigInteger k;        k = c.subtract(x.subtract(BigInteger.ONE));   if(k.compareTo(BigInteger.ZERO) > 0)    res = res.subtract(k.multiply(k));      k = c.subtract(y.subtract(BigInteger.ONE));   if(k.compareTo(BigInteger.ZERO) > 0)    res = res.subtract(k.multiply(k));      k = c.subtract(n.subtract(x));   if(k.compareTo(BigInteger.ZERO) > 0)    res = res.subtract(k.multiply(k));      k = c.subtract(n.subtract(y));   if(k.compareTo(BigInteger.ZERO) > 0)    res = res.subtract(k.multiply(k));      k = c.subtract(x.add(y).subtract(BigInteger.ONE));   if(k.compareTo(BigInteger.ZERO) > 0)    res = res.add(k.multiply(k.add(BigInteger.ONE)).divide(TWO));      k = c.subtract(x.add(n).subtract(y));   if(k.compareTo(BigInteger.ZERO) > 0)    res = res.add(k.multiply(k.add(BigInteger.ONE)).divide(TWO));      k = c.subtract(y.add(n).subtract(x));   if(k.compareTo(BigInteger.ZERO) > 0)    res = res.add(k.multiply(k.add(BigInteger.ONE)).divide(TWO));      k = c.subtract(n.subtract(x).add(n.subtract(y)).add(BigInteger.ONE));   if(k.compareTo(BigInteger.ZERO) > 0)    res = res.add(k.multiply(k.add(BigInteger.ONE)).divide(TWO));    return res;  }   public static void main(String[] args)  {TWO = new BigInteger("2");   Scanner in = new Scanner(System.in);   n = new BigInteger(in.next());   BigInteger x = new BigInteger(in.next());   BigInteger y = new BigInteger(in.next());   BigInteger c = new BigInteger(in.next());      BigInteger left = new BigInteger("0");   BigInteger right = new BigInteger("1000000000000");   while(left.compareTo(right) < 0)   {    BigInteger val = left.add(right).divide(TWO);    if(solve(x, y, val).compareTo(c) >= 0)     right = val;    else     left = val.add(BigInteger.ONE);   }   System.out.println(left);  } }
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();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  }  static class Reader {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;    public Reader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public Reader(String file_name) throws IOException   {    din = new DataInputStream(     new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public String readLine() throws IOException   {    byte[] buf = new byte[64];    int cnt = 0, c;    while ((c = read()) != -1) {     if (c == '\n') {      if (cnt != 0) {       break;      }      else {       continue;      }     }     buf[cnt++] = (byte)c;    }    return new String(buf, 0, cnt);   }    public int nextInt() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ') {     c = read();    }    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');     if (neg)     return -ret;    return ret;   }    public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }    public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();     do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');     if (c == '.') {     while ((c = read()) >= '0' && c <= '9') {      ret += (c - '0') / (div *= 10);     }    }     if (neg)     return -ret;    return ret;   }    private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0,         BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }    private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }    public void close() throws IOException   {    if (din == null)     return;    din.close();   }  }   }
0	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   if ((n%4==0)||(n%7==0)||(n%44==0)||(n%47==0)||(n%74==0)||(n%77==0)||(n%444==0)||(n%447==0)||(n%474==0)||(n%477==0)||(n%744==0)||(n%747==0)||(n%774==0)||(n%777==0)) {    System.out.println("YES");   } else {    System.out.println("NO");   }  } }
5	public class Flatwile {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int t = sc.nextInt();   int[] c = new int[n];   int[] a = new int[n];   for (int i=0; i<n; i++){    c[i] = sc.nextInt();    a[i] = sc.nextInt();   }   sort(c, a);   int res = 1;   double prev = Integer.MIN_VALUE;   for(int i=0; i<c.length; i++){    if (c[i]-a[i]/2d - prev >=t){     res++;    }    if (i!=c.length-1 && c[i+1]-a[i+1]/2d-(c[i]+a[i]/2d)>t ){     res++;    }    prev = c[i] +a[i]/2d;   }   System.out.println(res);  }  private static void sort(int[] a, int[] b){   for(int i=0; i<a.length; i++){    for(int j=i+1; j<a.length; j++){     if (a[i]>a[j]){      swap(a, i, j);      swap(b, i, j);     }    }   }  }  private static void swap(int[] a, int i, int j) {   int t = a[i];   a[i] = a[j];   a[j] = t;  } }
3	public class Main3 implements Runnable {  public static void main(String[] args) {   new Thread(null, new Main3(), "", 128 * 1024 * 1024).start();  }  private static Scanner in = new Scanner(System.in);  public void run() {   int n = in.nextInt();   int m = 1_000_000_007;   boolean[] state = new boolean[n];   for (int i = 0; i < n; i++) {    state[i] = in.next().equals("f");   }     long[][] dp = new long[n][n + 1];   dp[0][0] = 1;     for (int i = 0; i < n - 1; i++) {    if (state[i]) {         for (int j = 0; j < n - 1; j++) {      dp[i + 1][j + 1] = dp[i][j];     }    } else {         for (int j = n - 1; j >= 0; j--) {           dp[i + 1][j] = (dp[i][j] + dp[i + 1][j + 1]) % m;     }    }   }   long sum = 0;   for (int i = 0; i < n; i++) {    sum += dp[n - 1][i] % m;   }   System.out.println(sum % m);  } }
3	public class typeA { public static void main(String[] args) {  FastReader s = new FastReader();  int n = s.nextInt();  int[] arr = new int[n];  for(int i=0;i<n;i++) {  arr[i]=s.nextInt();  }  boolean[] arr2 = new boolean[n];  Arrays.sort(arr);  for(int i=0;i<arr2.length;i++) {  arr2[i]=true;  }   for(int i=0;i<n-1;i++) {  for(int j=i+1;j<n;j++) {   if(arr[j]%arr[i]==0) {    arr2[j]=false;   }   }  }  int count=0;  for(int i=0;i<n;i++) {  if(arr2[i]==true) {   count++;  }  }  System.out.println(count); } 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());   }    double nextDouble()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  }  }
3	public class C {  static int MOD = 1_000_000_007;  public static void main(String[] args) {   MyScanner in = new MyScanner();   PrintWriter out = new PrintWriter(System.out);   int n = in.nextInt();   char prev = ' ';      int[][] dp = new int[n+1][n+2];   dp[0][0] = 1;   for(int i=0;i<n;++i){    char ch = in.next().charAt(0);    if(prev == 's'){     int sum = 0;     for(int j=n;j>=0;--j){      sum = (sum + dp[i-1][j]) % MOD;      dp[i][j] = sum;     }    }else if(prev == 'f'){     for(int j=0;j<n;++j){      dp[i][j+1] = dp[i-1][j];     }    }    prev = ch;   }   int result = 0;   for(int i=0;i<=n;++i){    result = (result + dp[n-1][i]) % MOD;   }    out.println(result);   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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  }   }
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);  } }
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)]);  } }
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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  }  private static final FastReader scanner = new FastReader();  private static 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 void run() {   int t = scanner.nextInt();   for (int i = 0; i < t; i++) {    solve();   }   out.close();  }    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;  }   private static 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 C817{  void solve() {  long n = nl(), s = nl();  long l = 0, r = n;  while(l < r)  {  long mid = (l + r)/2;  if(mid - digSum(mid) < s)   l = mid + 1;  else   r = mid;  }  out.println(l - digSum(l) >= s ? (n - l + 1) : 0); }  int digSum(long k) {  int sum = 0;  while(k != 0)  {  sum += k % 10;  k /= 10;  }  return sum; }  public static void main(String[] args){new C817().run();}  private byte[] bufferArray = new byte[1024]; private int bufLength = 0; private int bufCurrent = 0; InputStream inputStream; PrintWriter out;  public void run() {  inputStream = System.in;  out = new PrintWriter(System.out);  solve();  out.flush(); }  int nextByte() {  if(bufLength==-1)  throw new InputMismatchException();  if(bufCurrent>=bufLength)  {  bufCurrent = 0;  try  {bufLength = inputStream.read(bufferArray);}  catch(IOException e)  { throw new InputMismatchException();}  if(bufLength<=0)   return -1;  }  return bufferArray[bufCurrent++]; }  boolean isSpaceChar(int x) {return (x<33 || x>126);}  boolean isDigit(int x) {return (x>='0' && x<='9');}  int nextNonSpace() {  int x;  while((x=nextByte())!=-1 && isSpaceChar(x));  return x; }  int ni() {  long ans = nl();  if ( Integer.MIN_VALUE <= ans && ans <= Integer.MAX_VALUE )  return (int)ans;  throw new InputMismatchException(); }  long nl() {  long ans = 0;  boolean neg = false;  int x = nextNonSpace();  if(x=='-')  {  neg = true;  x = nextByte();  }  while(!isSpaceChar(x))  {  if(isDigit(x))  {   ans = ans*10 + x -'0';   x = nextByte();  }  else   throw new InputMismatchException();  }  return neg ? -ans:ans; }  String ns() {  StringBuilder sb = new StringBuilder();  int x = nextNonSpace();  while(!isSpaceChar(x))  {  sb.append((char)x);  x = nextByte();  }  return sb.toString(); }  char nc() { return (char)nextNonSpace();}  double nd() { return (double)Double.parseDouble(ns()); }  char[] ca() { return ns().toCharArray();}  char[] ca(int n) {  char[] ans = new char[n];  int p =0;  int x = nextNonSpace();  while(p<n)  {  ans[p++] = (char)x;  x = nextByte();  }  return ans; }  int[] ia(int n) {  int[] ans = new int[n];  for(int i=0;i<n;i++)  ans[i]=ni();  return ans; }  }
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 long nextLong() {return Long.parseLong(next());}   public double nextDouble() {return Double.parseDouble(next());}   public String nextLine() {    String line = "";    if(st.hasMoreTokens()) line = st.nextToken();    else try {return br.readLine();}catch(IOException e){e.printStackTrace();}    while(st.hasMoreTokens()) line += " "+st.nextToken();    return line;   }  }  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();  } }
0	public class A {  ArrayList<Integer> list = new ArrayList<Integer>();     boolean valid(int n) {   Queue<Integer> q = new LinkedList<Integer>();   q.add(4);   q.add(7);   int crnt;   while(!q.isEmpty()) {    crnt = q.poll();    if(n%crnt == 0) return true;    if ( crnt*10 + 4 <= 1000 ) q.add(crnt*10 + 4);    if ( crnt*10 + 7 <= 1000 ) q.add(crnt*10 + 7);   }   return false;  }   void dfs(int n){   if(n>1000)return;   if(n!=0)list.add(n);   n = n*10;   dfs(n+4);   dfs(n+7);  }  void run() {   Scanner s = new Scanner(System.in);   int n = s.nextInt();   if (valid(n)) {    System.out.println("YES");   } else {    System.out.println("NO");   }  }  public static void main(String[] args) {   new A().run();  } }
6	public class Main{  static long dp[][][][]=new long [16][16][16][4];  static void ini() {  for(int i=0;i<16;i++) {   for(int j=0;j<16;j++) {   for(int k=0;k<16;k++) {    for(int l=0;l<4;l++) {    dp[i][j][k][l]=-1L;    }   }   }  }  }  static int chk(long i) {  if(i==0L)   return 1;  else   return 0;  }  static long f(long a,long b,long c,int taken) {  int got=(int) (a+b+c);  int have=chk(a)+chk(b)+chk(c);  if(have==2) {  if(got==1)   return 1L;  else   return 0L;  }  if(dp[(int) a][(int) b][(int) c][taken]!=-1) {  return dp[(int) a][(int) b][(int) c][taken];  }  long ans=0L;  if(taken == 0) {   if(a!=0)   ans+=(a*f(a-1,b,c,1))%mod; ans%=mod;   if(b!=0)   ans+=(b*f(a,b-1,c,2))%mod; ans%=mod;   if(c!=0)   ans+=(c*f(a,b,c-1,3))%mod; ans%=mod;  }  else {   ans+=((taken==1 || a==0)?0L:(a*f(a-1,b,c,1))%mod)%mod; ans%=mod;   ans+=((taken==2 || b==0)?0L:(b*f(a,b-1,c,2))%mod)%mod; ans%=mod;   ans+=((taken==3 || c==0)?0L:(c*f(a,b,c-1,3))%mod)%mod; ans%=mod;  }  dp[(int) a][(int) b][(int) c][taken]=ans;  return ans;  } public static void main(String[] args)  {   InputReader in=new InputReader(System.in);   PrintWriter pw = new PrintWriter(System.out);   int n=in.nextInt();   int total=in.nextInt();   int t[]=new int[n];   int g[]=new int[n];   for(int i=0;i<n;i++) {   t[i]=in.nextInt();   g[i]=in.nextInt();   }   long ans=0L;   for(int i=0;i<(1<<n);i++) {   int sum=0;   int a[]=new int[4];   for(int j=0;j<n;j++) {       if(((i>>j)&1)==1) {    sum+=t[j];    a[g[j]]++;    }   }   if(sum==total) {    ini();    ans=(ans+f(a[1],a[2],a[3],0))%mod;   }   }   pw.println(ans);   pw.flush();   pw.close();        }   private static void debug(Object... o) {   System.out.println(Arrays.deepToString(o));   }   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 int[] nextIntArray(int n)   {    int a[] = new int[n];    for (int i = 0; i < n; i++)    {     a[i] = nextInt();    }    return a;   }   static class tri implements Comparable<tri> {    int p, c, l;     tri(int p, int c, int l) {     this.p = p;     this.c = c;     this.l = l;    }     public int compareTo(tri o) {     return Integer.compare(l, o.l);    }   }    public String readString()   {    int c = snext();    while (isSpaceChar(c))    {     c = snext();    }    StringBuilder res = new StringBuilder();    do    {     res.appendCodePoint(c);     c = snext();    } while (!isSpaceChar(c));    return res.toString();   }    public String nextLine()   {    int c = snext();    while (isSpaceChar(c))     c = snext();    StringBuilder res = new StringBuilder();    do    {     res.appendCodePoint(c);     c = snext();    } while (!isEndOfLine(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;   }    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[] suffle(int[] a,Random gen)   {    int n = a.length;    for(int i=0;i<n;i++)    {     int ind = gen.nextInt(n-i)+i;     int temp = a[ind];     a[ind] = a[i];     a[i] = temp;    }    return a;   }     public static void swap(int a, int b){    int temp = a;    a = b;    b = temp;   }          public static void sieve(boolean[] isPrime,int n)   {    for(int i=1;i<n;i++)     isPrime[i] = true;       isPrime[0] = false;    isPrime[1] = false;       for(int i=2;i*i<n;i++)    {     if(isPrime[i] == true)     {      for(int j=(2*i);j<n;j+=i)       isPrime[j] = false;     }    }   }     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 long LCM(long a,long b)   {    return (a*b)/GCD(a,b);   }     public static int LCM(int a,int b)   {    return (a*b)/GCD(a,b);   }     public static int binaryExponentiation(int x,int n)   {    int result=1;    while(n>0)    {     if(n % 2 ==1)      result=result * x;     x=x*x;     n=n/2;    }    return result;   }     public static long binaryExponentiation(long x,long n)   {    long result=1;    while(n>0)    {     if(n % 2 ==1)      result=result * x;     x=x*x;     n=n/2;    }    return result;   }     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%M*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%M * x%M)%M;     x=(x%M * x%M)%M;     n=n/2;    }    return result;   }     public static long modInverse(int A,int M)   {    return modularExponentiation(A,M-2,M);   }     public static long modInverse(long A,long M)   {    return modularExponentiation(A,M-2,M);   }     public static boolean isPrime(int n)   {       if (n <= 1) return false;    if (n <= 3) return true;       if (n%2 == 0 || n%3 == 0)     return false;       for (int i=5; i*i<=n; i=i+6)    {     if (n%i == 0 || n%(i+2) == 0)      return false;    }       return true;   }      public static long[] shuffle(long[] a, Random gen){     for(int i = 0, n = a.length;i < n;i++){      int ind = gen.nextInt(n-i)+i;      long d = a[i];      a[i] = a[ind];      a[ind] = d;     }     return a;    }   static class pair implements Comparable<pair>{    Long x;    Long y;    Integer z;    pair(long l,long y2,int z){     this.x=l;     this.y=y2;     this.z=z;    }    public int compareTo(pair o) {      int result = x.compareTo(o.x);      if(result==0)       result = y.compareTo(o.y);           return result;     }     public String toString(){     return (x+" "+y);    }   }      }
0	public class Task267A {  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++]);  }  String next() throws IOException {  if (cacheIndex >= cache.length) {   cache = br.readLine().split(" ");   cacheIndex = 0;  }  return 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);   int n = sc.nextInt();   while (n-- > 0) {   int ai = sc.nextInt();   int bi = sc.nextInt();   int retVal = 0;   while (ai > 0 && bi > 0) {   if (ai > bi) {    retVal += ai / bi;    ai = ai % bi;   } else {    retVal += bi / ai;    bi = bi % ai;   }   }   pw.println(retVal);  }   pw.flush();  sc.close();  } } }
0	public class Main {  private static BufferedReader in; private static 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)); } }
1	public class pr1073B {  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[] a = new int[n];   int[] b = new int[n];   StringTokenizer st = new StringTokenizer(br.readLine());   for (int i = 0; i < n; i++) {    a[i] = Integer.parseInt(st.nextToken());   }   st = new StringTokenizer(br.readLine());   for (int i = 0; i < n; i++) {    b[i] = Integer.parseInt(st.nextToken());   }   solve(n, a, b, out);   out.flush();   out.close();  }  private static void solve(int n, int[] a, int[] b, PrintWriter out) {   boolean[] book = new boolean[n+1];   boolean f;   int j1 = 0, j2 = 0;   for (int i = 0; i < n; i++) {    f = false;    int num = b[i];    if(!book[num]) {     f = true;     j1 = j2;     for (;j2 < n; j2++) {      book[a[j2]] = true;      if (a[j2] == num) {       j2++;       break;      }     }    }    out.print(f ? j2-j1 + " ": 0 + " ");   }  } }
1	public class A implements Runnable{  BufferedReader in;  PrintWriter out;  StringTokenizer st;  public static final String filename = "";  public void solve() throws IOException{   int n = nextInt();   int[] a = new int[n + 1];   ArrayList<Integer> pr = new ArrayList<Integer>();     for(int i = 2;i < n + 1;i ++){    if(a[i] != 0)continue;    pr.add(i);    for(int j = 2 * i;j < n + 1;j += i){     a[j] = 1;    }   }   int k = nextInt();   for(int i = 2;i < n + 1;i ++){    if(a[i] != 0)continue;    for(int j = 1;j < pr.size();j ++){     if(i == pr.get(j) + pr.get(j - 1) + 1){      k --;      break;     }    }   }   if(k > 0){    out.println("NO");    return;   }   out.println("YES");  }  public void run(){   try{    Locale.setDefault(Locale.US);    in = new BufferedReader(new InputStreamReader(System.in));       out = new PrintWriter(System.out);       st = new StringTokenizer("");    solve();    out.close();   } catch(IOException e){    throw new RuntimeException(e);   }  }  public static void main(String[] args){   new Thread(new A()).start();  }  public String nextToken() throws IOException{   while(!st.hasMoreTokens()){    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  public int nextInt() throws IOException{   return Integer.parseInt(nextToken());  }  public double nextDouble() throws IOException{   return Double.parseDouble(nextToken());  } }
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;  } }
4	public class x1523C {  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[] arr = new int[N];    for(int i=0; i < N; i++)     arr[i] = Integer.parseInt(infile.readLine());    ArrayList<Integer>[] buckets = new ArrayList[N];    buckets[0] = new ArrayList<Integer>();    buckets[0].add(arr[0]);       for(int i=1; i < N; i++)    {     ArrayList<Integer> ls = new ArrayList<Integer>();     if(arr[i] == 1)     {      for(int x: buckets[i-1])       ls.add(x);      ls.add(1);     }     else     {      int dex = -1;      for(int a=0; a < buckets[i-1].size(); a++)       if(buckets[i-1].get(a) == arr[i]-1)        dex = a;      for(int a=0; a < dex; a++)       ls.add(buckets[i-1].get(a));      ls.add(arr[i]);     }     buckets[i] = ls;    }       for(int a=0; a < N; a++)    {     for(int i=0; i < buckets[a].size()-1; i++)     {      sb.append(buckets[a].get(i));      sb.append(".");     }     sb.append(arr[a]);     sb.append("\n");    }   }   System.out.print(sb);  } }
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(); } }
1	public class two {  public static void main(String[] args) throws IOException, FileNotFoundException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));    HashSet<Integer> good = new HashSet<>();  int i=1;  for (; i<= (int)(1e9);) {  i <<= 1;  good.add(i);  }   for (i=3; i*i*2 <= (int)(1e9); i++) {  good.add(i*i*2);  }   int beg = 4;  for (i=3; beg + i*4 <= (int)(1e9); i+=2) {  good.add(beg + i*4);  beg += i*4;  }   int t = Integer.parseInt(in.readLine());  while (t-- > 0) {  int n = Integer.parseInt(in.readLine());  if (good.contains(n)) {   System.out.println("YES");  }  else {   System.out.println("NO");  }    }  } }
1	public class Main implements Runnable {  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private SpaceCharFilter filter;   private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));    public InputReader(InputStream stream) {    this.stream = stream;   }     public int read() {    if (numChars==-1)     throw new InputMismatchException();       if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     }     catch (IOException e) {      throw new InputMismatchException();     }         if(numChars <= 0)          return -1;    }    return buf[curChar++];   }     public String nextLine() {    String str = "";    try {     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }   public int nextInt() {    int c = read();       while(isSpaceChar(c))     c = read();       int sgn = 1;       if (c == '-') {     sgn = -1;     c = read();    }       int res = 0;    do {     if(c<'0'||c>'9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));        return res * sgn;   }     public long nextLong() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;       do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));     return res * sgn;   }     public double nextDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, nextInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, nextInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }     public String readString() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    }    while (!isSpaceChar(c));       return res.toString();   }     public boolean isSpaceChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }     public String next() {    return readString();   }     public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  public static void main(String args[]) throws Exception {   new Thread(null, new Main(),"Main",1<<26).start();  }  public void run() {   InputReader sc = new InputReader(System.in);   PrintWriter w = new PrintWriter(System.out);    int n = sc.nextInt();   long d = sc.nextLong();   long a[] = new long[n];   for(int i = 0; i < n; ++i)    a[i] = sc.nextLong();   int ans = 0;   for(int i = 1; i < n; ++i) {    if(a[i] - a[i - 1] > 2 * d)     ans += 2;    else if(a[i] - a[i - 1] == 2 * d)     ans++;   }   ans += 2;   w.print(ans);   w.close();   } }
5	public class Test {  public static void main(String[] args)  {  Scanner t = new Scanner(System.in);  int n=t.nextInt();  int a[]= new int[n];  for(int i=0; i<n; i++)   a[i]=t.nextInt();  Arrays.sort(a);  int r=a[0];  for(int i=1; i<n; i++)   if(a[i]!=r)   {    System.out.println(a[i]);    System.exit(0);   }  System.out.println("NO");    } }
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);  } }
1	public class C {  MyScanner in;  PrintWriter out;  public static void main(String[] args) throws Exception {   new C().run();  }  public void run() throws Exception {   in = new MyScanner();   out = new PrintWriter(System.out);   solve();   out.close();  }  public void solve() throws Exception {   int n = in.nextInt();   char[] a = in.next().toCharArray();   int h = 0;   for (int i = 0; i < a.length; i++) {    if (a[i] == 'H') h++;   }   char[] b = new char[2 * a.length - 1];   for (int i = 0; i < b.length; i++) {    b[i] = a[i % a.length];   }   int maxh = 0;   int hh = 0;   for (int i = 0; i < b.length - h; i++) {    hh = 0;    for (int j = 0; j < h; j++) {     if (b[i + j] == 'H') hh++;    }    maxh = Math.max(maxh, hh);   }        out.println(h - maxh);  }  class MyScanner {   BufferedReader br;   StringTokenizer st;   public MyScanner() throws Exception {    br = new BufferedReader(new InputStreamReader(System.in));   }   String next() throws Exception {    if ((st == null) || (!st.hasMoreTokens())) {     st = new StringTokenizer(br.readLine());    }    return st.nextToken();   }   int nextInt() throws Exception {    return Integer.parseInt(next());   }   double nextDouble() throws Exception {    return Double.parseDouble(next());   }   boolean nextBoolean() throws Exception {    return Boolean.parseBoolean(next());   }   long nextLong() throws Exception {    return Long.parseLong(next());   }  } }
5	public class A {  public static void main(String[] args) {  try {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));    String[] s = in.readLine().split(" ");  int n = Integer.parseInt(s[0]);  int t = Integer.parseInt(s[1]) * 2;    int[] walls = new int[n*2];     for (int i=0; i<n; i++)  {   s = in.readLine().split(" ");   int x = Integer.parseInt(s[0]) * 2;   int a = Integer.parseInt(s[1]);   walls[i*2] = x-a;   walls[i*2+1] = x+a;  }    Arrays.sort(walls);    int count = 2;    for (int i=1; i<n*2-2; i+=2) {   int space = walls[i+1] - walls[i];   if ( space == t)   count += 1;   else if ( space > t)   count += 2;  }    System.out.println (count);  } catch (NumberFormatException e) {  throw new RuntimeException(e);  } catch (IOException e) {  throw new RuntimeException(e);  }  } }
5	public class ProblemA {  static ArrayList<Point2> houses = new ArrayList<Point2>();   public static void main(String[] args) {   ProblemA a = new ProblemA();   Scanner in = new Scanner(System.in);   while(in.hasNextInt()){    int n = in.nextInt();    double t = in.nextDouble();    for (int k=0;k<n;k++){     houses.add(a.new Point2(in.nextDouble(),in.nextDouble()));    }    Collections.sort(houses);    int ans = 2;    for (int k=0;k<n-1;k++){     Point2 cur = houses.get(k);     Point2 next = houses.get(k+1);     double dist = (next.x - next.y/2) - (cur.x + cur.y/2);     if (dist == t) ans ++;     if (dist > t ) ans+=2;    }    System.out.println(ans);   }  }   public class Point2 implements Comparable<Point2>{   public double x;   public double y;   public Point2(double one, double two){    x = one;    y = two;   }     public int compareTo(Point2 other){    if (x - other.x > 0) return 1;    if (x - other.x < 0) return -1;    return 0;   }     public String toString(){    return "x:" + x + " y:" + y;   }  } }
2	public class PipelineRedo { public static void main(String[] args){  FastScanner sc = new FastScanner();  long n = sc.nextLong() - 1;  long k = sc.nextInt() - 1;   if(n==0){  System.out.println(0);  return;  }else if(n <= k){  System.out.println(1);  return;  }else if(n > k*(k+1)/2){  System.out.println(-1);  return;  }         long rightSum = k*(k+1)/2;  long lo = 1;  long hi = k;  while(lo < hi){  long mid = lo + (hi-lo+1)/2;  long val = rightSum - mid*(mid-1)/2;    if(val <= n){   hi = mid -1;  }else{   lo = mid;  }  }      if(rightSum - (lo+1)*(lo)/2 == n){  System.out.println(k - (lo+1) + 1);  }else{  System.out.println(1 + (k - (lo+1) + 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());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  } } }
1	public class Test {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   String s = in.readLine();   String[] p = in.readLine().split(" ");   List<Integer> a = new ArrayList<Integer>();   for (String k : p) {    a.add(Integer.parseInt(k));   }   int n = a.size();   int c1 = 0;   int c2 = 0;   int c1p = 0;   int c2p = 0;   for (int i = 0; i < n; i++) {    if (a.get(i) % 2 == 0) {     c1++;     c1p = i;    } else {     c2++;     c2p = i;    }   }   if (c1 < c2) {    System.out.println(c1p + 1);   } else {    System.out.println(c2p + 1);   }  }  }
6	public class Main { static class TaskAdapter implements Runnable {  @Override  public void run() {  long startTime = System.currentTimeMillis();  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FastReader in = new FastReader(inputStream);  Output out = new Output(outputStream);  EKeyboardPurchase solver = new EKeyboardPurchase();  solver.solve(1, in, out);  out.close();  System.err.println(System.currentTimeMillis()-startTime+"ms");  } }  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 {  final private 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();  }  }  } }
5	public class Main{   BufferedReader in;   StringTokenizer str = null;   PrintWriter out;   private String next() throws Exception{     if (str == null || !str.hasMoreTokens())       str = new StringTokenizer(in.readLine());     return str.nextToken();   }     private int nextInt() throws Exception{     return Integer.parseInt(next());   }     private long nextLong() throws Exception{     return Long.parseLong(next());   }     private double nextDouble() throws Exception{     return Double.parseDouble(next());   }   public void run() throws Exception{     in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);     int n = nextInt();     HashSet<Integer> hs = new HashSet<Integer>();     for(int i=0;i<n;i++) hs.add(nextInt());     if (hs.size() == 1){     out.println("NO");     out.close();     return;     }     int a[] = new int[hs.size()];     int yk = 0;     for(int i:hs) a[yk++] = i;     Arrays.sort(a);     out.println(a[1]);     out.close();   }   public static void main(String args[]) throws Exception{     new Main().run();   } }
1	public class B implements Runnable {  void Solution() throws IOException {  int n = nextInt(), k = nextInt();  int[] mas = new int[n];  for (int i = 0; i < n; i++)  mas[i] = nextInt();  int l = 0, r = 0;  HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();  map.put(mas[l], 1);  int cur = 1;  while (true) {  if (cur == k) {   print(l + 1, r + 1);   return;  }  r++;  if (r >= n)   break;  int kol = map.containsKey(mas[r]) ? map.remove(mas[r]) : 0;  if (kol == 0) {   cur++;   map.put(mas[r], 1);  } else   map.put(mas[r], kol + 1);  while (true) {   kol = map.remove(mas[l]);   if (kol == 1) {   map.put(mas[l], 1);   break;   } else   map.put(mas[l++], kol - 1);  }  }  print(-1, -1); }  public static void main(String[] args) {  new B().run(); }  BufferedReader in; PrintWriter out; StringTokenizer tokenizer;  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  Solution();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(0);  } }  void print(Object... obj) {  for (int i = 0; i < obj.length; i++) {  if (i != 0)   out.print(" ");  out.print(obj[i]);  } }  void println(Object... obj) {  print(obj);  out.println(); }  void halt() {  out.close();  System.exit(0); }  String nextLine() throws IOException {  return in.readLine(); }  String next() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens())  tokenizer = new StringTokenizer(nextLine());  return tokenizer.nextToken(); }  int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(next()); }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next()); }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(next()); } }
5	public class test {  public static void main(String[] args) {  new test().run(); }  PrintWriter out = null;  void run() {  Scanner in = new Scanner(System.in);  out = new PrintWriter(System.out);  int n = in.nextInt();  int a = in.nextInt();  int b = in.nextInt();  int[] h = new int[n];  for (int i = 0; i < n; i++)  h[i] = in.nextInt();  Arrays.sort(h);  if (h[b] == h[b - 1])  out.println(0);  else  out.println(h[b] - h[b - 1]);  out.close(); } }
4	public class Main {  private static HashMap<String, Integer> nodes;  private static void dfs(String cur, PrintWriter out) {   if(cur.length() > 0) {    out.println(cur.substring(1));   }   int children = nodes.get(cur);   for(int i = 1; i <= children; i++) {    dfs(cur+"."+i, out);   }  }  public static void main(String[] args) throws IOException {          BufferedReader f = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   int t = Integer.parseInt(f.readLine());   while(t-- > 0) {    int n = Integer.parseInt(f.readLine());    nodes = new HashMap<>();    nodes.put("", 0);    String cur = "";    for(int i = 0; i < n; i++) {     int a = Integer.parseInt(f.readLine());     while(nodes.get(cur) != a-1) {      cur = cur.substring(0, cur.lastIndexOf("."));     }     nodes.put(cur, a);     cur = cur+"."+a;     nodes.put(cur, 0);    }    dfs("", out);   }   f.close();   out.close();  } }
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++)    outer: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 outer;     }   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;  }  }
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());  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } } }
3	public class P1141F {  static BufferedReader br; static BufferedWriter bw; static StringTokenizer st;  public static void main(String[] args) throws IOException {  br = new BufferedReader(new InputStreamReader(System.in));  bw = new BufferedWriter(new OutputStreamWriter(System.out));  int n = Integer.parseInt(br.readLine());  int[] a = new int[n];  int[][] b = new int[n][n];  HashMap<Integer, ArrayList<Integer>> map = new HashMap<Integer, ArrayList<Integer>>();   st = new StringTokenizer(br.readLine());  for(int i = 0; i < n; ++i) {  a[i] = Integer.parseInt(st.nextToken());    int r = i;  b[r][r] = a[r];  if (!map.containsKey(b[r][r]))   map.put(b[r][r], new ArrayList<Integer>());  for(int l = 0; l < r; ++l) {   b[l][r] = b[l][r-1] + a[r];   if (!map.containsKey(b[l][r]))   map.put(b[l][r], new ArrayList<Integer>());  }  }    for(int r = 0; r < n; ++r) {  for(int l = 0; l <= r; ++l) {   int sum = b[l][r];   ArrayList<Integer> intervals = map.get(sum);   int last_r = -1;   if(!intervals.isEmpty())   last_r = intervals.get(intervals.size()-1);     if(l > last_r) {   intervals.add(l);   intervals.add(r);   }     }  }     ArrayList<Integer> best_intervals = new ArrayList<Integer>();   for(Map.Entry<Integer, ArrayList<Integer>> entry : map.entrySet()) {    ArrayList<Integer> intervals = entry.getValue();    if(intervals.size() > best_intervals.size()) {   best_intervals = intervals;  }  }   bw.write(best_intervals.size()/2 + "\n");  for(int i = 0; i < best_intervals.size(); i += 2) {  bw.write((best_intervals.get(i)+1) + " " + (best_intervals.get(i+1)+1) + "\n");  }   br.close();  bw.close(); } }
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) {    public void run() {     try {      solve();     } catch (Exception e) {      e.printStackTrace();      System.exit(1);     }    }   }.start();  }  static int n,m,need,a[][],dp[][][],real[][];  static void solve() throws IOException  {     initIo(false);   StringBuilder sb = new StringBuilder();   int t = ni();   while(t-->0) {    n = ni();    m = ni();    a = new int[n][m];    for(int i=0;i<n;++i) {     for(int j=0;j<m;++j) {      a[i][j] = ni();     }    }    need = min(n,m);    Pair max_in_cols[] = new Pair[m];    for(int COL=0;COL<m;++COL) {     int max = 0;     for(int i=0;i<n;++i) {      max = max(max, a[i][COL]);     }     max_in_cols[COL] = new Pair(max, COL);    }    real = new int[n][need];    Arrays.sort(max_in_cols);    for(int i=0;i<need;++i) {     int COL = max_in_cols[m-1-i].y;     for(int j=0;j<n;++j) {      real[j][i] = a[j][COL];     }    }     dp = new int[need][n+1][(1<<n)];    for(int i=0;i<need;++i) {     for(int j=0;j<=n;++j) {      for(int k=0;k<(1<<n);++k) {       dp[i][j][k] = -1;      }     }    }    pl(f(0, n, 0));   }   pw.flush();   pw.close();  }  static int f(int idx, int bias, int mask) {     if(idx==need) {    return 0;   }   if(dp[idx][bias][mask]!=-1) {    return dp[idx][bias][mask];   }      if(bias==n) {    int max = 0;    for(int b=0;b<n;++b) {     max = max(max, f(idx, b, mask));    }       dp[idx][bias][mask] = max;    return max;   }   else {    int max = f(idx+1, n, mask);    for(int i=0;i<n;++i) {     if((mask&(1<<i))==0) {      max = max(max, real[(i-bias+n)%n][idx] + f(idx, bias, mask | (1<<i)));     }    }       dp[idx][bias][mask] = max;    return max;   }  }  static class Pair implements Comparable<Pair>  {   int x,y;   Pair(int x,int y)   {    this.x=x;    this.y=y;   }   public int compareTo(Pair other)   {    if(this.x!=other.x)     return this.x-other.x;    return this.y-other.y;   }   public String toString()   {    return "("+x+","+y+")";   }  }  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 long nl() throws IOException  {   return scan.nextLong();  }  static double nd() throws IOException  {   return scan.nextDouble();  }  static String ne() throws IOException  {   return scan.next();  }  static String nel() throws IOException  {   return scan.nextLine();  }  static void pl()  {   pw.println();  }  static void p(Object o)  {   pw.print(o+" ");  }  static void pl(Object o)  {   pw.println(o);  }  static void psb(StringBuilder sb)  {   pw.print(sb);  }  static void pa(String arrayName, Object arr[])  {   pl(arrayName+" : ");   for(Object o : arr)    p(o);   pl();  }  static void pa(String arrayName, int arr[])  {   pl(arrayName+" : ");   for(int o : arr)    p(o);   pl();  }  static void pa(String arrayName, long arr[])  {   pl(arrayName+" : ");   for(long o : arr)    p(o);   pl();  }  static void pa(String arrayName, double arr[])  {   pl(arrayName+" : ");   for(double o : arr)    p(o);   pl();  }  static void pa(String arrayName, char arr[])  {   pl(arrayName+" : ");   for(char o : arr)    p(o);   pl();  }  static void pa(String listName, List list)  {   pl(listName+" : ");   for(Object o : list)    p(o);   pl();  }  static void pa(String arrayName, Object[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(Object o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, int[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(int o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, long[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(long o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, char[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(char o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, double[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(double o : arr[i])     p(o);    pl();   }  }  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());   }  } }
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 { static void debug(Object... os) {  System.err.println(deepToString(os)); }  public static void main(String[] args) {  new Main().run(); }  void run() {  Scanner sc = new Scanner(System.in);  int n=sc.nextInt(),m=sc.nextInt();  boolean[][] bs=new boolean[n][n];  for (int i = 0; i < m; i++) {  int s=sc.nextInt()-1,t=sc.nextInt()-1;  bs[s][t] = bs[t][s] = true;  }  long res = 0;  for(int i=0;i<n;i++){  res += calc(bs,n-1-i);  }  System.out.println(res/2); } long calc(boolean[][] bs,int n){  long[][] dp=new long[1<<n][n];  for(int i=0;i<n;i++){  if(bs[i][n])   dp[1<<i][i] ++;  }  for(int i=1;i<1<<n;i++){  for(int j=0;j<n;j++)if(((i>>j)&1)==1)   for(int k=0;k<n;k++)if(((i>>k)&1)==0 && bs[j][k]){   dp[i|(1<<k)][k] += dp[i][j];   }  }  long res=0;  for(int i=0;i<1<<n;i++)for(int j=0;j<n;j++)if(Integer.bitCount(i)>=2&&bs[j][n])res+=dp[i][j];  return res; }  }
4	public class Solution {  private BufferedReader in; private PrintWriter out; private StringTokenizer st;  void solve() throws IOException {  String s = next();  HashSet<String> set = new HashSet<String>();  int ans = 0;  for (int i = 0; i < s.length(); ++i) {  for (int j = i + 1; j <= s.length(); ++j) {   String t = s.substring(i, j);   if (set.contains(t)) {   ans = Math.max(ans, t.length());   }   set.add(t);  }  }  out.println(ans); }  Solution() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   eat("");   solve();   in.close();  out.close(); }  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()); }  long nextLong() throws IOException {  return Long.parseLong(next()); }  double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static void main(String[] args) throws IOException {  new Solution(); } }
1	public class A { private static StreamTokenizer in; private static PrintWriter out;  private static int nextInt() throws Exception {  in.nextToken();  return (int) in.nval; }  private static String nextString() throws Exception {  in.nextToken();  return in.sval; }  public static void main(String[] args) throws Exception {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(System.out);   ArrayList<Integer> p = new ArrayList<Integer>();  ArrayList<Integer> o = new ArrayList<Integer>();   int n = nextInt();  for (int i=0; i<n; i++) {  int a = nextInt();  if (a % 2 == 0) p.add(i+1);  else o.add(i+1);  }   if (p.size() < o.size()) out.println(p.get(0));  else out.println(o.get(0));  out.flush();  } }
5	public class A {  static StreamTokenizer st;  static PrintWriter pw;  static class Sort implements Comparable<Sort> {   int x,y;   public int compareTo(Sort arg0) {    if (this.x==arg0.x)     return this.y-arg0.y;    return -(this.x-arg0.x);   }  }  public static void main(String[] args) throws IOException{   st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));   pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   int n = nextInt();   int k = nextInt();   Sort[]a = new Sort[n+1];   for (int i = 1; i <= n; i++) {    a[i] = new Sort();    a[i].x = nextInt();    a[i].y = nextInt();   }   Arrays.sort(a,1, n+1);                   int ans = 0;   for (int i = 1; i <= n; i++) {    if (a[i].x==a[k].x && a[i].y==a[k].y)     ans++;   }   System.out.println(ans);   pw.close();  }  private static int nextInt() throws IOException{   st.nextToken();   return (int) st.nval;  } }
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);   G1PlaylistForPolycarpEasyVersion solver = new G1PlaylistForPolycarpEasyVersion();   solver.solve(1, in, out);   out.close();  }  static class G1PlaylistForPolycarpEasyVersion {   static ArrayList<Integer> list;   static int n;   static int req;   static int mod = (int) 1e9 + 7;   static int[] dur;   static int[] genre;   static Integer[][][] memo;   public void solve(int testNumber, Scanner sc, PrintWriter pw) {    n = sc.nextInt();    req = sc.nextInt();    dur = new int[n];    genre = new int[n];    list = new ArrayList<>();    for (int i = 0; i < n; i++) {     dur[i] = sc.nextInt();     genre[i] = sc.nextInt();    }    int ans = 0;    memo = new Integer[1 << n][n + 1][4];    for (int i = 0; i <= n; i++)     ans += bf(0, 0, 0, i) % mod;    pw.print(ans % mod);   }   private int bf(int idx, int msk, int before, int max) {    if (idx == max) {     int sum = 0;     for (int x : list)      sum += x;     if (sum == req)      return 1;     return 0;    }    if (memo[msk][max][before] != null)     return memo[msk][max][before] % mod;    int toRet = 0;    for (int i = 0; i < n; i++) {     if (genre[i] != before && (msk & 1 << i) == 0) {      list.add(dur[i]);      toRet += bf(idx + 1, msk | 1 << i, genre[i], max);      toRet %= mod;      list.remove(list.size() - 1);     }    }    return memo[msk][max][before] = (toRet % mod);   }  }  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 D {  public static void main(String[] args) {  FastScanner sc = new FastScanner();  int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int[][] lr = new int[n][m-1];  for(int i = 0; i < n; i++){  for(int j = 0; j < m-1; j++){   lr[i][j] = sc.nextInt();  }  }  int[][] ud = new int[n-1][m];  for(int i = 0; i < n-1; i++){  for(int j = 0; j < m; j++){   ud[i][j] = sc.nextInt();  }  }  if(k % 2 == 1) {  StringBuilder sb = new StringBuilder();  for(int i = 0; i < n; i++){   for(int j = 0; j < m; j++){   sb.append(-1+" ");   }   sb.replace(sb.length()-1, sb.length(), "\n");  }  PrintWriter pw = new PrintWriter(System.out);  pw.println(sb.toString().trim());  pw.flush();  }  else {  int[][] dir = {{0,1},{0,-1},{1,0},{-1,0}};  long[][][] dp = new long[k/2+1][n][m];  for(int s = 1; s <= k/2; s++) {   for(int i = 0; i < n; i++){   for(int j = 0; j < m; j++){    dp[s][i][j] = Long.MAX_VALUE;    for(int[] d: dir) {    int u = i + d[0], v = j + d[1];    if(u >= 0 && u < n && v >= 0 && v < m) {     long w = calc(i, j, u, v, lr, ud);     dp[s][i][j] = Math.min(dp[s][i][j], dp[s-1][u][v] + 2*w);    }    }   }   }  }  StringBuilder sb = new StringBuilder();  for(int i = 0; i < n; i++){   for(int j = 0; j < m; j++){   sb.append(dp[k/2][i][j]+" ");   }   sb.replace(sb.length()-1, sb.length(), "\n");  }  PrintWriter pw = new PrintWriter(System.out);  pw.println(sb.toString().trim());  pw.flush();  } } static long calc(int i, int j, int u, int v, int[][] lr, int[][] ud) {  if(i == u) {  return lr[i][Math.min(j, v)];  }  else {  return ud[Math.min(i, u)][j];  } }   static class Pair implements Comparable<Pair>{  int x, y;  public Pair(int x, int y) {  this.x = x; this.y = y;  }  @Override  public int compareTo(Pair p) {  if(x == p.x) return y - p.y;  else return x - p.x;  }  public String toString() {  return x+" "+y;  } } 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 long nextLong() {  return Long.parseLong(next());  }  public double nextDouble() {  return Double.parseDouble(next());  }  public String nextLine() {  try {   return reader.readLine();  } catch(IOException e) {   throw new RuntimeException(e);  }  } } }
0	public class lukno {  public static void main (String args[])  {   Scanner i= new Scanner(System.in);   int n,p;     n=i.nextInt(); int t=n;   if(t%4==0||t%7==0||t%47==0||t%74==0||t%44==0||t%447==0||t%474==0||t%477==0)     System.out.print("YES");     else System.out.print("NO");       } }
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;   }  }  } } }
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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.nextInt();    int[] a = in.nextIntArray(n);    Arrays.sort(a);    int count = 0;    boolean[] used = new boolean[n];    for (int i = 0; i < n; i++) {     if (!used[i]) {      count++;      for (int j = i; j < n; j++) {       if (a[j] % a[i] == 0) {        used[j] = true;       }      }     }    }    out.println(count);   }  }  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();   }   public int[] nextIntArray(int n) {    int[] ret = new int[n];    for (int i = 0; i < n; i++) {     ret[i] = nextInt();    }    return ret;   }  } }
2	public class Main  {  public static void main(String args[]) throws IOException   {   Scanner c=new Scanner(System.in);   PrintWriter out=new PrintWriter(System.out);   long N=c.nextLong()-1;   long K=c.nextLong()-1;   long tot=(K*(K+1))/2;     if(N>tot)    {    System.out.println(-1);    return;    }   long lo=1;   long hi=K;   while(hi-lo>=10)    {    long mid=(hi+lo)/2;       long sum=(mid*(mid-1))/2;    long left=mid*K-sum;    if(left>=N)     hi=mid+1;    else     lo=mid-1;    }   for(int num=(int)lo-1000;num<lo+1000;num++)    {    if(num>=0)     {     long sum=((long)num*(num-1))/2;     long left=(long)num*K-sum;     if(left>=N)      {      System.out.println(num);      return;      }     }    }   out.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 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 char readCharacter()   {   int c=read();   while (isSpaceChar(c))    c=read();   return (char) c;   }  public interface SpaceCharFilter   {   public boolean isSpaceChar(int ch);   }  }
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 a = in.nextInt();   int b = in.nextInt();   int[] input = IOUtils.readIntArray(in, n);   Arrays.sort(input);   int x = input[b-1];   int y = input[b];   out.println(y - x);  } } class IOUtils {  public static int[] readIntArray(Scanner in, int size) {   int[] array = new int[size];   for (int i = 0; i < size; i++)    array[i] = in.nextInt();   return array;  }  }
5	public class CFJava {  private static void println(Integer n) {   System.out.println(n);  }  private static void println(String s) {   System.out.println(s);  }  private static void print(Integer n) {   System.out.print(n);  }  private static 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 Pair {  public int x;  public int y;  Pair(int x, int y) {   this.x = x;   this.y = y;  } } 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 String nextString() throws IOException {   if (buffer == null) {    buffer = in.readLine().split(" ");    pos = 0;   }   if (buffer.length <= pos) {    buffer = in.readLine().split(" ");    pos = 0;   }   pos++;   return buffer[pos - 1];  }  public ArrayList<Integer> getIntList(Integer n) throws IOException {   ArrayList<Integer> result = new ArrayList<Integer>(n);   for (int i = 0; i < n; i++)    result.add(nextInt());   return result;  }  public Integer[] getIntArray(Integer n) throws IOException {   Integer[] result = new Integer[n];   for (int i = 0; i < n; i++)    result[i]= (nextInt());   return result;  } }
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--;   }  } }
4	public class C {   static public void main(String... args) throws Exception {    Foster sc = new Foster();   PrintWriter p = new PrintWriter(out);   int t = sc.nextInt();   while(t--!=0){    int n = sc.nextInt();    int a[] = sc.intArray(n);    ArrayList<ArrayList<Integer>> arr = new ArrayList<>();    for(int i = 0; i < n; i++){     ArrayList<Integer> temp = new ArrayList<>();     if(i-1 < 0){      temp.add(1);     }     else{      ArrayList<Integer> inner = arr.get(i-1);      int last = inner.get(inner.size()-1);      ArrayDeque<Integer> q = new ArrayDeque<>();      for(int j : inner){       q.addLast(j);      }           if(last+1 == a[i]){       q.pollLast();       q.addLast(a[i]);      }           else if(a[i]==1){       q.addLast(a[i]);      }           else{       while(!q.isEmpty() && a[i]-q.peekLast() != 1){        q.pollLast();       }       if(q.isEmpty()) q.addLast(a[i]);       else{        q.pollLast();        q.addLast(a[i]);       }      }           while(!q.isEmpty()){       temp.add(q.pollFirst());      }     }     arr.add(temp);    }        for(int i = 0; i < arr.size(); i++){     p.print(arr.get(i).get(0));     for(int j = 1; j < arr.get(i).size(); j++){      p.print("." + arr.get(i).get(j));     }     p.println();    }   }   p.close();  }   static long[] sort(long a[]){   ArrayList<Long> arr = new ArrayList<>();   for(long i : a){    arr.add(i);   }   Collections.sort(arr);   for(int i = 0; i < arr.size(); i++){    a[i] = arr.get(i);   }   return a;  }  static int[] sort(int a[]){   ArrayList<Integer> arr = new ArrayList<>();   for(int i : a){    arr.add(i);   }   Collections.sort(arr);     for(int i = 0; i < arr.size(); i++){    a[i] = arr.get(i);   }   return a;  }       static class Foster {   BufferedReader br = new BufferedReader(new InputStreamReader(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());   }   double nextDouble() {    return Double.parseDouble(next());   }   int[] intArray(int n) {         int arr[] = new int[n];    for(int i = 0; i < n; i++) {     arr[i] = nextInt();    }    return arr;   }   long[] longArray(int n) {        long arr[] = new long[n];    for(int i = 0; i < n; i++) {     arr[i] = nextLong();    }    return arr;   }   int[] getBits(int n) {         int a[] = new int[31];    for(int i = 0; i < 31; i++) {     if(((1<<i) & n) != 0)      a[i] = 1;    }    return a;   }   static long pow(long... a) {    long mod = Long.MAX_VALUE;    if(a.length == 3) mod = a[2];    long res = 1;    while(a[1] > 0) {     if((a[1] & 1) == 1)      res = (res * a[0]) % mod;     a[1] /= 2;     a[0] = (a[0] * a[0]) % mod;    }    return res;   }  } }
3	public class Codeshefcode{ public static void main(String[] args) throws IOException{  Solver Machine = new Solver() ;  Machine.Solve() ;  Machine.Finish() ;                           } } class Mod{ static long mod=1000000007 ; static long d(long a,long b){ return (a*MI(b))%mod ; } static long m(long a,long b){ return (a*b)%mod ; } static private long MI(long a){ return pow(a,mod-2) ; } static long pow(long a,long b){  if(b<0) return pow(MI(a),-b) ;  long val=a ; long ans=1 ;  while(b!=0){  if((b&1)==1) ans = (ans*val)%mod ;   val = (val*val)%mod ;   b/=2 ;  }  return ans ; } } class pair implements Comparable<pair>{ int x ; int y ;  pair(int x,int y){ this.x=x ; this.y=y ;}  public int compareTo(pair p){  return (this.x<p.x ? -1 : (this.x>p.x ? 1 : (this.y<p.y ? -1 : (this.y>p.y ? 1 : 0)))) ; } } class Solver{ Reader ip = new Reader(System.in) ;  PrintWriter op = new PrintWriter(System.out) ; long dp[][] ; public void Solve() throws IOException{  int n = ip.i() ;  int arr[] = new int[n] ;  dp = new long[n][n] ;  for(int i=0 ; i<n ; i++)  for(int j=0 ; j<n ; j++)   dp[i][j]=-1 ;  for(int i=0 ; i<n ; i++){  String s = ip.s() ;  if(s.compareTo("s")==0) arr[i]=0 ;  else if(s.compareTo("f")==0) arr[i]=1 ;  else throw new IOException() ;  }  for(int j=0 ; j<n ; j++) dp[n-1][j] = 1 ;  for(int i=(n-2) ; i>=0 ; i--){  long cuml[] = new long[n] ;  for(int j=0 ; j<n ; j++) cuml[j] = (dp[i+1][j]+(j==0 ? 0 : cuml[j-1]))%Mod.mod ;  for(int j=0 ; j<n ; j++)   dp[i][j] = (arr[i]==0 ? cuml[j] : (j==(n-1) ? -1 : dp[i+1][j+1])) ;  }  pln(dp[0][0]) ; } void Finish(){  op.flush();  op.close(); } void p(Object o){  op.print(o) ; } void pln(Object o){  op.println(o) ; }  } class mylist extends ArrayList<String>{} class myset extends TreeSet<Integer>{} class mystack extends Stack<Integer>{} class mymap extends TreeMap<Long,Integer>{} 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()) ; } long l() throws IOException{  return Long.parseLong(s()) ; } double d() throws IOException {  return Double.parseDouble(s()) ; } }
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 = Integer.parseInt(s2[0]);  int m = Integer.parseInt(s2[1]);  int k = Integer.parseInt(s2[2]);  dp=new long[n][m][k+1];  int[][] hori = new int[n][m - 1];  int[][] verti = new int[n - 1][m];  for (int i = 0; i < n; i++) {  String str = (br.readLine());  String[] s1 = str.split(" ");  for (int j = 0; j < m - 1; j++) {   hori[i][j] = Integer.parseInt(s1[j]);  }  }  for (int i = 0; i < n - 1; i++) {  String str = (br.readLine());  String[] s1 = str.split(" ");  for (int j = 0; j < m; j++) {   verti[i][j] = Integer.parseInt(s1[j]);  }  }  long[][]ans=new long[n][m];  if(k%2!=0) {  for(int i=0;i<n;i++) {   for(int j=0;j<m;j++) {   ans[i][j]=-1;   }  }  }else {  for(int i=0;i<n;i++) {   for(int j=0;j<m;j++) {   ans[i][j]=findAns(i,j,k,hori,verti,n,m,Integer.MAX_VALUE);   }  }  }  for(int i=0;i<n;i++) {  StringBuilder str=new StringBuilder();  for(int j=0;j<m;j++) {   str.append(ans[i][j]+" ");  }pw.println(str.toString());  }    pw.close(); }  private static long findAns(int i, int j, int k, int[][] hori, int[][] verti, int n, int m, int last) {   if(k==0) {  return 0;  }  if(i<n&&j<m&&i>=0&&j>=0) {    }else {  return 100000000;  }   if(dp[i][j][k]!=0) {  return dp[i][j][k];  }  long ans=k*((long)last);  if(j>0) {  long curr=2*hori[i][j-1];  curr+=findAns(i, j-1, k-2, hori, verti, n, m, hori[i][j-1]);  ans=Math.min(ans, curr);  }   if(j<m-1) {  long curr=2*hori[i][j];  curr+=findAns(i, j+1, k-2, hori, verti, n, m, hori[i][j]);  ans=Math.min(ans, curr);  }   if(i>0) {  long curr=2*verti[i-1][j];  curr+=findAns(i-1, j, k-2, hori, verti, n, m, verti[i-1][j]);  ans=Math.min(ans, curr);  }   if(i<n-1) {  long curr=2*verti[i][j];  curr+=findAns(i+1, j, k-2, hori, verti, n, m, verti[i][j]);  ans=Math.min(ans, curr);  }   dp[i][j][k]=ans;  return ans; } }
5	public class CF_Chores {    public static void main(String[] args) {   Scanner s = new Scanner(System.in);     int n = s.nextInt();   int a = s.nextInt();   int b = s.nextInt();     long ar[] = new long[n];   for (int i = 0; i < n; i++) {    ar[i]=s.nextLong();   }   Arrays.sort(ar);     long ret = 0;   if(ar[b]==ar[b-1])    System.out.println("0");   else {    ret = ar[b]-ar[b-1];    System.out.println(ret);   }    } }
4	public class Main {  static final long MOD = 1000000007L;      static final int INF = 1000000005;  static final int NINF = -1000000005;   static FastScanner sc;  static PrintWriter pw;  static final int[][] dirs = {{-1,0},{1,0},{0,-1},{0,1}};    static final int MO = 1200;   public static void main(String[] args) {   sc = new FastScanner();   pw = new PrintWriter(System.out);   int N = sc.ni();   int M = sc.ni();   int K = sc.ni();   int[][] LR = new int[N][M-1];   for (int i = 0; i < N; i++) {    LR[i] = sc.intArray(M-1,0);   }   int[][] UD = new int[N-1][M];   for (int i = 0; i < N-1; i++) {    UD[i] = sc.intArray(M,0);   }   if (K%2==0) {    int T = K/2;    int[][] dist = new int[N][M];    for (int step = 1; step <= T; step++) {     int[][] newDist = new int[N][M];     for (int i = 0; i < N; i++) {      for (int j = 0; j < M; j++) {       newDist[i][j] = INF;              if (i > 0) {        newDist[i][j] = Math.min(newDist[i][j],UD[i-1][j]+dist[i-1][j]);       }              if (i < N-1) {        newDist[i][j] = Math.min(newDist[i][j],UD[i][j]+dist[i+1][j]);       }              if (j > 0) {        newDist[i][j] = Math.min(newDist[i][j],LR[i][j-1]+dist[i][j-1]);       }              if (j < M-1) {        newDist[i][j] = Math.min(newDist[i][j],LR[i][j]+dist[i][j+1]);       }      }     }     dist = newDist;    }       for (int i = 0; i < N; i++) {     for (int j = 0; j < M; j++) {      pw.print((2*dist[i][j]) + " ");     }     pw.println();    }   } else {    for (int i = 0; i < N; i++) {     for (int j = 0; j < M; j++) {      pw.print("-1 ");     }     pw.println();    }   }   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[]>() {    @Override    public int compare(int[] a, int[] b) {     int ablock = a[0]/MO;     int bblock = b[0]/MO;     if (ablock != bblock)      return ablock-bblock;     else      return a[1]-b[1];    }   });  }   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[]>() {    @Override    public int compare(long[] a, long[] b) {     if (a[0] > b[0])      return 1;     else if (a[0] < b[0])      return -1;     else      return 0;        }   });  }   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());   }    int[][] graph(int N, int[][] edges) {    int[][] graph = new int[N][];    int[] sz = new int[N];    for (int[] e: edges) {     sz[e[0]] += 1;     sz[e[1]] += 1;    }    for (int i = 0; i < N; i++) {     graph[i] = new int[sz[i]];    }    int[] cur = new int[N];    for (int[] e: edges) {     graph[e[0]][cur[e[0]]] = e[1];     graph[e[1]][cur[e[1]]] = e[0];     cur[e[0]] += 1;     cur[e[1]] += 1;    }    return graph;   }    int[] intArray(int N, int mod) {    int[] ret = new int[N];    for (int i = 0; i < N; i++)     ret[i] = ni()+mod;    return ret;   }    long nl() {    return Long.parseLong(next());   }    long[] longArray(int N, long mod) {    long[] ret = new long[N];    for (int i = 0; i < N; i++)     ret[i] = nl()+mod;    return ret;   }    double nd() {    return Double.parseDouble(next());   }    String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
5	public class A {  private void solve() throws IOException {   int n = nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = nextInt();   }   Arrays.sort(a);   int sum = 0;   for (int i = a.length - 1; i >= 0; i--) {    sum += a[i];    int k = 0;    for (int j = 0; j < i; j++)     k += a[j];    if (sum > k) {     pl(a.length - i);     return;    }   }  }  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());  }  BigInteger nextBigInteger() throws IOException {   return new BigInteger(nextToken());  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }  void p(Object... objects) {   for (int i = 0; i < objects.length; i++) {    if (i != 0)     writer.print(' ');    writer.flush();    writer.print(objects[i]);    writer.flush();   }  }  void pl(Object... objects) {   p(objects);   writer.flush();   writer.println();   writer.flush();  }  int cc;  void pf() {   writer.printf("Case #%d: ", ++cc);   writer.flush();  } }
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);  } }
6	public class LookingForOrder {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int bx = in.nextInt();   int by = in.nextInt();   in.nextLine();   int n = in.nextInt();   int[][] objects = new int[n][2];   for (int i = 0; i < n; i++) {    objects[i][0] = in.nextInt();    objects[i][1] = in.nextInt();   }   int[] cs = new int[n];   for (int i = 0; i < n; i++) {    cs[i] = 2 * time(objects[i], new int[] { bx, by });   }   int[][] cd = new int[n][n];   for (int i = 0; i < n; i++) {    for (int j = i + 1; j < n; j++) {     cd[j][i] = cd[i][j] = time(objects[i], new int[] { bx, by }) + time(objects[j], new int[] { bx, by }) + time(objects[i], objects[j]);    }   }   int maxMask = 1 << n;   int[] dp = new int[maxMask];   int[] path = new int[maxMask];   Arrays.fill(dp, -1);   dp[0] = 0;   for (int g = 1; g < maxMask; g++) {    int min = Integer.MAX_VALUE;    int minPath = 0;    int h = 31;    while ((g & (1 << h)) == 0)     h--;    h++;    int l = 0;    while ((g & (1 << l)) == 0)     l++;    if ((g & 1 << l) > 0) {     int oneleft = g ^ (1 << l);     int t = cs[l] + dp[oneleft];     if (t < min) {      min = t;      minPath = oneleft;     }     for (int j = l + 1; j < h; j++) {      if ((oneleft & 1 << j) > 0) {       int twoleft = oneleft ^ (1 << j);       t = cd[l][j] + dp[twoleft];       if (t < min) {        min = t;        minPath = twoleft;       }      }     }    }    dp[g] = min;    path[g] = minPath;   }   System.out.println(dp[maxMask - 1]);   int previous = maxMask - 1;   int pathElt = path[previous];   System.out.print("0 ");   while (previous > 0) {    int bits = previous - pathElt;    int h = 31;    while ((bits & (1 << h)) == 0)     h--;    int l = 0;    while ((bits & (1 << l)) == 0)     l++;    String el = h == l ? "" + (h + 1) : (h + 1) + " " + (l + 1);    System.out.print(el + " " + 0 + " ");    previous = pathElt;    pathElt = path[pathElt];   }   System.out.println();  }  static int time(int[] a, int[] b) {   int x = b[0] - a[0];   int y = b[1] - a[1];   return x * x + y * y;  } }
3	public class Solution {  private static int[] dx = {    -1, -1, -1,    0, 0,    1, 1, 1};  private static 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");   }  }  private static 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 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();  } } class TaskB {  public void solve(int testNumber, Scanner in, PrintWriter out) {   long N = in.nextLong();   int K = in.nextInt();   long pipes = 1;   if(N == 1){    out.println(0);return;   }   long left = 0, right = K - 1, find = -1;   while (left <= right){    long mid = (left + right) / 2;    if(mid * mid + (1 - 2 * K) * mid + 2 * (N - 1) <= 0){     find = mid;     right = mid - 1;    }    else     left = mid + 1;   }   out.println(find);  } }
0	public class A{ public static BufferedReader k; public static BufferedWriter z;    public static void main(String [] args)throws IOException{  k = new BufferedReader(new InputStreamReader(System.in));  z = new BufferedWriter(new OutputStreamWriter(System.out));      String[] dat = k.readLine().split(" ");    long l = Long.parseLong(dat[0]);   long r = Long.parseLong(dat[1]);    if(r-l<=1){   z.write(-1+"\n");  }  else if(r-l == 2){        if((l&1)!=0){   z.write(-1+"\n");   }   else{   z.write(l+" "+(l+1)+" "+r+"\n");   }     }  else{   if(l%2==0){   z.write(l+" "+(l+1)+" "+(l+2)+"\n");   }   else{   z.write((l+1)+" "+(l+2)+" "+(l+3)+"\n");   }  }           z.flush();  } }
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 count = in.readInt();  int place = in.readInt() - 1;  final int[] points = new int[count];  final int[] time = new int[count];  IOUtils.readIntArrays(in, points, time);  Comparator<Integer> comparator = new Comparator<Integer>() {  public int compare(Integer o1, Integer o2) {   if (points[o1] != points[o2])   return points[o2] - points[o1];   return time[o1] - time[o2];  }  };  Integer[] order = ArrayUtils.order(count, comparator);  int answer = 0;  for (int i = 0; i < count; i++) {  if (comparator.compare(order[place], order[i]) == 0)   answer++;  }  out.printLine(answer); } } 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 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 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 IOUtils {  public static void readIntArrays(InputReader in, int[]... arrays) {  for (int i = 0; i < arrays[0].length; i++) {  for (int j = 0; j < arrays.length; j++)   arrays[j][i] = in.readInt();  } }  } class ArrayUtils { public static Integer[] generateOrder(int size) {  Integer[] order = new Integer[size];  for (int i = 0; i < size; i++)  order[i] = i;  return order; }  public static Integer[] order(int size, Comparator<Integer> comparator) {  Integer[] order = generateOrder(size);  Arrays.sort(order, comparator);  return order; }  }
2	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   FastInput in = new FastInput(inputStream);   FastOutput out = new FastOutput(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, FastInput in, FastOutput out) {    long n = in.nextLong();    long s = in.nextLong();    long cnt = 0;    long res = 0;    for (long i = s; i <= Math.min(s + 200, n); i++) {     long d = i;     int sum = 0;     while (d > 0) {      long l = d % 10;      sum += l;      d /= 10;     }     if ((i - sum) >= s) {      cnt++;     }    }    long tmp = n - Math.min(n, s + 200);    if (tmp < 0) tmp = 0;    cnt += tmp;    out.println(cnt);    }  }  static class FastInput {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private FastInput.SpaceCharFilter filter;   public FastInput(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() {    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 FastOutput {   private final PrintWriter writer;   public FastOutput(OutputStream outputStream) {    writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));   }   public FastOutput(Writer writer) {    this.writer = new PrintWriter(writer);   }   public void close() {    writer.close();   }   public void println(long i) {    writer.println(i);   }  } }
6	public class C0008 {  public static void main(String args[]) throws Exception {   new C0008();  }  int n;  int target;  int pow[];  int dp[];  int next[];  int dist[][];  C0008() throws Exception {   PandaScanner sc = null;   PrintWriter out = null;   try {    sc = new PandaScanner(System.in);    out = new PrintWriter(System.out);   } catch (Exception ignored) {   }   pow = new int[26];   for (int i = 0; i < 26; i++) {    pow[i] = 1 << i;   }   dist = new int[26][26];   int[][] p = new int[26][];   p[25] = new int[] {sc.nextInt(), sc.nextInt()};   n = sc.nextInt();   target = (1 << n) - 1;   for (int i = 0; i < n; i++) {    p[i] = new int[] {sc.nextInt(), sc.nextInt()};    dist[i][25] = getDist(p[i], p[25]);    for (int j = 0; j < i; j++) {     dist[j][i] = getDist(p[j], p[i]);    }   }   next = new int[1 << n];   dp = new int[1 << n];   Arrays.fill(dp, -1);   out.println(go(0));   ArrayList<Integer> paths = new ArrayList<Integer>();   paths.add(0);   int curr = 0;   while (curr != target) {    for (Integer i: getBits(next[curr], true)) {     paths.add(i + 1);    }    paths.add(0);    curr |= next[curr];   }   out.println(paths.toString().replaceAll("[^ 0-9]", ""));   out.close();   System.exit(0);  }  int go(int mask) {   if (mask == target) {    return 0;   }   if (dp[mask] != -1) {    return dp[mask];   }   ArrayList<Integer> notDone = getBits(mask, false);   dp[mask] = Integer.MAX_VALUE;   for (Integer i: notDone) {    int oneD = (dist[i][25] << 1) + go(mask | pow[i]);    if (dp[mask] > oneD) {     dp[mask] = oneD;     next[mask] = 1 << i;    }    for (Integer j: notDone) {     if (j == i) continue;     int d = (dist[j][25] + dist[i][j] + dist[i][25]) + go(mask | pow[i] | pow[j]);     if (dp[mask] > d) {      dp[mask] = d;      next[mask] = (1 << i) | (1 << j);     }    }    break;   }   return dp[mask];  }  int getDist(int[] p1, int[] p2) {   return sq(p1[0] - p2[0]) + sq(p1[1] - p2[1]);  }  int sq(int a) {   return a * a;  }  ArrayList<Integer> getBits(int mask, boolean on) {   ArrayList<Integer> res = new ArrayList<Integer>();   for (int i = 0; i < n; i++) {    if (((mask & (1 << i)) == 0) ^ on) {     res.add(i);    }   }   return res;  }    public class PandaScanner {   BufferedReader br;   StringTokenizer st;   InputStream in;   PandaScanner(InputStream in) throws Exception {    br = new BufferedReader(new InputStreamReader(this.in = in));   }   public String next() throws Exception {    if (st == null || !st.hasMoreTokens()) {     st = new StringTokenizer(br.readLine().trim());     return next();    }    return st.nextToken();   }   public boolean hasNext() throws Exception {    return (st != null && st.hasMoreTokens()) || in.available() > 0;   }   public long nextLong() throws Exception {    return Long.parseLong(next());   }   public int nextInt() throws Exception {    return Integer.parseInt(next());   }  } }
2	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer tokenizer = new StringTokenizer(reader.readLine());   int n = Integer.parseInt(tokenizer.nextToken());   int k = Integer.parseInt(tokenizer.nextToken());   System.out.println((int)(n-(-3.0+Math.sqrt(9.0+8.0*(n+k)))/2.0));  } }
1	public class C364C {  static StringTokenizer st; static BufferedReader br; static PrintWriter pw;  static int n; static int[] a; public static void main(String[] args) throws IOException {  br = new BufferedReader(new InputStreamReader(System.in));  pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  n = nextInt();  int ans = n, cc, cur = 0;  a = new int [52];  char[] c = next().toCharArray();  int l = 0, len = 0;  for (int i = 0; i < n; ++i) {  if (Character.isUpperCase(c[i])) {   cur = 26 + c[i] - 'A';  } else   cur = c[i] - 'a';  if (a[cur] == 0) {   a[cur]++;   len++;   ans = i - l + 1;  } else {   a[cur]++;   for (; l < i; ++l) {   if (Character.isUpperCase(c[l])) {    cc = 26 + c[l] - 'A';   } else    cc = c[l] - 'a';      if (a[cc] > 1) {    --a[cc];   } else break;   }   if (i - l + 1 < ans) {   ans = i - l + 1;   }  }  }    pw.print(ans);  pw.close(); }  private static int sumf(int[] fen, int id) {  int summ = 0;  for (; id >= 0; id = (id & (id + 1)) - 1)   summ += fen[id];  return summ; }  private static void addf(int[] fen, int id) {  for (; id < fen.length; id |= id + 1)   fen[id]++; }  private static int nextInt() throws IOException {  return Integer.parseInt(next()); } private static long nextLong() throws IOException {  return Long.parseLong(next()); } private static double nextDouble() throws IOException {  return Double.parseDouble(next()); } private static String next() throws IOException {  while (st==null || !st.hasMoreTokens())  st = new StringTokenizer(br.readLine());  return st.nextToken(); } }
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 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;  } } 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)); } }
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);  } }
0	public class Task483A {  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++]);   }   long nextLong() throws IOException {    if (cacheIndex >= cache.length) {     cache = br.readLine().split(" ");     cacheIndex = 0;    }    return Long.parseLong(cache[cacheIndex++]);   }   String next() throws IOException {    if (cacheIndex >= cache.length) {     cache = br.readLine().split(" ");     cacheIndex = 0;    }    return 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 l = sc.nextLong();    long r = sc.nextLong();    long interval = r-l;    if(interval == 0 || interval == 1 || (interval == 2 && l % 2 ==1 )){     pw.println(-1);    } else {     if(l % 2 == 1){      l++;     }     pw.print(l);     pw.print(" ");     pw.print(l+1);     pw.print(" ");     pw.print(l+2);    }     pw.flush();    sc.close();   }  } }
6	public class realfast implements Runnable {  private static final int INF = (int) 1e9;  int time[]= new int[15];  int g[]= new int [15];  public void solve() throws IOException  {  int n = readInt();  int t = readInt();    for(int i=0;i<n;i++)  {   time[i]=readInt();   g[i]=readInt();  }  long dp[][]= new long [(int)Math.pow(2,n)][4];  for(int i =0;i<(int)Math.pow(2,n);i++)  {  for(int j=0;j<=3;j++)   dp[i][j]=-1;   }  long val = cal(dp,0,0,0,t);  out.println(val);  }  public long cal(long dp[][], int mask , int genre , int t ,int T )  {  int val = dp.length;    if(t>T)   {   return 0;   }  if(t==T)  {   return 1;  }     if(dp[mask][genre]!=-1)   return dp[mask][genre];   dp[mask][genre]=0;   int i=1;   int count=0;   while(i<val)   {     if((i&mask)==0&&g[count]!=genre)   {    dp[mask][genre] = ((dp[mask][genre]%1000000007)+ cal(dp,mask|i,g[count],t+time[count],T)%1000000007)%1000000007;   }   i=2*i;   count++;   }   return dp[mask][genre];  }       public static void main(String[] args) {   new Thread(null, new realfast(), "", 128 * (1L << 20)).start();  }   private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  private BufferedReader reader;  private StringTokenizer tokenizer;  private PrintWriter out;   @Override  public void run() {   try {    if (ONLINE_JUDGE || !new File("input.txt").exists()) {     reader = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);    } else {     reader = new BufferedReader(new FileReader("input.txt"));     out = new PrintWriter("output.txt");    }    solve();   } catch (IOException e) {    throw new RuntimeException(e);   } finally {    try {     reader.close();    } catch (IOException e) {        }    out.close();   }  }   private String readString() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }   @SuppressWarnings("unused")  private int readInt() throws IOException {   return Integer.parseInt(readString());  }   @SuppressWarnings("unused")  private long readLong() throws IOException {   return Long.parseLong(readString());  }   @SuppressWarnings("unused")  private double readDouble() throws IOException {   return Double.parseDouble(readString());  } } class edge implements Comparable<edge>{  int u ;  int v ;  int val;  edge(int u1, int v1 , int val1)  {   this.u=u1;   this.v=v1;   this.val=val1;  }  public int compareTo(edge e)  {   return this.val-e.val;  } }
2	public class CFEdu23C { static long sum(long n) {  long ans=0;  while(n>0)  {  ans+=(n%10);  n/=10;  }  return ans; } static long BS(long l,long h,long s) {  if(l<=h)  {  long m=(l+h)/2l;  if(m-sum(m)>=s && (m==1 || (m-1)-sum(m-1)<s))   return m;  else if(m-sum(m)>=s)   return BS(l, m-1, s);  else   return BS(m+1, h, s);  }  return (h+1); } 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(),s=in.nextLong();  long x=BS(0,n,s);  out.print(n-x+1);  out.close();   }  public static final long l = (int) (1e9 + 7);  private static int[] nextIntArray(InputReader in, int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = in.nextInt();  return a; }  private static long[] nextLongArray(InputReader in, int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)  a[i] = in.nextLong();  return a; }  private static int[][] nextIntMatrix(InputReader in, int n, int m) {  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();  }  return a; }  private static void show(int[] a) {  for (int i = 0; i < a.length; i++)  System.out.print(a[i] + " ");  System.out.println(); }  private static void show2DArray(char[][] a) {  for (int i = 0; i < a.length; i++) {  for (int j = 0; j < a[0].length; j++)   System.out.print(a[i][j]);  System.out.println();  } }  static class Pair {  private int first;  private int second;  public Pair(int i, int j) {  this.first = i;  this.second = j;  }  public int getFirst() {  return first;  }  public int getSecond() {  return second;  }  public void setFirst(int k) {  this.first = k;  }  public void setSecond(int k) {  this.second = k;  } }  static int modPow(int a, int b, int p) {  int result = 1;  a %= p;  while (b > 0) {  if ((b & 1) != 0)   result = (result * a) % p;  b = b >> 1;  a = (a * a) % p;  }  return result; }  public static void SieveOfEratosthenes(int n) {  boolean[] prime = new boolean[n + 1];  Arrays.fill(prime, true);  prime[1] = false;  int i, j;  for (i = 2; i * i <= n; i++) {  if (prime[i]) {   for (j = i; j <= n; j += i) {   if (j != i)    prime[j] = false;   }  }  } }  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();  }  public long nextLong() {  return Long.parseLong(next());  }  public int nextInt() {  return Integer.parseInt(next());  } } }
4	public class D {  private static long INF = 2000000000000000000L, M = 1000000007, MM = 998244353; private static int N = 0; private static long[][][] dp; private static long[][] ff; private static long[][] ss;  public static void process() throws IOException {  int n = sc.nextInt(),m = sc.nextInt(),k = sc.nextInt();   ff = new long[n][m];  ss = new long[n][m];  for(int i = 0; i<n; i++) {  for(int j = 0; j<m-1; j++) {   ff[i][j] = sc.nextLong();  }  }  for(int i = 0; i<n-1; i++) {  for(int j = 0; j<m; j++) {   ss[i][j] = sc.nextLong();  }  }   if(k%2 == 1) {  for(int i = 0; i<n; i++) {   for(int j = 0; j<m; j++)System.out.print(-1+" ");   System.out.println();  }  return;  }   dp = new long[n+1][m+1][11];  for(int i = 0; i<=n; i++) {  for(int j = 0; j<=m; j++)Arrays.fill(dp[i][j], -1);  }  for(int i = 0; i<=n; i++) {  for(int j = 0; j<=m; j++) {   dp[i][j][0] = 0;  }  }   k/=2;  long ans[][] = new long[n][m];  for(int i = 0; i<n; i++) {  for(int j = 0; j<m; j++) {   ans[i][j] = solve(i,j,k,n,m)*2L;  }  }  for(int i = 0; i<n; i++) {  for(int j = 0; j<m; j++)print(ans[i][j]+" ");  println();  } }  private static long solve(int i, int j, int k, int n, int m) {  if(dp[i][j][k] != -1)return dp[i][j][k];  long ans = Long.MAX_VALUE;  if(i+1<n) {  ans = min(ans,ss[i][j] + solve(i+1, j, k-1, n, m));  }  if(i-1>=0) {  ans = min(ans,ss[i-1][j] + solve(i-1, j, k-1, n, m));  }  if(j+1<m) {  ans = min(ans,ff[i][j] + solve(i, j+1, k-1, n, m));  }  if(j-1>=0) {  ans = min(ans,ff[i][j-1] + solve(i, j-1, k-1, n, m));  }   return dp[i][j][k] = ans; }     static FastScanner sc; static PrintWriter out;  public static void main(String[] args) throws IOException {  boolean oj = true;  if (oj) {  sc = new FastScanner();  out = new PrintWriter(System.out);  } else {  sc = new FastScanner(100);  out = new PrintWriter("output.txt");  }  int t = 1;  while (t-- > 0) {  process();  }  out.flush();  out.close(); }  static class Pair implements Comparable<Pair> {  int x, y;  Pair(int x, int y) {  this.x = x;  this.y = y;  }  @Override  public int compareTo(Pair o) {  return Integer.compare(this.x, o.x);  }                       }   static void println(Object o) {  out.println(o); }  static void println() {  out.println(); }  static void print(Object o) {  out.print(o); }  static void pflush(Object o) {  out.println(o);  out.flush(); }  static int ceil(int x, int y) {  return (x % y == 0 ? x / y : (x / y + 1)); }  static long ceil(long x, long y) {  return (x % y == 0 ? x / y : (x / y + 1)); }  static int max(int x, int y) {  return Math.max(x, y); }  static int min(int x, int y) {  return Math.min(x, y); }  static int abs(int x) {  return Math.abs(x); }  static long abs(long x) {  return Math.abs(x); }  static long sqrt(long z) {  long sqz = (long) Math.sqrt(z);  while (sqz * 1L * sqz < z) {  sqz++;  }  while (sqz * 1L * sqz > z) {  sqz--;  }  return sqz; }  static int log2(int N) {  int result = (int) (Math.log(N) / Math.log(2));  return result; }  static long max(long x, long y) {  return Math.max(x, y); }  static long min(long x, long y) {  return Math.min(x, y); }  public static int gcd(int a, int b) {  BigInteger b1 = BigInteger.valueOf(a);  BigInteger b2 = BigInteger.valueOf(b);  BigInteger gcd = b1.gcd(b2);  return gcd.intValue(); }  public static long gcd(long a, long b) {  BigInteger b1 = BigInteger.valueOf(a);  BigInteger b2 = BigInteger.valueOf(b);  BigInteger gcd = b1.gcd(b2);  return gcd.longValue(); }  public static long lcm(long a, long b) {  return (a * b) / gcd(a, b); }  public static int lcm(int a, int b) {  return (a * b) / gcd(a, b); }  public static int lower_bound(int[] arr, int x) {  int low = 0, high = arr.length, mid = -1;  while (low < high) {  mid = (low + high) / 2;   if (arr[mid] >= x)   high = mid;  else   low = mid + 1;  }  return low; }  public static int upper_bound(int[] arr, int x) {  int low = 0, high = arr.length, mid = -1;  while (low < high) {  mid = (low + high) / 2;   if (arr[mid] > x)   high = mid;  else   low = mid + 1;  }  return low; }   static class FastScanner {  BufferedReader br;  StringTokenizer st;  FastScanner() throws FileNotFoundException {  br = new BufferedReader(new InputStreamReader(System.in));  }  FastScanner(int a) throws FileNotFoundException {  br = new BufferedReader(new FileReader("input.txt"));  }  String next() throws IOException {  while (st == null || !st.hasMoreElements()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  }  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());  }  String nextLine() throws IOException {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }  int[] readArray(int n) throws IOException {  int[] A = new int[n];  for (int i = 0; i != n; i++) {   A[i] = sc.nextInt();  }  return A;  }  long[] readArrayLong(int n) throws IOException {  long[] A = new long[n];  for (int i = 0; i != n; i++) {   A[i] = sc.nextLong();  }  return A;  } }  static void ruffleSort(int[] a) {  Random get = new Random();  for (int i = 0; i < a.length; i++) {  int r = get.nextInt(a.length);  int temp = a[i];  a[i] = a[r];  a[r] = temp;  }  Arrays.sort(a); }  static void ruffleSort(long[] a) {  Random get = new Random();  for (int i = 0; i < a.length; i++) {  int r = get.nextInt(a.length);  long temp = a[i];  a[i] = a[r];  a[r] = temp;  }  Arrays.sort(a); } }
5	public class Main {  public static void main(String[] args)throws Exception {   File _=new File("chores.in");   BufferedReader br=_.exists()? new BufferedReader(new FileReader(_)):new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st;   String str;     st=new StringTokenizer(br.readLine());   int n,a,b;   n=Integer.parseInt(st.nextToken());   a=Integer.parseInt(st.nextToken());   b=Integer.parseInt(st.nextToken());     ArrayList<Integer> chores=new ArrayList<Integer>();   int k;   st=new StringTokenizer(br.readLine());   for (int i = 0; i < n; i++) {    k=Integer.parseInt(st.nextToken());    chores.add(k);   }   Collections.sort(chores);     System.out.println(chores.get(b)-chores.get(b-1));    } }
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);   F solver = new F();   solver.solve(1, in, out);   out.close();  }  static class F {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.ni();    int[] a = in.na(n);    TreeMap<Integer, TreeMap<Integer, Segment>> map = new TreeMap<>();    int[] pref = new int[n + 1];    for (int i = 0; i < n; i++) {     pref[i + 1] = pref[i] + a[i];    }    for (int i = 0; i < n; i++) {     for (int j = i; j >= 0; j--) {      int val = pref[i + 1] - pref[j];      TreeMap<Integer, Segment> dp = map.computeIfAbsent(val, k -> new TreeMap<>());      if (!dp.containsKey(i)) {       Map.Entry<Integer, Segment> lastEntry = dp.lastEntry();       if (lastEntry == null) {        dp.put(i, new Segment(j, i, 1, null));       } else {        Segment lastValue = lastEntry.getValue();        Map.Entry<Integer, Segment> prev = dp.lowerEntry(j);        if (prev == null) {         if (lastValue.dp >= 1)          dp.put(i, lastValue);         else          dp.put(i, new Segment(j, i, 1, null));        } else if (lastValue.dp >= prev.getValue().dp + 1) {         dp.put(i, lastValue);        } else {         dp.put(i, new Segment(j, i, prev.getValue().dp + 1, prev.getValue()));        }       }      }     }    }    Segment best = null;    for (TreeMap<Integer, Segment> segments : map.values()) {     Segment seg = segments.lastEntry().getValue();     if (best == null || best.dp < seg.dp) {      best = seg;     }    }    if (best == null)     throw new RuntimeException("Null best");    out.println(best.dp);    while (best != null) {     out.printf("%d %d%n", best.from + 1, best.to + 1);     best = best.prev;    }   }   class Segment {    int from;    int to;    int dp;    Segment prev;    public Segment(int from, int to, int dp, Segment prev) {     this.from = from;     this.to = to;     this.dp = dp;     this.prev = prev;    }   }  }  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 int[] na(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++) a[i] = ni();    return a;   }  } }
2	public class Main {  public static void main (String[] args) throws java.lang.Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(br.readLine());   long n = Long.parseLong(st.nextToken()),    s = Long.parseLong(st.nextToken());   long m = s;   while (m-f(m)<s && m<=n) m++;   System.out.println(Math.max(n-m+1, 0));  }   public static int f(long n) {   int sum = 0;   for (long i=0, j=1L ; i<(int)Math.log10(n)+1 ; i++, j*=10) {    sum += (n/j)%10;   }   return sum;  }  }
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); } }
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);   BObtainingTheString solver = new BObtainingTheString();   solver.solve(1, in, out);   out.close();  }  static class BObtainingTheString {   public void solve(int testNumber, FastScanner br, PrintWriter pw) {    int n = br.nextInt();    String s = br.nextString();    String t = br.nextString();    char[] sarr = new char[n];    char[] tarr = new char[n];    int[] sAppear = new int[26];    int[] tAppear = new int[26];    for (int i = 0; i < s.length(); i++) {     sarr[i] = s.charAt(i);     tarr[i] = t.charAt(i);     sAppear[s.charAt(i) - 'a']++;     tAppear[t.charAt(i) - 'a']++;    }    for (int i = 0; i < 26; i++) {     if (sAppear[i] != tAppear[i]) {      pw.println(-1);      pw.close();     }    }    ArrayList<Integer> ans = new ArrayList<Integer>();    for (int i = 0; i < n; i++) {     char curr = tarr[i];     for (int j = i + 1; j < n; j++) {      if (sarr[j] == curr) {       for (int k = j; k > i; k--) {        ans.add(k);        char temp = sarr[k - 1];        sarr[k - 1] = sarr[k];        sarr[k] = temp;       }       break;      }     }    }    pw.println(ans.size());    for (int e : ans) {     pw.print(e + " ");    }    pw.close();   }  }  static class FastScanner {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private FastScanner.SpaceCharFilter filter;   public FastScanner(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 nextString() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     if (Character.isValidCodePoint(c)) {      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);   }  } }
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());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    String str = "";    try {     str = reader.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
0	public class Main {  static void solve() throws IOException {   int n = nextInt();   if (n >= 0) {    System.out.println(n);   } else {    String string = String.valueOf(n);    int v1 = Integer.valueOf(string.substring(0, string.length() - 1));    int v2 = Integer.valueOf(string.substring(0, string.length() - 2)      + string.charAt(string.length() - 1));    if (v1 >= v2) {     System.out.println(v1);    } else {     System.out.println(v2);    }   }    }  public static void main(String[] args) throws Exception {   reader = new BufferedReader(new InputStreamReader(System.in));   writer = new PrintWriter(System.out);   setTime();   solve();   printTime();   printMemory();   writer.close();  }  static BufferedReader reader;  static PrintWriter writer;  static StringTokenizer tok = new StringTokenizer("");  static long systemTime;  static void debug(Object... o) {   System.err.println(deepToString(o));  }  static void setTime() {   systemTime = System.currentTimeMillis();  }  static void printTime() {   System.err.println("Time consumed: "     + (System.currentTimeMillis() - systemTime));  }  static void printMemory() {   System.err.println("Memory consumed: "     + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime()       .freeMemory()) / 1000 + "kb");  }  static String next() {   while (!tok.hasMoreTokens()) {    String w = null;    try {     w = reader.readLine();    } catch (Exception e) {     e.printStackTrace();    }    if (w == null)     return null;    tok = new StringTokenizer(w);   }   return tok.nextToken();  }  static int nextInt() {   return Integer.parseInt(next());  }  static long nextLong() {   return Long.parseLong(next());  }  static double nextDouble() {   return Double.parseDouble(next());  }  static BigInteger nextBigInteger() {   return new BigInteger(next());  } }
3	public class Main {  static StringBuilder data = new StringBuilder();  final static FastReader in = new FastReader();   public static void main(String[] args) {   int n = in.nextInt();   int a[] = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }   Arrays.sort(a);   int answ = 0;   for (int i = 0; i < n; i++) {    if (a[i] != 0) {     for (int j = i + 1; j < n; j++) {      if (a[j] % a[i] == 0) {       a[j] = 0;      }     }     answ++;     a[i]=0;    }   }   System.out.println(answ);  }   static void fileOut(String s) {   File out = new File("output.txt");   try {    FileWriter fw = new FileWriter(out);    fw.write(s);    fw.flush();    fw.close();   } catch (IOException e) {    e.printStackTrace();   }  }  static class FastReader {   BufferedReader br;   StringTokenizer st;   public FastReader() {    br = new BufferedReader(new      InputStreamReader(System.in));   }   public FastReader(String path) {    try {     br = new BufferedReader(new       InputStreamReader(new FileInputStream(path)));    } catch (FileNotFoundException e) {     e.printStackTrace();    }   }   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());   }   float nextFloat() {    return Float.parseFloat(next());   }   double nextDouble() {    return Double.parseDouble(next());   }    String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
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();  } }
0	public class Main { public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  StringTokenizer tok = new StringTokenizer(br.readLine());  int ax = Integer.parseInt(tok.nextToken());  int ay = Integer.parseInt(tok.nextToken());  tok = new StringTokenizer(br.readLine());  int bx = Integer.parseInt(tok.nextToken());  int by = Integer.parseInt(tok.nextToken());  tok = new StringTokenizer(br.readLine());  int cx = Integer.parseInt(tok.nextToken());  int cy = Integer.parseInt(tok.nextToken());  boolean ans = (bx < ax && cx < ax && by < ay && cy < ay) ||  (bx < ax && cx < ax && by > ay && cy > ay) ||  (bx > ax && cx > ax && by < ay && cy < ay) ||  (bx > ax && cx > ax && by > ay && cy > ay);  System.out.print(ans?"YES":"NO"); } }
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);  } }
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;  public void run() {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  System.err.println("");    long tot = 0;  for(int i = 0; i < 20000; i++) tot += i;   n = fs.nextInt(); m = fs.nextInt();  byte[] str = fs.next().getBytes();  int[] occs = new int[1<<m];  for(int i = 0; i < n-1; i++) {  int l1 = str[i] - 'a';  int l2 = str[i+1] - 'a';  occs[(1<<l1) | (1<<l2)]++;  occs[(1<<l2) | (1<<l1)]++;  }   int all = (1<<m)-1;  cost = new int[m][1<<m];  for(int i = 0; i < m; i++) {  for(int mask = 1; mask < all; mask++) {   if(((1<<i)&mask) > 0) continue;   int lb = mask & (-mask);   int trail = Integer.numberOfTrailingZeros(lb);   int nmask = mask ^ lb;   cost[i][mask] = cost[i][nmask]+occs[1<<i | 1<<trail];  }  }   dp = new int[1<<m];  for(int mask = dp.length-2; mask >= 0; mask--) {  int addOn = 0;  for(int nxt = 0; nxt < m; nxt++) {   if(((1<<nxt)&mask) > 0) continue;   addOn += cost[nxt][mask];  }  int res = oo;  for(int nxt = 0; nxt < m; nxt++) {   if(((1<<nxt)&mask) > 0) continue;   int ret = addOn+dp[mask | (1<<nxt)];   res = min(res, ret);  }  dp[mask] = res;  }   System.out.println(dp[0]>>1);   out.close(); }  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 double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }  public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }  public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  }   public int[] nextIntArray(int n) {  int[] res = new int[n];  for(int i = 0; i < n; i++) res[i] = nextInt();  return res;  }   } }
5	public class Main{  public static void main(String[] args) throws Exception {   int n = nextInt();  int a = nextInt();  int b = nextInt();  int[] tasks = new int[n];  for(int i = 0; i < n; i++){  tasks[i] = nextInt();  }  Arrays.sort(tasks);  exit(tasks[b] - tasks[b-1]);   }  private static PrintWriter out; private static BufferedReader inB; private static boolean FILE = false;   static {  try {  out = new PrintWriter(FILE ? (new FileOutputStream("output.txt")) : System.out);  inB = new BufferedReader(new InputStreamReader(FILE ? new FileInputStream("input.txt") : System.in));  } catch(Exception e) {e.printStackTrace();} }  private static StreamTokenizer in = new StreamTokenizer(inB);  private static void exit(Object o) throws Exception {  out.println(o);  out.flush();  System.exit(0); } private static void println(Object o) throws Exception{  out.println(o);  out.flush(); } private static void print(Object o) throws Exception{  out.print(o);  out.flush(); } private static int nextInt() throws Exception {  in.nextToken();  return (int)in.nval; }  private static String nextString() throws Exception {  in.nextToken();  return in.sval;   } }
5	public class Prob015A {  public static void main( String[] Args )  {   Scanner scan = new Scanner( System.in );   int numHouses = scan.nextInt();   int side = scan.nextInt() * 2;   ArrayList<Integer> sides = new ArrayList<Integer>();   for ( int x = 0; x < numHouses; x++ )   {    int c = scan.nextInt() * 2;    int s = scan.nextInt();    int l = c - s;    int r = c + s;    int li = Collections.binarySearch( sides, l );    int ri = Collections.binarySearch( sides, r );    if ( li >= 0 && ri >= 0 )    {     sides.remove( li );     sides.remove( li );    }    else if ( li >= 0 )     sides.set( li, r );    else if ( ri >= 0 )     sides.set( ri, l );    else    {     sides.add( -li - 1, r );     sides.add( -li - 1, l );    }   }   int possibilities = 2;   for ( int x = 1; x < sides.size() - 1; x += 2 )    if ( sides.get( x + 1 ) - sides.get( x ) > side )     possibilities += 2;    else if ( sides.get( x + 1 ) - sides.get( x ) == side )     possibilities += 1;   System.out.println( possibilities );  } }
4	public class Main{ static int[][][]memo; static int inf=(int)1e9; static int n,m,down[][],right[][]; static int dp(int i,int j,int k) {  if(k<=0)return 0;  if(memo[i][j][k]!=-1)return memo[i][j][k];  int ans=inf;  if(i+1<n) {  ans=Math.min(ans, down[i][j]+dp(i+1, j, k-1));  }  if(i-1>=0) {  ans=Math.min(ans, down[i-1][j]+dp(i-1, j, k-1));  }  if(j+1<m) {  ans=Math.min(ans, right[i][j]+dp(i, j+1, k-1));  }  if(j-1>=0) {  ans=Math.min(ans, right[i][j-1]+dp(i, j-1, k-1));  }  return memo[i][j][k]=ans; } static void main() throws Exception{  n=sc.nextInt();m=sc.nextInt();int k=sc.nextInt();  if((k&1)==1) {  for(int i=0;i<n;i++) {   for(int j=0;j<m;j++) {   pw.print((-1)+" ");   }   pw.println();  }  return;  }  k>>=1;  right=new int[n][];  down=new int[n-1][];  for(int i=0;i<n;i++) {  right[i]=sc.intArr(m-1);  }  for(int i=0;i<n-1;i++) {  down[i]=sc.intArr(m);  }  memo = new int[n][m][k+1];  int inf=(int)1e9;  for(int i=0;i<=k;i++) {  for(int j=0;j<n;j++) {   for(int o=0;o<m;o++) {   memo[j][o][i]=-1;   }  }  }   for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   pw.print((dp(i, j, k)<<1)+" ");  }  pw.println();  }  }  public static void main(String[] args) throws Exception{  sc=new MScanner(System.in);  pw = new PrintWriter(System.out);   int tc=1;   for(int i=1;i<=tc;i++) {    main();   }   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[] intArr(int n) throws IOException {    int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();    return in;   }   public long[] longArr(int n) throws IOException {    long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();    return in;   }   public int[] intSortedArr(int n) throws IOException {    int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();    shuffle(in);    Arrays.sort(in);    return in;   }   public long[] longSortedArr(int n) throws IOException {    long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();    shuffle(in);    Arrays.sort(in);    return in;   }   public Integer[] IntegerArr(int n) throws IOException {    Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();    return in;   }   public Long[] LongArr(int n) throws IOException {    Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();    return in;   }   public String nextLine() throws IOException {    return br.readLine();   }     public int nextInt() throws IOException {    return Integer.parseInt(next());   }     public double nextDouble() throws IOException {    return Double.parseDouble(next());   }     public char nextChar() throws IOException {    return next().charAt(0);   }     public long nextLong() throws IOException {    return Long.parseLong(next());   }     public boolean ready() throws IOException {    return br.ready();   }     public void waitForInput() throws InterruptedException {    Thread.sleep(3000);   }    }  static void sort(int[]in) {  shuffle(in);   Arrays.sort(in);  }  static void sort(long[]in) {  shuffle(in);   Arrays.sort(in);  }  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 Main{  void solve() {   int n=ni();   long d=nl();   long x[]=new long[n+1];   for(int i=1;i<=n;i++) x[i]=nl();   Arrays.sort(x,1,n+1);   int ans=2;   for(int i=2;i<=n;i++){    long x1=x[i-1]+d,x2=x[i]-d;    if(x[i]-x1>=d) ans++;    if(x2-x[i-1]>=d && x1!=x2) ans++;      }   pw.println(ans);  }    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 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 double nd() { return Double.parseDouble(ns()); }  private char nc() { return (char)skip(); }  private String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b))){    sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }  private char[] ns(int n) {   char[] buf = new char[n];   int b = skip(), p = 0;   while(p < n && !(isSpaceChar(b))){    buf[p++] = (char)b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }  private char[][] nm(int n, int m) {   char[][] map = new char[n][];   for(int i = 0;i < n;i++)map[i] = ns(m);   return map;  }  private int[] na(int n) {   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = ni();   return a;  }  private int ni() {   int num = 0, b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private long nl() {   long num = 0;   int b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); } }
5	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());  }  long nextLong() throws Exception {   return Long.parseLong(next());  }  double nextDouble() throws Exception {   return Double.parseDouble(next());  }  void solve() throws Exception {        int n = nextInt();   int a[] = new int[n];   for (int i = 0; i < n; i++)    a[i] = nextInt();   Arrays.sort(a);   if (a[n - 1] == 1) {    for (int i = 1; i < n; i++)     out.print("1 ");    out.print(2);    return;   }      Arrays.sort(a);   out.print(1);   for (int i = 1; i < n; i++)    out.print(" " + a[i-1]);  }  void run() {   try {    Locale.setDefault(Locale.US);    boolean oj = System.getProperty("ONLINE_JUDGE") != null;    Reader reader = oj ? new InputStreamReader(System.in)      : new FileReader("input.txt");    Writer writer = oj ? new OutputStreamWriter(System.out)      : new FileWriter("output.txt");    in = new BufferedReader(reader);    out = new PrintWriter(writer);    solve();    out.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }  public static void main(String[] args) {   new A().run();  } }
2	public class Problem {   public static void main(String[] args) throws Exception {   Scanner input = new Scanner(System.in);   int side = input.nextInt()-1;   int x = input.nextInt()-1;   int y = input.nextInt()-1;   long target = input.nextLong();        int[] to_sides = {y, side - x, side - y, x};   int[] to_corners = {(y+1)+(side-x+1),(side-x+1)+(side-y+1),(side-y+1)+(x+1),    (x+1)+(y+1)};   int min = Math.min(Math.min(y, x), Math.min(side - x, side - y));   int[] after_pass = {1, 1, 1, 1};   int[] corner_share = {1,1,1,1};   int steps = 0 , i;   long init = 1 ;   int grown = 4;   while (init < target) {    init += grown;    steps++;    if (steps >= min) {     for (i = 0; i < 4; i++) {      if (steps > to_sides[i]) {       init -= after_pass[i];       after_pass[i] += 2;      }      if (steps >= to_corners[i]){       init += corner_share[i]++;            }     }    }    grown += 4;   }   System.out.println(steps);  } }
4	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   String line = in.readLine();   int n = line.length();   int maxlenght = 0;   for (int i = 0; i < n; i++) {    int j = line.indexOf(line.charAt(i), i + 1);    while (j != -1) {     int k = i;     int l = j;     while (k < n && l < n && line.charAt(k) == line.charAt(l)) {      k++;      l++;     }     if (k - i > maxlenght) {      maxlenght = k - i;     }     j = line.indexOf(line.charAt(i), j + 1);    }   }   System.out.println(maxlenght);  } }
3	public class BuildIn {  public static void main(String[] args) throws IOException {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   solve(in, out);   out.close();  }  public static void solve(InputReader in, PrintWriter out) throws IOException  {  int n = in.nextInt();  int[] list = new int[n];  for(int i = 0; i < n; i++)  {   list[i]=in.nextInt();  }    int count = 0;  for(int i = 0; i < n-1; i++)  {   for(int j = i+1; j < n; j++)   {   if(list[j]<list[i])   {    count++;   }   }  }    boolean sta = true;  if(count%2==1) sta = false;    int m = in.nextInt();  for(int i = 0; i <m; i++)  {   int a = in.nextInt();   int b = in.nextInt();   if((b-a)%4==2) sta = !sta;   if((b-a)%4==1) sta = !sta;     if(sta) out.println("even");   else out.println("odd");  } }  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());   }   } }
0	public class Main{ public static void main(String args[]){  Scanner in = new Scanner(System.in);  int a[]={4,7,44,47,74,77,444,447,474,477,744,747,774,777};  int n=in.nextInt();  int i=0;  boolean yes=false;  while((i<14)&&(a[i]<=n)){  if(n%a[i]==0){   System.out.print("YES");   yes=true;   break;  } i++;  }  if(!yes)  System.out.print("NO"); } }
1	public class Main{           static int mod = 1000000007;       static ArrayList<Integer> cd[]; static int K=0;  public static void main(String[] args) throws Exception, IOException{      Reader sc = new Reader(System.in);         int n=sc.nextInt();  int a=sc.nextInt(),b=sc.nextInt(),d[]=new int[n];  HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();  ArrayList<Integer> A = new ArrayList<Integer>();     for (int i = 0; i < n ; i++) {    d[i]=sc.nextInt();  map.put(d[i],i );    }   int c=1;  if( a>b ){c--; int x=a; a=b; b=x;}   int r[]=new int[n];   if(a==b){    for (int i = 0; i < n; i++) {   if(d[i]>a || !map.containsKey(a-d[i]) ){System.out.println("NO"); return;}  } System.out.println("YES");  for (int i = 0; i < n; i++) {System.out.print("1 ");}  System.out.println();  return;  }    sort(d);  for (int j = 0; j < n; j++) {   int i=n-j-1;  int id=map.get(d[i]),idd=-1;  if( id<0)continue;        if( d[i]<=a ){   if( map.containsKey(a-d[i]) && 0<=(idd=map.get(a-d[i])) ){    r[id]=r[idd]=(c+1)%2;   map.put(a-d[i], -1);   }   else if( map.containsKey(b-d[i]) && 0<=(idd=map.get(b-d[i])) ){     r[id]=r[idd]=c;    map.put(b-d[i], -1); }   else{ System.out.println("NO"); return; }     }    else{     if( map.containsKey(b-d[i]) && 0<=(idd=map.get(b-d[i])) ){    r[id]=r[idd]=c;   map.put(b-d[i], -1); }   else{ System.out.println("NO"); return; }     }  map.put(d[i], -1);     }  System.out.println("YES");   for (int j = 0; j < n; j++) {  System.out.print(r[j]+" ");  }  System.out.println();        }  static class P implements Comparable<P>{  int id; long d; ; P(int id,long d){  this.id=id;  this.d=d; }   public int compareTo(P x){  return (-x.d+d)>=0?1:-1 ;     }  }  static void db(Object... os){  System.err.println(Arrays.deepToString(os)); }  }  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()); } public long nextLong() throws IOException {  return Long.parseLong(nextString()); } public double nextDouble() throws IOException {  return Double.parseDouble(nextString()); } }
5	public class main { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter; private PrintWriter pw; private long mod = 1000000000 + 7;  private StringBuilder ans_sb; private ArrayList<Integer> primes; private long ans;  private void soln() {  int n = nextInt();  long[] arr = new long[n];  for (int i = 0; i < n; i++)  arr[i] = nextLong();  Segment tree = new Segment(n, arr);  long[] ans = new long[n];  BigInteger fa = BigInteger.ZERO;  HashMap<Long, Integer> map = new HashMap<>();  for (int i = 0; i < n; i++)  {  ans[i] = ((long) i + 1) * arr[i] - tree.query(0, i);  if (map.containsKey(arr[i] - 1))  {   long tmp = map.get(arr[i] - 1);   ans[i] -= tmp;  }  if (map.containsKey(arr[i] + 1))  {   long tmp = map.get(arr[i] + 1);   ans[i] += tmp;  }   if (!map.containsKey(arr[i]))   map.put(arr[i], 0);  map.put(arr[i], map.get(arr[i]) + 1);  fa = fa.add(new BigInteger(Long.toString(ans[i])));  }     pw.println(fa.toString());                                                                                                                                                                                  }  public class Segment {  private Node[] tree;  private boolean[] lazy;  private int size;  private int n;  private long[] base;  private class Node  {  private int l;  private int r;  private long ans;  private long ans2;  }  public Segment(int n, long[] arr)  {  this.base = arr;  int x = (int) (Math.ceil(Math.log(n) / Math.log(2)));  size = 2 * (int) Math.pow(2, x) - 1;  tree = new Node[size];  lazy = new boolean[size];  this.n = n;    build(0, 0, n - 1);  }  public void build(int id, int l, int r)  {  if (l == r)  {   tree[id] = new Node();   tree[id].l = l;   tree[id].r = r;   tree[id].ans = base[l];   return;  }  int mid = (l + r) / 2;  build(2 * id + 1, l, mid);  build(2 * id + 2, mid + 1, r);  tree[id] = merge(tree[2 * id + 1], tree[2 * id + 2], l, r);    }  public Node merge(Node n1, Node n2, int l, int r)  {  Node ret = new Node();  if (n1 == null && n2 == null)   return null;  else if (n1 == null)  {   ret.ans = n2.ans;  }   else if (n2 == null)  {   ret.ans = n1.ans;  } else  {   ret.ans = n1.ans + n2.ans;   }   return ret;  }  public long query(int l, int r)  {  Node ret = queryUtil(l, r, 0, 0, n - 1);  if (ret == null)  {   return 0;  } else   return ret.ans;  }  private Node queryUtil(int x, int y, int id, int l, int r)  {  if (l > y || x > r)   return null;  if (x <= l && r <= y)  {   return tree[id];  }  int mid = l + (r - l) / 2;    Node q1 = queryUtil(x, y, 2 * id + 1, l, mid);  Node q2 = queryUtil(x, y, 2 * id + 2, mid + 1, r);   return merge(q1, q2, Math.max(l, x), Math.min(r, y));  }  public void update(int x, int y, int c)  {  update1(x, y, c, 0, 0, n - 1);  }  private void update1(int x, int y, int colour, int id, int l, int r)  {    if (x > r || y < l)   return;  if (x <= l && r <= y)  {   if (colour != -1)   {   tree[id] = new Node();   tree[id].ans = 1;   } else   tree[id] = null;   return;  }  int mid = l + (r - l) / 2;    if (y <= mid)   update1(x, y, colour, 2 * id + 1, l, mid);  else if (x > mid)   update1(x, y, colour, 2 * id + 2, mid + 1, r);  else  {   update1(x, y, colour, 2 * id + 1, l, mid);   update1(x, y, colour, 2 * id + 2, mid + 1, r);  }  tree[id] = merge(tree[2 * id + 1], tree[2 * id + 2], l, r);  }  public void print(int l, int r, int id)  {  if (l == r)  {   if (tree[id] != null)   System.out.println(l + " " + r + " " + tree[id].l + " " + tree[id].r + " " + tree[id].ans + " "    + tree[id].ans2);   return;  }  int mid = l + (r - l) / 2;  print(l, mid, 2 * id + 1);  print(mid + 1, r, 2 * id + 2);  if (tree[id] != null)   System.out.println(    l + " " + r + " " + tree[id].l + " " + tree[id].r + " " + tree[id].ans + " " + tree[id].ans2);  }  public void shift(int id)  {  } }  private class Node implements Comparable<Node> {  int node;  long dist;  @Override  public int compareTo(Node arg0)  {  if (this.dist != arg0.dist)   return (int) (this.dist - arg0.dist);  return this.node - arg0.node;  }  public boolean equals(Object o)  {  if (o instanceof Node)  {   Node c = (Node) o;   return this.node == c.node && this.dist == c.dist;  }  return false;  }  public String toString()  {  return this.node + ", " + this.dist;  } }  private void debug(Object... o) {  System.out.println(Arrays.deepToString(o)); }  private long pow(long a, long b, long c) {  if (b == 0)  return 1;  long p = pow(a, b / 2, c);  p = (p * p) % c;  return (b % 2 == 0) ? p : (a * p) % c; }  private long gcd(long n, long l) {  if (l == 0)  return n;  return gcd(l, n % l); }  public static void main(String[] args) throws Exception {  new Thread(null, new Runnable()  {  @Override  public void run()  {   new main().solve();  }  }, "1", 1 << 26).start(); }  public StringBuilder solve() {  InputReader(System.in);   pw = new PrintWriter(System.out);  ans_sb = new StringBuilder();  soln();  pw.close();   return ans_sb; }  public void InputReader(InputStream stream1) {  stream = stream1; }  private boolean isWhitespace(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  private boolean isEndOfLine(int c) {  return c == '\n' || c == '\r' || 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++]; }  private 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 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; }  private String nextToken() {  int c = read();  while (isSpaceChar(c))  c = read();  StringBuilder res = new StringBuilder();  do  {  res.appendCodePoint(c);  c = read();  } while (!isSpaceChar(c));  return res.toString(); }  private String nextLine() {  int c = read();  while (isSpaceChar(c))  c = read();  StringBuilder res = new StringBuilder();  do  {  res.appendCodePoint(c);  c = read();  } while (!isEndOfLine(c));  return res.toString(); }  private int[] nextIntArray(int n) {  int[] arr = new int[n];  for (int i = 0; i < n; i++)  {  arr[i] = nextInt();  }  return arr; }  private long[] nextLongArray(int n) {  long[] arr = new long[n];  for (int i = 0; i < n; i++)  {  arr[i] = nextLong();  }  return arr; }  private void pArray(int[] arr) {  for (int i = 0; i < arr.length; i++)  {  System.out.print(arr[i] + " ");  }  System.out.println();  return; }  private void pArray(long[] arr) {  for (int i = 0; i < arr.length; i++)  {  System.out.print(arr[i] + " ");  }  System.out.println();  return; }  private boolean isSpaceChar(int c) {  if (filter != null)  return filter.isSpaceChar(c);  return isWhitespace(c); }  private char nextChar() {  int c = read();  while (isSpaceChar(c))  c = read();  char c1 = (char) c;  while (!isSpaceChar(c))  c = read();  return c1; }  private interface SpaceCharFilter {  public boolean isSpaceChar(int ch); } }
6	public class Main {  BufferedReader in = null;  PrintWriter out = null;  int dist(int x1, int y1, int x2, int y2) {   int dx = Math.abs(x1 - x2);   int dy = Math.abs(y1 - y2);   return dx * dx + dy * dy;  }  boolean testBit(int use, int p) {   return ((use >> p) & 1) == 1;  }  int rec(int use, int a[][], int dp[], int next[]) {   if (dp[use] != -1) {    return dp[use];   }   if (use == 0) {    return dp[use] = 0;   }   int n = a.length;   int ix = -1;     for (int i = 0; i < n; ++i) {    if (testBit(use, i)) {     if (ix == -1) {      ix = i;      break;     }         }   }   int r = rec(use ^ (1 << ix), a, dp, next) + a[ix][ix];   next[use] = use ^ (1 << ix);      for (int i = ix + 1; i < n; ++i) {    if (!testBit(use, i)) {     continue;    }    int t = rec(use ^ (1 << ix) ^ (1 << i), a, dp, next);    t += a[ix][i];    if (t < r) {     r = t;     next[use] = use ^ (1 << ix) ^ (1 << i);    }   }   return dp[use] = r;  }  void print(int use1, int use2, int n) {   for (int i = 0; i < n; ++i) {    if (testBit(use1, i) ^ testBit(use2, i)) {     int x = i + 1;     out.print(x + " ");    }   }  }  void solve() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);     StringTokenizer st;   st = new StringTokenizer(in.readLine());   int sx = Integer.valueOf(st.nextToken());   int sy = Integer.valueOf(st.nextToken());   st = new StringTokenizer(in.readLine());   int n = Integer.valueOf(st.nextToken());   int x[] = new int[n];   int y[] = new int[n];   for (int i = 0; i < n; ++i) {    st = new StringTokenizer(in.readLine());    x[i] = Integer.valueOf(st.nextToken());    y[i] = Integer.valueOf(st.nextToken());   }   int a[][] = new int[n][n];   for (int i = 0; i < n; ++i) {    for (int j = 0; j < n; ++j) {     a[i][j] = dist(x[i], y[i], sx, sy) + dist(x[j], y[j], sx, sy) + dist(x[i], y[i], x[j], y[j]);    }   }   int dp[] = new int[1 << n];   Arrays.fill(dp, -1);   int next[] = new int[1 << n];   int ans = rec((1 << n) - 1, a, dp, next);   out.println(ans);   int use = (1 << n) - 1;   while (true) {    int nuse = next[use];    out.print("0 ");    print(use, nuse, n);    if (nuse == 0) break;    use = nuse;   }   out.println("0");     in.close();   out.close();  }   public static void main(String[] args) throws IOException {   new Main().solve();  } }
0	public class HexadecimalsTheorem {  public void solve() {   Scanner sc = new Scanner(System.in);   long n = sc.nextLong();   ArrayList<Long> a = new ArrayList<Long>();   a.add(0l);   a.add(1L);   a.add(1L);   int i = 1, j = 2;   while ((a.get(i) + a.get(j)) <= n) {    a.add((a.get(i) + a.get(j)));    i++;    j++;   }   if (a.contains(n)) {    if (n == 0) {     System.out.println("0 0 0");    } else if (n == 1) {     System.out.println("0 0 1");    } else if (n == 2) {     System.out.println("0 1 1");    } else {     System.out.println(a.get(j - 4) + " " + a.get(j - 3) + " " + a.get(j - 1));    }   } else {    System.out.println("I'm too stupid to solve this problem");   }   }  public static void main(String[] args) {   new HexadecimalsTheorem().solve();  } }
1	public class BOOL {  static char [][]ch;  static int n,m; private static FastReader in =new FastReader();  public static void main(String[] args) {  int n=in.nextInt();  int a[]=new int[1000002];  int dp[]=new int[1000002],ans=0;  for(int i=0;i<n;i++){a[in.nextInt()]=in.nextInt();}  dp[0]=a[0]==0?0:1;  for(int i=1;i<1000002;i++){  if(a[i]==0){dp[i]=dp[i-1];}  else{  if(a[i]>=i){dp[i]=1;}  else{  dp[i]=dp[i-a[i]-1]+1;  }}  if(dp[i]>=ans)ans=dp[i];  }   System.out.println(n-ans);  }} 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());   }    double nextDouble()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   } }
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);    }   }  } }
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 sx = in.nextInt();   int sy = in.nextInt();   int n = in.nextInt();   int[] x = new int[n];   int[] y = new int[n];   for (int i = 0; i < n; i++) {    x[i] = in.nextInt();    y[i] = in.nextInt();   }   int[] dp = new int[1 << n];   int[] p = new int[1 << n];   int inf = 1000000000;   Arrays.fill(dp, inf);   dp[0] = 0;   for (int mask = 0; mask < (1 << n) - 1; mask ++) {    int k = -1;    if (dp[mask] == inf)     continue;    for (int i = 0; i < n; i++) {     if ((mask & (1 << i)) == 0) {      k = i;      break;     }    }    for (int i = k; i < n; i++) {     if ((mask & (1 << i)) == 0) {      int val = dp[mask] + dist(sx, sy, x[i], y[i]) + dist(sx, sy, x[k], y[k]) + dist(x[i], y[i], x[k], y[k]);      if (val < dp[mask | (1 << i) | (1 << k)]) {       dp[mask | (1 << i) | (1 << k)] = val;       p[mask | (1 << i) | (1 << k)] = mask;      }     }    }   }   out.println(dp[(1 << n) - 1]);   int cur = (1 << n) - 1;   out.print(0+" ");   while (cur != 0) {    int prev = p[cur];    for (int i = 0; i < n; i++) {     if (((cur & (1 << i)) ^ (prev & (1 << i))) != 0)      out.print(i+1+" ");    }     out.print(0+" ");    cur = prev;   }   out.flush();   out.close();  }  int dist(int x1, int y1, int x2, int y2) {   return (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);  }  long gcd(long a, long b) {   if (b == 0)    return a;   return gcd(b, a%b);  }  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 Pair implements Comparable<Pair>{   int a;   int b;   Pair(int a, int b) {    this.a = a;    this.b = b;   }   public int compareTo(Pair p) {    if (b < p.b)     return 1;    if (b > p.b)     return -1;    return 0;   }                            }  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());   }   long nextLong() throws NumberFormatException, IOException {    return Long.valueOf(next());   }   double nextDouble() throws NumberFormatException, IOException {    return Double.valueOf(next());   }   String nextLine() throws IOException {    return br.readLine();   }  } }
1	public class Main { static Scanner sc = new Scanner (System.in);  public static void main(String[] args) {  int n = sc.nextInt();  int k = sc.nextInt();  char str[][] = new char[5][n];   for(int i = 0;i < 4;i ++){   for(int j = 0;j < n;j ++)     str[i][j] = '.';   }   if(k % 2 == 0){    k /= 2;    for(int i = 1;i <= 2;i++){     for(int j = 1;j <= k;j++)      str[i][j] = '#';    }   }   else{    str[1][n / 2] = '#';    if(k != 1){     int tmp = n / 2;     if(k <= n - 2){      for(int i = 1;i<= (k - 1) / 2;i++){       str[1][i] = '#';       str[1][n - 1 - i] = '#';      }     }     else{      for(int i = 1;i <= n - 2;i++) str[1][i] = '#';      k -= n - 2;      for(int i = 1;i <= k/2;i++){       str[2][i] = '#';       str[2][n - 1 - i]='#';      }     }      }   }   System.out.println("YES");   for(int i = 0;i < 4;i ++){   System.out.println(str[i]);   }  } }
2	public class ReallyBigNums {   private static long[] factorArray(long s)  {   int d=0;   long n=s;   long f=1;   while(n>0)   {    n=n/10;    d++;    f = f*10;   }     long[] fact = new long[d+1];   n=s;   for(int i=d;i>=0;i--)   {    if(f==1)     fact[i] = n;    else    {     fact[i] = n/(f-1);     n = n%(f-1);     f=f/10;    }   }   int carry=0;   for(int i=0;i<=d;i++)   {    fact[i] = fact[i]+carry;    if(fact[i]>9 || (i==0 && fact[i]>0))    {     fact[i] = 0;     carry = 1;     for(int j=i-1;j>=0;j--)     {      fact[j] =0;     }    }    else    {     carry = 0;    }   }     return fact;  }   private static long bigNumCount(long n, long s)  {   if(s>=n)    return 0;   if(s==0)    return n;   long[] fact = factorArray(s);     long startNum = 0;   int len = fact.length;   long tenPow = 1;   for(int i=0;i<len;i++)   {    startNum = startNum+tenPow*fact[i];    tenPow = tenPow*10;   }     return(Math.max(0,n-startNum+1));  }  private 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());   }    double nextDouble()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  }  public static void main(String args[])  {   FastReader r = new FastReader();   long n = r.nextLong();   long s= r.nextLong();   System.out.println(bigNumCount(n,s));  }  }
1	public class Main {    private PrintWriter out;  private Map<Integer, Integer> map;   private int arr[], ans[];  int n, a, b;   class DSU {   private int[] p, size;     public DSU(int n) {    p = new int[n];    size = new int[n];       for (int i=0; i<n; i++) {     p[i] = i;     size[i] = 1;    }   }     public int find(int i) {    if (p[i] == i) {     return i;    }    return p[i] = find(p[i]);   }     public void union (int a, int b) {    a = find(a); b = find(b);    if (size[a] > size[b]) {     p[b] = a;     size[a] += size[b];    } else {     p[a] = b;     size[b] += size[a];    }   }  }   private void solve() throws Exception {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(new OutputStreamWriter(System.out));   StringTokenizer st = new StringTokenizer(in.readLine());     n = Integer.valueOf(st.nextToken());   a = Integer.valueOf(st.nextToken());   b = Integer.valueOf(st.nextToken());   map = new HashMap<Integer, Integer>(n);     String line = in.readLine();   StringTokenizer st1 = new StringTokenizer(line);     arr = new int[n];   ans = new int[n];   DSU dsu = new DSU(n);     for (int i=0; i<n; i++) {    arr[i] = Integer.valueOf(st1.nextToken());    map.put(arr[i], i);   }   in.close();     for (int i=0; i<n; i++) {    boolean f = false;    if (map.get(a - arr[i]) != null) {     f = true;     dsu.union(i, map.get(a - arr[i]));    }       if (map.get(b - arr[i]) != null) {     f = true;     dsu.union(i, map.get(b - arr[i]));    }       if (!f) {     out.println("NO");     out.flush();     return;    }   }     for (int i=0; i<n; i++) {    int p = dsu.find(i);    if (map.get(a - arr[i]) == null) {     ans[p] = 1;    } else if (map.get(b - arr[i]) == null) {     ans[p] = 0;    }   }     for (int i=0; i<n; i++) {    int p = dsu.find(i);    if (ans[p] == 0 && map.get(a - arr[i]) == null) {     out.println("NO");     out.flush();     return;    }        if (ans[p] == 1 && map.get(b - arr[i]) == null) {     out.println("NO");     out.flush();     return;    }   }     out.println("YES");   for (int i=0; i<n; i++) {    out.print(ans[dsu.find(i)] + " ");   }       out.flush();   out.close();  }  public static void main(String[] args) throws Exception {   new Main().solve();  } }
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());   }   public long nextLong()   {    return Long.parseLong(next());   }  }  static class card{   long a;   int i;   public card(long a,int i)   {    this.a=a;    this.i=i;   }  }  static class sort implements Comparator<pair>  {   public int compare(pair o1,pair o2)   {    if(o1.a!=o2.a)     return (int)(o1.a-o2.a);    else     return (int)(o1.b-o2.b);   }  }  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);  }     static class pair{   int a,b;   public pair(int a,int b)   {    this.a=a;    this.b=b;   }  }  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);  } }
5	public class order { public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(new BufferedWriter(   new OutputStreamWriter(System.out)));  int n=Integer.parseInt(in.readLine());  Set<Integer> set = new TreeSet<Integer>();  StringTokenizer st= new StringTokenizer(in.readLine());  int a;  List<Integer> list =new LinkedList<Integer>();  while(st.hasMoreTokens()){  a= Integer.parseInt(st.nextToken());  if(!set.contains(a)){   list.add(a);   set.add(a);  }    }  if(list.size()==1){  out.println("NO");  }else{  Collections.sort(list);  out.println(list.get(1));  }  out.close();  System.exit(0); } }
0	public class Main {  static void solve() throws IOException {   String str = br.readLine();   StringBuffer sb1 = new StringBuffer(str);   StringBuffer sb2 = new StringBuffer(str);   StringBuffer sb3 = new StringBuffer(str);   sb1.deleteCharAt(sb1.length()-1);   sb2.deleteCharAt(sb2.length()-2);   int n1 = Integer.parseInt(sb1.toString());   int n2 = Integer.parseInt(sb2.toString());   int n3 = Integer.parseInt(sb3.toString());   out.println(Math.max(n1, Math.max(n2, n3)));  }  static BufferedReader br;  static StringTokenizer st;  static PrintWriter out;  public static void main(String[] args) throws IOException {   InputStream input = System.in;   br = new BufferedReader(new InputStreamReader(input));   out = new PrintWriter(System.out);   solve();   out.close();  }  static long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  static double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  static int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  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();  } }
3	public class Main{ static int max=Integer.MAX_VALUE,min=Integer.MIN_VALUE; static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st;  static int max(int a,int b)  {  return Math.max(a, b);  }  static int min(int a,int b)  {  return Math.min(a, b);  }  static int i()throws IOException  {  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  return Integer.parseInt(st.nextToken());  }  static long l()throws IOException  {  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  return Long.parseLong(st.nextToken());  }  static String s()throws IOException  {  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  return st.nextToken();  }  static double d()throws IOException  {  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  return Double.parseDouble(st.nextToken());  }  static void p(String p)  {  System.out.print(p);  }  static void p(int p)  {  System.out.print(p);  }  static void p(double p)  {  System.out.print(p);  }  static void p(long p)  {  System.out.print(p);  }  static void p(char p)  {  System.out.print(p);  }  static void p(boolean p)  {  System.out.print(p);  }  static void pl(String pl)  {  System.out.println(pl);  }  static void pl(int pl)  {  System.out.println(pl);  }  static void pl(char pl)  {  System.out.println(pl);  }  static void pl(double pl)  {  System.out.println(pl);  }  static void pl(long pl)  {  System.out.println(pl);  }  static void pl(boolean pl)  {  System.out.println(pl);  }  static void pl()  {  System.out.println();  }  static int[] ari(int n)throws IOException  {  int ar[]=new int[n];  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  for(int x=0;x<n;x++)   ar[x]=Integer.parseInt(st.nextToken());  return ar;  }  static int[][] ari(int n,int m)throws IOException  {  int ar[][]=new int[n][m];  for(int x=0;x<n;x++)  {   st=new StringTokenizer(br.readLine());   for(int y=0;y<m;y++)   ar[x][y]=Integer.parseInt(st.nextToken());  }  return ar;  }  static long[] arl(int n)throws IOException  {  long ar[]=new long[n];  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  for(int x=0;x<n;x++)   ar[x]=Long.parseLong(st.nextToken());  return ar;  }  static long[][] arl(int n,int m)throws IOException  {  long ar[][]=new long[n][m];  for(int x=0;x<n;x++)  {   st=new StringTokenizer(br.readLine());   for(int y=0;y<m;y++)   ar[x][y]=Long.parseLong(st.nextToken());  }  return ar;  }  static String[] ars(int n)throws IOException  {  String ar[]=new String[n];  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  for(int x=0;x<n;x++)   ar[x]=st.nextToken();  return ar;  }  static String[][] ars(int n,int m)throws IOException  {  String ar[][]=new String[n][m];  for(int x=0;x<n;x++)  {   st=new StringTokenizer(br.readLine());   for(int y=0;y<m;y++)   ar[x][y]=st.nextToken();  }  return ar;  }  static double[] ard(int n)throws IOException  {  double ar[]=new double[n];  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  for(int x=0;x<n;x++)   ar[x]=Double.parseDouble(st.nextToken());  return ar;  }  static double[][] ard(int n,int m)throws IOException  {  double ar[][]=new double[n][m];  for(int x=0;x<n;x++)  {   st=new StringTokenizer(br.readLine());   for(int y=0;y<m;y++)   ar[x][y]=Double.parseDouble(st.nextToken());  }  return ar;  }  static char[] arc(int n)throws IOException  {  char ar[]=new char[n];  if(!st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  for(int x=0;x<n;x++)   ar[x]=st.nextToken().charAt(0);  return ar;  }  static char[][] arc(int n,int m)throws IOException  {  char ar[][]=new char[n][m];  for(int x=0;x<n;x++)  {   st=new StringTokenizer(br.readLine());   for(int y=0;y<m;y++)   ar[x][y]=st.nextToken().charAt(0);  }  return ar;  }  static void par(int ar[])  {  for(int a:ar)   System.out.print(a+" ");  System.out.println();  }  static void par(int ar[][])  {  for(int a[]:ar)  {   for(int aa:a)   System.out.print(aa+" ");   System.out.println();  }  }  static void par(long ar[])  {  for(long a:ar)   System.out.print(a+" ");  System.out.println();  }  static void par(long ar[][])  {  for(long a[]:ar)  {   for(long aa:a)   System.out.print(aa+" ");   System.out.println();  }  }  static void par(String ar[])  {  for(String a:ar)   System.out.print(a+" ");  System.out.println();  }  static void par(String ar[][])  {  for(String a[]:ar)  {   for(String aa:a)   System.out.print(aa+" ");   System.out.println();  }  }  static void par(double ar[])  {  for(double a:ar)   System.out.print(a+" ");  System.out.println();  }  static void par(double ar[][])  {  for(double a[]:ar)  {   for(double aa:a)   System.out.print(aa+" ");   System.out.println();  }  }  static void par(char ar[])  {  for(char a:ar)   System.out.print(a+" ");  System.out.println();  }  static void par(char ar[][])  {  for(char a[]:ar)  {   for(char aa:a)   System.out.print(aa+" ");   System.out.println();  }  }  static public void main(String[] args)throws Exception{  st=new StringTokenizer(br.readLine());  int n=i();  int ar[]=ari(n);  Arrays.sort(ar);  int c=0;     for(int x=0;x<n;x++)   {   if(ar[x]!=-1)   {    c++;    for(int y=x+1;y<n;y++)    {    if(ar[y]!=-1)     {     if(ar[y]%ar[x]==0)     {     ar[y]=-1;     }     }    }    ar[x]=-1;   }   }   pl(c);                                          } }
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);  }  }  @Override  public int compareTo(Column col) {  return max - col.max;  } } }
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(); } private static int nextInt() throws IOException{  return Integer.parseInt(next()); }  private static long nextLong() throws IOException{  return Long.parseLong(next()); }  private static double nextDouble() throws IOException{  return Double.parseDouble(next()); }  private static String next() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  } }
5	public class A {  int INF = 1 << 28;  void run() {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int a = sc.nextInt();   int b = sc.nextInt();   long[] chores = new long[n];   for(int i=0;i<n;i++) chores[i] = sc.nextLong();   sort(chores);   System.out.println(chores[b]-chores[b-1]);  }  public static void main(String[] args) {   new A().run();  } }
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)); } }
0	public class CF125A {  private void work() throws IOException {  Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(   System.in)));  int n = sc.nextInt();  System.out.printf("%d %d %d\n", 0, 0, n);  System.out.close(); }  public static void main(String[] args) throws IOException {  new CF125A().work(); } }
4	public class D2 { InputStream is; FastWriter out; String INPUT = "";  void solve() {  int n = ni(), m = ni(), K = ni();  int[][] a = new int[2*n+1][2*m+1];  for(int i = 0;i < n;i++){  int[] u = na(m-1);  for(int j = 0;j < m-1;j++){   a[2*i][2*j+1] = u[j];  }  }  for(int i = 0;i < n-1;i++){  int[] u = na(m);  for(int j = 0;j < m;j++){   a[2*i+1][2*j] = u[j];  }  }  if(K % 2 == 1){  for(int i = 0;i < n;i++){   for(int j = 0;j < m;j++){   out.print(-1 + " ");   }   out.println();  }  return;  }  int[][][] dp = new int[K/2+1][n][m];  int[] dr = {1, 0, -1, 0};  int[] dc = {0, 1, 0, -1};  for(int i = 1;i <= K/2;i++){  for(int j = 0;j < n;j++){   for(int k = 0;k < m;k++){   dp[i][j][k] = Integer.MAX_VALUE;   for(int l = 0;l < 4;l++){    int jj = j + dr[l], kk = k + dc[l];    if(jj >= 0 && jj < n && kk >= 0 && kk < m){    dp[i][j][k] = Math.min(dp[i][j][k], dp[i-1][jj][kk] + a[j+jj][k+kk]);    }   }   }  }  }  for(int i = 0;i < n;i++){  for(int j = 0;j < m;j++){   out.print(dp[K/2][i][j] * 2 + " ");  }  out.println();  } }  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 D2().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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   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 long[] nal(int n) {  long[] a = new long[n];  for(int i = 0;i < n;i++)a[i] = nl();  return a; }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[][] nmi(int n, int m) {  int[][] map = new int[n][];  for(int i = 0;i < n;i++)map[i] = na(m);  return map; }  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 {  private static 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;  }  private static 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;  }  private static 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(); } }  public void trnz(int... o) {  for(int i = 0;i < o.length;i++)if(o[i] != 0)System.out.print(i+":"+o[i]+" ");  System.out.println(); }   public void trt(long... o) {  Queue<Integer> stands = new ArrayDeque<>();  for(int i = 0;i < o.length;i++){  for(long x = o[i];x != 0;x &= x-1)stands.add(i<<6|Long.numberOfTrailingZeros(x));  }  System.out.println(stands); }  public void tf(boolean... r) {  for(boolean x : r)System.out.print(x?'#':'.');  System.out.println(); }  public void tf(boolean[]... b) {  for(boolean[] r : b) {  for(boolean x : r)System.out.print(x?'#':'.');  System.out.println();  }  System.out.println(); }  public void tf(long[]... b) {  if(INPUT.length() != 0) {  for (long[] r : b) {   for (long x : r) {   for (int i = 0; i < 64; i++) {    System.out.print(x << ~i < 0 ? '#' : '.');   }   }   System.out.println();  }  System.out.println();  } }  public void tf(long... b) {  if(INPUT.length() != 0) {  for (long x : b) {   for (int i = 0; i < 64; i++) {   System.out.print(x << ~i < 0 ? '#' : '.');   }  }  System.out.println();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
6	public class MaeDosDragoes { public static PrintWriter saida = new PrintWriter(System.out, false); public static class Escanear {   BufferedReader reader;   StringTokenizer tokenizer;  public Escanear() {    this(new InputStreamReader(System.in));   }  public Escanear(Reader in) {    reader = new BufferedReader(in);   }   String proximo() {    if (tokenizer == null || !tokenizer.hasMoreElements()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return tokenizer.nextToken();   }     int proximoNum() {    return Integer.parseInt(proximo());   }  }  public static void main(String[] args) {  Escanear escanear = new Escanear();  int proximoInt = escanear.proximoNum();   long[] aux = new long[proximoInt];   double proximoDouble = escanear.proximoNum();   for(Integer i = 0; i < proximoInt; i++) {    for(Integer j =0; j < proximoInt; j++) {     Integer val = escanear.proximoNum();     if (val.equals(1) || i.equals(j)) {   aux[i] |= 1L << j;   }    }   }   int esquerda = proximoInt/2;   int direita = proximoInt - esquerda;  int maiorMascara = 1 << esquerda;  int[] depois = new int[1 << esquerda];  Integer mascara = 1;  while (mascara < maiorMascara) {  int mascaraAtual = mascara;    for(int j = 0; j < esquerda; j++) {     if (((1 << j) & mascara) > 0) {      mascaraAtual &= aux[j + direita] >> direita;      depois[mascara] = Math.max(depois[mascara], depois[mascara ^ (1 << j)]);     }    }    if (mascara.equals(mascaraAtual)) {     depois[mascara] = Math.max(depois[mascara],Integer.bitCount(mascara));  }  mascara++;  }                                 int auxiliar = 0;   int mascaraMaxima = 1 << direita;   for(int masc = 0; masc < mascaraMaxima; masc++) {    int mascaraCorrente = masc;    int mascaraValor = maiorMascara -1;    for(int j = 0; j < direita; j++) {     if (((1 << j) & masc) > 0) {      mascaraCorrente &= (aux[j] & (mascaraMaxima-1));      mascaraValor &= aux[j] >> direita;     }    }    if (mascaraCorrente != masc) continue;    auxiliar = Math.max(auxiliar, Integer.bitCount(masc) + depois[mascaraValor]);   }   proximoDouble/=auxiliar;   saida.println(proximoDouble * proximoDouble * (auxiliar * (auxiliar-1))/2);   saida.flush();  } }
2	public class Main {   public static void main(String[] args) {  Scanner scanner = new Scanner(System.in);  long n = scanner.nextLong();  long s = scanner.nextLong();  long l = 0, r = n + 1;  while(r - l > 1) {  long mid = (l + r) / 2;  long k = mid, sum = 0;  while(k != 0) {   sum += k % 10;   k /= 10;  }  if(mid - sum >= s) r = mid; else l = mid;  }  System.out.print(n - r + 1); } }
6	public class Main {  static int hx, hy; static int[] X, Y; static int N; static int[] DP;  static int pw(int a) {  return a * a; }  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  hx = sc.nextInt();  hy = sc.nextInt();  N = sc.nextInt();  X = new int[N];  Y = new int[N];  for (int i = 0; i < N; ++i) {  X[i] = sc.nextInt();  Y[i] = sc.nextInt();  }  DP = new int[1 << N];  Arrays.fill(DP, -1);  int ans = recur(0);  ArrayList<Integer> aa = new ArrayList<Integer>();  int U = 0;  aa.add(0);  int test = 0;  while (U != (1 << N) - 1) {  int a = 0;  for (int i = 0; i < N; ++i) {   if (((1 << i) & U) == 0) {   a = i;   break;   }  }  int ans2 = recur(U | (1 << a)) + 2 * (pw(X[a] - hx) + pw(Y[a] - hy));  int temp = 2 * (pw(X[a] - hx) + pw(Y[a] - hy));  int best = -1;  for (int i = a + 1; i < N; ++i) {   if (((1 << i) & U) == 0) {   int ans3 = recur(U|(1<<a)|(1<<i)) + pw(X[a]-X[i])+pw(Y[a]-Y[i]) + pw(X[a]-hx)+pw(Y[a]-hy) + pw(X[i]-hx)+pw(Y[i]-hy);   if (ans3 < ans2) {    ans2 = ans3;    ans2 = ans3;    best = i;    temp = pw(X[a]-X[i])+pw(Y[a]-Y[i]) + pw(X[a]-hx)+pw(Y[a]-hy) + pw(X[i]-hx)+pw(Y[i]-hy);   }   }  }  if (best == -1) {   aa.add(a + 1);   aa.add(0);   U |= (1 << a);  } else {   aa.add(a + 1);   aa.add(best + 1);   aa.add(0);   U |= (1 << a) | (1 << best);  }  }  System.out.println(ans);  for (int i = 0; i < aa.size(); ++i) {  System.out.print(aa.get(i) + " ");  } }  private static int recur(int U) {  if (DP[U] != -1) {  return DP[U];  }  if (U == (1 << N) - 1) {  return 0;  }  int a = 0;  for (int i = 0; i < N; ++i) {  if (((1 << i) & U) == 0) {   a = i;   break;  }  }  int ans = recur(U | (1 << a)) + 2 * (pw(X[a] - hx) + pw(Y[a] - hy));  for (int i = a + 1; i < N; ++i) {  if (((1 << i) & U) == 0) {   ans = min(ans, recur(U|(1<<a)|(1<<i)) + pw(X[a]-X[i])+pw(Y[a]-Y[i]) + pw(X[a]-hx)+pw(Y[a]-hy) + pw(X[i]-hx)+pw(Y[i]-hy));  }  }  DP[U] = ans;  return ans; } }
3	public class A { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int []a = new int [n];  boolean []used = new boolean[n];  for (int i = 0; i < n; i++) {  a[i] = sc.nextInt();  }  Arrays.sort(a);  int ans = 0;  for (int i = 0; i < used.length; i++) {  if (!used[i]){   ans++;   for (int j = i; j < used.length; j++) {   if (a[j]%a[i] == 0){   used[j] = true;   }   }  }  }  System.out.print(ans); } }
1	public class Main {  static PrintWriter out; static BufferedReader in;  public static void main(String[] args) throws Exception {  out = new PrintWriter(System.out);  in = new BufferedReader(new InputStreamReader(System.in));   int n = new Integer(in.readLine());  for (int i = 0; i < n; i++) {  String s = in.readLine();  int x = 0;  while (s.charAt(x) - 'A' >= 0 && s.charAt(x) - 'Z' <= 0) x++;  int y = s.length() - 1;  while (s.charAt(y) - '0' >= 0 && s.charAt(y) - '9' <= 0) y--;   if (x > y) {   int k = 1;   int a = 1;   for (int j = 1; j < x; j++) {   k *= 26;   a += k;   }   for (int j = 0; j < x; j++) {   a += k*(s.charAt(j) - 'A');   k /= 26;   }   int b = Integer.parseInt(s.substring(x));   out.println("R" + b + "C" + a);  } else {   while (s.charAt(x) - '0' >= 0 && s.charAt(x) - '9' <= 0) x++;   int b = Integer.parseInt(s.substring(1, x));   int a = Integer.parseInt(s.substring(x + 1));   int num = 0;   int k = 1;   while (a >= k) {   a -= k;   k *= 26;   }   k /= 26;   while (k > 0) {    out.print((char)('A' + (a/k)));   a %= k;   k /= 26;   }   out.println(b);  }  }  out.close(); } }
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());  }    public long nextLong() throws IOException {   return Long.parseLong(next());  }  public double nextDouble() throws IOException {   return Double.parseDouble(next());  }   } }
0	public class Soal3 {  public static void main(String[] args) throws IOException{   BufferedReader baca = new BufferedReader(new InputStreamReader(System.in));   String[] masukan = baca.readLine().split(" ");   BigInteger a = new BigInteger(masukan[0]);   BigInteger b = new BigInteger(masukan[1]);          BigInteger i=new BigInteger("0");   while(a.compareTo(new BigInteger("1"))!=0){    if(a.compareTo(b)==1){     i=i.add(a.divide(b));     if(a.mod(b)==new BigInteger("0")){      a=new BigInteger("1");      b=new BigInteger("0");     }     else{      a=a.mod(b);     }        }    else{     BigInteger temp =a;     a=b;     b=temp;       }   }   if(a.compareTo(new BigInteger("1"))==0){    i=i.add(b);   }   System.out.println(i.toString());  } }
1	public class B {  public static String toB(String str){   String row,col;   int i=0;   while(i<str.length() && str.charAt(i)<='Z'&&str.charAt(i)>='A')i++;   col = str.substring(0,i);   row = str.substring(i,str.length());   StringBuffer sb = new StringBuffer(col);   col = sb.reverse().toString();   int accum = 0;   for(i=0;i<col.length();i++){    int val = getValue(col.charAt(i));    accum+=val*Math.pow(26, i);    }   return "R"+row+"C"+accum;    }  public static String toA(String str){   int i = str.indexOf('C');   String row,col,ans="";   row = str.substring(1,i);   col = str.substring(i+1,str.length());   int colVal = Integer.parseInt(col),mod;   while(colVal>0){    mod = colVal%26;    if(mod==0){     ans+='Z';     colVal--;    }    else{     ans+=getLetter(mod);    }    colVal/=26;   }   StringBuffer sb = new StringBuffer(ans);   ans = sb.reverse().toString();   return ans+row;  }  public static int getValue(char c){   return c-'A'+1;  }  public static char getLetter(int n){   return (char)(n+'A'-1);  }  public static void main(String[] args)throws Exception{   Scanner in = new Scanner(System.in);   int cases = in.nextInt();   for(int i = 0;i<cases;i++){    String str = in.next();    if(str.charAt(0)=='R' && str.charAt(1)>='0'&&str.charAt(1)<='9' && str.indexOf('C')!=-1){     System.out.println(toA(str));    }    else System.out.println(toB(str));   }    } }
4	public class Main {  public static void main(String[] args) {   InputStream inputStream;   try {    inputStream = new FileInputStream("input.txt");   } catch (IOException e) {    throw new RuntimeException(e);   }   OutputStream outputStream;   try {    outputStream = new FileOutputStream("output.txt");   } catch (IOException e) {    throw new RuntimeException(e);   }   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) {   int n = in.nextInt();   int m = in.nextInt();   int k = in.nextInt();   Queue<Point> points = new LinkedList<Point>();   int[][] burnTime = new int[n][m];   boolean[][] visited = new boolean[n][m];   for (int i = 0; i < k; i++) {    int x = in.nextInt() - 1;    int y = in.nextInt() - 1;    visited[x][y] = true;    burnTime[x][y] = 0;    points.add(new Point(x, y));   }   int[] dx = new int[]{-1, 0, 0, 1};   int[] dy = new int[]{0, -1, 1, 0};   while (points.size() != 0) {    Point cur = points.poll();    int x = cur.x;    int y = cur.y;    for (int i = 0; i < dx.length; i++) {     int nextX = x + dx[i];     int nextY = y + dy[i];     if (nextX >= 0 && nextX < n && nextY >= 0 && nextY < m && (burnTime[x][y] + 1 < burnTime[nextX][nextY] || !visited[nextX][nextY])) {      points.add(new Point(nextX, nextY));      visited[nextX][nextY] = true;      burnTime[nextX][nextY] = burnTime[x][y] + 1;     }    }   }   int x, y;   x = y = 0;   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     if (burnTime[i][j] > burnTime[x][y]) {      x = i;      y = j;     }    }   }   out.printf("%d %d", x + 1, y + 1);  } } class Point {  int x;  int y;  public Point(int x, int y) {   this.x = x;   this.y = y;  } } 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{   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());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }  }   static long MOD=(long)1e9+7;   static void debug(Object... o) {   System.out.println(Arrays.deepToString(o));  }  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();  } }
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;  }  public boolean isNT(Circ b) {  double dist = Math.sqrt((x-b.x)*(x-b.x)+(y-b.y)*(y-b.y));  return dist > 2*r;  } } }
0	public class A {  public static void main(String[] args) throws FileNotFoundException {   Scanner s = new Scanner(System.in);   int T = s.nextInt();   System.out.println("0 0 "+T);    } }
4	public class Main {  void solve() {  int R = sc.nextInt();  int C = sc.nextInt();  int K = sc.nextInt();  int[] x = new int[K];  int[] y = new int[K];  for (int i = 0; i < K; i++) {  x[i] = sc.nextInt();  y[i] = sc.nextInt();  }  int best = -1;  int bestX = 0;  int bestY = 0;  for (int r = 1; r <= R; r++) for (int c = 1; c <= C; c++) {  int here = R + C;  for (int i = 0; i < K; i++) {   int t = abs(r - x[i]) + abs(c - y[i]);   here = min(here, t);  }  if (best < here){   best = here;   bestX = r;   bestY = c;  }  }  out.println(bestX + " " + bestY); }  void print(int[] a) {  out.print(a[0]);  for (int i = 1; i < a.length; i++) out.print(" " + a[i]);  out.println(); }  static void tr(Object... os) {  System.err.println(deepToString(os)); }  public static void main(String[] args) throws Exception {  new Main().run(); }  MyScanner sc = null; PrintWriter out = null; public void run() throws Exception {   sc = new MyScanner(new FileInputStream(new File("input.txt")));  out = new PrintWriter(new File("output.txt"));  for (;sc.hasNext();) {  solve();  out.flush();  }  out.close(); }  class MyScanner {  String line;  BufferedReader reader;  StringTokenizer tokenizer;  public MyScanner(InputStream stream) {  reader = new BufferedReader(new InputStreamReader(stream));  tokenizer = null;  }  public void eat() {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {   try {   line = reader.readLine();   if (line == null) {    tokenizer = null;    return;   }   tokenizer = new StringTokenizer(line);   } catch (IOException e) {   throw new RuntimeException(e);   }  }  }  public String next() {  eat();  return tokenizer.nextToken();  }  public String nextLine() {  try {   return reader.readLine();  } catch (IOException e) {   throw new RuntimeException(e);  }  }  public boolean hasNext() {  eat();  return (tokenizer != null && tokenizer.hasMoreElements());  }  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;  } } }
5	public class Main{ public static void main(String[] args) throws Exception{  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));  String out = "";  String[] p = br.readLine().split("[ ]");  int n = Integer.valueOf(p[0]);  double t = Double.valueOf(p[1]);   int offset = 5000;  boolean[] flags = new boolean[offset+5000];  for(int i=0;i<n;i++){  int[] q = toIntArray(br.readLine());  int c = 2*q[0];  for(int j=-q[1];j<q[1];j++){   flags[c+offset+j] = true;     }  }  int buf = 0;  int last = -1;  int index = 0;  for(;index<flags.length;index++){  if(flags[index]){   if(last==-1){   buf++;   }else{         if(Math.abs(index-last-(2*t+1))<1e-10) buf++;   else if(index-last>2*t+1) buf+=2;   }   last = index;  }  }  buf ++;  out = ""+buf+"\r\n";  bw.write(out,0,out.length());  br.close();  bw.close(); } static int[] toIntArray(String line){  String[] p = line.trim().split("\\s+");  int[] out = new int[p.length];  for(int i=0;i<out.length;i++) out[i] = Integer.valueOf(p[i]);  return out; } }
1	public class Round364_div2_C {  public static void main(String[] args) throws IOException {   FastReader in = new FastReader(System.in);   PrintWriter out = new PrintWriter(System.out);   solve(in, out);   out.flush();  }   public static void solve(FastReader in, PrintWriter out) {   int n = in.readInt();   String s = in.readString();   int totalCnt = (int) s.chars().distinct().count();   Map<Character, Integer> curCnts = new HashMap<>();   int solution = s.length();   int i = 0;   for (int j = 0 ; j < s.length() ; j++) {       char sj = s.charAt(j);    curCnts.put(sj, curCnts.getOrDefault(sj, 0) + 1);        while (curCnts.getOrDefault(s.charAt(i), 0) > 1) {     char si = s.charAt(i);     int siCnt = curCnts.get(si);     if (siCnt > 1) {      curCnts.put(si, siCnt - 1);     } else {      curCnts.remove(si);     }     i++;    }    if (curCnts.size() == totalCnt) {     solution = Math.min(solution, j - i + 1);    }   }   out.println(solution);  }    static class FastReader {   private final InputStream stream;   private int current;   private int size;   private byte[] buffer = new byte[1024 * 8];   public FastReader(InputStream stream) {    this.stream = stream;    current = 0;    size = 0;   }   public int readInt() {    int sign = 1;    int abs = 0;    int c = readNonEmpty();    if (c == '-') {     sign = -1;     c = readAny();    }    do {     if (c < '0' || c > '9') {      throw new IllegalStateException();     }     abs = 10 * abs + (c - '0');     c = readAny();    } while (!isEmpty(c));    return sign * abs;   }   public int[] readIntArray(int n) {    int[] array = new int[n];    for (int i = 0 ; i < n ; i++) {     array[i] = readInt();    }    return array;   }   public char readChar() {    return (char) readNonEmpty();   }   public String readString() {    StringBuffer sb = new StringBuffer();    int c;    do {     c = readAny();    } while (isEmpty(c));    do {     sb.append((char) c);     c = readAny();    } while (!isEmpty(c));    return sb.toString();   }   private int readAny() {    try {     if (current >= size) {      current = 0;      size = stream.read(buffer);      if (size < 0) {       return -1;      }     }    } catch (IOException e) {     throw new RuntimeException("Failed to readAny next byte", e);    }    return buffer[current++];   }   private int readNonEmpty() {    int result;    do {     result = readAny();    } while (isEmpty(result));    return result;   }   private static boolean isEmpty(int c) {    return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == -1;   }  } }
6	public class Template implements Runnable {  private void solve() throws IOException {   int n = nextInt();   int m = nextInt();   boolean[][] g = new boolean[n][n];   for (int i = 0; i < m; ++i) {    int a = nextInt() - 1;    int b = nextInt() - 1;    g[a][b] = true;    g[b][a] = true;   }     long[] am = new long[n + 1];   long[][] ways = new long[1 << n][n];   for (int start = 0; start < n; ++start) {    for (int mask = 0; mask < (1 << (n - start)); ++mask)     for (int last = start; last < n; ++last) {      ways[mask][last - start] = 0;     }    ways[1][0] = 1;    for (int mask = 0; mask < (1 << (n - start)); ++mask) {     int cnt = 0;     int tmp = mask;     while (tmp > 0) {      ++cnt;      tmp = tmp & (tmp - 1);     }     for (int last = start; last < n; ++last)      if (ways[mask][last - start] > 0) {       long amm = ways[mask][last - start];       for (int i = start; i < n; ++i)        if ((mask & (1 << (i - start))) == 0 && g[last][i]) {         ways[mask | (1 << (i - start))][i - start] += amm;        }       if (g[last][start])        am[cnt] += ways[mask][last - start];      }    }   }   long res = 0;   for (int cnt = 3; cnt <= n; ++cnt) {    if (am[cnt] % (2) != 0)     throw new RuntimeException();    res += am[cnt] / (2);   }   writer.println(res);  }   public static void main(String[] args) {   new Template().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();  } }
3	public class A {  public static void main(String[] args) {   Scanner input = new Scanner();   StringBuilder output = new StringBuilder();   int n = input.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = input.nextInt();   }   Arrays.sort(a);   boolean[] colored = new boolean[n];   int colors = 0;   for (int i = 0; i < n; i++) {    if (!colored[i]) {     colors ++;     colored[i] = true;     for (int j = i+1; j < n; j++) {      if (a[j] % a[i] == 0) {       colored[j] = true;      }     }    }   }   System.out.println(colors);  }  private static class Scanner {   BufferedReader br; StringTokenizer st;   public Scanner(Reader in) { br = new BufferedReader(in); }   public Scanner() { 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()); }   String readNextLine() {    String str = "";    try { str = br.readLine();    } catch (IOException e) { e.printStackTrace(); }    return str; }   int[] readIntArray(int n) {    int[] a = new int[n];    for (int idx = 0; idx < n; idx++) { a[idx] = nextInt(); }    return a; }   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 { BufferedReader in; PrintWriter out;  public static void main(String[] args) throws IOException {  new Main().run(); } public void run() throws IOException {     in=new BufferedReader(new InputStreamReader(System.in));  out=new PrintWriter(new OutputStreamWriter(System.out));  solve();   out.flush(); }  public void solve() throws IOException {  String now=in.readLine();  int l=now.length();  int answ=0;  for(int i=0;i!=l;i++)  for(int j=i+1;j<l;j++)  {   String a=now.substring(i, j);   for(int k=i+1;k<l-j+i+1;k++)   if(a.compareTo(now.substring(k, k+j-i))==0)    answ=Math.max(answ, a.length());  }  out.print(answ);    } }
5	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();   int[] a = new int[n];   boolean has_more_than_one = false;   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();    if (a[i] > 1)     has_more_than_one = true;   }   Arrays.sort(a);   if (n == 1) {    if (a[0] == 1)     out.print(2);    else     out.print(1);   } else {    out.print(1 + " ");    for (int i = 1; i < n; i++) {     if (has_more_than_one || i < n - 1)      out.print(a[i - 1] + " ");     else      out.println(2);    }   }   out.close();  } }
1	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(); } } class TaskB {  Scanner in;  PrintWriter out;  public void solve(int testNumber, Scanner in, PrintWriter out) {   this.in = in;   this.out = out;   run();  }  void run() {   int n = in.nextInt();   int a = in.nextInt();   int b = in.nextInt();   int[] is = in.nextIntArray(n);   Map<Integer, Integer> id = new HashMap<Integer, Integer>();   for (int i = 0; i < n; i++) {    id.put(is[i], i);   }   SCC.V[] vs = new SCC.V[n * 2];   for (int i = 0; i < vs.length; i++) vs[i] = new SCC.V();   for (int i = 0; i < n; i++) {    if (id.containsKey(a - is[i])) {     int j = id.get(a - is[i]);     vs[i].add(vs[j]);     vs[j + n].add(vs[i + n]);    } else {     vs[i].add(vs[i + n]);    }    if (id.containsKey(b - is[i])) {     int j = id.get(b - is[i]);     vs[i + n].add(vs[j + n]);     vs[j].add(vs[i]);    } else {     vs[i + n].add(vs[i]);    }   }   SCC.scc(vs);   for (int i = 0; i < n; i++) {    if (vs[i].comp == vs[i + n].comp) {     out.println("NO");     return ;    }   }   out.println("YES");   for (int i = 0; i < n; i++) {    if (vs[i].comp > vs[i + n].comp) {     out.print("0 ");    } else {     out.print("1 ");    }   }   out.println();  } } class Scanner {  BufferedReader br;  StringTokenizer st;  public Scanner(InputStream in) {   br = new BufferedReader(new InputStreamReader(in));   eat("");  }  private void eat(String s) {   st = new StringTokenizer(s);  }  public String nextLine() {   try {    return br.readLine();   } catch (IOException e) {    return null;   }  }  public boolean hasNext() {   while (!st.hasMoreTokens()) {    String s = nextLine();    if (s == null)     return false;    eat(s);   }   return true;  }  public String next() {   hasNext();   return st.nextToken();  }  public int nextInt() {   return Integer.parseInt(next());  }  public int[] nextIntArray(int n) {   int[] is = new int[n];   for (int i = 0; i < n; i++) {    is[i] = nextInt();   }   return is;  } } class SCC {  public static int n;  public static V[] us;  public static int scc(V[] vs) {   n = vs.length;   us = new V[n];   for (V v : vs) if (!v.visit) dfs(v);   for (V v : vs) v.visit = false;   for (V u : us) if (!u.visit) dfsRev(u, n++);   return n;  }  public static void dfs(V v) {   v.visit = true;   for (V u : v.fs) if (!u.visit) dfs(u);   us[--n] = v;  }  public static void dfsRev(V v, int k) {   v.visit = true;   for (V u : v.rs) if (!u.visit) dfsRev(u, k);   v.comp = k;  }  public static class V {   public boolean visit;   public int comp;   public List<V> fs = new ArrayList<V>();   public List<V> rs = new ArrayList<V>();   public void add(V u) {    fs.add(u);    u.rs.add(this);   }  } }
5	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();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }   int[] b = a.clone();   ArrayUtils.sort(b);   int count = 0;   for (int i = 0; i < n; i++) {    if (a[i] != b[i]) {     ++count;    }   }   out.println(count <= 2 ? "YES" : "NO"); } } 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);  }  } class ArrayUtils {  public static void sort(int[] a) {   Random rand = new Random(System.nanoTime());   for (int i = 0; i < a.length; i++) {    int j = rand.nextInt(i + 1);    int t = a[i];    a[i] = a[j];    a[j] = t;   }   Arrays.sort(a);  }   }
2	public class B2 {   public static void main(String[] args) throws IOException {    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));    String line = reader.readLine();    StringTokenizer tokenizer = new StringTokenizer(line);    long n = Long.parseLong(tokenizer.nextToken());    long k = Long.parseLong(tokenizer.nextToken());    if (n == 1){     System.out.println("0");     return;    }    if (n <= k){     System.out.println("1");     return;    }    long first = 0;    long end = k;    long mid;    while (first < end){     mid = first + (end - first)/2;     if (is_exist(n, k , mid - 1)){      end = mid;     } else {      first = mid + 1;     }    }    if (is_exist(n, k, end - 1)){     System.out.println((end ));     return;    }    System.out.println("-1");    return;   }  static boolean is_exist(long n, long k, long x){   long res = n - (k - 1 + k - x)* (k - 1 - (k - x) + 1)/2;   if (res <= k - x ){    return true;   }   return false;  }  }
5	public class Main { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tokenizer=null;  public static void main(String[] args) throws IOException {  new Main().execute(); }  void debug(Object...os) {  System.out.println(Arrays.deepToString(os)); }  int ni() throws IOException {  return Integer.parseInt(ns()); }  long nl() throws IOException  {  return Long.parseLong(ns()); }  double nd() throws IOException  {  return Double.parseDouble(ns()); }   String ns() throws IOException  {  while (tokenizer == null || !tokenizer.hasMoreTokens())   tokenizer = new StringTokenizer(br.readLine());  return tokenizer.nextToken(); }  String nline() throws IOException {  tokenizer=null;  return br.readLine(); }     int totalCases, testNum;  int n,a,b; long arr[];  void execute() throws IOException {  totalCases = 1;  for(testNum = 1; testNum <= totalCases; testNum++)  {  if(!input())   break;  solve();  } }  void solve() throws IOException {  Arrays.sort(arr);  long x1 = arr[b-1];  long x2 = arr[b];   System.out.println(x2-x1); }  boolean input() throws IOException {  n = ni();  a = ni();  b = ni();  arr = new long[n];  for(int i = 0;i<n;i++)  {  arr[i] = nl();  }  return true; } }
4	public class Main {  public static void deal(int n,int m,int k,int[][] d1,int[][] d2) {   if(k % 2 == 1) {    for(int i=0;i<n;i++) {     for(int j=0;j<m;j++) {      System.out.print("-1 ");     }     System.out.println();    }    return;   }   int[][][] dp = new int[k/2+1][n][m];   for(int i=0;i<k/2;i++) {    for(int j=0;j<n;j++) {     for(int l=0;l<m;l++) {      int min = Integer.MAX_VALUE;      if(j>0) min = Math.min(min,d2[j-1][l]+dp[i][j-1][l]);      if(j<n-1) min = Math.min(min,d2[j][l]+dp[i][j+1][l]);      if(l>0) min = Math.min(min,d1[j][l-1]+dp[i][j][l-1]);      if(l<m-1) min = Math.min(min,d1[j][l]+dp[i][j][l+1]);      dp[i+1][j][l] = min;     }    }   }   for(int i=0;i<n;i++) {    for(int j=0;j<m;j++) {     System.out.print(dp[k/2][i][j]*2);     System.out.print(" ");    }    System.out.println();   }  }  public static void main(String[] args) {   MyScanner scanner = new MyScanner();   int n = scanner.nextInt();   int m = scanner.nextInt();   int k = scanner.nextInt();   int[][] d1 = new int[n][m-1];   int[][] d2 = new int[n-1][m];   for(int i=0;i<n;i++) {    for(int j=0;j<m-1;j++) {     d1[i][j] = scanner.nextInt();    }   }   for(int i=0;i<n-1;i++) {    for(int j=0;j<m;j++) {     d2[i][j] = scanner.nextInt();    }   }   deal(n,m,k,d1,d2);  }   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());   }     String nextLine(){     String str = "";  try {    str = br.readLine();  } catch (IOException e) {    e.printStackTrace();  }  return str;   }    } }
0	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));   int n = Integer.parseInt(in.readLine());   if (n == 0) {    System.out.println("0 0 0");    return;   }   int p2 = 0;   int p1 = 1;   while (true) {    int now = p2 + p1;    if (n == now) {     System.out.println("0 " + p1 + " " + p2);     return;    } else {     p2 = p1;     p1 = now;    }   }  } }
5	public class Solution{   void solve()throws Exception  {   int n=nextInt();   int[]a=new int[n];   for(int i=0;i<n;i++)    a[i]=nextInt();   int[]b=a.clone();   Arrays.sort(b);   int cnt=0;   for(int i=0;i<n;i++)    if(a[i]!=b[i])     cnt++;   if(cnt<=2)    System.out.println("YES");   else    System.out.println("NO");     }  private boolean sorted(int[] a) {   for(int i=0;i+1<a.length;i++)    if(a[i]>a[i+1])     return false;   return true;  }    BufferedReader reader;  PrintWriter writer;  StringTokenizer stk;  void run()throws Exception  {   reader=new BufferedReader(new InputStreamReader(System.in));     stk=null;   writer=new PrintWriter(new PrintWriter(System.out));     solve();   reader.close();   writer.close();  }  int nextInt()throws Exception  {   return Integer.parseInt(nextToken());  }  long nextLong()throws Exception  {   return Long.parseLong(nextToken());  }  double nextDouble()throws Exception  {   return Double.parseDouble(nextToken());   }  String nextString()throws Exception  {   return nextToken();  }  String nextLine()throws Exception  {   return reader.readLine();  }  String nextToken()throws Exception  {   if(stk==null || !stk.hasMoreTokens())   {    stk=new StringTokenizer(nextLine());    return nextToken();   }   return stk.nextToken();  }  public static void main(String[]args) throws Exception  {   new Solution().run();  }     }
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());  }  long nextLong(){   return Long.valueOf(next());  }  double nextDouble(){   return Double.valueOf(next());  } }
1	public class Main { Scanner in; PrintWriter out; StreamTokenizer ST; BufferedReader br;  int nextInt() throws IOException {  ST.nextToken();  return (int) ST.nval; }  double nextDouble() throws IOException {  ST.nextToken();  return ST.nval; }  String next() throws IOException {  ST.nextToken();  return ST.sval; }  String nextLine() throws IOException {  return br.readLine(); }  void solve() throws IOException {  br.readLine();  char[]s = br.readLine().toCharArray();  int n = s.length;  int h=0;  for(int i=0;i<n;++i)if (s[i]=='H')++h;  int res=1000000;  for(int i=0;i<n;++i)  {  int t=0;  for(int j=0;j<h;++j)  {   if (s[(i+j)%n]=='T')++t;  }  res=Math.min(res,t);  }  out.println(res); }  public void run() throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));  ST = new StreamTokenizer(br);  in = new Scanner(br);  out = new PrintWriter(System.out);   solve();  in.close();  out.close();  br.close(); }  public static void main(String[] args) throws Exception {  new Main().run(); } }
0	public class D {  BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof;  double f(int dist, double initSp, int a, int maxSp) {  double distToReachMaxSpeed = 0.5 * (maxSp * maxSp - initSp * initSp)   / a;  if (dist > distToReachMaxSpeed)  return 1d * (maxSp - initSp) / a + (dist - distToReachMaxSpeed)   / maxSp;  return (Math.sqrt(initSp * initSp + 2 * a * dist) - initSp) / a; }  void solve() throws IOException {  int a = nextInt();  int maxSp = nextInt();  int len = nextInt();  int signX = nextInt();  int signSp = nextInt();  if (maxSp <= signSp) {  out.printf("%.9f\n", f(len, 0, a, maxSp));  return;  }  double distToReachSignSp = 0.5 * signSp * signSp / a;  if (distToReachSignSp >= signX) {  double t = Math.sqrt(2d * signX / a);  out.printf("%.9f\n", t + f(len - signX, t * a, a, maxSp));  return;  }  double distToReachMaxThenSign = 0.5   * (maxSp * maxSp + maxSp * maxSp - signSp * signSp) / a;  if (distToReachMaxThenSign <= signX) {  double t = 1d * (2 * maxSp - signSp) / a   + (signX - distToReachMaxThenSign) / maxSp   + f(len - signX, signSp, a, maxSp);  out.printf("%.9f\n", t);  return;  }   double xSp = Math.sqrt(a * signX + signSp * signSp * 0.5);  double xTime = (2 * xSp - signSp) / a;  out.printf("%.9f\n", xTime + f(len - signX, signSp, a, maxSp)); }  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 D().inp(); }  String nextToken() {  while (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(br.readLine());  } catch (Exception e) {   eof = true;   return null;  }  }  return st.nextToken(); }  String nextString() {  try {  return br.readLine();  } catch (IOException e) {  eof = true;  return null;  } }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
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);   F1BlokiRavnoiSummiProstayaRedakciya solver = new F1BlokiRavnoiSummiProstayaRedakciya();   solver.solve(1, in, out);   out.close();  }  static class F1BlokiRavnoiSummiProstayaRedakciya  {   InputReader in;   Map<Long, List<F1BlokiRavnoiSummiProstayaRedakciya.Block>> sums;   public void solve(int testNumber, InputReader in, PrintWriter out)   {    this.in = in;    int n = ni();    long[] a = nla(n);    sums = new HashMap<>();    for (int i = 0; i < n; i++)    {     long sum = 0;     for (int j = i; j < n; j++)     {      sum += a[j];      sums.computeIfAbsent(sum, k -> new ArrayList<>()).add(          new F1BlokiRavnoiSummiProstayaRedakciya.Block(i, j, sum));     }    }    for (Map.Entry<Long, List<F1BlokiRavnoiSummiProstayaRedakciya.Block>> e : sums.entrySet())    {     Collections.sort(e.getValue());    }    List<F1BlokiRavnoiSummiProstayaRedakciya.Block> res = Collections.emptyList();    for (Map.Entry<Long, List<F1BlokiRavnoiSummiProstayaRedakciya.Block>> e : sums.entrySet())    {     List<F1BlokiRavnoiSummiProstayaRedakciya.Block> blocks = e.getValue();     List<F1BlokiRavnoiSummiProstayaRedakciya.Block> updated = new ArrayList<>();     if (blocks.size() <= res.size())      continue;     for (F1BlokiRavnoiSummiProstayaRedakciya.Block next : blocks)     {      if (updated.size() == 0)       updated.add(next);      else      {       F1BlokiRavnoiSummiProstayaRedakciya.Block prev = updated.get(updated.size() - 1);       if (next.l > prev.r)        updated.add(next);      }     }     if (updated.size() > res.size())      res = updated;    }    StringBuilder resS = new StringBuilder();    resS.append(res.size()).append('\n');    for (F1BlokiRavnoiSummiProstayaRedakciya.Block block : res)     resS.append(block.l + 1).append(' ').append(block.r + 1).append('\n');    out.println(resS);   }   private long[] nla(int size)   {    return in.nextLongArray(size);   }   private int ni()   {    return in.nextInt();   }   static class Block implements Comparable<F1BlokiRavnoiSummiProstayaRedakciya.Block>   {    int l;    int r;    long sum;    public Block(int l, int r, long sum)    {     this.l = l;     this.r = r;     this.sum = sum;    }    public int compareTo(F1BlokiRavnoiSummiProstayaRedakciya.Block o)    {     int res = Integer.compare(r, o.r);     if (res == 0)      res = Integer.compare(l, o.l);     return res;    }   }  }  static class InputReader  {   private final BufferedReader reader;   private StringTokenizer tokenizer;   public InputReader(InputStream in)   {    reader = new BufferedReader(new InputStreamReader(in));   }   public long[] nextLongArray(int size)   {    long[] array = new long[size];    for (int i = 0; i < size; ++i)    {     array[i] = nextLong();    }    return array;   }   public int nextInt()   {    return Integer.parseInt(next());   }   public long nextLong()   {    return Long.parseLong(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;   }  } }
5	public class A { public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int t = scan.nextInt();  List<Double> coords = new ArrayList<Double>();  while (n-- > 0) {  double x = scan.nextDouble();  double a = scan.nextDouble() / 2;  coords.add(x - a);  coords.add(x + a);  }  Collections.sort(coords);  int count = 2;  ChoiceFormat f = new ChoiceFormat("-1#0|0#1|0<2");  for (int i = 1; i < coords.size()-2; i+=2) {  count += new Integer(f.format(coords.get(i+1)-coords.get(i)-t));  }  System.out.println(count); } }
2	public class CodeForces {    private static 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 MyScanner {  private StreamTokenizer st;  public MyScanner(InputStream is) {   st = new StreamTokenizer(new BufferedReader(new InputStreamReader(is)));  }  public MyScanner(File f) throws FileNotFoundException {   st = new StreamTokenizer(new BufferedReader(new FileReader(f)));  }  public int nextInt() throws IOException {   st.nextToken();   return ((int) st.nval);  }  public double nextDouble() throws IOException {   st.nextToken();   return (st.nval);  }  public String nextString() throws IOException {   st.nextToken();   if (st.ttype == StreamTokenizer.TT_WORD) {    return (st.sval);   } else {    return ("not found");   }  } } 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 print(int i) throws IOException {   out.write(Integer.toString(i));  }  public void print(double d) throws IOException {   out.write(Double.toString(d));  }  public void print(long l) throws IOException {   out.write(Long.toString(l));  }  public void print(String s) throws IOException {   out.write(s);  }  public void print(char c) throws IOException {   out.write(Character.toString(c));  }  public void close() throws IOException {   out.flush();   out.close();  } }
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>() {     public int compare(E2RotateColumnsHardVersion.Column o1, E2RotateColumnsHardVersion.Column o2) {      return o2.max - o1.max;     }    });    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 Column {    int[] vals;    int max;    public Column(int[] vals) {     this.vals = vals;    }    void initMax() {     max = 0;     for (int vv : vals) max = Math.max(max, vv);    }   }  }  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;   }  } }
0	public class dwl {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  String[] lr = sc.nextLine().split(" ");  long l = Long.valueOf(lr[0]);  long r = Long.valueOf(lr[1]);  if (r - l <= 1 || (l == 1 && (r - l) == 2)   || (l % 2 != 0 && (r - l) < 3))  System.out.println(-1);  else {  if (l == 1)   System.out.println(2 + " " + 3 + " " + 4);  else {   if (l % 2 == 0) {   String res = "";   res += l + " ";   res += (l + 1) + " ";   res += (l + 2) + " ";   res = res.trim();   System.out.println(res);   } else {   String res = "";   res += (l + 1) + " ";   res += (l + 2) + " ";   res += (l + 3) + " ";   res = res.trim();   System.out.println(res);   }  }  }  } }
4	public class A23 {  public static void main(String[] args){ Scanner sc = new Scanner(System.in); char[] input = sc.nextLine().toCharArray(); int[][] dyn = new int[input.length][input.length]; int max = 0; for(int a = 0; a < input.length; a++) {  for(int b = a + 1; b < input.length; b++) {  if(input[a] == input[b]) {   int prev = (a == 0) ? 0 : dyn[a-1][b-1];   dyn[a][b] = prev + 1;   max = (dyn[a][b] > max) ? dyn[a][b] : max;  }  } } System.out.println(max);  } }
3	public class Main3 {  static PrintWriter pr;  static Scanner scan;  static BufferedReader br;  static StringTokenizer st;  public static void main(String args[]) throws Exception {   pr = new PrintWriter(System.out);   scan = new Scanner(System.in);   br = new BufferedReader(new InputStreamReader(System.in));   int n = inputInt();     int[] a = new int[n];   int[] b = new int[n];   st = new StringTokenizer(br.readLine());   for(int i=0;i<n;i++){    a[i]=Integer.parseInt(st.nextToken());      }   Arrays.sort(a);   int ans=0;   for(int i=0;i<n;i++){    if(b[i]!=1){     ans++;     for(int j=i;j<n;j++){      if(a[j]%a[i]==0){       b[j]=1;      }     }    }   }   System.out.println(ans);  }   public static int inputInt() throws IOException{   return Integer.parseInt(br.readLine());  }  public static long inputLong() throws IOException{   return Long.parseLong(br.readLine());  }  public static String inputString() throws IOException{   return br.readLine();  }  public static int[] intArray(int n) throws IOException{   int a[] = new int[n];   st = new StringTokenizer(br.readLine());   for(int i=0;i<n;i++){    a[i] = Integer.parseInt(st.nextToken());   }   return a;  }  public static long[] longArray(int n) throws IOException{   long a[] = new long[n];   st = new StringTokenizer(br.readLine());   for(int i=0;i<n;i++){    a[i] = Long.parseLong(st.nextToken());   }   return a;  }  public static String[] stringArray(int n) throws IOException{   String a[] = new String[n];   st = new StringTokenizer(br.readLine());   for(int i=0;i<n;i++){    a[i] = st.nextToken();   }   return a;  }  public static long gcd(long a,long b){   if(b==0){    return a;   }   else{    return gcd(b,a%b);   }  }  public long max(long a,long b,long c){   return Math.max(a,Math.max(b,c));  } }
0	public class Main { private static BufferedReader br; private static StringTokenizer st; private 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 qq = readInt();  while(qq-- > 0) {  pw.println(solve(readInt(), readInt()));  }  pw.close(); }  public static int solve(int a, int b) {  if(a < b) {  return solve(b,a);  }  if(a%b == 0) {  return a / b;  }  return a/b + solve(b,a%b); }    private static long readLong() throws IOException {  return Long.parseLong(nextToken()); }  private static double readDouble() throws IOException {  return Double.parseDouble(nextToken()); }  private static int readInt() throws IOException {  return Integer.parseInt(nextToken()); }  private static String nextToken() throws IOException {  while(st == null || !st.hasMoreTokens()) {  if(!br.ready()) {   pw.close();   System.exit(0);  }  st = new StringTokenizer(br.readLine().trim());  }  return st.nextToken(); } }
2	public class Main {  @SuppressWarnings("unchecked")  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 inverse(long x, long p)  {   return pow(x, p - 2, p);  } static boolean isPrime(long n) {  long h=(long)Math.sqrt(n);  for(long i=2;i<=h;i++)  if(n%i==0)  return false;  return true&&n!=1; }  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 void seive(int n,int prime[])  {   for(int i=2;i<=n;i++)    if(prime[i]==0)    {     prime[i]=1;     for(int j=2;j*i<=n;j++)     prime[j*i]=-1;    }  }  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 Pair<T1,T2>  {   T1 x;T2 y;   Pair(T1 xx,T2 yy)   {    x=xx;    y=yy;   }  }   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 + "" );  }  }  <T>void pa(T a[])  {   for(T i:a)   System.out.print(i+" ");   System.out.println();  }  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 String nl() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isEndOfLine(c));  return res.toString();  }  public String n() {  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 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;  }  public int[] NIA(int n)  {  int[] arr = new int[n];  for (int i = 0; i < n; i++) {   arr[i] = nI();  }  return arr;  }  public int[] NIA1(int n)  {  int[] arr = new int[n+1];  for (int i = 1; i <=n; i++) {   arr[i] = nI();  }  return arr;  }   public long[] NLA(int n)  {  long[] arr = new long[n];  for (int i = 0; i < n; i++) {   arr[i] = nL();  }  return arr; }  public long[] NLA1(int n)  {  long[] arr = new long[n+1];  for (int i = 1; i <=n; i++) {   arr[i] = nL();  }  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;  } } static class DSU {  int a[],size[],c=1,m;  HashMap<String,Integer> hm=new HashMap<String,Integer>();  DSU(int n)  {   a=new int[n+1];   m=n;   size=new int[n+1];   for(int i=1;i<=n;i++)  {   a[i]=i;   size[i]=1;  }  }  void add(String x,int i)  {   hm.put(x,i);  }  int find(int n)  {   while(a[n]!=n)   {    a[n]=a[a[n]];   n=a[n];  }   return n;  }  int[] eval()  {   int y[]=new int[m+1];   for(int i=1;i<=m;i++)   y[find(i)]++;   return y;  }  void union(int a1,int b)  {   int x=find(a1);   int y=find(b);   if(size[x]>size[y])  {   a[y]=x;   size[x]+=size[y];  }  else  {   a[x]=y;   size[y]+=size[x];  } }   } class Segment {  int sum[];  void build(int a[],int v,int l,int r)  {   if(l==r)   sum[v]=a[l];   else   {    int m=(l+r)/2;    build(a,v*2,l,m);    build(a,2*v+1,m+1,r);    sum[v]=sum[v*2]+sum[2*v+1];   }  }  void update(int a[],int l,int r,int x,int v,int y)  {   if(l==r&&r==y)    sum[v]+=x;   else if(l>y||y>r)   return;   else   {    int m=(l+r)/2;    update(a,l,m,x,2*v,y);    update(a,m+1,r,x,2*v+1,y);    sum[v]=sum[2*v]+sum[2*v+1];   }  }  int query(int v,int l,int r,int x,int y)  {   if(x>r||y<l)   return 0;   else if(x<=l&&r<=y)   return sum[v];   else   {    int m=(l+r)/2;   return query(2*v,l,m,x,y)+query(2*v+1,m+1,r,x,y);  } } } static class Trie {  Trie child[]=new Trie[26];  int count=0;  }   }  class Pairs implements Comparable<Pairs>  {   int x,y;String z;   Pairs(int a,int b)   {    x=a;y=b;   }   @Override   public int compareTo(Pairs a)    {       if(a.x>this.x||(a.x==this.x&&a.y<this.y)||(a.x==this.x&&a.y==this.y&&(a.z).equals("BhayanakMaut")))    return 1;    else    return -1;   }  }
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());  }   long nextLong()  {   return Long.parseLong(next());  }   double nextDouble()  {   return Double.parseDouble(next());  }   String nextLine()  {   String str = "";   try   {    str = br.readLine();   }   catch (IOException e)   {    e.printStackTrace();   }   return str;  } }
3	public class Main { public static void main(String[] args) throws Exception {  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  int n=Integer.parseInt(br.readLine());  String s=br.readLine();  String ss[]=s.split(" ");  int arr[]=new int[n];  for(int i=0;i<n;i++)  arr[i]=Integer.parseInt(ss[i]);  Arrays.sort(arr);  int coun=0,coun2=0;  for(int i=arr[0],k=0;k<n;)  {   for(int j=k;j<n;j++)   {    if(arr[j]%i==0)    {     arr[j]=-1;     coun2++;    }   }   Arrays.sort(arr);   k=coun2;   coun++;   if(coun2<n)   i=arr[coun2];   else   break;     }  System.out.println(coun); } }
1	public class EhabAndAComponentChoosingProblem {   long INF = (long) 1e18;   int n;  int[] a;   int[][] G;   void solve() {   n = in.nextInt();   a = new int[n];   for (int i = 0; i < n; i++) a[i] = in.nextInt();   int[] fr = new int[n - 1], to = new int[n - 1];   for (int i = 0; i < n - 1; i++) {    fr[i] = in.nextInt() - 1;    to[i] = in.nextInt() - 1;   }   G = build_graph(n, fr, to);     int[][] ret = bfs(G, 0);   int[] par = ret[0], ord = ret[2];     long best = -INF;   long[] dp = new long[n];   for (int i = n - 1; i >= 0; i--) {    int u = ord[i];    dp[u] = a[u];    for (int v : G[u]) {     if (v != par[u]) {      if (dp[v] > 0) dp[u] += dp[v];     }    }    best = Math.max(best, dp[u]);   }     int k = 0;   for (int i = n - 1; i >= 0; i--) {    int u = ord[i];    dp[u] = a[u];    for (int v : G[u]) {     if (v != par[u]) {      if (dp[v] > 0) dp[u] += dp[v];     }    }    if (dp[u] == best) {     dp[u] = -INF;     k++;    }   }     out.printf("%d %d%n", best * k, k);  }   int[][] bfs(int[][] G, int root) {   int n = G.length;     int[] par = new int[n];   Arrays.fill(par, -1);     int[] dep = new int[n];   dep[root] = 0;     int[] qu = new int[n];   qu[0] = root;   for (int l = 0, r = 1; l < r; l++) {    int u = qu[l];    for (int v : G[u]) {     if (v != par[u]) {      qu[r++] = v;      par[v] = u;      dep[v] = dep[u] + 1;     }    }   }     return new int[][]{par, dep, qu};  }   int[][] build_graph(int n, int[] from, int[] to) {   int[][] G = new int[n][];   int[] cnt = new int[n];   for (int i = 0; i < from.length; i++) {    cnt[from[i]]++;    cnt[to[i]]++;   }   for (int i = 0; i < n; i++) G[i] = new int[cnt[i]];   for (int i = 0; i < from.length; i++) {    G[from[i]][--cnt[from[i]]] = to[i];    G[to[i]][--cnt[to[i]]] = from[i];   }   return G;  }   public static void main(String[] args) {   in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));   out = new PrintWriter(System.out);   new EhabAndAComponentChoosingProblem().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());   }     public double nextDouble() {    return Double.parseDouble(nextToken());   }  } }
4	public class N718 { 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);      D();      out.close(); }  private static void A() throws IOException {  int t=ni();  while(t-->0) {   long l=nl();   if(l%2050!=0)ol(-1);   else {   long num=l/2050;   int cnt=0;   while(num>0) {    cnt+=num%10;    num/=10;   }   ol(cnt);      }  }    }  static void B() throws IOException {  int t=ni();  while(t-->0) {   int n=ni(),m=ni();   int[][]a=nmi(n,m);   PriorityQueue<int[]>pq=new PriorityQueue<int[]>((u,v)->u[0]-v[0]);   ArrayList<Integer>[]nums=new ArrayList[n];   for(int i=0;i<n;i++) {      for(int j=0;j<m;j++) {       pq.add(new int[] {a[i][j],i});   }   }   int[][]ans=new int[n][m];   for(int i=0;i<m;i++) {   int[]x=pq.poll();   ans[x[1]][i]=x[0];   }   int []indices=new int[n];   while(!pq.isEmpty()) {   int[]x=pq.poll();   int i=x[1];   while(ans[i][indices[i]]!=0) {    indices[i]++;   }   ans[i][indices[i]]=x[0];   }   for(int i=0;i<n;i++) {   for(int j=0;j<m;j++) {    out.print(ans[i][j]+" ");   }   ol("");   }  }  }   static void C() throws IOException{   int t=1;   while(t-->0) {   int n=ni();   a=nai(n);   int[][]ans=new int[n][n];   for(int i=0;i<n;i++)ans[i][i]=a[i];   for(int i=n-1;i>=0;i--) {    int j=i,k=i;    int cur=ans[i][i];    cur--;    while(cur>0) {    j++;    if(j>=n||ans[j][k]!=0) {     j--;     k--;    }    ans[j][k]=ans[i][i];    cur--;    }   }   for(int i=0;i<n;i++) {    for(int j=0;j<=i;j++) {    out.print(ans[i][j]+" ");    }    ol("");   }   }  }  private static 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 boolean isPrime(long n) {  if(n==2)return true;  if(n<2||n%2==0)return false;    for(long i=3L;i*i<n;i+=2l) {   long rem=(n%i);   if(rem==0)return false;  }  return true;  }  static void D() throws IOException {  int t=1;  while(t-->0) {   int n=ni(),m=ni(),k=ni();   int[][]ans=new int[n][m];   dist=new int[n][m][4];   for(int i=0;i<n;i++)for(int j=0;j>m;j++)   Arrays.fill(dist[i][j], Integer.MAX_VALUE);   int x;   for(int i=0;i<n;i++) {   for(int j=0;j<m-1;j++) {    dist[i][j][2]=(x=ni());    dist[i][j+1][3]=x;   }   }   for(int i=0;i<n-1;i++) {   for(int j=0;j<m;j++) {    dist[i][j][1]=(x=ni());    dist[i+1][j][0]=x;   }   }   int[][]nans=new int[n][m];   if(k%2==1) {   for(int i=0;i<n;i++)Arrays.fill(ans[i], -1);   }else {   for(int ii=0;ii<k/2;ii++) {   for(int i=0;i<n;i++) {       for(int j=0;j<m;j++) {    nans[i][j]=Integer.MAX_VALUE;    if(i>0)     nans[i][j]=Math.min(nans[i][j], ans[i-1][j]+dist[i-1][j][1]);    if(i<n-1)     nans[i][j]=Math.min(nans[i][j], ans[i+1][j]+dist[i+1][j][0]);    if(j>0)     nans[i][j]=Math.min(nans[i][j], ans[i][j-1]+dist[i][j-1][2]);    if(j<m-1)     nans[i][j]=Math.min(nans[i][j], ans[i][j+1]+dist[i][j+1][3]);    }   }   int[][]tmp=ans;   ans=nans;   nans=tmp;   }   }   for(int i=0;i<n;i++) {   for(int j=0;j<m;j++) {    if(ans[i][j]!=-1)ans[i][j]*=2;    out.print(ans[i][j]+" ");   }   ol("");   }  }  }  private static int bfs(int i, int j,int k) {  boolean [][]vis=new boolean[dist.length][dist[0].length];  Queue<int[]>q=new LinkedList<int[]>();  int mn=Integer.MAX_VALUE;  q.add(new int[] {i,j,0,0});  int[]dx=new int[] {-1,1,0,0};  int[]dy=new int[] {0,0,1,-1};  while(!q.isEmpty()) {   int []x=q.poll();   vis[x[0]][x[1]]=true;   int c=x[2];   if(c>k/2)continue;   if(c>0&&k%c==0&&(k/c)%2==0) {   mn=Math.min(mn,x[3]*k/c );   }   for(int a=0;a<4;a++) {   int nx=x[0]+dx[a];   int ny=x[1]+dy[a];   if(valid(nx,ny)&&!vis[nx][ny]) {    q.add(new int[] {nx,ny,c+1,x[3]+dist[x[0]][x[1]][a]});   }   }     }  return mn;  }  private static 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=ni();  while(t-->0) {      }   }  static void F() throws IOException {  int t=ni();  while(t-->0) {    } } static void CC() throws IOException {  for(int kk=2;kk<21;kk++) {  ol(kk+" -------");  int n=kk;  int k=n-2;  int msk=1<<k;  int[]a=new int[k];  for(int i=0;i<a.length;i++)a[i]=i+2;  int mx=1;  int ms=0;  for(int i=1;i<msk;i++) {  long prod=1;  int cnt=0;  for(int j=0;j<a.length;j++) {   if(((i>>j)&1)!=0) {   prod*=a[j];   cnt++;   }  }  if(cnt>=mx&&prod%n==1) {   mx=cnt;   ms=i;  }    }  ol(mx==1?mx:mx+1);  out.print(1+" ");  long pr=1;  for(int j=0;j<a.length;j++) {  if(((ms>>j)&1)!=0) {   out.print(a[j]+" ");   pr*=a[j];  }  }  ol("");  ol("Prod: "+pr);  ol(n+"*"+((pr-1)/n)+" + "+1);  } } static int ni() throws IOException {  return sc.nextInt(); } static double nd() throws IOException {  return sc.nextDouble(); } static long nl() throws IOException {  return sc.nextLong(); } static String ns() throws IOException {  return sc.next(); } 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 long[] nal(int n) throws IOException {  long[] a = new long[n];  for (int i = 0; i < n; i++)  a[i] = sc.nextLong();  return a; } static int[][] nmi(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]=sc.nextInt();  }  }  return a; }  static long[][] nml(int n,int m) throws IOException{  long[][]a=new long[n][m];  for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   a[i][j]=sc.nextLong();  }  }  return a; } static void o(String x) {  out.print(x); } static void ol(String x) {  out.println(x); } static void ol(int x) {  out.println(x); } static void disp1(int []a) {  for(int i=0;i<a.length;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 boolean hasNext() {return st.hasMoreTokens();}  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 String nextLine() throws IOException {return br.readLine();}    public boolean ready() throws IOException {return br.ready(); }   } }
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[]>() {  public int compare(int[] arr1,int[] arr2) {   return arr2[0]-arr1[0];  }  });  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()); }  public long nextLong() {  return Long.parseLong(next()); } }
1	public class A { public static void main(String args[]) {  boolean[] b = new boolean[11000];  Arrays.fill(b, true);  b[0] = b[1] = false;  for(int i=2;i < b.length;i++)  {  if(!b[i])   continue;   for(int j=2;i*j<b.length;j++)   b[i*j] = false;  }  int[] p = new int[11000];  int pn = 0;  for(int i=0;i < b.length;i++)  {  if(b[i])   p[pn++] = i;  }  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int k = scan.nextInt();  int rtn = 0;    for(int j=0;p[j] <= n;j++)  {    for(int h=0;h <= j;h++)  {   if(p[h] + p[h+1] + 1 == p[j])   {   rtn++;   break;   }  }  }  System.out.println(rtn >= k ? "YES" : "NO");   } }
1	public class IQTest { public static void main(String args[]) throws Exception {  BufferedReader stdin =  new BufferedReader(new InputStreamReader(System.in));  String line;  line = stdin.readLine();  int n = Integer.parseInt(line);  line = stdin.readLine();  List even = new ArrayList();  List odd = new ArrayList();  String[] kk = line.split(" ");  for(int i=0;i<n;i++) {   if(Integer.parseInt(kk[i])%2==0)   even.add(i);   else   odd.add(i);  }  if(even.size()==1)   System.out.println((Integer)even.get(0)+1);  else   System.out.println((Integer)odd.get(0)+1); } }
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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   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 long[] nal(int n) {  long[] a = new long[n];  for(int i = 0;i < n;i++)a[i] = nl();  return a; }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[][] nmi(int n, int m) {  int[][] map = new int[n][];  for(int i = 0;i < n;i++)map[i] = na(m);  return map; }  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 {  private static 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;  }  private static 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;  }  private static 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(); } }  public void trnz(int... o) {  for(int i = 0;i < o.length;i++)if(o[i] != 0)System.out.print(i+":"+o[i]+" ");  System.out.println(); }   public void trt(long... o) {  Queue<Integer> stands = new ArrayDeque<>();  for(int i = 0;i < o.length;i++){  for(long x = o[i];x != 0;x &= x-1)stands.add(i<<6|Long.numberOfTrailingZeros(x));  }  System.out.println(stands); }  public void tf(boolean... r) {  for(boolean x : r)System.out.print(x?'#':'.');  System.out.println(); }  public void tf(boolean[]... b) {  for(boolean[] r : b) {  for(boolean x : r)System.out.print(x?'#':'.');  System.out.println();  }  System.out.println(); }  public void tf(long[]... b) {  if(INPUT.length() != 0) {  for (long[] r : b) {   for (long x : r) {   for (int i = 0; i < 64; i++) {    System.out.print(x << ~i < 0 ? '#' : '.');   }   }   System.out.println();  }  System.out.println();  } }  public void tf(long... b) {  if(INPUT.length() != 0) {  for (long x : b) {   for (int i = 0; i < 64; i++) {   System.out.print(x << ~i < 0 ? '#' : '.');   }  }  System.out.println();  } }  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 {  long MOD = 1000000007;  InputReader in;BufferedReader br;PrintWriter out;  public static void main (String[] args) throws java.lang.Exception  {   Main solver = new Main();   solver.in = new InputReader(System.in);   solver.br = new BufferedReader(new InputStreamReader(System.in));   solver.out = new PrintWriter(System.out);   solver.solve();   solver.out.flush();   solver.out.close();  }  public void solve(){     int tc = 1;     for(int cas=1;cas<=tc;cas++){    int N = in.readInt();    int[] A = new int[N];    in.readInt(A);       HashMap<Integer, Integer> H = new HashMap<>();    long sum = A[0], count = 1;    BigInteger B = BigInteger.ZERO;    H.put(A[0], 1);    for(int i=1;i<N;i++){         B = B.add(BigInteger.valueOf(count*A[i]-sum));     if(!H.containsKey(A[i]))      H.put(A[i], 0);     H.put(A[i], H.get(A[i])+1);     if(H.containsKey(A[i]-1)){      int k = H.get(A[i]-1);           B = B.add(BigInteger.valueOf((k*(A[i]-1) - k*A[i])));     }     if(H.containsKey(A[i]+1)){      int k = H.get(A[i]+1);      B = B.add(BigInteger.valueOf((k*(A[i]+1) - k*A[i])));          }         sum+=A[i];count++;    }       out.println(B);    }  }  }  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 void readInt(int[] A){   for(int i=0;i<A.length;i++)    A[i] = readInt();  }  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 void readLong(long[] A){   for(int i=0;i<A.length;i++)    A[i] = readLong();  }  public double readDouble() {   int c = read();   while (isSpaceChar(c))    c = read();   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   double res = 0;   while (!isSpaceChar(c) && c != '.') {    if (c == 'e' || c == 'E')     return res * Math.pow(10, readInt());    if (c < '0' || c > '9')     throw new InputMismatchException();    res *= 10;    res += c - '0';    c = read();   }   if (c == '.') {    c = read();    double m = 1;    while (!isSpaceChar(c)) {     if (c == 'e' || c == 'E')      return res * Math.pow(10, readInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     m /= 10;     res += (c - '0') * m;     c = read();    }   }   return res * sgn;  }  public char[] readCharA(){   return readString().toCharArray();  }  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);  } }
5	public class Solution {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt(), k = in.nextInt();   int x[] = new int[n];   for (int i = 0; i < n; i++) {    int p = in.nextInt(), t = in.nextInt();    x[i] = (50 - p) * 100 + t;   }   Arrays.sort(x);   int cnt = 0;   for (int q: x)    if (q == x[k - 1]) cnt++;   System.out.println(cnt);  } }
5	public class problemA {  public static void main(String[] args){   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int a = sc.nextInt();   int b = sc.nextInt();   int[] hs = new int[n];   for(int i = 0; i < n; i++){    hs[i] = sc.nextInt();   }   Arrays.sort(hs);   System.out.println(hs[b]-hs[b-1]);  } }
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 ELR {  public static void main(String[] args) {new Thread(null, new Runnable() { public void run() {try {  sol(); } catch (Throwable e) {  e.printStackTrace(); }}}, "2",1<<26).start();}  static int n,k; static boolean adj[][]; static int dp1[],dp2[]; static int myMask[]; static int next1[]; static int m1,m2; public static int solve1(int msk) {  if (dp1[msk] != -1) {  return dp1[msk];  }  int ret = 0;  int tmp = msk;  for (int i = 0 ; i < m1 ; ++i) {  if ( ((msk & (1 << i)) > 0)) {   tmp &= (myMask[i]);  }  }  if (tmp == msk) {  ret = Integer.bitCount(msk);  }  for (int i = 0 ; i < m1 ; ++i) {  if ( (msk & (1 << i)) > 0) {   ret = Math.max(ret, solve1(msk & ~(1 << i)));  }  }  return dp1[msk] = ret; } public static int solve2(int msk) {  if (dp2[msk] != -1) {  return dp2[msk];  }  int ret = 0;  int tmp = msk;  for (int i = 0 ; i < m2 ; ++i) {  if ( ((msk & (1 << i)) > 0)) {   tmp &= (myMask[i + m1]);  }  }  if (tmp == msk) {  ret = Integer.bitCount(msk);  }  for (int i = 0 ; i < m2 ; ++i) {  if ( (msk & (1 << i)) > 0) {   ret = Math.max(ret, solve2(msk & ~(1 << i)));  }  }  return dp2[msk] = ret; } public static void sol() throws Throwable {  Scanner sc = new Scanner(System.in);  n = sc.nextInt();  k = sc.nextInt();  adj = new boolean[n][n];  for (int i = 0 ; i < n ; ++i) {  for (int j = 0 ; j < n ; ++j) {   adj[i][j] = sc.nextInt() == 1;  }  }  m1= (n + 1) / 2;  m2 = n - m1;  dp1 = new int[1 << m1];  dp2 = new int[1 << m2];  next1 = new int[1 << m2];  Arrays.fill(dp1, -1);  Arrays.fill(dp2, -1);  myMask = new int[n];  for (int i = 0 ; i < n ; ++i) {  if (i >= m1) {   for (int j = m1 ; j < n ; ++j) {   if (adj[i][j] || i == j) {    myMask[i] |= (1 << (j - m1));   }   }  } else {   for (int j = m1 ; j < n ; ++j) {   if (adj[i][j]) {    next1[i] |= (1 << (j - m1));   }   }   for (int j = 0 ; j < m1 ; ++j) {   if (adj[i][j] || i == j) {    myMask[i] |= (1 << j);   }   }  }  }  for (int i = 0 ; i < (1 << m1) ; ++i) {  solve1(i);  }  for (int i = 0 ; i < (1 << m2) ; ++i) {  solve2(i);  }  int ans = 0;  for (int msk = 0 ; msk < (1 << m1) ; ++msk) {  int next = (1 << (m2)) - 1;  if (dp1[msk] != Integer.bitCount(msk)) {   continue;  }  for (int i = 0 ; i < m1 ; ++i) {   if ( (msk & (1 << i)) > 0) {   next &= next1[i];   }  }  ans = Math.max(ans, dp1[msk] + dp2[next]);  }  double cont = (k / (ans*1.0));  double edges = (ans) * (ans - 1) / 2.0;  double res = cont * cont * edges;  System.out.println(res);  }  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 String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public boolean ready() throws IOException {  return br.ready();  } } }
6	public class CF11D { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int m = sc.nextInt();  boolean[][] map = new boolean[n][n];  long[][] dp = new long[1 << n][n];  for (int i = 0; i < m; i++) {  int a = sc.nextInt() - 1;  int b = sc.nextInt() - 1;  map[a][b] = map[b][a] = true;  dp[(1 << a) + (1 << b)][Math.max(a, b)] = 1;  }  long ans = 0;  for (int mask = 1; mask < (1 << n); mask++) {  int lowbit = 0;  for (; (mask & (1 << lowbit)) == 0; lowbit++);  for (int i = lowbit + 1; i < n; i++) {   if ((mask & (1 << i)) == 0) {   continue;   }   for (int j = lowbit + 1; j < n; j++) {   if ((mask & (1 << j)) == 0 || j == i) {    continue;   }   if (map[i][j]) {    dp[mask][i] += dp[mask ^ (1 << i)][j];   }   }   if (map[lowbit][i]) {   ans += dp[mask][i];   }  }  }  System.out.println((ans - m) / 2);  sc.close(); } }
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);   SameSumBlocks solver = new SameSumBlocks();   solver.solve(1, in, out);   out.close();  }  static class SameSumBlocks {   int N;   public void solve(int testNumber, InputReader in, PrintWriter out) {    N = in.nextInt();    int[] arr = new int[N];    for (int i = 1; i <= N; i++) {     arr[i - 1] = in.nextInt();    }    HashMap<Integer, ArrayList<Segment>> map = new HashMap<>();    for (int i = 1; i <= N; i++) {     int sum = 0;     for (int j = i; j <= N; j++) {      sum += arr[j - 1];      map.putIfAbsent(sum, new ArrayList<>());      map.get(sum).add(new Segment(i, j));     }    }    int resI = 0;    int resVal = 0;    int sum = 0;    if (arr.length > 1 && arr[1] == -999) {     for (int i = 11; i < 130; i++) {      sum += arr[i];     }    }    for (int key : map.keySet()) {     if (map.get(key).size() > resI) {      int next = largestNon(map.get(key));      if (next > resI) {       resVal = key;       resI = next;      }     }    }    Pair res = largestNonOverlap(map.get(resVal));    out.println(resI);    for (int i = 0; i < resI; i++) {     out.println(res.used.get(i).li + " " + res.used.get(i).ri);    }   }   int largestNon(ArrayList<Segment> arr) {    Collections.sort(arr, new Comparator<Segment>() {     public int compare(Segment o1, Segment o2) {      return Integer.compare(o1.ri, o2.ri);     }    });    SameSumBlocks.SegmentTree seg = new SameSumBlocks.SegmentTree(N + 1);    for (int i = 0; i < arr.size(); i++) {     seg.add(arr.get(i).ri, arr.get(i).ri, 1 + seg.query(0, arr.get(i).li - 1).mx);    }    return seg.query(0, N).mx;   }   Pair largestNonOverlap(ArrayList<Segment> arr) {    Segment[] segs = new Segment[N + 1];    int[] dp = new int[N + 1];    for (int i = 0; i <= N; i++) {     segs[i] = new Segment(-1, 0);    }    for (Segment s : arr) {     if (s.li > segs[s.ri].li) {      segs[s.ri] = s;     }    }    int[] used = new int[N + 1];    for (int i = 1; i <= N; i++) {     dp[i] = dp[i - 1];     used[i] = used[i - 1];     if (segs[i].li != -1) {      if (dp[i] < dp[segs[i].li - 1] + 1) {       used[i] = i;       dp[i] = dp[segs[i].li - 1] + 1;      }     }    }    ArrayList<Segment> res = new ArrayList<>();    int u = used[N];    while (segs[u].li > 0) {     res.add(segs[u]);     u = used[segs[u].li - 1];    }    return new Pair(dp[N], res);   }   class Segment {    int li;    int ri;    Segment() {    }    Segment(int li, int ri) {     this.li = li;     this.ri = ri;    }   }   class Pair {    int val;    ArrayList<Segment> used = new ArrayList<>();    Pair(int val, ArrayList<Segment> used) {     this.val = val;     this.used = used;    }   }   static class SegmentTree {    Node[] tree;    int size = 0;    public Node none() {         Node res = new Node();     return res;    }    public SegmentTree(int N) {     tree = new Node[4 * N];     size = N;     for (int i = 0; i < 4 * N; i++) {      tree[i] = new Node();     }    }    Node combine(Node a, Node b) {         Node res = new Node();     res.mx = Math.max(a.mx, b.mx);     return res;    }    public Node query(int l, int r) {     return queryUtil(1, 0, size - 1, l, r);    }    public Node queryUtil(int n, int tl, int tr, int l, int r) {         if (l > r) {      return none();     }     if (tl == l && tr == r) {      return tree[n];     }     int tm = (tl + tr) / 2;     return combine(queryUtil(2 * n, tl, tm, l, Math.min(r, tm)), queryUtil(2 * n + 1, tm + 1, tr, Math.max(tm + 1, l), r));    }    public void add(int l, int r, int val) {         addUtil(1, 0, size - 1, l, r, val);    }    public void addUtil(int n, int tl, int tr, int l, int r, int val) {     if (l > r) {      return;     }     if (tl == l && tr == r) {      tree[n].update(val);     } else {      int tm = (tl + tr) / 2;      addUtil(2 * n, tl, tm, l, Math.min(tm, r), val);      addUtil(2 * n + 1, tm + 1, tr, Math.max(l, tm + 1), r, val);      tree[n] = combine(tree[2 * n], tree[2 * n + 1]);     }    }    class Node {     int mx = 0;     int lzy = 0;     void update(int val) {      mx = Math.max(mx, val);      lzy += val;     }    }   }  }  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());   }  } }
1	public class Main {  void solve(){   int n=ni();   int c1[]=new int[9];   int c2[]=new int[9];   for(int i=0;i<n;i++){    String s=ns();    if(s.equals("M")) c1[0]++;    else if(s.equals("S")) c1[1]++;    else if(s.equals("L")) c1[2]++;    else if(s.equals("XS")) c1[3]++;    else if(s.equals("XL")) c1[4]++;    else if(s.equals("XXS")) c1[5]++;    else if(s.equals("XXL")) c1[6]++;    else if(s.equals("XXXS")) c1[7]++;    else if(s.equals("XXXL")) c1[8]++;   }   for(int i=0;i<n;i++){    String s=ns();    if(s.equals("M")) c2[0]++;    else if(s.equals("S")) c2[1]++;    else if(s.equals("L")) c2[2]++;    else if(s.equals("XS")) c2[3]++;    else if(s.equals("XL")) c2[4]++;    else if(s.equals("XXS")) c2[5]++;    else if(s.equals("XXL")) c2[6]++;    else if(s.equals("XXXS")) c2[7]++;    else if(s.equals("XXXL")) c2[8]++;   }   int ans=0;   for(int i=0;i<9;i++){    if(c2[i]<c1[i]) ans+=c1[i]-c2[i];   }   pw.println(ans);   }  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 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 double nd() { return Double.parseDouble(ns()); }  private char nc() { return (char)skip(); }  private String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b))){    sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }  private char[] ns(int n) {   char[] buf = new char[n];   int b = skip(), p = 0;   while(p < n && !(isSpaceChar(b))){    buf[p++] = (char)b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }  private char[][] nm(int n, int m) {   char[][] map = new char[n][];   for(int i = 0;i < n;i++)map[i] = ns(m);   return map;  }  private int[] na(int n) {   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = ni();   return a;  }  private int ni() {   int num = 0, b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private long nl() {   long num = 0;   int b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); } }
3	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 nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}   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 long l(){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 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 double d() throws IOException {return Double.parseDouble(s()) ;}   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 int[] arr(int n){int[] ret = new int[n];for (int i = 0; i < n; i++) {ret[i] = i();}return ret;}  }                         public static void main(String[] args)throws IOException  {   Reader sc=new Reader();   PrintWriter out=new PrintWriter(System.out);   int n=sc.i();   int arr[]=sc.arr(n);   int count=0;   for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)if(arr[j]<arr[i])count++;   count%=2;   int q=sc.i();   while(q-->0)   {    int a=sc.i();    int b=sc.i();    long len=((long)(b-a+1)*(b-a))/2;    if(len%2==1)count^=1;    if(count==0)out.println("even");    else out.println("odd");   }   out.flush();  } }
4	public class ExplorerSpace {  private 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());  }   String nextLine(){   String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }  }    public static long[][][] dp;   public static boolean valid(int i, int j, int n, int m) {  return i>=0 && i<n &&j>=0 && j<m; }  public static void solution(int n, int m, int k, int[][] h, int[][] v)   {  if(k%2==1)  {  for(int i = 0; i<n; i++)  {   for(int j = 0; j<m; j++)    out.print(-1+" ");     out.println();     }    return;  }   dp = new long[n][m][k/2+1];   for(int t = 1; t<=k/2; t++)  {  for(int i = 0; i<n; i++)  {   for(int j = 0; j<m; j++)   {   dp[i][j][t] = Long.MAX_VALUE;      }  }  }   for(int i = 0; i<n; i++)  {  for(int j = 0; j<m; j++)  {   dp[i][j][0] = 0;     }  }     for(int t = 1; t<=k/2; t++)  {  for(int i = 0; i<n; i++)  {   for(int j = 0; j<m; j++)   {   if(valid(i,j+1,n,m))    dp[i][j][t] = Math.min(dp[i][j][t], h[i][j] + dp[i][j+1][t-1]);      if(valid(i,j-1,n,m))    dp[i][j][t] = Math.min(dp[i][j][t], h[i][j-1] + dp[i][j-1][t-1]);      if(valid(i+1,j,n,m))    dp[i][j][t] = Math.min(dp[i][j][t], v[i][j] + dp[i+1][j][t-1]);      if(valid(i-1,j,n,m))    dp[i][j][t] = Math.min(dp[i][j][t], v[i-1][j] + dp[i-1][j][t-1]);     }  }  }     for(int i = 0; i<n; i++)  {  for(int j = 0; j<m; j++)   out.print((dp[i][j][k/2]*2)+" ");    out.println();  }   }   private static PrintWriter out = new PrintWriter(System.out); public static void main (String[] args) { MyScanner s = new MyScanner();    int n = s.nextInt();  int m = s.nextInt();  int k = s.nextInt();   int[][] h = new int[n][m-1];   for(int i = 0; i<n; i++)  {  for(int j = 0; j<m-1; j++)  {   h[i][j] = s.nextInt();  }  }   int[][] v = new int[n-1][m];   for(int i = 0; i<n-1; i++)  {  for(int j = 0; j<m; j++)  {   v[i][j] = s.nextInt();  }  }     solution(n,m,k,h,v);   out.flush();  out.close();  } }
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; }  private static 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();  }  String nextLine() throws IOException {  return br.readLine();  }  int nextInt() throws IOException {  return Integer.parseInt(next());  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(next());  }  boolean ready() throws IOException {  return br.ready();  }  } }
6	public class Ok_Simple { static BufferedReader reader; static StringTokenizer tokenizer; static boolean am[][]; static long dp[][]; static int n; public static void main(String[] args) throws IOException {  reader = new BufferedReader(new InputStreamReader(System.in));  int m;  n = NextInt();  m = NextInt();  am = new boolean[n][n];  dp = new long[n][1 << n];  for (int i = 0; i < n; ++i)  Arrays.fill(dp[i], -1);  for (int i = 0; i < m; ++i) {  int a = NextInt() - 1;  int b = NextInt() - 1;  am[a][b] = am[b][a] = true;  };  long res = 0;  for (int a = 0; a < n; ++a)  res += solve(a, (1 << a));  System.out.println(res / 2); } private static long solve(int b, int mask) {  int a = 0;  for (int i = 0 ;i < n; ++i)  if (((mask >> i) & 1) != 0)  {   a = i;   break;  }  if (dp[b][mask] >= 0)  return dp[b][mask];  long res = 0;  if (am[b][a] && Integer.bitCount(mask) > 2)  res = 1;  for (int i = a + 1; i < n; ++i)  if (((mask >> i) & 1) == 0 && am[b][i])   res += solve(i, mask ^ (1 << i));  return dp[b][mask] = res; } static int NextInt() throws NumberFormatException, IOException {  return Integer.parseInt(NextToken()); } static double NextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(NextToken()); } static long NextLong() throws NumberFormatException, IOException {  return Long.parseLong(NextToken()); } static String NextToken() throws IOException {  while(tokenizer == null || !tokenizer.hasMoreTokens()) {  tokenizer = new StringTokenizer(reader.readLine());  }  return tokenizer.nextToken(); } }
1	public class Main {  static StringTokenizer st;  static PrintWriter out = new PrintWriter(System.out,true);  static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  public static int nextInt() throws Exception {   if(st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine());   return Integer.parseInt(st.nextToken());  }  public static long nextLong() throws Exception {   if(st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine());   return Long.parseLong(st.nextToken());  }  public static void main(String[] args) throws Exception {   HashSet<Integer> set = new HashSet<>();   int n = nextInt();   int k = nextInt();   int[] m = new int[n];   int[] d = new int[n];   for(int i = 0;i < n;i++) m[i] = nextInt();   int l = -1;   int r = -1;   for(int i = 0;i < n;i++) {    set.add(m[i]);    d[i] = set.size();    if(d[i] == k) {     r = i;     break;    }   }   if(r == -1) {    out.println("-1 -1");    return;   }   for(int i = r;i >= 0;i--) {    set.remove(m[i]);    if(set.size() == 0) {     l = i;     break;    }   }   out.println((l+1)+" "+(r+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 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());  } }
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(); }  String nextString() {  try {  return br.readLine();  } catch (IOException e) {  eof = true;  return null;  } }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
1	public class A {  public static void main(String[] args) {  JS in = new JS();  int n = in.nextInt();  int m1 = 0;  int s1 = 0;  int l1 = 0;  int ss1 = 0;  int sss1 = 0;  int ssss1 = 0;  int ll1 = 0;  int lll1 = 0;  int llll1 = 0;   int m2 = 0;  int s2 = 0;  int l2 = 0;  int ss2 = 0;  int sss2 = 0;  int ssss2 = 0;  int ll2 = 0;  int lll2 = 0;  int llll2 = 0;  for(int i = 0; i < n; i++) {  String s = in.next();  if(s.equals("S")) s1++;  else if(s.equals("M"))m1++;  else if(s.equals("L"))l1++;  else if(s.equals("XS")) ss1++;  else if(s.equals("XXS")) sss1++;  else if(s.equals("XXXS")) ssss1++;  else if(s.equals("XL")) ll1++;  else if(s.equals("XXL")) lll1++;  else if(s.equals("XXXL")) llll1++;  }  for(int i = 0; i < n; i++) {  String s = in.next();  if(s.equals("S")) s2++;  else if(s.equals("M"))m2++;  else if(s.equals("L"))l2++;  else if(s.equals("XS")) ss2++;  else if(s.equals("XXS")) sss2++;  else if(s.equals("XXXS")) ssss2++;  else if(s.equals("XL")) ll2++;  else if(s.equals("XXL")) lll2++;  else if(s.equals("XXXL")) llll2++;  }   int res = 0;  int res1 = 0;    res1 += Math.abs(m2-m1);  res1 += Math.abs(s2-s1);  res1 += Math.abs(l2-l1);  res += res1/2;  res1 = 0;   res1 += Math.abs(ss2-ss1);  res1 += Math.abs(ll2-ll1);  res += res1/2;  res1 = 0;   res1 += Math.abs(sss2-sss1);  res1 += Math.abs(lll2-lll1);  res += res1/2;  res1 = 0;   res1 += Math.abs(ssss2-ssss1);  res1 += Math.abs(llll2-llll1);  res += res1/2;  res1 = 0;  System.out.println(res);    }   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;  }   public double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }   public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }   public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  } } }
0	public class file{   public static void main(String []args) {  Scanner sc=new Scanner(System.in);  int n=sc.nextInt();  while(n-->0)  {   int a=sc.nextInt();   int b=sc.nextInt();   int ans=f(a,b);   System.out.println(ans);  }  }  public static int f(int a,int b)  {   if(a==0||b==0)    return 0;   if(a>b)   {    return a/b + f(b,a%b);   }   else    return b/a + f(a,b%a);  } }
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 a = in.nextLong();   long b = in.nextLong();   long res = 0;   while(a > 1 && b > 1) {    if(a < b) {     res += b / a;     b %= a;    }    else {     res += a / b;     a %= b;    }   }   if(a == 1)    res += b;   else    res += a;   out.println(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 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;  }  }
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);  } }
0	public class Rules { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int a = in.nextInt();  double maxSpeed = in.nextInt();  double len = in.nextInt();  double delayDist = in.nextInt();  double delaySpeed = in.nextInt();     double timeToDelayAtMax = travelS(a, 0.0, maxSpeed, delayDist);  double timeToDelayAtDelay = travelS(a, 0.0, delaySpeed, delayDist);  if (Math.abs(timeToDelayAtMax-timeToDelayAtDelay) < 0.00001) {    double time = travelS(a, 0.0, maxSpeed, len);  System.out.printf("%.9f\n", time);  return;  }     double lowV = delaySpeed;  double highV = maxSpeed;  int loopCount = 1000;  double[] initial = null;  double[] secondary = null;  while (loopCount-->0) {  double guessV = (lowV+highV)/2.0;  initial = travelA(a, 0.0, guessV);  secondary = travelA(a, guessV, Math.min(delaySpeed, maxSpeed));  if (initial[1] + secondary[1] < delayDist) {   lowV = guessV;  } else {   highV = guessV;  }  }  double totalTime = 0.0;  double finalSpeed = 0.0;  initial = travelA(a, 0.0, lowV);  secondary = travelA(a, lowV, delaySpeed);  totalTime = initial[0] + secondary[0];  double totalDist = initial[1] + secondary[1];  totalTime += (delayDist-totalDist)/maxSpeed;     totalTime += travelS(a, delaySpeed, maxSpeed, len-delayDist);  System.out.printf("%.9f\n", totalTime); }    public static double[] travelA(int a, double startSpeed, double endSpeed) {  if (startSpeed > endSpeed)  a = -a;   double time = (endSpeed - startSpeed) / a;  double dist = 0.5*a*time*time + startSpeed*time;  return new double[] {time, dist}; }   public static double travelS(int a, double startSpeed, double maxSpeed, double dist) {  double timeToMax = (maxSpeed - startSpeed) / a;  double targetTime = (-startSpeed + Math.sqrt(startSpeed*startSpeed + 2*a*dist)) / a;  if (targetTime < timeToMax)  return targetTime;   double partialDist = 0.5*timeToMax*timeToMax*a + startSpeed*timeToMax;  double remainingDist = dist - partialDist;  targetTime = remainingDist / maxSpeed;  return targetTime + timeToMax; } }
3	public class A {  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  {   ntok();   int n = ipar();   ArrayList<Integer> list = new ArrayList<>();   ntok();   for (int i = 0; i < n; i++)   {    list.add(ipar());   }   Collections.sort(list);   HashSet<Integer> set = new HashSet<>();   for (int x : list)   {    boolean add = true;    for (int y : set)    {     if (x % y == 0)     {      add = false;      break;     }    }    if (add)    {     set.add(x);    }   }   out.println(set.size());   out.flush();   in.close();  }  public void ntok() throws IOException  {   tok = new StringTokenizer(in.readLine());  }  public int ipar()  {   return Integer.parseInt(tok.nextToken());  }  public int[] iapar(int n)  {   int[] arr = new int[n];   for (int i = 0; i < n; i++)   {    arr[i] = ipar();   }   return arr;  }  public long lpar()  {   return Long.parseLong(tok.nextToken());  }  public long[] lapar(int n)  {   long[] arr = new long[n];   for (int i = 0; i < n; i++)   {    arr[i] = lpar();   }   return arr;  }  public double dpar()  {   return Double.parseDouble(tok.nextToken());  }  public String spar()  {   return tok.nextToken();  }  public static void main(String[] args) throws IOException  {   new A().go();  } }
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 a = in.nextLong();   long b = in.nextLong();   out.println(go(a, b));  }  private long go(long a, long b) {   if (b == 0) return 0;   return a / b + go(b, a % b);  } } 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 long nextLong() {   return Long.parseLong(next());  }  }
6	public class Main implements Runnable { private void solution() throws IOException {  int n = in.nextInt();  int m = in.nextInt();  boolean[][] adj = new boolean[n][n];  long res = 0;  for (int i = 0; i < m; ++i) {  int x = in.nextInt();  int y = in.nextInt();  adj[x - 1][y - 1] = true;  adj[y - 1][x - 1] = true;  }  for (int i = 0; i < n; ++i) {  for (int j = i + 1; j < n; ++j) {   if (adj[i][j]) {   --res;   }  }  }  for (int i = 0; i < n; ++i) {  long[][] dp = new long[n - i][1 << (n - i)];  dp[0][0] = 1;  for (int mask = 0; mask < (1 << (n - i)); ++mask) {   for (int j = 0; j < n - i; ++j) {   if (dp[j][mask] != 0) {    for (int k = 0; k < n - i; ++k) {    if (((mask >> k) & 1) == 0 && adj[j + i][k + i]) {     dp[k][mask | (1 << k)] += dp[j][mask];    }    }   }   }   if (((mask >> 0) & 1) != 0) {   res += dp[0][mask];   }  }  }  out.println(res / 2); }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  private class Scanner {  BufferedReader reader;  StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  public boolean hasNext() throws IOException {  while (!tokenizer.hasMoreTokens()) {   String next = reader.readLine();   if (next == null) {   return false;   }   tokenizer = new StringTokenizer(next);  }  return true;  }  public String next() throws IOException {  hasNext();  return tokenizer.nextToken();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
1	public class Main {    void run() throws IOException {   int n = in.nextInt();   char[] c = in.next().toCharArray();   int[][] t = new int[n][n];   int[][] h = new int[n][n];   int allt = 0, allh = 0;   for (int i = 0; i < n; i++) {    if (c[i] == 'T') {     allt++;    } else {     allh++;    }   }   for (int i = 0; i < n; i++) {    if (c[i] == 'T') {     t[i][i] = 1;     h[i][i] = 0;    } else {     t[i][i] = 0;     h[i][i] = 1;    }    for (int j = i + 1; j < n; j++) {     if (c[j] == 'T') {      t[i][j] = t[i][j - 1] + 1;      h[i][j] = h[i][j - 1];     } else {      h[i][j] = h[i][j - 1] + 1;      t[i][j] = t[i][j - 1];     }    }   }   for (int i = 1; i < n; i++) {    t[i][i - 1] = allt;    h[i][i - 1] = allh;    for (int j = 0; j < i - 1; j++) {     t[i][j] = allt - t[j + 1][i - 1];     h[i][j] = allh - h[j + 1][i - 1];    }   }   int r = Integer.MAX_VALUE;   for (int i = 0; i < n; i++) {    for (int j = 0; j < n; j++) {         if (h[i][j] == t[(j + 1) % n][(i - 1 + n) % n]) {      r = min(r, h[i][j]);     }     if (t[i][j] == h[(j + 1) % n][(i - 1 + n) % n]) {      r = min(r, t[i][j]);     }    }   }   out.println(r);    }  class pair implements Comparable <pair> {   int x, y;   pair(int x, int y) {    this.x = x;    this.y = y;      }   public int compareTo (pair p) {    if (x != p.x) {     return x - p.x;    } else {     return y - p.y;    }   }  }  static PrintWriter out;  static Scanner in;  public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);     in = new Scanner (System.in); out = new PrintWriter (System.out);   new Main().run();     out.close();  } }
4	public class C { String line; StringTokenizer inputParser; BufferedReader is; FileInputStream fstream; DataInputStream in;  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; }  String NextString() {  String n = inputParser.nextToken();  return n; }  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];  C c = new C(filePath); }  public C(String inputFile) {  inputFile="input.txt";   openInput(inputFile);   PrintWriter writer=null;  try {  writer = new PrintWriter("output.txt");    } catch (FileNotFoundException e) {  e.printStackTrace();  }   readNextLine();  int N=NextInt();  int M=NextInt();  readNextLine();  int K=NextInt();  readNextLine();  int [] [] p = new int[N][M];  int [] [] init = new int [K][2];   for(int i=0; i<K; i++)  {  int x=NextInt()-1;  int y=NextInt()-1;  p[x][y]=0;  init[i][0]=x;  init[i][1]=y;  }   int max=-1;  int maxX=-1, maxY=-1;   for(int i=0; i<N; i++)  for(int j=0; j<M; j++)  {   p[i][j]=10000;   for(int k=0; k<K; k++)   {   int n=Math.abs(init[k][0]-i)+Math.abs(init[k][1]-j);   if(n<p[i][j])p[i][j]=n;   }   if(p[i][j]>max)   {   max=p[i][j];   maxX=i+1;   maxY=j+1;   }  }      writer.println( maxX+" "+maxY);       closeInput();  writer.close(); }  }
1	public class A25 {   public void run() {  try {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(in.readLine().trim());  String[] toks = in.readLine().trim().split("[ ]+");  int counter = 0;  boolean even = true;  int e = -1, o = -1;  int ec = 0, oc = 0;  for (int i = 0; i < toks.length; i++) {   int x = Integer.parseInt(toks[i]);   if (x % 2 == 0) {   ec ++;   if (e == -1) {    e = i+1;   }   }   else {   oc ++;   if (o == -1) {    o = i+1;   }   }  }  if (ec == 1) {   System.out.println(e);  }  else if (oc == 1) {   System.out.println(o);  }  } catch (Exception e) {  e.printStackTrace();  } }   public static void main(String[] args) {  new A25().run(); } }
5	public class Main implements Runnable {  PrintWriter out;  BufferedReader in;  StringTokenizer st;   void solve() throws Exception {   int n = nextInt();   int[] a = new int[n];   int sum = 0;   for(int i = 0; i < n; ++i) {    a[i] = nextInt();    sum += a[i];   }   Arrays.sort(a);   int ans = 0, csum = 0;   for(int i = n - 1; csum <= sum - csum && i >= 0; i--) {    csum += a[i];    ans++;   }   out.println(ans);  }  public void run() {   try {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);     solve();    out.close();   } catch (Exception e) {    e.printStackTrace();   }  }   static public void main(String args[]) throws Exception {   (new Main()).run();  }   int nextInt() {   return Integer.parseInt(nextToken());  }   double nextDouble() {   return Double.parseDouble(nextToken());  }   String nextToken() {   while(st == null || !st.hasMoreTokens()) {    try {     String line = in.readLine();     st = new StringTokenizer(line);    } catch(Exception e) {     return null;    }   }   return st.nextToken();  } }
4	public class C {  private static boolean marked[][] ;     public static void main(String[] args) throws Exception {              File file = new File("input.txt") ;    Scanner s = new Scanner(file) ;      int n = s.nextInt();   int m = s.nextInt();      marked = new boolean [n + 1 ][m + 1] ;      int k = s.nextInt();     Queue<Point> queue = new LinkedList<Point>();        for(int i =0 ; i < k ; ++i){    int tempX = s.nextInt() ;    int tempY = s.nextInt() ;    marked[tempX][tempY] = true ;    queue.add(new Point(tempX , tempY));      }      Point c = null ;      while(!queue.isEmpty()){    c = queue.poll() ;        if(c.x>1 && !marked[c.x-1][c.y]){     marked[c.x -1 ][c.y] = true ;     queue.add(new Point(c.x-1,c.y));    }       if(c.y>1 && !marked[c.x][c.y-1]){     marked[c.x][c.y-1] = true ;     queue.add(new Point(c.x,c.y-1));    }       if(c.x < n && !marked[c.x+1][c.y]){     marked[c.x + 1 ][c.y] = true ;     queue.add(new Point(c.x + 1,c.y));    }       if(c.y < m && !marked[c.x][c.y+1]){     marked[c.x][c.y+1] = true ;     queue.add(new Point(c.x,c.y+1));    }   }   PrintWriter out = new PrintWriter(new File("output.txt"));   out.println(c.x+" "+c.y);   out.close();  }   static class Point {   int x ;   int y ;   public Point(int x ,int y ){    this.x = x ;    this.y = y ;   }  } }              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 double nextDouble() {   return Double.parseDouble(next());  } }
2	public class A { private static 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);   }  private static 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 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 m = in.nextLong();   long x1 = in.nextLong();   long y1 = in.nextLong();   long x2 = in.nextLong();   long y2 = in.nextLong();   long x3 = in.nextLong();   long y3 = in.nextLong();   long x4 = in.nextLong();   long y4 = in.nextLong();   long w = white(1, 1, m, n);   long b = black(1, 1, m, n);   long whited = 0;   if(x3 > x2 || x4 < x1 || y3 > y2 || y4 < y1) {   whited = black(x1, y1, x2, y2);   } else {   whited = black(x1, y1, x2, y2);   long xm1 = Math.max(x1, x3);   long ym1 = Math.max(y1, y3);   long xm2 = Math.min(x2, x4);   long ym2 = Math.min(y2, y4);   whited -= black(xm1, ym1, xm2, ym2);   }   b -= whited;w += whited;   long blacked = white(x3, y3, x4, y4);   w-= blacked;b += blacked;   out.println(w + " " + b);  }  }   long black(long x1, long y1, long x2, long y2) {  long dx = (x2 - x1) + 1;  long dy = (y2 - y1) + 1;  if((x1+y1)%2!=0) {   return ((dy+1)/2)*((dx+1)/2)+(dy/2)*(dx/2);  }  return ((dy+1)/2)*((dx)/2)+(dy/2)*((dx+1)/2);  }   long white(long x1, long y1, long x2, long y2) {  long dx = (x2 - x1) + 1;  long dy = (y2 - y1) + 1;  if((x1+y1)%2==0) {   return ((dy+1)/2)*((dx+1)/2)+(dy/2)*(dx/2);  }  return ((dy+1)/2)*(dx/2)+(dy/2)*((dx+1)/2);  }   }  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 nextLine() {   String str = "";   try {   str = reader.readLine();  } catch (IOException e) {     e.printStackTrace();  }   return str;   }     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 double nextDouble() {   return Double.parseDouble(next());   }    } }
3	public class CODE2{      private static InputStream stream;       private static byte[] buf = new byte[1024];       private static int curChar,MAX;       private static int numChars;       private static SpaceCharFilter filter;       private static PrintWriter pw;       private static long count = 0,mod=1000000007;       static int BIT[];       private static boolean primer[];      public final static int INF = (int) 1E9; public static void main(String args[]) {  InputReader(System.in);  pw = new PrintWriter(System.out);  new Thread(null ,new Runnable(){   public void run(){    try{     solve();         pw.close();    } catch(Exception e){     e.printStackTrace();    }   }  },"1",1<<26).start();  }  static StringBuilder sb;  public static void test(){   sb=new StringBuilder();   int t=nextInt();   while(t-->0){       solve();      }   pw.println(sb);  }  public static long pow(long n, long p,long mod) {   if(p==0)    return 1;   if(p==1)    return n%mod;   if(p%2==0){    long temp=pow(n, p/2,mod);   return (temp*temp)%mod;   }else{     long temp=pow(n,p/2,mod);     temp=(temp*temp)%mod;     return(temp*n)%mod;        }  }  public static long pow(long n, long p) {   if(p==0)    return 1;   if(p==1)    return n;   if(p%2==0){    long temp=pow(n, p/2);   return (temp*temp);   }else{     long temp=pow(n,p/2);     temp=(temp*temp);     return(temp*n);        }  }  public static void Merge(long a[],int p,int r){   if(p<r){    int q = (p+r)/2;    Merge(a,p,q);    Merge(a,q+1,r);    Merge_Array(a,p,q,r);   }  }  public static void Merge_Array(long a[],int p,int q,int r){   long b[] = new long[q-p+1];   long c[] = new long[r-q];   for(int i=0;i<b.length;i++)    b[i] = a[p+i];   for(int i=0;i<c.length;i++)    c[i] = a[q+i+1];   int i = 0,j = 0;   for(int k=p;k<=r;k++){    if(i==b.length){     a[k] = c[j];     j++;    }    else if(j==c.length){     a[k] = b[i];     i++;    }    else if(b[i]<c[j]){     a[k] = b[i];     i++;    }    else{     a[k] = c[j];     j++;    }   }  }    public static long gcd(long x, long y) {   if (x == 0)    return y;   else    return gcd( y % x,x);  }    public static boolean isPrime(int n) {   if (n <= 1)    return false;   if (n <= 3)    return true;    if (n % 2 == 0 || n % 3 == 0)    return false;    for (int i = 5; i * i <= n; i = i + 6)    if (n % i == 0 || n % (i + 2) == 0)     return false;    return true;  }    static LinkedList<Integer> adj[];   static boolean Visited[];   static HashSet<Integer> exc;   static long oddsum[]=new long[1000001];   static long co=0,ans=0;   static int parent[];   static int size[],color[],res[],k;   static ArrayList<Integer> al[];   static long MOD = (long)1e9 + 7;   private static void buildgraph(int n){    adj=new LinkedList[n+1];    Visited=new boolean[n+1];    levl=new int[n+1];       for(int i=0;i<=n;i++){     adj[i]=new LinkedList<Integer>();       }    }       static int[] levl;   static int[] eat;     static int price[];    static boolean check(char c)  {  if(c!='a' && c!='e' && c!='i' && c!='o' && c!='u' )   return true;  else   return false;  }   public static void solve(){         int n= nextInt();  int a[]=new int[n];  a=nextIntArray(n);     int invcount=0;  for(int i=0;i<n;i++)  {  for(int j=i+1;j<n;j++)  {   if(a[i]>a[j])   invcount++;  }  }     int m=nextInt();   int initial = invcount%2;  while(m--!=0)  {  int l=nextInt();  int r=nextInt();      int diff = r-l+1;  int totalpair = (diff*(diff-1))/2;    if(((totalpair%2)+initial)%2==1)  {   pw.println("odd");   initial=1;  }  else  {   pw.println("even");   initial=0;  }    }     }     static void seive2(int n)   {   primer=new boolean[n+1];   Arrays.fill(primer,true);   primer[0]=false;   primer[1]=false;   primer[2]=true;      for(int i=2;i*i<=n;i++)   {    if(primer[i])    {    for(int j=2*i;j<=n;j=j+i)    {     primer[j]=false;    }    }   }   }            static int BITsum(int x)    {   int sum=0;   while(x>0)   {    sum+=BIT[x];    x-= (x & -x);   }    return sum;    }    static boolean union(int x,int y)   {   int xr=find(x);   int yr=find(y);   if(xr==yr)    return false;   if(size[xr]<size[yr])   {    size[yr]+=size[xr];    parent[xr]=yr;   }   else   {    size[xr]+=size[yr];    parent[yr]=xr;       }   return true;      }   static int find(int x)   {   if(parent[x]==x)    return x;   else   {    parent[x]=find(parent[x]);    return parent[x];   }      }   public static class Edge implements Comparable<Edge>   {   int u, v,s;  public Edge(int u, int v)   {   this.u = u;   this.v = v;     }  public int hashCode()   {   return Objects.hash();  }  public int compareTo(Edge other)   {  return (Integer.compare(u, other.u) != 0 ? (Integer.compare(u, other.u)):(Integer.compare(v, other.v)));       }  public String toString()  {   return this.u + " " + this.v;  }   }     static int col[];  public static boolean isVowel(char c){   if(c=='a' || c=='e'||c=='i' || c=='o' || c=='u')    return true;   return false;  } static int no_vert=0;  private static void dfs(int start){  Visited[start]=true;  if(al[color[start]].size()>=k)  {  res[start]=al[color[start]].get(al[color[start]].size()-k);  }  al[color[start]].add(start);  for(int i:adj[start]){   if(!Visited[i])    {    dfs(i);    }  }  (al[color[start]]).remove(al[color[start]].size()-1);   }   public static String reverseString(String s) {   StringBuilder sb = new StringBuilder(s);   sb.reverse();   return (sb.toString());  }           static int indeg[];          static HashSet<Integer> hs;                 static boolean prime[];      static int spf[];      public static void sieve(int n){       prime=new boolean[n+1];       spf=new int[n+1];             Arrays.fill(spf, 1);       Arrays.fill(prime, true);      prime[1]=false;       spf[2]=2;            for(int i=4;i<=n;i+=2){       spf[i]=2;      }      for(int i=3;i<=n;i+=2){       if(prime[i]){        spf[i]=i;        for(int j=2*i;j<=n;j+=i){                 prime[j]=false;        if(spf[j]==1){         spf[j]=i;        }        }       }      }                  }                   public static void sort(long a[]){       Merge(a, 0, a.length-1);      }      public static void InputReader(InputStream stream1) {       stream = stream1;      }       private static boolean isWhitespace(int c) {       return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;      }       private static boolean isEndOfLine(int c) {       return c == '\n' || c == '\r' || c == -1;      }       private static 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++];      }       private static 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 static 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;      }       private static String nextToken() {       int c = read();       while (isSpaceChar(c))        c = read();       StringBuilder res = new StringBuilder();       do {        res.appendCodePoint(c);        c = read();       } while (!isSpaceChar(c));       return res.toString();      }       private static String nextLine() {       int c = read();       while (isSpaceChar(c))        c = read();       StringBuilder res = new StringBuilder();       do {        res.appendCodePoint(c);        c = read();       } while (!isEndOfLine(c));       return res.toString();      }       private static int[] nextIntArray(int n) {       int[] arr = new int[n];       for (int i = 0; i < n; i++) {        arr[i] = nextInt();       }       return arr;      }       private static long[][] next2dArray(int n, int m) {       long[][] arr = new long[n][m];       for (int i = 0; i < n; i++) {        for (int j = 0; j < m; j++) {         arr[i][j] = nextLong();        }       }       return arr;      }      private static char[][] nextCharArray(int n,int m){       char [][]c=new char[n][m];       for(int i=0;i<n;i++){        String s=nextLine();        for(int j=0;j<s.length();j++){         c[i][j]=s.charAt(j);        }       }       return c;      }       private static long[] nextLongArray(int n) {       long[] arr = new long[n];       for (int i = 0; i < n; i++) {        arr[i] = nextLong();       }       return arr;      }       private static void pArray(int[] arr) {       for (int i = 0; i < arr.length; i++) {        pw.print(arr[i] + " ");       }       pw.println();       return;      }       private static void pArray(long[] arr) {       for (int i = 0; i < arr.length; i++) {        pw.print(arr[i] + " ");       }       pw.println();       return;      }       private static void pArray(boolean[] arr) {       for (int i = 0; i < arr.length; i++) {        pw.print(arr[i] + " ");       }       pw.println();       return;      }       private static boolean isSpaceChar(int c) {       if (filter != null)        return filter.isSpaceChar(c);       return isWhitespace(c);      }       private interface SpaceCharFilter {       public boolean isSpaceChar(int ch);      }       }
0	public class Hexadecimaltheorem { public static void main(String[] args) {  BufferedReader buf = new BufferedReader(   new InputStreamReader(System.in));  int x;  ArrayList<Integer> arr = new ArrayList<Integer>();  arr.add(0);  arr.add(1);  try {  while ((x = Integer.parseInt(buf.readLine())) != -1) {   if (x == 1) {    System.out.println(arr.get(0) + " " + arr.get(0) + " "    + arr.get(1));   } else if (x == 0) {   System.out.println(arr.get(0) + " " + arr.get(0) + " "    + arr.get(0));   } else {   int i = 1;   while (x > arr.get(arr.size() - 1)) {    arr.add(arr.get(i) + arr.get(i - 1));    i++;   }   System.out.println(arr.get(0) + " " + arr.get(i - 2) + " "    + arr.get(i - 1));   }  }  } catch (NumberFormatException e) {    e.printStackTrace();  } catch (IOException e) {    e.printStackTrace();  } } }
0	public class cf343a { static FastIO in = new FastIO(), out = in;  public static void main(String[] args) {  out.println(go(in.nextLong(),in.nextLong()));  out.close(); } static long go(long a, long b) {  return b==0?0:(go(b,a%b) + a/b); }  static class FastIO extends PrintWriter {  BufferedReader br;  StringTokenizer st;  public FastIO() {  this(System.in, System.out);  }  public FastIO(InputStream in, OutputStream out) {  super(new BufferedWriter(new OutputStreamWriter(out)));  br = new BufferedReader(new InputStreamReader(in));  scanLine();  }  public void scanLine() {  try {   st = new StringTokenizer(br.readLine().trim());  } catch (Exception e) {   throw new RuntimeException(e.getMessage());  }  }  public int numTokens() {  if (!st.hasMoreTokens()) {   scanLine();   return numTokens();  }  return st.countTokens();  }  public String next() {  if (!st.hasMoreTokens()) {   scanLine();   return next();  }  return st.nextToken();  }  public double nextDouble() {  return Double.parseDouble(next());  }  public long nextLong() {  return Long.parseLong(next());  }  public int nextInt() {  return Integer.parseInt(next());  } } }
4	public class C{  public static void main(String args[])  {   Scanner sc=new Scanner(System.in);   long mod=1000000007l;   int cases=sc.nextInt();    while(cases>0)   {    cases--;    Stack<Integer> stack=new Stack<>();    int n=sc.nextInt();    for(int j=0;j<n;j++)    {     int x=sc.nextInt();     if(x==1)     {      stack.add(1);     }     else     {      int p=stack.pop();      if(p==x-1)      {       stack.add(x);      }      else {       while (p != x-1) {        p = stack.pop();       }       stack.add(x);      }     }     StringBuilder f=new StringBuilder();     Stack<Integer> temp=new Stack<>();     while(stack.isEmpty()==false)     {      temp.add(stack.pop());     }     while(temp.isEmpty()==false)     {      int z=temp.pop();      f.append(z+".");      stack.add(z);     }      System.out.println(f.substring(0,f.length()-1));    }   }  } }
4	public class Main {  static int MOD = 1000000007;              void solve() throws IOException {   int T = ri();   for (int Ti = 0; Ti < T; Ti++) {    int n = ri();    int[] a = new int[n];    for (int i = 0; i < n; i++) a[i] = ri();    Deque<int[]> stack = new ArrayDeque<>();    stack.addLast(new int[]{1});    pw.println("1");    for (int i = 1; i < n; i++) {     if (a[i] == 1) {      int[] prev = stack.peekLast();      int[] curr = new int[prev.length+1];      System.arraycopy(prev, 0, curr, 0, prev.length);      curr[curr.length-1] = 1;      printArr(curr);      stack.addLast(curr);      continue;     }     while (!stack.isEmpty()) {      int[] prev = stack.removeLast();      if (a[i] == prev[prev.length-1] + 1) {       prev[prev.length-1]++;       printArr(prev);       stack.addLast(prev);       break;      } else {       continue;      }     }    }   }  }     void printArr(int[] a) {   pw.print(a[0]);   for (int j = 1; j < a.length; j++) pw.print("." + a[j]);   pw.println();  }    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter pw = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {   Main m = new Main();   m.solve();   m.close();  }  void close() throws IOException {   pw.flush();   pw.close();   br.close();  }  int ri() throws IOException {   return Integer.parseInt(br.readLine().trim());  }  long rl() throws IOException {   return Long.parseLong(br.readLine().trim());  }  int[] ril(int n) throws IOException {   int[] nums = new int[n];   int c = 0;   for (int i = 0; i < n; i++) {    int sign = 1;    c = br.read();    int x = 0;    if (c == '-') {     sign = -1;     c = br.read();    }    while (c >= '0' && c <= '9') {     x = x * 10 + c - '0';     c = br.read();    }    nums[i] = x * sign;   }   while (c != '\n' && c != -1) c = br.read();   return nums;  }  long[] rll(int n) throws IOException {   long[] nums = new long[n];   int c = 0;   for (int i = 0; i < n; i++) {    int sign = 1;    c = br.read();    long x = 0;    if (c == '-') {     sign = -1;     c = br.read();    }    while (c >= '0' && c <= '9') {     x = x * 10 + c - '0';     c = br.read();    }    nums[i] = x * sign;   }   while (c != '\n' && c != -1) c = br.read();   return nums;  }  int[] rkil() throws IOException {   int sign = 1;   int c = br.read();   int x = 0;   if (c == '-') {    sign = -1;    c = br.read();   }   while (c >= '0' && c <= '9') {    x = x * 10 + c - '0';    c = br.read();   }   return ril(x);  }  long[] rkll() throws IOException {   int sign = 1;   int c = br.read();   int x = 0;   if (c == '-') {    sign = -1;    c = br.read();   }   while (c >= '0' && c <= '9') {    x = x * 10 + c - '0';    c = br.read();   }   return rll(x);  }  char[] rs() throws IOException {   return br.readLine().toCharArray();  }  void sort(int[] A) {   Random r = new Random();   for (int i = A.length-1; i > 0; i--) {    int j = r.nextInt(i+1);    int temp = A[i];    A[i] = A[j];    A[j] = temp;   }   Arrays.sort(A);  }  void printDouble(double d) {   pw.printf("%.16f", d);  } }
3	public class CF1003E{  public static void main(String args[]) throws IOException{   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   String[] s = br.readLine().split(" ");   int n = Integer.parseInt(s[0]);   int d = Integer.parseInt(s[1]);   int k = Integer.parseInt(s[2]);   StringBuffer sb = new StringBuffer();   int[] rem = new int[n];   int[] deg = new int[n];   int i = 0;   if(k == 1){    if(n <= 2){    }else{     System.out.println("NO");     return;    }   }   for(i=0;i<d;i++){    if(i>=n-1){     System.out.println("NO");     return;    }    sb.append((i+1) +" " + (i+2)+"\n");    rem[i] = Math.min(i, d-i);    deg[i]++;    if(i+1<n)    deg[i+1]++;   }   if(i<n){    rem[i] = 0;    deg[i] = 1;   }   i++;   int j = 0;   for(;i<n;i++){       while(true){     if(j>=n){      System.out.println("NO");      return;     }     if(rem[j] > 0 && deg[j]<k){      deg[j]++;      rem[i] = rem[j] - 1;      sb.append((j+1)+" "+(i+1)+"\n");      deg[i]++;      break;     }else{      j++;     }    }   }   System.out.println("YES");   System.out.println(sb);  } }
4	public class practice { static class Reader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;    public Reader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public Reader(String file_name) throws IOException   {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public String readLine() throws IOException   {    byte[] buf = new byte[64];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }    public int nextInt() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do    {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');     if (neg)     return -ret;    return ret;   }    public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }    public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();     do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');     if (c == '.')    {     while ((c = read()) >= '0' && c <= '9')     {      ret += (c - '0') / (div *= 10);     }    }     if (neg)     return -ret;    return ret;   }    private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }    private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }    public void close() throws IOException   {    if (din == null)     return;    din.close();   }  }   public static void main(String[] args) throws IOException {    Reader scn=new Reader("input.txt");  PrintWriter out = new PrintWriter(new File("output.txt"));  int n=scn.nextInt(),m=scn.nextInt(),k=scn.nextInt();  int[][] inf=new int[k][2];  for(int i=0;i<k;i++){   inf[i][0]=scn.nextInt();inf[i][1]=scn.nextInt();  }  int ans=0,x=1,y=1;  for(int i=1;i<=n;i++){   for(int j=1;j<=m;j++){   int temp=Integer.MAX_VALUE;   for(int l=0;l<k;l++){   temp=Math.min(temp, Math.abs(i-inf[l][0])+Math.abs(j-inf[l][1]));    }   if(temp>ans){    ans=temp;x=i;y=j;   }   }  }  out.print(x + " " + y);   out.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());   }     public long nextLong() {    return Long.parseLong(nextToken());   }     public double nextDouble() {    return Double.parseDouble(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);   TaskE solver = new TaskE();   solver.solve(1, in, out);   out.close();  }  static class TaskE {   int n;   double k;   boolean[][] g;   public void solve(int testNumber, InputReader in, OutputWriter out) {    n = in.readInt();    k = in.readInt();    g = new boolean[n][n];    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      g[i][j] = in.readInt() == 1;     }    }    double answer = solve();    out.printFormat("%.20f", answer);   }   private double solve() {    int firstPartSize = g.length / 2;    int secondPartSize = g.length - firstPartSize;    int[] firstPart = findMaxCliqueSize(firstPartSize);    int m1Full = (1 << firstPartSize) - 1;    int maxCliqueSize = 1;    for (int m = 0; m < 1 << secondPartSize; m++) {     if (isClique(secondPartSize, m, firstPartSize)) {      int m1 = m1Full;      for (int j = 0; j < secondPartSize; j++) {       if (bit(m, j)) {        for (int i = 0; i < firstPartSize; i++) {         if (bit(m1, i) && !g[i][j + firstPartSize]) {          m1 ^= 1 << i;         }        }       }      }      int firstCliqueSize = firstPart[m1];      int secondCliqueSize = Integer.bitCount(m);      int curCliqueSize = firstCliqueSize + secondCliqueSize;      if (curCliqueSize > maxCliqueSize) {       maxCliqueSize = curCliqueSize;      }     }    }    return k * k * (maxCliqueSize - 1) / (2 * maxCliqueSize);   }   private int[] findMaxCliqueSize(int size) {    int[] dp = new int[1 << size];    for (int m = 1; m < 1 << size; m++) {     if (isClique(size, m, 0)) {      dp[m] = Integer.bitCount(m);     }    }    for (int m = 1; m < 1 << size; m++) {     for (int i = 0; i < size; i++) {      if ((m >> i & 1) == 0) {       dp[m | (1 << i)] = Math.max(dp[m | (1 << i)], dp[m]);      }     }    }    return dp;   }   private boolean isClique(int size, int m, int offset) {    for (int i = 0; i < size; i++) {     if (bit(m, i)) {      for (int j = i + 1; j < size; j++) {       if (bit(m, j) && !g[i + offset][j + offset]) {        return false;       }      }     }    }    return true;   }   private boolean bit(int m, int b) {    return (m >> b & 1) != 0;   }  }  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);   }  }  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 printFormat(String format, Object... objects) {    writer.printf(format, objects);   }   public void close() {    writer.close();   }  } }
0	public class kresz { public static double a; public static double v; public static double l; public static double d; public static double w;   public static double gyorsulut (double v1, double v2) {  return Math.abs((v2*v2-v1*v1)/(2*a)); } public static double gyorsulido (double v1, double v2) {  return Math.abs((v2-v1)/a); }   public static void beolvas () throws IOException {  Scanner be = new Scanner (new InputStreamReader (System.in));  a = be.nextDouble();  v = be.nextDouble();  l = be.nextDouble();  d = be.nextDouble();  w = be.nextDouble();  be.close(); }   public static void main (String args[]) throws IOException {  beolvas();  double s = l;   double t = 0;     if (v <= w || Math.sqrt(2*a*d) <= w) {   if (gyorsulut(0,v) > l) {   t+=gyorsulido(0, Math.sqrt(2*a*l));   s = 0;   }   else {   s-=gyorsulut(0,v);   t+=gyorsulido(0,v);   }  }  else {        if (d < gyorsulut(0,v)+gyorsulut(v,w)) {   double x = Math.sqrt(a*(d-w*w/(2*a))+w*w);   s-=gyorsulut(0,w)+2*gyorsulut(w,x);   t+=gyorsulido(0,w)+2*gyorsulido(w,x);   }   else {   s-=gyorsulut(0,v)+gyorsulut(w,v);   t+=gyorsulido(0,v)+gyorsulido(w,v);   }        if (gyorsulut(v,w) > l-d) {   double y = Math.sqrt(2*a*(l-d)+w*w);   s-= gyorsulut(w,y);   t+=gyorsulido(w,y);   }   else {   s-=gyorsulut(w,v);   t+=gyorsulido(w,v);   }  }    t+=s/v;     System.out.println(t);   }  }
2	public class A{ static long mod = 1000000000+7; static int arr[]; static HashMap<Long,Long> map = new HashMap<>(); public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  long x = scan.nextLong();  long k = scan.nextLong();  if(x == 0)  {  System.out.println(0);  return;  }  x = x%mod;  long power = pow(2,k + 1)%mod;  power = (power*x)%mod;  long num = (pow(2,k) - 1 + mod)%mod;  long ans = (power - num + mod)%mod;  System.out.println((ans)); } public static long pow(long a,long b) {  if(b == 0)  return 1;  if(b == 1)  return a;  long x1,x2;  if(map.containsKey(b - b/2))  x1 = map.get(b - b/2);  else  {  x1 = pow(a,b - b/2)%mod;  map.put(b - b/2,x1);  }  if(map.containsKey(b/2))  x2 = map.get(b/2);  else  {  x2 = pow(a,b/2)%mod;  map.put(b/2,x2);  }  return (x1*x2)%mod; } }
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); } }
3	public class TaskA {  public static void main(String[] args) {   FastReader in = new FastReader(System.in);   PrintWriter out = new PrintWriter(System.out);    int n = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }   Arrays.sort(a);   int ans = 1;   for (int i = 1; i < n; i++) {    boolean bb = false;    for (int j = i - 1; j >= 0; j--) {     if (a[i] % a[j] == 0) {      bb = true;      break;     }    }    if (!bb) ans++;   }   out.println(ans);     out.close();  }  static class FastReader {   BufferedReader br;   StringTokenizer st;   FastReader(InputStream is) {    br = new BufferedReader(new InputStreamReader(is));   }   Integer nextInt() {    return Integer.parseInt(next());   }   Long nextLong() {    return Long.parseLong(next());   }   Double nextDouble() {    return Double.parseDouble(next());   }   String next() {    while (st == null || !st.hasMoreTokens()) {     st = new StringTokenizer(nextLine());    }    return st.nextToken();   }   String nextLine() {    String s = "";    try {     s = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return s;   }  } }
2	public class Main {  class IOManager {   BufferedReader reader;   PrintWriter writer;   StringTokenizer tokenizer;   IOManager() {    reader = new BufferedReader(new InputStreamReader(System.in));    writer = new PrintWriter(new BufferedOutputStream(System.out));   }   IOManager(String file) throws FileNotFoundException {    reader = new BufferedReader(new FileReader(file));    writer = new PrintWriter(new BufferedOutputStream(System.out));   }   String next() throws IOException {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     String line = reader.readLine();     if (line == null)      throw new IOException("No lines left.");     tokenizer = new StringTokenizer(line);    }    return tokenizer.nextToken();   }   public Integer nextInt() throws IOException {    return Integer.parseInt(next());   }   public Long nextLong() throws IOException {    return Long.parseLong(next());   }   public Double nextDouble() throws IOException {    return Double.parseDouble(next());   }   public void writeSpace(Object obj) {    writer.print(obj.toString() + " ");   }   public void writeLine(Object obj) {    writer.println(obj.toString());   }   public void writeDouble(Double x, int n) {    String format = "%." + n + "f";    writer.printf(format, x);   }   public void write(Object obj) {    writer.print(obj.toString());   }   public void close() {    writer.close();   }  }  class Pair implements Comparable {   public long u, v;   public Pair(long u, long v) {    this.u = u;    this.v = v;   }   @Override   public int compareTo(Object o) {    Pair that = (Pair) o;    if (Long.compare(u, that.u) != 0)     return Long.compare(u, that.u);    return Long.compare(v, that.v);   }  }  class Graph {   public int n, m;   public List<Integer>[] adj;   public Graph(int n, int m) {    this.n = n;    this.m = m;    adj = new List[n + 1];    for (int i = 0; i <= n; ++i) {     adj[i] = new ArrayList<>();    }   }   public void add(int u, int v) {    adj[u].add(v);   }   public void add2Ways(int u, int v) {    add(u, v);    add(v, u);   }   public void dfs(int i, boolean fr[]) {    fr[i] = false;    for (int j: adj[i]) {     if (fr[j]) {      dfs(j, fr);     }    }   }   public boolean isConnected() {    boolean fr[] = new boolean[n + 1];    Arrays.fill(fr, true);    dfs(1, fr);    for (int i = 2; i <= n; ++i) {     if (fr[i])      return false;    }    return true;   }   public boolean hasEuclideanPath() {    if (!isConnected())     return false;    int cnt = 0;    for (int i = 1; i <= n; ++i) {     if (adj[i].size() % 2 == 1)      cnt++;    }    return cnt <= 2;   }   public boolean dfsHamiltonian(int i, boolean[] fr, int reached) {    fr[i] = false;    reached++;    if (reached == n)     return true;    for (int j: adj[i]) {     if (fr[j]) {      if (dfsHamiltonian(j, fr, reached))       return true;     }    }    fr[i] = true;    return false;   }   public boolean hasHamiltonianPathFrom(int st) {    boolean fr[] = new boolean[n + 1];    Arrays.fill(fr, true);    return dfsHamiltonian(st, fr, 0);   }  }    class Tree extends Graph {   public Tree(int n, int m) {    super(n, m);   }   public int getHeight(int i) {    int res = 0;    for (Integer j: adj[i]) {     res = Math.max(res, getHeight(j) + 1);    }    return res;   }  }  class FenwickTree {   int n;   int tree[];   public FenwickTree() {   }   public FenwickTree(int maxn) {    n = maxn;    tree = new int[maxn + 10];   }   public void add(int i, int x) {    while (i <= n) {     tree[i] += x;     i += i & (-i);    }   }   public void add(int i) {    add(i, 1);   }   public int get(int i) {    int res = 0;    while (i > 0) {     res += tree[i];     i -= i & (-i);    }    return res;   }  }  IOManager ioManager;  Main() {   ioManager = new IOManager();  }  Main(String file) throws FileNotFoundException {   ioManager = new IOManager(file);  }  long n, s;  int m, a[], sum[];  long pow[];  long f[][];  void doi(long n) {   m = 0;   while (n > 0) {    a[m++] = (int) (n % 10L);    n /= 10L;   }  }  int getsum(long n) {   int res = 0;   while (n > 0) {    res += (int) (n % 10L);    n /= 10L;   }   return res;  }  void solve() throws IOException {   n = ioManager.nextLong();   s = ioManager.nextLong();   a = new int[100];   pow = new long[100];   pow[0] = 1;   for (int i = 1; i < 100; ++i) {    pow[i] = pow[i - 1] * 10L;   }   doi(n);   sum = new int[m + 1];   sum[m] = 0;   for (int i = m - 1; i >= 0; --i)    sum[i] = sum[i + 1] + a[i];    long first = -1;   for (long i = s + 1; i <= n; ++i) {    if (i - getsum(i) >= s) {     first = i;     break;    }   }   if (first == -1) {    ioManager.writeLine(0);    return;   }   ioManager.writeLine(n - first + 1);  }  void close() {   ioManager.close();  }  public static void main(String args[]) throws IOException {   Main solver;   if (!"true".equals(System.getProperty("ONLINE_JUDGE"))) {    solver = new Main("input.txt");   } else {    solver = new Main();   }   solver.solve();   solver.close();  } }
3	public class TaskA { public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringBuilder sb = new StringBuilder();  int n = Integer.parseInt(br.readLine());  String[] s = br.readLine().split(" ");  int[] arr = new int[n];  for (int i=0; i<n; i++) {  arr[i] = Integer.parseInt(s[i]);  }  Arrays.sort(arr);  boolean[] vis = new boolean[n];  int nColours = 0;  int nVis = 0;  int index = 0;  while (nVis<n) {  while (index<n && nVis<n) {   if (vis[index]) {   index++;   continue;   }   int val = arr[index];   nColours++;   while (index<n && nVis<n) {   if (vis[index]) {    index++;    continue;   }   if (arr[index]%val==0) {    vis[index] = true;    nVis++;   }   index++;   }   index = 0;  }  }  System.out.println(nColours);  } }
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 double nextDouble() throws Exception {  return Double.parseDouble(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);  } } }
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 long nextLong()  {  int c = snext();  while (isSpaceChar(c))   {   c = snext();  }  int sgn = 1;  if (c == '-')   {   sgn = -1;   c = snext();  }  long res = 0;  do   {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = snext();  } while (!isSpaceChar(c));  return res * sgn;  }   public int[] nextIntArray(int n)  {  int a[] = new int[n];  for (int i = 0; i < n; i++)   {   a[i] = nextInt();  }  return a;  }   public String readString()  {  int c = snext();  while (isSpaceChar(c))   {   c = snext();  }  StringBuilder res = new StringBuilder();  do   {   res.appendCodePoint(c);   c = snext();  } while (!isSpaceChar(c));  return res.toString();  }   public String nextLine()  {  int c = snext();  while (isSpaceChar(c))   c = snext();  StringBuilder res = new StringBuilder();  do   {   res.appendCodePoint(c);   c = snext();  } while (!isEndOfLine(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;  }   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[] suffle(int[] a,Random gen) {  int n = a.length;  for(int i=0;i<n;i++)  {  int ind = gen.nextInt(n-i)+i;  int temp = a[ind];  a[ind] = a[i];  a[i] = temp;  }  return a; }  public static void swap(int a, int b){  int temp = a;  a = b;  b = temp; }  public static HashSet<Integer> primeFactorization(int n) {  HashSet<Integer> a =new HashSet<Integer>();  for(int i=2;i*i<=n;i++)  {  while(n%i==0)  {   a.add(i);   n/=i;  }  }  if(n!=1)  a.add(n);  return a; }  public static void sieve(boolean[] isPrime,int n) {  for(int i=1;i<n;i++)  isPrime[i] = true;   isPrime[0] = false;  isPrime[1] = false;   for(int i=2;i*i<n;i++)  {  if(isPrime[i] == true)  {   for(int j=(2*i);j<n;j+=i)   isPrime[j] = false;  }  } }  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 long LCM(long a,long b) {  return (a*b)/GCD(a,b); }  public static int LCM(int a,int b) {  return (a*b)/GCD(a,b); }  public static int binaryExponentiation(int x,int n) {  int result=1;  while(n>0)  {   if(n % 2 ==1)    result=result * x;   x=x*x;   n=n/2;  }  return result; }  public static long binaryExponentiation(long x,long n) {  long result=1;  while(n>0)  {   if(n % 2 ==1)    result=result * x;   x=x*x;   n=n/2;  }  return result; }  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; }  public static int modInverse(int A,int M) {  return modularExponentiation(A,M-2,M); }  public static long modInverse(long A,long M) {  return modularExponentiation(A,M-2,M); }  public static boolean isPrime(int n) {    if (n <= 1) return false;  if (n <= 3) return true;    if (n%2 == 0 || n%3 == 0)   return false;    for (int i=5; i*i<=n; i=i+6)  {   if (n%i == 0 || n%(i+2) == 0)    return false;  }    return true; }  static class pair implements Comparable<pair> {  Integer x, y;  pair(int x,int y)  {  this.x=x;  this.y=y;  }   public int compareTo(pair o) {  int result = x.compareTo(o.x);  if(result==0)   result = y.compareTo(o.y);    return result;  }    public String toString()  {  return x+" "+y;  }   public boolean equals(Object o)  {  if (o instanceof pair)   {   pair p = (pair)o;   return p.x == x && p.y == y ;  }  return false;  }   public int hashCode()  {  return new Long(x).hashCode()*31 + new Long(y).hashCode();  } } }
0	public class Codechef{ static int max=Integer.MIN_VALUE; static int res=0; static int[] checkMax(int arr[],int j){    int sum=0;    int x=arr[j];    while(x!=0){      if(j+1==15){      j=0;      }else{      arr[j+1]=arr[j+1]+1;      }                                             x--;      j++;    }     return arr;  }    public static void main(String []args){   Scanner sc = new Scanner (System.in);  long a [] = new long [14];  long b [] = new long [14];  long p,q,r,s,max = 0;  for(int i = 0; i < 14; i++) a[i] = sc.nextInt();  for(int i = 0; i < 14; i++){  p = a[i]%14;  q = a[i]/14;  r = 0;  s = 0;  for(int j = 0; j < 14; j++) b[j] = a[j];  b[i] = 0;  int j = (i+1)%14;  for(; r < p; r++) {   b[j]++;   j=(j+1)%14;  }  for( j = 0; j < 14; j++) {   b[j] += q;   if(b[j] % 2 == 0) s+= b[j];  }  max = Math.max(max,s);  }  System.out.println(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);  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 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 int compareTo(Col col) {    return -sorted[sorted.length-1] + col.sorted[sorted.length-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());   }     double nextDouble() {    return Double.parseDouble(next());   }     String readNextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
5	public class A {  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[] A = new int[n];   for (int i = 0; i < n; i++)    A[i] = in.nextInt();   Arrays.sort(A);   int cnt = 0;   for (int i = n - 1; i >= 0; i--) {    if (k >= m) {     System.out.println(cnt);     return;    }    cnt++;    k += A[i] - 1;   }   if (k >= m)    System.out.println(cnt);   else    System.out.println(-1);  } }
1	public class ProblemB3 {  Map<Integer, List<int[]>> dest;  private ProblemB3() throws IOException {   BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));   String h = rd.readLine();   String[] q = h.split("\\s+");   int a = Integer.parseInt(q[1]);   int b = Integer.parseInt(q[2]);   h = rd.readLine();   q = h.split(" ");   int n = q.length;   int[] p = new int[n];   for(int i=0;i<n;i++) {    p[i] = Integer.parseInt(q[i]);   }   Set<Integer> pset = new HashSet<>();   for(int x: p) {    pset.add(x);   }   dest = new HashMap<>();   boolean res = true;   for(int x: p) {    boolean aOk = pset.contains(a-x);    boolean bOk = pset.contains(b-x);    if(!aOk && !bOk) {     res = false;     break;    } else {     if(aOk) {      addEdgeAndBack(x,a-x,0);     }     if(bOk) {      addEdgeAndBack(x,b-x,1);     }    }   }   Set<Integer> aSet = new HashSet<>();   if(res && a != b) {    for(int x: p) {     List<int[]> e = getEdges(x);     if(e.size() == 1) {      int[] edge = e.get(0);      boolean odd = true;      int curA = edge[1];      int prev = x;      while(true) {       int cur = edge[0];       if(curA == 0 && odd) {        aSet.add(prev);        aSet.add(cur);       }       e = getEdges(cur);       if(e.size() == 1) {        if(!odd && e.get(0)[0] != cur) {         res = false;        }        break;       }       int other = e.get(0)[0] == prev?1:0;       edge = e.get(other);       if(edge[1] == curA) {        res = false;        break;       }       curA = 1-curA;       prev = cur;       odd = !odd;      }      if(!res) {       break;      }     }    }   }   out(res?"YES":"NO");   if(res) {    StringBuilder buf = new StringBuilder();    for(int i=0;i<n;i++) {     if(i>0) {      buf.append(' ');     }     buf.append(aSet.contains(p[i])?'0':'1');    }    out(buf);   }  }  private void addEdgeAndBack(int from, int to, int u) {   addEdge(from, to, u);   addEdge(to, from, u);  }  private void addEdge(int from, int to, int u) {   List<int[]> edges = getEdges(from);   for(int[] edge: edges) {    if(edge[0] == to) {     return;    }   }   edges.add(new int[]{to, u});  }  private List<int[]> getEdges(int from) {   List<int[]> ds = dest.get(from);   if(ds == null) {    ds = new ArrayList<>();    dest.put(from, ds);   }   return ds;  }  private static void out(Object x) {   System.out.println(x);  }  public static void main(String[] args) throws IOException {   new ProblemB3();  } }
5	public class A {  int n;  int[] a;  public void run() throws IOException{   Scanner s = new Scanner(new InputStreamReader(System.in));     n = s.nextInt();   a = new int[n];   long sum = 0;   for (int i = 0; i < n; i++) {    a[i] = s.nextInt();    sum+=a[i];   }     Arrays.sort(a);     long mysum = 0;   int count = 0;   for (int i = n-1; i > -1; i--) {    if (mysum > sum)     break;       count++;    mysum+=a[i];    sum-=a[i];   }        System.out.println(count);    }   public static void main(String[] args) throws IOException {   (new A()).run();  } }
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();   }   String nextLine() {    st = null;    try {     return br.readLine();    } catch (IOException e) {         e.printStackTrace();    }    return null;   }   int nextInt() {    return Integer.parseInt(nextToken());   }   long nextLong() {    return Long.parseLong(nextToken());   }   double nextDouble() {    return Double.parseDouble(nextToken());   }  } }
5	public class D { public static void main(String[] args) {  init();  int n = in.nextInt();  long total = 0L;   int arr[] = new int[n+5];  Map<Integer, Integer> freq = new HashMap<>();  Map<Integer, Integer> kiri = new HashMap<>();  for (int i = 1; i <= n; ++i){  arr[i] = in.nextInt();  if (freq.containsKey(arr[i])) {   freq.put(arr[i], freq.get(arr[i])+1);  } else {   freq.put(arr[i], 1);   kiri.put(arr[i], 0);  }  total += (long)arr[i];  }  BigInteger ans = BigInteger.valueOf(0L);  for (int i = 1; i <= n - 1; ++i) {  kiri.put(arr[i], kiri.get(arr[i])+1);  total -= arr[i];   int cnt_kanan = n - i;  long temp = total;  int cnt_sama = freq.get(arr[i]) - kiri.get(arr[i]);  temp -= (cnt_sama)*(long)arr[i];  cnt_kanan -= (cnt_sama);  if (freq.containsKey(arr[i]-1)) {   int cnt_kurang = freq.get(arr[i]-1) - kiri.get(arr[i]-1);   cnt_kanan -= cnt_kurang;   temp -= (long) cnt_kurang * (long)(arr[i]-1);  }  if (freq.containsKey(arr[i]+1)) {   int cnt_lebih = freq.get(arr[i]+1) - kiri.get(arr[i]+1);   cnt_kanan -= cnt_lebih;   temp -= (long)(cnt_lebih) * (long)(arr[i]+1);  }  temp -= (long)cnt_kanan * (long)arr[i];  ans = ans.add(BigInteger.valueOf(temp));  }  out.println(ans.toString());  out.close(); }   public static MyScanner in; public static PrintWriter out;  public static void init() {  in = new MyScanner();  out = new PrintWriter(new BufferedOutputStream(System.out)); }  public static class MyScanner {  BufferedReader br;  StringTokenizer st;  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());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  } } }
3	public class SameSumBlocks {    public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   int t = 1;   for (int i = 0; i < t; i++) {    solve(sc, pw);   }   pw.close();  }  static void solve(Scanner in, PrintWriter out){   int n = in.nextInt();   int[] arr = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = in.nextInt();   }   Map<Long, List<int[]>> mp = new HashMap<>();   long[] pre = new long[n + 1];   for (int i = 1; i <= n; i++) {    pre[i] = pre[i - 1] + arr[i - 1];   }   for (int i = 0; i < n; i++) {    for (int j = i; j < n; j++) {     long sz = pre[j + 1] - pre[i];     if (!mp.containsKey(sz)) mp.put(sz, new ArrayList<>());     mp.get(sz).add(new int[]{i, j});    }   }   int max = 0;   List<int[]> ans = new ArrayList<>();   for(List<int[]> ls : mp.values()){    Collections.sort(ls, (a, b) -> {     if (a[1] == b[1]) return b[0] - a[0];     return a[1] - b[1];    });    List<int[]> tt = new ArrayList<>();    int cnt = 0;    int pr = -1;    for (int i = 0; i < ls.size(); i++) {     int[] get = ls.get(i);     if (get[0] <= pr) continue;     cnt++;     tt.add(get);     pr = get[1];    }    if (max < cnt){     ans = tt;     max = cnt;    }   }   out.println(max);   for(int[] v : ans){    out.println((v[0] + 1) + " " + (v[1] + 1));   }  } }
6	public class LookingForOrder { static final int INF = (int)1e9; static Point a[]; static Point o; static int n; static int dp[]; static PrintWriter out;  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  out = new PrintWriter(System.out);  o = new Point(sc.nextInt(), sc.nextInt());  n = sc.nextInt();  a = new Point[n];  for (int i = 0; i < n; i++)  a[i] = new Point(sc.nextInt(), sc.nextInt());   dp = new int[(1 << n) + 5];  Arrays.fill(dp, -1);  out.println(rec(0));  out.print(0 + " ");  path(0);  out.println();   out.flush();  out.close(); }  static void path(int msk) {  if (msk == (1 << n) - 1) return;   int optimal = rec(msk);  for (int i = 0; i < n; i++) {  if ((msk & (1 << i)) == 0) {   if (rec(msk | (1 << i)) + 2 * o.dist(a[i]) == optimal) {   out.print((i + 1) + " " + 0 + " ");   path(msk | (1 << i));   return;   }     for (int j = 0; j < n; j++)    if (rec(msk | (1 << i) | (1 << j)) + o.dist(a[i]) + a[i].dist(a[j]) + a[j].dist(o) == optimal) {    out.print((i + 1) + " " + (j + 1) + " " + 0 + " ");    path(msk | (1 << i) | (1 << j));    return;   }   break;  }  } }  static int rec(int msk) {  if (msk == (1 << n) - 1) return 0;  if (dp[msk] != -1) return dp[msk];   int ans = INF;  for (int i = 0; i < n; i++) {  if ((msk & (1 << i)) == 0) {   ans = Math.min(ans, rec(msk | (1 << i)) + 2 * o.dist(a[i]));   for (int j = 0; j < n; j++) {   if (i == j) continue;   if ((msk & (1 << j)) == 0)    ans = Math.min(ans, rec(msk | (1 << i) | (1 << j)) + o.dist(a[i]) + a[i].dist(a[j]) + a[j].dist(o));   }   break;  }  }   return dp[msk] = ans; }  static class Point {  int x, y;  public Point(int x, int y) {  this.x = x;  this.y = y;  }  public int dist(Point p) {  return (x - p.x) * (x - p.x) + (y - p.y) * (y - p.y);  } }  static class Scanner {  BufferedReader br;  StringTokenizer st;  public Scanner(FileReader f) {  br = new BufferedReader(f);  }  public Scanner(InputStream in) {  br = new BufferedReader(new InputStreamReader(in));  }  public String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  public String nextLine() throws IOException {  return br.readLine();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public boolean Ready() throws IOException {  return br.ready();  }  public void waitForInput(long time) {  long ct = System.currentTimeMillis();  while(System.currentTimeMillis() - ct < time) {};  }  } }
1	public class Problem01B implements Runnable {  static final long[] x10 = new long[] { 1, 26, 26*26, 26*26*26, 26*26*26*26, 26*26*26*26*26, 26*26*26*26*26*26};  void solve() throws NumberFormatException, IOException {     int n = nextInt();   for (int i = 0; i < n; i++) {    String t = nextToken().toUpperCase();    StringBuffer rowString = new StringBuffer(t.length());    StringBuffer numb1 = new StringBuffer(t.length());    StringBuffer numb2 = new StringBuffer(t.length());    int stage = 0;    for (int j = 0; j < t.length(); j++) {;     char charAt = t.charAt(j);     if (charAt >= 'A') {      if (stage == 0) {       rowString.append(charAt);      } else {       stage++;      }     } else {      if (stage == 0 || stage == 2)       stage++;      switch (stage) {      case 1: numb1.append(charAt); break;      case 3: numb2.append(charAt); break;      }     }    }       if (stage == 1) {     long result = convertString(rowString);     System.out.print("R");     System.out.print(numb1.toString());     System.out.print("C");     System.out.println(result);    } else {     StringBuffer tmp = convertNumber(Long.parseLong(numb2.toString()));     System.out.print(tmp.toString());     System.out.println(numb1.toString());    }   }  }   public StringBuffer convertNumber(long n) {   StringBuffer sb2 = new StringBuffer();   long nmod26 = n % 26;   long ndiv26 = n / 26;   while (ndiv26 > 0 || nmod26 > 0) {    long tmp = 0;    if (nmod26 > 0) {     sb2.append((char) ('A' + nmod26 - 1));     tmp = ndiv26;    } else {     sb2.append('Z');     tmp = ndiv26 - 1;    }    nmod26 = tmp % 26;    ndiv26 = tmp / 26;   }     return sb2.reverse();  }   public long convertString(StringBuffer sb) {   long result = 0;   for (int i = 0; i < sb.length(); i++) {    long l = (sb.charAt(i) - 'A' + 1) * x10[sb.length() - i - 1];    result += l;   }   return result;  }   StringTokenizer st;  BufferedReader in;  PrintWriter out;   public static void main(String[] args) {   new Problem01B().run();  }  public void run() {   try {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();   } catch (Exception e) {    System.exit(9000);   } finally {    out.flush();    out.close();   }  }  String nextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int nextInt() throws NumberFormatException, IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws NumberFormatException, IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextToken());  } }
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(); }     }
5	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   Hashtable<Integer, Integer> hi = new Hashtable<Integer, Integer>();   for (int i = 0; i < n; i++) {    int m = sc.nextInt();    hi.put(m, 1);   }   Set<Integer> set = hi.keySet();   Integer[] key = set.toArray(new Integer[set.size()]);   Arrays.sort(key);   try {    System.out.println(key[1]);   } catch (Exception e) {    System.out.println("NO");   }  } }
2	public class B2 { public static void main (String args[]){  Scanner in = new Scanner(System.in);  long n = in.nextLong();  long k = in.nextLong();  long upn = k;  long tmp=upn;  if(n==1){  System.out.println(0);  return;  }  if(n<=k){  System.out.println(1);  return;  }   if(!bS(n, k, upn)){  System.out.println(-1);  return;  }  boolean flag = false;  while(bS(n, k, upn)){   tmp = upn;   flag = true;   upn=5*upn/6;   if(tmp==upn)   break;  }  long ans = tmp;  if(!flag)   upn=0;  for(int i = (int)tmp;i>=upn;i--){   if(bS(n, k, i)){   ans=i;   }   else   break;  }  System.out.println(ans); }  static boolean bS(long key,long k ,long n)   {  long pipe = (n * (k-n+k+1))/2;  pipe = pipe - n+1;    if(pipe>=key){    return true;    }    else    return false;  } }
5	public class A{  public static void main(String[] args){   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   TreeSet<Integer> v = new TreeSet<Integer>();   for(int i=0;i<n;i++) v.add(sc.nextInt());   Iterator<Integer> it = v.iterator();   it.next();   it.remove();   System.out.println(v.isEmpty() ? "NO" : v.iterator().next());  } }
6	public class Main { public static void main(String[] args) throws IOException {  new Thread(null, new Runnable() {  public void run() {   try {   long prevTime = System.currentTimeMillis();   new Main().run();   System.err.println("Total time: "    + (System.currentTimeMillis() - prevTime) + " ms");   System.err.println("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);  Object o = solve();  if (o != null)  out.println(o);  out.close();  in.close(); }  int n; Point[] ps; int[] dp;  private Object solve() throws IOException {  int o_x = ni();  int o_y = ni();  n = ni();  ps = new Point[n];  for (int i = 0; i < n; i++)  ps[i] = new Point(ni() - o_x, ni() - o_y);  dp = new int[1 << n];  Arrays.fill(dp, Integer.MAX_VALUE);  dp[0] = 0;  int[] path_x = new int[1 << n];  int[] path_y = new int[1 << n];   for (int mask = 1; mask < (1 << n); mask++) {  int i = min(mask);  int min_val = dp[mask - (1 << i)] + 2 * ps[i].norm;  if (min_val < dp[mask]) {   dp[mask] = min_val;   path_x[mask] = i;   path_y[mask] = i;     }  for (int j = i + 1; j < n; j++)   if ((mask & (1 << j)) != 0) {   int newMask = mask - (1 << i) - (1 << j);   int val = dp[newMask] + ps[i].norm + ps[j].norm    + ps[i].dist(ps[j]);   if (val < dp[mask]) {    dp[mask] = val;    path_x[mask] = i;    path_x[mask] = j;       }   }  }  pln(dp[(1 << n) - 1]);  int maskPath = (1 << n) - 1;  LinkedList<Long> list = new LinkedList<Long>();  while (maskPath != 0) {  long x = path_x[maskPath];  long y = path_y[maskPath];    list.addFirst(0L);  list.addFirst(y + 1);  maskPath -= (1 << y);  if (x != y) {   list.addFirst(x + 1);   maskPath -= 1 << x;  }  }  list.addFirst(0L);  show(list);  return null; }  private int min(int mask) {  int ret = 0;  while (mask % 2 == 0) {  mask /= 2;  ret++;  }  return ret; }  private void show(LinkedList<Long> list) {  int index = 0;  for (long a : list) {  if (index == 0) {   p(a);  } else {   p(" " + a);  }  index++;  }  pln(); }  class Point {  int x;  int y;  int norm;  public Point(int x, int y) {  this.x = x;  this.y = y;  this.norm = x * x + y * y;  }  public int dist(Point other) {  int dx = (x - other.x);  int dy = (y - other.y);   return dx * dx + dy * dy;  }  @Override  public String toString() {  return "Point [x=" + x + ", y=" + y + ", norm=" + norm + "]";  }  }  BufferedReader in; PrintWriter out; StringTokenizer strTok = new StringTokenizer("");  String nextToken() throws IOException {  while (!strTok.hasMoreTokens())  strTok = new StringTokenizer(in.readLine());  return strTok.nextToken(); }  int ni() throws IOException {  return Integer.parseInt(nextToken()); }  long nl() throws IOException {  return Long.parseLong(nextToken()); }  double nd() throws IOException {  return Double.parseDouble(nextToken()); }  int[] nia(int size) throws IOException {  int[] ret = new int[size];  for (int i = 0; i < size; i++)  ret[i] = ni();  return ret; }  long[] nla(int size) throws IOException {  long[] ret = new long[size];  for (int i = 0; i < size; i++)  ret[i] = nl();  return ret; }  double[] nda(int size) throws IOException {  double[] ret = new double[size];  for (int i = 0; i < size; i++)  ret[i] = nd();  return ret; }  String nextLine() throws IOException {  strTok = new StringTokenizer("");  return in.readLine(); }  boolean EOF() throws IOException {  while (!strTok.hasMoreTokens()) {  String s = in.readLine();  if (s == null)   return true;  strTok = new StringTokenizer(s);  }  return false; }  void printRepeat(String s, int count) {  for (int i = 0; i < count; i++)  out.print(s); }  void printArray(int[] array) {  for (int i = 0; i < array.length; i++) {  if (i > 0)   out.print(' ');  out.print(array[i]);  }  out.println(); }  void printArray(long[] array) {  for (int i = 0; i < array.length; i++) {  if (i > 0)   out.print(' ');  out.print(array[i]);  }  out.println(); }  void printArray(double[] array) {  for (int i = 0; i < array.length; i++) {  if (i > 0)   out.print(' ');  out.print(array[i]);  }  out.println(); }  void printArray(double[] array, String spec) {  for (int i = 0; i < array.length; i++) {  if (i > 0)   out.print(' ');  out.printf(Locale.US, spec, array[i]);  }  out.println(); }  void printArray(Object[] array) {  boolean blank = false;  for (Object x : array) {  if (blank)   out.print(' ');  else   blank = true;  out.print(x);  }  out.println(); }  @SuppressWarnings("rawtypes") void printCollection(Collection collection) {  boolean blank = false;  for (Object x : collection) {  if (blank)   out.print(' ');  else   blank = true;  out.print(x);  }  out.println(); }  static String memoryStatus() {  return (Runtime.getRuntime().totalMemory()   - Runtime.getRuntime().freeMemory() >> 20)   + "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB"; }  public void pln() {  out.println(); }  public void pln(int arg) {  out.println(arg); }  public void pln(long arg) {  out.println(arg); }  public void pln(double arg) {  out.println(arg); }  public void pln(String arg) {  out.println(arg); }  public void pln(boolean arg) {  out.println(arg); }  public void pln(char arg) {  out.println(arg); }  public void pln(float arg) {  out.println(arg); }  public void pln(Object arg) {  out.println(arg); }  public void p(int arg) {  out.print(arg); }  public void p(long arg) {  out.print(arg); }  public void p(double arg) {  out.print(arg); }  public void p(String arg) {  out.print(arg); }  public void p(boolean arg) {  out.print(arg); }  public void p(char arg) {  out.print(arg); }  public void p(float arg) {  out.print(arg); }  public void p(Object arg) {  out.print(arg); } }
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;  @Override public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  sc = new FastScanner(in);  solve();  } catch (Throwable t) {  Solution.uncaught = t;  } finally {  out.close();  } }  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()); }  public long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  public double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
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 Solution{  public static Integer INT(String s){  return Integer.parseInt(s); }  public static Long LONG(String s){  return Long.parseLong(s); }       public static void main(String args[])throws IOException{   BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); Scanner in=new Scanner(System.in); StringBuilder out=new StringBuilder();   long n=in.nextLong(),   k=in.nextLong();  long a=1,   b=3,   c=-2*(n+k);   long r1=(-b+(long)Math.sqrt(b*b-4*a*c))/(2*a);  long r2=(-b-(long)Math.sqrt(b*b-4*a*c))/(2*a);  System.out.println(n-Math.max(r1, r2)); } }
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;    }    public String toString() {     return from + " " + to + " " + 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 P1195B {  public static void main(String[] args) {   SimpleScanner scanner = new SimpleScanner(System.in);   PrintWriter writer = new PrintWriter(System.out);   int n = scanner.nextInt();   int k = scanner.nextInt();   int l = 0;   int r = n;   int ans = 0;   while (l <= r) {    int eat = (l + r) >> 1;    int lastPut = n - eat;    long totalPut = (long) (lastPut + 1) * lastPut / 2;    long remain = totalPut - eat;    if (remain == k) {     ans = eat;     break;    } else if (remain > k)     l = eat + 1;    else     r = eat - 1;   }   writer.println(ans);   writer.close();  }  private static class SimpleScanner {   private static final int BUFFER_SIZE = 10240;   private Readable in;   private CharBuffer buffer;   private boolean eof;   SimpleScanner(InputStream in) {    this.in = new BufferedReader(new InputStreamReader(in));    buffer = CharBuffer.allocate(BUFFER_SIZE);    buffer.limit(0);    eof = false;   }    private char read() {    if (!buffer.hasRemaining()) {     buffer.clear();     int n;     try {      n = in.read(buffer);     } catch (IOException e) {      n = -1;     }     if (n <= 0) {      eof = true;      return '\0';     }     buffer.flip();    }    return buffer.get();   }   void checkEof() {    if (eof)     throw new NoSuchElementException();   }   char nextChar() {    checkEof();    char b = read();    checkEof();    return b;   }   String next() {    char b;    do {     b = read();     checkEof();    } while (Character.isWhitespace(b));    StringBuilder sb = new StringBuilder();    do {     sb.append(b);     b = read();    } while (!eof && !Character.isWhitespace(b));    return sb.toString();   }   int nextInt() {    return Integer.valueOf(next());   }   long nextLong() {    return Long.valueOf(next());   }   double nextDouble() {    return Double.parseDouble(next());   }  } }
2	public class Main{   public long power(long x, long y, long p)  {   long res = 1;       while (y > 0)   {    if((y & 1)==1)     res = (res * x) % p;    y = y >> 1;    x = (x * x) % p;   }   return res;  }  public static void main(String[] args) throws IOException{     Scanner sc=new Scanner(System.in);   Main mm=new Main();   long x=sc.nextLong();    long k=sc.nextLong();    if(x==0) {     System.out.println(0);    }    else {    long temp=mm.power(2, k, 1000000007);    long temp1=(2*x-1)%(1000000007);    long temp3=(temp1*temp)%(1000000007);    System.out.println((temp3+1)%1000000007);    }  } }  class trienode{  trienode[] next=new trienode[26];  int count;  char value;  boolean last;  trienode() {   this.value='0';   this.count=0;  }  trienode(char x) {   this.value=x;   this.count=1;  }  } class trie{  trienode root=new trienode();  public void insert(String s) {   trienode temp=root;   int length=s.length();   for(int i=0;i<length;i++) {    char c=s.charAt(i);    int index=c-'a';    if(temp.next[index]==null) {     temp.next[index]=new trienode(c);    }    else {     temp.next[index].count++;    }    if(i==length-1) {     temp.next[index].last=true;    }    temp=temp.next[index];    }   }  public String find(String s) {   trienode temp=root;   String ans="";   int pos=0;   char c=s.charAt(pos);   int index=c-'a';   while(temp.next[index]!=null) {    temp=temp.next[index];    ans+=temp.value;    if(pos==s.length()-1) {     break;    }    c=s.charAt(++pos);    index=c-'a';      }   while(temp.last!=true) {    int position=-1;    for(int i=0;i<26;i++) {    if(temp.next[i]!=null) {     ans+=temp.next[i].value;     position=i+0;     break;    }       }    temp=temp.next[position];   }   return ans;  } } class node{  int index;  int a;  int b;  node(int index,int a,int b){   this.a=a;   this.b=b;this.index=index;    } } class comp implements Comparator<node>{  public int compare(node n1,node n2) {   if(n1.b>n2.b) {    return 1;   }   else if(n1.b<n2.b) {    return -1;   }   else {    return 0;   }  } } class cc implements Comparator<node>{  public int compare(node n1,node n2) {   if(n1.index>n2.index) {    return 1;   }   else if(n1.index<n2.index) {    return -1;   }   else {    return 0;   }  } }     class Reader {  static BufferedReader reader;  static StringTokenizer tokenizer;    static void init(InputStream input) {   reader = new BufferedReader(      new InputStreamReader(input) );   tokenizer = new StringTokenizer("");  }    static String next() throws IOException {   while ( ! tokenizer.hasMoreTokens() ) {       tokenizer = new StringTokenizer(      reader.readLine() );   }   return tokenizer.nextToken();  }   static int nextInt() throws IOException {   return Integer.parseInt( next() );  }   static double nextDouble() throws IOException {   return Double.parseDouble( next() );  } }
3	public class indent {    static int N, M, K;  static String s;  static StringTokenizer st;  static int[] d;  static long MOD = (int)1e9 + 7;  public static void main(String[] args) throws Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int N = Integer.parseInt(br.readLine());   char[] d = new char[N];   for (int i = 0; i < N; i++) {    d[i] = br.readLine().charAt(0);   }   long[][] dp = new long[N][N];   boolean det = d[0] == 'f';     dp[0][0] = 1;     for (int i = 1; i < N; i++) {       long sum = 0;    for (int j = 0; j < N; j++) {     sum = (dp[i - 1][j]%MOD + sum%MOD + MOD) % MOD;    }           if (d[i] == 'f') {     if(det){      for (int j = 1; j < N; j++) {       dp[i][j] = dp[i-1][j-1]%MOD;      }      continue;     }         for (int j = 0; j < N; j++) {      dp[i][j] = sum%MOD;      sum -= dp[i - 1][j]%MOD;     }     det = true;             } else if (d[i] == 's') {              if(det){           det = false;      for (int j = 1; j < N; j++) {       dp[i][j] = dp[i-1][j-1]%MOD;      }           continue;     }              for (int j = 0; j < N; j++) {      dp[i][j] = sum%MOD;      sum = ((sum - dp[i - 1][j])%MOD + MOD)%MOD;     }        }      }        long ans = 0;   for (long e: dp[dp.length-1]) {    ans = (ans + e + MOD) % MOD;   }   System.out.println(ans);              } }
6	public class ACMIND {  static FastReader 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<<25)   {    public void run()    {     try     {      solve();     }     catch(Exception e)     {      e.printStackTrace();      System.exit(1);     }    }   }.start();  }  static int n, g[], t[], T;  static int dp[][];  static void solve() throws IOException  {   scan = new FastReader();   pw = new PrintWriter(System.out,true);   StringBuilder fast = new StringBuilder();   n = ni();   T = ni();   g = new int[n];   t = new int[n];   for(int i=0;i<n;++i) {    t[i] = ni();    g[i] = ni();   }   int MAX = (1<<n);   dp = new int[MAX][4];   for(int i=0;i<MAX;++i) {    for(int j=0;j<4;++j) {     dp[i][j] = -1;    }   }   pl(f((1<<n)-1,0));   pw.flush();   pw.close();  }  static int f(int mask, int prev) {   if(dp[mask][prev]!=-1) {    return dp[mask][prev];   }   int left = T;   for(int i=0;i<n;++i) {    if((mask&(1<<i))==0) {     left-=t[i];    }   }   if(left==0) {    return 1;   }   int cnt = 0;   for(int i=0;i<n;++i) {    if((mask&(1<<i))!=0) {     if(g[i]!=prev && left>=t[i]) {      cnt+=f(mask^(1<<i), g[i]);      if(cnt>=MOD) {       cnt-=MOD;      }     }    }   }   return dp[mask][prev] = cnt;  }  static int ni() throws IOException  {   return scan.nextInt();  }  static long nl() throws IOException  {   return scan.nextLong();  }  static double nd() throws IOException  {   return scan.nextDouble();  }  static void pl()  {   pw.println();  }  static void p(Object o)  {   pw.print(o+" ");  }  static void pl(Object o)  {   pw.println(o);  }  static void psb(StringBuilder sb)  {   pw.print(sb);  }  static void pa(String arrayName, Object arr[])  {   pl(arrayName+" : ");   for(Object o : arr)    p(o);   pl();  }  static void pa(String arrayName, int arr[])  {   pl(arrayName+" : ");   for(int o : arr)    p(o);   pl();  }  static void pa(String arrayName, long arr[])  {   pl(arrayName+" : ");   for(long o : arr)    p(o);   pl();  }  static void pa(String arrayName, double arr[])  {   pl(arrayName+" : ");   for(double o : arr)    p(o);   pl();  }  static void pa(String arrayName, char arr[])  {   pl(arrayName+" : ");   for(char o : arr)    p(o);   pl();  }  static void pa(String listName, List list)  {   pl(listName+" : ");   for(Object o : list)    p(o);   pl();  }  static void pa(String arrayName, Object[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(Object o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, int[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(int o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, long[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(long o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, char[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(char o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, double[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(double o : arr[i])     p(o);    pl();   }  }  static class FastReader {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;   public FastReader() {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public FastReader(String file_name) throws IOException {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public String readLine() throws IOException {    byte[] buf = new byte[1000000];    int cnt = 0, c;    while ((c = read()) != -1) {     if (c == '\n') break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }   public int nextInt() throws IOException {    int ret = 0;    byte c = read();    while (c <= ' ') c = read();    boolean neg = (c == '-');    if (neg) c = read();    do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (neg) return -ret;    return ret;   }   public long nextLong() throws IOException {    long ret = 0;    byte c = read();    while (c <= ' ') c = read();    boolean neg = (c == '-');    if (neg) c = read();    do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (neg) return -ret;    return ret;   }   public double nextDouble() throws IOException {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ') c = read();    boolean neg = (c == '-');    if (neg) c = read();    do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);    if (neg) return -ret;    return ret;   }   private void fillBuffer() throws IOException {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1) buffer[0] = -1;   }   private byte read() throws IOException {    if (bufferPointer == bytesRead) fillBuffer();    return buffer[bufferPointer++];   }   public void close() throws IOException {    if (din == null) return;    din.close();   }  } }
4	public class CFC23A implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok;  public static void main(String[] args) {  new Thread(new CFC23A()).start(); }  void solve() throws IOException {  int res = 0;  String str = nextToken();  for(int i = 0; i < str.length(); ++i)  for(int j = i + 1; j <= str.length(); ++j)   if(isOk(str.substring(i, j), str))   res = max(res, j - i);  out.println(res); }  private boolean isOk(String substring, String str) {  int from = 0, kol = 0;  while(str.indexOf(substring, from) != -1 && kol < 2) {  ++kol;  from = str.indexOf(substring, from) + 1;  }  return kol >= 2; }  @Override public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();  out.flush();  out.close();  in.close();  } catch (IOException e) {    e.printStackTrace();  }  }  String nextLine() throws IOException {  tok = null;  return in.readLine(); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  String nextToken() throws IOException {  while (tok == null || !tok.hasMoreTokens()) {  tok = new StringTokenizer(in.readLine());  }  return tok.nextToken(); } }
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("");  } }
6	public class B {  static int first(int n)  { int res = 0; while(n > 0 && (n & 1) == 0){  n >>= 1;  res++; } return res;  }  public static void main(String[] args) throws Exception  { Scanner bf = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = bf.nextInt(), m = bf.nextInt(); ArrayList<Integer> [] adjList = new ArrayList[n]; for (int i = 0; i < adjList.length; i++) {  adjList[i] = new ArrayList<Integer>(); } for (int i = 0; i < m; i++) {  int u = bf.nextInt()-1, v = bf.nextInt()-1;  adjList[u].add(v);  adjList[v].add(u); } long [][] memo = new long[(1<<n)][n]; for (int i = 0; i < n; i++) {  memo[1<<i][i] = 1; } long ans = 0; for (int i = 1; i < 1<<n; i++) {  if(Integer.bitCount(i) == 1) continue;  for (int j = 0; j < n; j++)  {  if((i & (1<<j)) == 0 || j == first(i)) continue;  for(int v:adjList[j])   memo[i][j] += memo[i^(1<<j)][v];  } } for (int i = 1; i < 1<<n; i++) {  if(Integer.bitCount(i) < 3) continue;  int t = first(i);  for (int j = 0; j < n; j++)  {  if(adjList[j].contains(t))   ans += memo[i][j];  } } out.println(ans/2); out.flush(); out.close();  }  static class Scanner { StringTokenizer st; BufferedReader br;  public Scanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s)); }  public Scanner(FileReader fileReader) {  br = new BufferedReader(fileReader); }  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 String nextLine() throws IOException {  return br.readLine(); }  public boolean ready() throws IOException {  return br.ready(); }  } }
3	public class Contest {  final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  BufferedReader in;  PrintWriter out;  StringTokenizer tok = new StringTokenizer("");  public static void main(String[] args) {   new Contest().run();  }  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());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  public void run() {   try {    long t1 = System.currentTimeMillis();    init();    solve();    out.close();    long t2 = System.currentTimeMillis();    System.err.println("Time(ms) = " + (t2 - t1));   } catch (Exception e) {    e.printStackTrace(System.err);    System.exit(-1);   }  }  class MyComparator implements Comparable<MyComparator> {   int x;   int y;   public MyComparator(int x, int y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(MyComparator a) {    if (x == a.x) {     return (y - a.y);    }    return x - a.x;   }  }  public static boolean isPrime(int num) {   if (num > 2 && num % 2 == 0) {       return false;   }   int top = (int) Math.sqrt(num) + 1;   for (int i = 3; i < top; i += 2) {    if (num % i == 0) {         return false;    }   }     return true;  }  private static int lowerBound(int[] a, int low, int high, int element) {   while (low < high) {    int middle = low + (high - low) / 2;    if (element > a[middle]) {     low = middle + 1;    } else {     high = middle;    }   }   return low;  }  private static int upperBound(int[] a, int low, int high, int element) {   while (low < high) {    int middle = low + (high - low) / 2;    if (a[middle] > element) {     high = middle;    } else {     low = middle + 1;    }   }   return low;  }  public void solve() throws IOException {   int num_a = readInt();   int[] array = new int[num_a];   for (int i = 0; i < num_a; i++) {    array[i] = readInt();   }   int result = 0;   Arrays.sort(array);   for (int i = 0; i < array.length; i++) {    if (array[i] == -1) {     continue;    }    for (int j = 0; j < array.length; j++) {     if (array[j] != -1 && array[j] % array[i] == 0 && j != i) {           array[j] = -1;          }    }    result++;   }   System.out.println(result);  }    private BigInteger lcm(BigInteger a, BigInteger b) {   return a.multiply(b.divide(a.gcd(b)));  } }
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();  } }
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);      }  }             } }
0	public class Main {  private static BufferedReader reader;  private static BufferedWriter out;  private static StringTokenizer tokenizer;    private static void init(InputStream input, OutputStream output) {   reader = new BufferedReader(new InputStreamReader(input));   out = new BufferedWriter(new OutputStreamWriter(output));        tokenizer = new StringTokenizer("");  }  private static String nextLine() throws IOException {   return reader.readLine();  }  private static String next() throws IOException {   while (!tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(nextLine());   }   return tokenizer.nextToken();  }  private static int nextInt() throws IOException {   return Integer.parseInt(next());  }  private static long nextLong() throws IOException {   return Long.parseLong(next());  }  private static double nextDouble() throws IOException {   return Double.parseDouble(next());  }    public static void main(String[] args) throws IOException {   init(System.in, System.out);   int n = nextInt();     if (n > 0) {    out.write(n + "\n");   } else {    String s = n + "";    String s2 = s.substring(0, s.length() - 1);    String s3 = s.substring(0, s.length() - 2) + s.charAt(s.length() - 1);    int a = Integer.parseInt(s2);    int b = Integer.parseInt(s3);    int ans = Math.max(a, b);    out.write(ans + "\n");   }        out.flush();  } }
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());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  } } }
0	public class Test {    public static void main(String[] args) {   Scanner s = new Scanner(System.in);   int n = s.nextInt();   int k = 1;   int t = 0;   int y = 2;   int[] a = new int[100000];   if(n==0){    System.out.println(0+" "+0+" "+0);   }   else    if(n==1){    System.out.println(0+" "+0+" "+1);    }    else     if(n==2){     System.out.println(0+" "+1+" "+1);     }     else{      a[0] = 0;      a[1] = 1;      a[y] = a[y - 2] + a[y - 1];      while (a[y - 1] < n) {       a[y] = a[y - 2] + a[y - 1];       ++y;       }      System.out.println(a[y - 2] + " " + a[y - 4] + " " + a[y - 5]);    }        } }
0	public class LuckySubstring {   static int[] luck;   public static void main(String[] args) {   Scanner s = new Scanner(System.in);     int n = s.nextInt();   int i = -1;   boolean ehLuck = false;   preencheLucky();   while (n >= luck[++i]) {    if (i > 13) {     break;    }    if (n % luck[i] == 0) {     ehLuck = true;     break;    }   }   if (ehLuck) {    System.out.println("YES");   } else {    System.out.println("NO");   }  }   static void preencheLucky() {   luck = new int[15];   luck[0] = 4;   luck[1] = 7;   luck[2] = 44;   luck[3] = 47;   luck[4] = 74;   luck[5] = 77;   luck[6] = 444;   luck[7] = 447;   luck[8] = 474;   luck[9] = 477;   luck[10] = 744;   luck[11] = 747;   luck[12] = 774;   luck[13] = 777;  }  }
4	public class A { public static void main(String[] args) throws Exception{  String str = new Scanner(System.in).next();  Set<String> set = new HashSet<String>();  String max = "";  for(int l = 1; l < str.length(); ++l){  for(int i = 0; i < str.length()-l; ++i){   String substr = str.substring(i, i+l);   if(!set.contains(substr) && str.indexOf(substr) != str.lastIndexOf(substr)){   set.add(substr);   if(substr.length() > max.length()){    max = substr;   }   }  }  }  System.out.println(max.length()); }  }
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;   }   @Override   public String toString() {    return "{" +      "level=" + level +      ", 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();   }  } }
6	public class E {  void solve(BufferedReader in) throws Exception {   int[] xx = toInts(in.readLine());   int n = xx[0];   double k = xx[1];   int[][] board = new int[n][n];   for(int i = 0; i<n; i++) board[i] = toInts(in.readLine());   int fst = n/2;   int snd = n - fst;   int[] maxc = new int[1<<fst];   int max = 1;   for(int i = 0; i<(1<<fst); i++) {    for(int j = 0; j<fst; j++) {     if((i&1<<j) != 0) maxc[i] = Math.max(maxc[i], maxc[i^(1<<j)]);    }    boolean ok = true;    for(int a = 0; a<fst; a++) if((i&1<<a) != 0) {     for(int b = a+1; b<fst; b++) if((i&1<<b) != 0) {      if(board[a][b] == 0) ok = false;     }    }    if(ok) {     maxc[i] = Integer.bitCount(i);     max = Math.max(max, maxc[i]);    }   }   for(int i = 0; i<(1<<snd); i++) {    boolean ok = true;    for(int a = 0; a<snd; a++) if((i&1<<a) != 0) {     for(int b = a+1; b<snd; b++) if((i&1<<b) != 0) {      if(board[a+fst][b+fst] == 0) ok = false;     }    }    if(!ok) continue;    int mask = 0;    for(int a = 0; a<fst; a++) {     ok = true;     for(int b = 0; b<snd; b++) {      if((i&1<<b) != 0) {       if(board[a][b+fst] == 0) ok = false;      }     }     if(ok) mask |= (1<<a);    }    max = Math.max(Integer.bitCount(i) + maxc[mask], max);   }   System.out.println(k*k*(max-1.0)/(2*max));  }  int toInt(String s) {return Integer.parseInt(s);}  int[] toInts(String s) {   String[] a = s.split(" ");   int[] o = new int[a.length];   for(int i = 0; i<a.length; i++) o[i] = toInt(a[i]);   return o;  }  void e(Object o) {   System.err.println(o);  }  public static void main(String[] args) throws Exception{   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   (new E()).solve(in);  } }
3	public class prob3{   static Parser sc=new Parser(System.in);  static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));  static int p[]=new int[100005]; public static void main(String[] args) throws IOException {     int n=sc.nextInt();  int arr[]=new int[n];  for(int i=0;i<n;i++){  arr[i]=sc.nextInt();  }  int swap=0;  for(int i=0;i<n;i++){  for(int j=0;j<i;j++){   if(arr[i]<arr[j]){    swap++;   }  }  }  swap%=2;   int m=sc.nextInt();  for(int i=0;i<m;i++){   int a=sc.nextInt(),b=sc.nextInt();  swap+=((b-a)*((b-a)+1))/2;   swap%=2;   if(swap%2==0){System.out.println("even");}  else{System.out.println("odd");}  }     }   public static void union(int a,int b){   int i=find(a);   int j=find(b);   if(p[i]!=j){   p[i]=j;   }  }   public static int find(int a){   while(p[a]!=a){   a=p[a];   }   return a;  }       static class Parser {   final private int BUFFER_SIZE = 1 << 20;   private InputStream din;    private byte[] buffer;    private int bufferPointer;   private int bytesRead;    private SpaceCharFilter filter;   public Parser(InputStream in) {    din = in;    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }      public int nextInt() throws IOException {    int result = 0;    byte c = read();    while (c <= ' ') c = read();    boolean neg = (c == '-');    if (neg) c = read();   while (c >= '0' && c <= '9') {     result = result * 10 + c - '0';     c = read();    }  if (neg) return -result;    return result;   }   public int nextLong() throws IOException {    int result = 0;    byte c = read();    while (c <= ' ') c = read();    boolean neg = (c == '-');    if (neg) c = read();   while (c >= '0' && c <= '9') {     result = result * 10 + c - '0';     c = read();    }  if (neg) return -result;    return result;   }   public String nextLine()throws IOException {   int c = read();   while (isSpaceChar(c))   c = read();   StringBuilder res = new StringBuilder();   do {   res.appendCodePoint(c);   c = read();   } while (!isEndOfLine(c)==true);   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;  }    private boolean isEndOfLine(int c) {   return c == '\n' || c == '\r' || c == -1;  }  public interface SpaceCharFilter {   public boolean isSpaceChar(int ch);  }      public byte read() throws IOException {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }      private void fillBuffer() throws IOException {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }  } }
3	public class Q6 {  public static void main(String[] args) {   InputReader s = new InputReader(System.in);   PrintWriter out = new PrintWriter(System.out);   int t = 1;   nexttest:   while (t-- > 0) {    int n = s.nextInt();    int a[] = s.nextIntArray(n);    HashMap<Integer, List<Pair>> sets = new HashMap<>();    int pre[] = new int[n + 1];    for (int i = 1; i <= n; i++) {     pre[i] = a[i - 1] + pre[i - 1];    }    for (int i = 1; i <= n; i++) {     for (int j = i; j <= n; j++) {      final Integer key = pre[j] - pre[i - 1];      if (!sets.containsKey(key)) {       sets.put(key, new ArrayList<>());      }      sets.get(key).add(new Pair(i, j));     }    }    int ans = 0;    List<Pair> answer = new ArrayList<>();    int[] ansNextPos = new int[1];    boolean[] ansTaken = new boolean[1];    for (List<Pair> intervals : sets.values()) {     Collections.sort(intervals);     int[] nextPos = new int[intervals.size()];     boolean[] taken = new boolean[intervals.size()];     int[] dp = new int[intervals.size()];     dp[intervals.size() - 1] = 1;     taken[intervals.size() - 1] = true;     nextPos[intervals.size() - 1] = -1;     for (int i = intervals.size() - 2; i >= 0; i--) {      dp[i] = dp[i + 1];      taken[i] = false;      nextPos[i] = i + 1;      int ll = i + 1;      int rr = intervals.size();      while (ll < rr) {       int mid = ll + rr;       mid /= 2;       if (intervals.get(mid).x > intervals.get(i).y) {        rr = mid;       } else {        ll = mid + 1;       }      }      if (ll < intervals.size()) {       if (dp[i] < 1 + dp[ll]) {        dp[i] = Math.max(dp[i], 1 + dp[ll]);        taken[i] = true;        nextPos[i] = ll;       }      }     }     if (dp[0] > ans) {      ans = dp[0];      answer = intervals;      ansNextPos = nextPos;      ansTaken = taken;     }    }     out.println(ans);    int cur = 0;    while (cur != -1) {     if (ansTaken[cur]) {      out.println(answer.get(cur));     }     cur = ansNextPos[cur];    }   }   out.close();  }  static class Pair implements Comparable<Pair> {   int x;   int y;   @Override   public String toString() {    return x + " " + y;   }   public Pair(final int x, final int y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(final Pair o) {    return this.x - o.x;   }  }  static class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar, snumChars;   private InputReader.SpaceCharFilter filter;   public InputReader(InputStream stream) {    this.stream = stream;   }   public int snext() {    if (snumChars == -1) {     throw new InputMismatchException();    }    if (curChar >= snumChars) {     curChar = 0;     try {      snumChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (snumChars <= 0) {      return -1;     }    }    return buf[curChar++];   }   public int nextInt() {    int c = snext();    while (isSpaceChar(c)) {     c = snext();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = snext();    }    int res = 0;    do {     if (c < '0' || c > '9') {      throw new InputMismatchException();     }     res *= 10;     res += c - '0';     c = snext();    } while (!isSpaceChar(c));    return res * sgn;   }   public long nextLong() {    int c = snext();    while (isSpaceChar(c)) {     c = snext();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = snext();    }    long res = 0;    do {     if (c < '0' || c > '9') {      throw new InputMismatchException();     }     res *= 10;     res += c - '0';     c = snext();    } while (!isSpaceChar(c));    return res * sgn;   }   public int[] nextIntArray(int n) {    int a[] = new int[n];    for (int i = 0; i < n; i++) {     a[i] = nextInt();    }    return a;   }   public String readString() {    int c = snext();    while (isSpaceChar(c)) {     c = snext();    }    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = snext();    } while (!isSpaceChar(c));    return res.toString();   }   public String nextLine() {    int c = snext();    while (isSpaceChar(c)) {     c = snext();    }    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = snext();    } while (!isEndOfLine(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;   }   private boolean isEndOfLine(int c) {    return c == '\n' || c == '\r' || c == -1;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
3	public class F{  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());   }    double nextDouble()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  } static class Pair {  int l;  int r;  Pair(int l,int r)  {  this.l = l;  this.r = r;  } } public static void main(String[] args)  {  OutputStream outputStream = System.out;   FastReader sc = new FastReader();   PrintWriter out = new PrintWriter(outputStream);   int n = sc.nextInt();   int a[] = new int[n];   Pair pr;   HashMap<Long,ArrayList> hm = new HashMap<>();   ArrayList<Pair> ar;   for(int i = 0; i < n; i++)   {   a[i] = sc.nextInt();   }   long sum = 0;   for(int r = 0; r < n; r++)   {    sum = 0;   for(int l = r; l >= 0; l--)   {    sum += a[l];    if(!hm.containsKey(sum))    {    ar = new ArrayList<>();    ar.add(new Pair(l,r));    hm.put(sum,ar);    }    else    {    ar = hm.get(sum);    ar.add(new Pair(l,r));    hm.put(sum,ar);    }   }   }     int count = 0;   int maxCount = 0;   long maxSum = 0;   for(Map.Entry<Long,ArrayList> entry:hm.entrySet())   {   sum = entry.getKey();   ar = entry.getValue();   count = 0;   int r = -1;   for(int i = 0; i < ar.size(); i++)   {    if(ar.get(i).l > r)    {    count++;    r = ar.get(i).r;    }   }   if(count > maxCount)   {    maxCount = count;    maxSum = sum;   }      }   ar = hm.get(maxSum);   out.println(maxCount);        int r = -1;   for(int i = 0; i < ar.size(); i++)  {   if(ar.get(i).l > r)   {   out.println((ar.get(i).l+1) +" "+(ar.get(i).r+1));   r = ar.get(i).r;   }  }   out.close(); } }
2	public class Main {  PrintWriter out = new PrintWriter(System.out, false);  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer stok = null;  String next() {   while (stok == null || !stok.hasMoreTokens())    try {     stok = new StringTokenizer(in.readLine());    } catch (IOException e) { throw new RuntimeException(e); }   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();  }    long n = parseLong(next()), k = parseLong(next());  long delta = 9 + 8 * (n + k);  long a = (-3 + (long)sqrt(delta)) / 2;  long b = n - a;  {   out.println(b);  } }
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 int reset(int N, int pos) {   return N = N & ~(1 << pos);  }  static void debug(Object... obj) {   System.err.println(Arrays.deepToString(obj));  }   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 String nextLine() throws Exception {    String line = null;    tokenizer = null;    line = reader.readLine();    return line;   }    public int nextInt() throws Exception {    return Integer.parseInt(next());   }    public double nextDouble() throws Exception {    return Double.parseDouble(next());   }    public long nextLong() throws Exception {    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);   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();    boolean[] isF = new boolean[n];    for (int i = 0; i < n; i++) {     isF[i] = in.readCharacter() == 'f';    }    int[][] mem = new int[n + 1][n + 1];    mem[n][0] = 1;    for (int idx = n - 1; idx >= 0; idx--) {     for (int indentLevel = 0; indentLevel < n; indentLevel++) {      mem[idx + 1][indentLevel + 1] += mem[idx + 1][indentLevel];      mem[idx + 1][indentLevel + 1] %= MiscUtils.MOD7;      int res = isF[idx] ?        mem[idx + 1][indentLevel + 1] - mem[idx + 1][indentLevel] :        mem[idx + 1][indentLevel];      mem[idx][indentLevel] = (res + MiscUtils.MOD7) % MiscUtils.MOD7;     }    }    out.printLine(mem[0][0]);   }  }  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 char readCharacter() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    return (char) c;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  static class MiscUtils {   public static final int MOD7 = (int) (1e9 + 7);  }  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);   }  } }
1	public class A { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni(), d = ni();  int[] a = na(n);  Set<Long> set = new HashSet<>();  for(int v : a){  set.add(v-(long)d);  set.add(v+(long)d);  }  int ct = 0;  for(long s : set){  long min = Long.MAX_VALUE;  for(int v : a){   min = Math.min(min, Math.abs(s-v));  }  if(min == d)ct++;  }  out.println(ct); }  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]; 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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
6	public class G1 {  static int n, T, duration[], type[];  static long dp[][][], mod = (long) 1e9 + 7;  public static void main(String[] args) throws Exception {   new Thread(null, new Runnable() {    public void run() {     try {      solveIt();     } catch (Exception e) {      e.printStackTrace();      System.exit(1);     }    }   }, "Main", 1 << 28).start();  }  public static void solveIt() throws Exception {   Scanner in = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   n = in.nextInt();   T = in.nextInt();   dp = new long[3][T + 1][1 << n];   duration = new int[n];   type = new int[n];   for (int i = 0; i < n; i++) {    duration[i] = in.nextInt();    type[i] = in.nextInt() - 1;   }   for (long a[][] : dp) for (long b[] : a) Arrays.fill(b, -1);   pw.println(solve(0, T, 0));   pw.close();  }  static long solve(int lastType, int rem, int mask) {   if (rem == 0) return 1;   if (rem < 0) return 0;   if (dp[lastType][rem][mask] != -1) return dp[lastType][rem][mask];   long res = 0;   for (int i = 0; i < n; i++) {    if (!check(mask, i) && (lastType != type[i] || mask == 0) && rem - duration[i] >= 0) {     res += solve(type[i], rem - duration[i], set(mask, i));     if (res >= mod) res -= mod;    }   }   return dp[lastType][rem][mask] = res;  }  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 int reset(int N, int pos) {   return N = N & ~(1 << pos);  }  static void debug(Object... obj) {   System.err.println(Arrays.deepToString(obj));  } }
1	public class Main {  Scanner cin;  int []prime;  int top;  void work()  {   cin=new Scanner(System.in);   int n=cin.nextInt();   int k=cin.nextInt();   top=0;   prime=new int[2000];   for(int i=2;i<=n;i++)   {   if(isprime(i))    prime[top++]=i;   }   int cnt=0;   for(int i=0;i<top;i++)   {   if(cando(prime[i]))    cnt++;   }   if(cnt>=k) System.out.println("YES");   else System.out.println("NO");  }  boolean cando(int n)  {  for(int i=0;i<top-1;i++)  {   if(prime[i]+prime[i+1]+1==n) return true;  }  return false;  }  boolean isprime(int n)  {  for(int i=2;i*i<=n;i++)   if(n%i==0)return false;  return true;  } public static void main(String args[]) throws Exception  {    new Main().work(); }  }
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());  }  double nextDouble() {   return Double.parseDouble(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();  } }
5	public class A {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;   class Team implements Comparable<Team>{   int ac;   int penalty;     public Team(int ac, int penalty) {    this.ac = ac;    this.penalty = penalty;   }   @Override   public int compareTo(Team o) {    if (ac != o.ac)     return ac > o.ac ? -1 : 1;    return (penalty == o.penalty) ? 0 : (penalty < o.penalty ? -1 : 1);   }    }  void solve() throws IOException {   int n = nextInt();   int k = nextInt() - 1;     Team[] a = new Team[n];   for (int i = 0; i < n; i++)    a[i] = new Team(nextInt(), nextInt());     Arrays.sort(a);   for (int i = 0; i < n;) {    int j = i;    while (j < n && a[j].compareTo(a[i]) == 0)     j++;    if (i <= k && k < j) {     out.println(j - i);     return;    }    i = j;   }  }  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 A().inp();  }  String nextToken() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return null;    }   }   return st.nextToken();  }  String nextString() {   try {    return br.readLine();   } catch (IOException e) {    eof = true;    return null;   }  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
6	public class Main {  static Scanner cin = new Scanner(System.in);  private int xs, ys, n;  private int[] x, y;  public static void main(String[] args) throws Exception {   new Main().run();  }  class Item implements Comparable<Item> {   int w, h, idx;   Item(int w, int h, int idx) {    this.w = w;    this.h = h;    this.idx = idx;   }   @Override   public int compareTo(Item o) {    if (this.w == o.w) {     return this.h - o.h;    }    return this.w - o.w;   }  }  private void run() throws Exception {   xs = cin.nextInt();   ys = cin.nextInt();   n = cin.nextInt();   x = new int[n + 1];   y = new int[n + 1];   for (int i = 0; i < n; i++) {    x[i] = cin.nextInt();    y[i] = cin.nextInt();   }   int[] res = new int[1 << n];   Arrays.fill(res, Integer.MAX_VALUE);   int[] ds = new int[n];   for (int i = 0; i < n; i++) {    ds[i] = (x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys);   }   int[][] d = new int[n + 1][n + 1];   int[] tr = new int[1 << n];   for (int i = 0; i < n; i++) {    for (int j = 0; j < n; j++) {     d[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);    }   }     res[0] = 0;   for (int i = 1; i < (1 << n); i++) {    for (int j = 0; j < n; j++) {     if (((i >> j) & 1) != 0) {      if (res[i - (1 << j)] + 2 * ds[j] < res[i]) {       res[i] = res[i - (1 << j)] + 2 * ds[j];       tr[i] = i - (1 << j);      }      for (int k = j + 1; k < n; k++) {       if (((i >> k) & 1) != 0) {        if (res[i - (1 << j) - (1 << k)] + ds[k] + ds[j] + d[k][j] < res[i]) {         res[i] = res[i - (1 << j) - (1 << k)] + ds[k] + ds[j] + d[k][j];         tr[i] = i - (1 << j) - (1 << k);        }       }      }      break;     }    }   }   System.out.println(res[(1 << n) - 1]);   int now = (1 << n) - 1;   while (now != 0) {    System.out.print("0 ");    int dif = now - tr[now];    for (int i = 0; i < n && dif != 0; i++) {     if (((dif >> i) & 1) != 0) {      System.out.print((i + 1) + " ");      dif -= (1 << i);     }    }    now=tr[now];   }   System.out.print("0");  } }
5	public class A{   void solve()throws Exception  {  int n=nextInt();  int[]a=new int[n];   for(int i=0;i<n;i++)    a[i]=nextInt();   Arrays.sort(a);   int[]res=new int[n];   for(int i=0;i<n;i++)   {    if(i==0)     res[i]=1;    else     res[i]=a[i-1];   }   if(a[n-1]==1)    res[n-1]=2;   for(int i=0;i<n;i++)   {    if(i==n-1)     writer.println(res[i]);    else     writer.print(res[i]+" ");   }   }    BufferedReader reader;  PrintWriter writer;  StringTokenizer stk;  void run()throws Exception  {   reader=new BufferedReader(new InputStreamReader(System.in));   stk=null;   writer=new PrintWriter(new PrintWriter(System.out));   solve();   reader.close();   writer.close();  }  int nextInt()throws Exception  {   return Integer.parseInt(nextToken());  }  long nextLong()throws Exception  {   return Long.parseLong(nextToken());  }  double nextDouble()throws Exception  {   return Double.parseDouble(nextToken());   }  String nextString()throws Exception  {   return nextToken();  }  String nextLine()throws Exception  {   return reader.readLine();  }  String nextToken()throws Exception  {   if(stk==null || !stk.hasMoreTokens())   {    stk=new StringTokenizer(nextLine());    return nextToken();   }   return stk.nextToken();  }  public static void main(String[]args) throws Exception  {   new A().run();  }  }
2	public class B { public static void main(String[] args){  FastScanner sc = new FastScanner();  long n = sc.nextLong();  int k = sc.nextInt();   if(n==1){  System.out.println(0);  return;  }  n=n-1;  int count = 0;  long nextK = k-1;  while(true){      if(nextK < 1 || (nextK <= 1 && n >1)){   System.out.println(-1);   return;  }    nextK = Math.min(n, nextK);  if(n==nextK){   System.out.println(count+1);   return;  }        long bSum = nextK * (nextK+1)/2;  long a = nextK;  long decrement = 1;  while(bSum - (a-1)*a/2 <= n && a>=1){   a-= decrement;   decrement *= 2;  }  a+=decrement/2;        count += nextK-a+1;    long nDecr = bSum-a*(a-1)/2;      n -= nDecr;  nextK = a-1;  if(n==0){   System.out.println(count);   return;  }  } }  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());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  } } }
5	public class Solution implements Runnable {   public void solve() throws Exception {  int n = nextInt();  int a [] = new int [n];  for (int i = 0 ;i < n; i++) {  a[i] = nextInt();  }  Arrays.sort(a);  if (n == 1) {  if (a[0] == 1) {   out.print(2);  } else {   out.print(1);  }  } else {  out.print(1);  for (int i = 1; i < n; i++) {   if (i == n-1 && a[i] == 1) {   out.print(" "+2);   } else {   out.print(" "+a[i-1]);   }  }  } }      BufferedReader in; PrintWriter out; StringTokenizer st;  long stime=0;  private String next() throws Exception {  while (st == null || !st.hasMoreElements())  st = new StringTokenizer(in.readLine());  return st.nextToken(); }  private int nextInt() throws Exception {  return Integer.parseInt(next()); }  private long nextLong() throws Exception {  return Long.parseLong(next()); }  private double nextDouble() throws Exception {  return Double.parseDouble(next()); }  public void run() {  try {    in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new OutputStreamWriter(System.out));  solve();  } catch (Exception ex) {  throw new RuntimeException(ex);  } finally {  out.close();  } }  public static void main(String[] args) throws Exception {  new Thread(null, new Solution(), "", 1 << 25).start(); }  }
4	public class P35C {  int n, m;  int [][]fire;  public P35C() throws FileNotFoundException {   Scanner in = new Scanner(new FileReader("input.txt"));   n = in.nextInt();   m = in.nextInt();   int k = in.nextInt();   fire = new int[k][2];   for (int i = 0; i < k; i++){    fire[i][0] = in.nextInt();    fire[i][1] = in.nextInt();   }   in.close();     int []last = new int[2];   int lastBurn = -1;   for (int i = 1; i <= n; i++){    for (int j = 1; j <= m; j++){     int burn = Integer.MAX_VALUE;     for (int l = 0; l < k; l++){      int burnAux = dist(i, j, fire[l][0], fire[l][1]);      burn = Math.min(burn, burnAux);     }     if(burn >= lastBurn){      lastBurn = burn;      last[0] = i;      last[1] = j;         }    }   }      PrintStream out = new java.io.PrintStream( "output.txt" );   out.print(last[0] + " " + last[1]);   out.close();  }    int dist(int x1, int y1, int x2, int y2){   return Math.abs(x2 - x1) + Math.abs(y2 - y1);  }   public static void main (String []args) throws FileNotFoundException{   new P35C();  } }
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); } }
3	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int N = Integer.parseInt(sc.next());   int[] a = new int[N];   int[] flag = new int[N];   int ans = 0;   for (int i=0;i<N;i++) {    a[i] = Integer.parseInt(sc.next());   }   Arrays.sort(a);   for (int i=0;i<N;i++) {    int used = 0;    for (int j=0;j<N;j++) {     if (flag[j]==1) {      continue;     } else {      if (a[j]%a[i]==0) {       used=1;       flag[j]=1;      }     }    }    if (used==1) {     ans++;    }   }   System.out.println(ans);  } }
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 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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
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());   }  } }
5	public class A implements Runnable {  String file = "input";   boolean TEST = System.getProperty("ONLINE_JUDGE") == null;   void solve() throws IOException  {   int n = nextInt();   int[] a = new int[n];   for(int i = 0; i < n; i++) a[i] = nextInt();   int[] b = a.clone();   sortInt(b);   int count = 0;   for(int i = 0; i < a.length; i++)    if(a[i] != b[i]) count++;   if(count == 0 || count == 2) out.println("YES");   else out.println("NO");  }   Random rnd = new Random();   void sortInt(int[] a)  {   sortInt(a, 0, a.length - 1);  }   void sortInt(int[] a, int from, int to)  {   if(from >= to) return;   int i = from - 1;   int p = rnd.nextInt(to - from + 1) + from;   int t = a[p]; a[p] = a[to]; a[to] = t;   for(int j = from; j < to; j++)    if(a[j] <= a[to])    {     i++;     t = a[i]; a[i] = a[j]; a[j] = t;    }   t = a[i + 1]; a[i + 1] = a[to]; a[to] = t;   sortInt(a, i + 2, to);   while(i >= 0 && a[i] == a[i + 1]) i--;   sortInt(a, from, i);    }   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());  }   long nextLong() throws IOException  {   return Long.parseLong(next());  }   double nextDouble() throws IOException  {   return Double.parseDouble(next());  }   void print(Object... o)  {   System.out.println(deepToString(o));  }   void gcj(Object o)  {   String s = String.valueOf(o);   out.println("Case #" + test + ": " + s);   System.out.println("Case #" + test + ": " + s);  }   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 A(), "", 1 << 22).start();  }   public void run()  {   try   {    init();    if(TEST)    {     int runs = nextInt();     for(int i = 0; i < runs; i++) solve();    }    else solve();    out.close();     }   catch(Exception e)   {    e.printStackTrace();    System.exit(1);   }  } }
1	public class Round42CC {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = Integer.parseInt(sc.nextLine());   String s = sc.nextLine();   int k = 0;   for (int i = 0; i < n; i++) {    if (s.charAt(i) == 'H') {     k++;    }   }   s = s + s.substring(0, k);   String ss = "";   int max = 0;   for (int i = 0; i < s.length() - k; i++) {    ss = s.substring(i, i + k);    int count = 0;    for (int j = 0; j < ss.length(); j++) {     if (ss.charAt(j) == 'H') {      count++;     }    }    if (count > max) {     max = count;    }   }     System.out.println(k - max);  } }
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(); }  String nextString() {  try {  return br.readLine();  } catch (IOException e) {  eof = true;  return null;  } }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
4	public class Main {  public static void main(String[] args) throws IOException  {   PrintWriter pw = new PrintWriter(new FileWriter("output.txt"));   Scanner in=new Scanner(new File("input.txt"));   int n,m,k;   n=in.nextInt();   m=in.nextInt();   k=in.nextInt();   Vector<Integer> vec=new Vector<Integer>();   Vector<Integer> temp=new Vector<Integer>();   boolean[][] mas=new boolean[n][m];   long time=System.currentTimeMillis();   for(int i=0;i<k;i++)   {    vec.add(in.nextInt()-1);    vec.add(in.nextInt()-1);    mas[vec.get(vec.size()-2)][vec.get(vec.size()-1)]=true;   }   int x,y;   x=y=0;   while(vec.size()!=0)   {    for(int i=0;i<vec.size();i+=2)    {     x=vec.get(i);     y=vec.get(i+1);     if(x>0 && !mas[x-1][y])     {      temp.add(x-1);      temp.add(y);      mas[x-1][y]=true;     }     if(x<n-1 && !mas[x+1][y])     {      temp.add(x+1);      temp.add(y);      mas[x+1][y]=true;     }     if(y>0 && !mas[x][y-1])     {      temp.add(x);      temp.add(y-1);      mas[x][y-1]=true;     }     if(y<m-1 && !mas[x][y+1])     {      temp.add(x);      temp.add(y+1);      mas[x][y+1]=true;     }    }    vec=temp;    temp=new Vector<Integer>();   }   pw.println((x+1)+" "+(y+1));   System.out.println(System.currentTimeMillis()-time);   in.close();   pw.close();  } }
4	public class CF_35C {  public static void main(String[] args) throws IOException{   BufferedReader f = new BufferedReader(new FileReader("input.txt"));   PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));   StringTokenizer st1 = new StringTokenizer(f.readLine());   int n = Integer.parseInt(st1.nextToken());   int m = Integer.parseInt(st1.nextToken());   boolean[][] visited = new boolean[n][m];   int k = Integer.parseInt(f.readLine());   LinkedList<state1> ll = new LinkedList<state1>();   StringTokenizer st = new StringTokenizer(f.readLine());   for(int i = 0; i < k; i++) {    int x = Integer.parseInt(st.nextToken());    int y = Integer.parseInt(st.nextToken());    ll.add(new state1(x - 1, y - 1));    visited[x - 1][y - 1] = true;   }   int lastx = 1;   int lasty = 1;   while(!ll.isEmpty()) {    state1 focus = ll.remove();    lastx = focus.x+1;    lasty = focus.y+1;        visited[focus.x][focus.y] = true;    if(focus.x+1 < n && !visited[focus.x+1][focus.y]) {     ll.add(new state1(focus.x+1, focus.y));     visited[focus.x+1][focus.y] = true;    }    if(focus.x-1 >= 0 && !visited[focus.x-1][focus.y]) {     ll.add(new state1(focus.x-1, focus.y));     visited[focus.x-1][focus.y] = true;    }    if(focus.y+1 < m && !visited[focus.x][focus.y+1]) {     ll.add(new state1(focus.x, focus.y+1));     visited[focus.x][focus.y+1] = true;    }    if(focus.y-1 >= 0 && !visited[focus.x][focus.y-1]) {     ll.add(new state1(focus.x, focus.y-1));     visited[focus.x][focus.y-1] = true;    }   }   out.println(lastx + " " + lasty);   out.close();  } } class state1 {  int x, y;  state1(int x, int y) {   this.x = x; this.y = y;  } }
6	public class TaskD implements Runnable { private InputReader in; private PrintWriter out; private int n; private int m; private boolean[][] e; private long[][] qp;  private 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;  }  public long readLong() {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  long res = 0;  do {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  } while (!isSpaceChar(c));  return res * sgn;  }  public String readString() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuffer res = new StringBuffer();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  private boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  private String readLine0() {  StringBuffer buf = new StringBuffer();  int c = read();  while (c != '\n' && c != -1) {   buf.appendCodePoint(c);   c = read();  }  return buf.toString();  }  public String readLine() {  String s = readLine0();  while (s.trim().length() == 0)   s = readLine0();  return s;  }  public String readLine(boolean ignoreEmptyLines) {  if (ignoreEmptyLines)   return readLine();  else   return readLine0();  }  public BigInteger readBigInteger() {  try {   return new BigInteger(readString());  } catch (NumberFormatException e) {   throw new InputMismatchException();  }  }  public char readCharacter() {  int c = read();  while (isSpaceChar(c))   c = read();  return (char) c;  }  public double readDouble() {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.') {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  if (c == '.') {   c = read();   double m = 1;   while (!isSpaceChar(c)) {   if (c < '0' || c > '9')    throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();   }  }  return res * sgn;  } }  public static void main(String[] args) {  new TaskD().run(); }  public TaskD() {     in = new InputReader(System.in);  out = new PrintWriter(System.out); }  public void run() {   n = in.readInt();  m = in.readInt();  e = new boolean[n][n];  for (int i = 0; i < m; i++) {  int a = in.readInt() - 1;  int b = in.readInt() - 1;  e[a][b] = e[b][a] = true;  }     int msk = (1 << n) - 1;  qp = new long[n - 1][1 << (n - 1)];  long ans = 0;  for (int i = n - 1; i >= 0; i--) {  msk -= (1 << i);  for (int k = 0; k < i; k++)   Arrays.fill(qp[k], 0, 1 << i, -1);  for (int j = 0; j < i; j++) {   if (e[i][j]) {   e[i][j] = e[j][i] = false;   ans += go(j, msk - (1 << j), i);   e[i][j] = e[j][i] = true;   }  }  }  out.println(ans / 2);  out.close(); }  private long go(int v, int msk, int u) {  if (qp[v][msk] != -1)  return qp[v][msk];  qp[v][msk] = 0;  if (e[v][u])  qp[v][msk] = 1;  for (int i = 0; i < u; i++) {  if (e[v][i] && ((msk >> i) & 1) != 0)   qp[v][msk] += go(i, msk - (1 << i), u);  }  return qp[v][msk]; } }
1	public class Main{  final long mod = (int)1e9+7, IINF = (long)1e19;  final int MAX = (int)1e6+1, MX = (int)1e7+1, INF = (int)1e9, root = 3;  DecimalFormat df = new DecimalFormat("0.0000000000000");  double eps = 1e-9;  FastReader in;  PrintWriter out;  static boolean multipleTC = false, memory = false;  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();  }  void run() throws Exception{   in = new FastReader();   out = new PrintWriter(System.out);   for(int i = 1, t = (multipleTC)?ni():1; i<=t; i++)solve(i);   out.flush();    out.close();  }   void solve(int TC)throws Exception{   int n = ni();   int[] f1 = new int[9], f2 = new int[9];   MyHashSet<String> set = new MyHashSet<>();   for(int i = 0; i< n; i++){    String s = n();    set.add(s);    f1[s.length()]++;   }   int[] f = new int[4];   for(int i = 0; i< n; i++){    String s = n();    if(set.remove(s))continue;    else f[s.length()-1]++;   }   int ans = 0;   for(int i = 0; i< 4; i++)ans+=f[i];   pn(ans);  }   class MyHashSet<T>{   private int size;   private HashMap<T, Integer> map;   public MyHashSet(){    size = 0;    map = new HashMap<>();   }   public int size(){return size;}   public void add(T t){    size++;    map.put(t, map.getOrDefault(t, 0)+1);   }   public int cnt(T t){return map.getOrDefault(t,0);}   public boolean remove(T t){    if(!map.containsKey(t))return false;    size--;    int c = map.get(t);    if(c==1)map.remove(t);    else map.put(t, c-1);    return true;   }  }   int[] reverse(int[] a){   int[] o = new int[a.length];   for(int i = 0; i< a.length; i++)o[i] = a[a.length-i-1];   return o;   }  int[] sort(int[] a){   if(a.length==1)return a;   int mid = a.length/2;   int[] b = sort(Arrays.copyOfRange(a,0,mid)), c = sort(Arrays.copyOfRange(a,mid,a.length));   for(int i = 0, j = 0, k = 0; i< a.length; i++){    if(j<b.length && k<c.length){     if(b[j]<c[k])a[i] = b[j++];     else a[i] = c[k++];    }else if(j<b.length)a[i] = b[j++];    else a[i] = c[k++];   }   return a;  }  long[] sort(long[] a){   if(a.length==1)return a;   int mid = a.length/2;   long[] b = sort(Arrays.copyOfRange(a,0,mid)), c = sort(Arrays.copyOfRange(a,mid,a.length));   for(int i = 0, j = 0, k = 0; i< a.length; i++){    if(j<b.length && k<c.length){     if(b[j]<c[k])a[i] = b[j++];     else a[i] = c[k++];    }else if(j<b.length)a[i] = b[j++];    else a[i] = c[k++];   }   return a;  }  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 bitcount(long n){return (n==0)?0:(1+bitcount(n&(n-1)));}  void p(Object o){out.print(o);}  void pn(Object o){out.println(o);}  void pni(Object o){out.println(o);out.flush();}  String n(){return in.next();}  String nln(){return in.nextLine();}  int ni(){return Integer.parseInt(in.next());}  long nl(){return Long.parseLong(in.next());}  double nd(){return Double.parseDouble(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(){    while (st == null || !st.hasMoreElements()){     try{      st = new StringTokenizer(br.readLine());     }catch (IOException e){      e.printStackTrace();     }    }    return st.nextToken();   }   String nextLine(){    String str = "";    try{     str = br.readLine();    }catch (IOException e){     e.printStackTrace();    }     return str;   }  } }
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]+" ");  }  }
1	public class A {  private static int[] prime = 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   };  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int k = sc.nextInt();   for (int i=0;i<prime.length-1;i++) {  if ((prime[i]+prime[i+1]+1) > n || k == 0)   break;  if (isPrime(prime[i]+prime[i+1]+1))   k--;  }   if (k == 0)  outnl("YES");  else  outnl("NO"); }  public static boolean isPrime(int x) {  int i=0;  while (i<prime.length)  if (prime[i++] == x)   return true;  return false; }  private static void debug(Object... os) { System.out.println(deepToString(os)); } private static void outnl(String out) { System.out.println(out); }  }
1	public class Main{  public static void main(String args[]){  Scanner sc=new Scanner(System.in);  int n=sc.nextInt();  int a[]=new int[n];  for(int i=0;i<n;i++)  a[i]=sc.nextInt();  Arrays.sort(a);   int t=1,c=0;  for(int i=1;i<n;i++){   if(a[i]==a[i-1])   {    if(i-2>=0&&a[i-2]==a[i-1]-1){     System.out.println("cslnb");     return;    }    c++;   }   if(a[i]==a[i-1]&&a[i]==0){   System.out.println("cslnb");   return;   }  }  if(c>1)  {   System.out.println("cslnb");   return;  }  for(int i=0;i<n;i++){   if((a[i]-i)%2!=0)   t=t^1;  }  if(t==1)  System.out.println("cslnb");  else  System.out.println("sjfnb");      }  }
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] + " ");  }   } }
3	public class problemA {  public static void main(String[] args) {   Scanner scan = new Scanner(System.in);   int n = scan.nextInt();   int[] numbs = new int[n];   int[] smallest_color = new int[n];   for(int i = 0; i < n;i++){    numbs[i] = scan.nextInt();   }   Arrays.sort(numbs);   int count = 0;   for(int i =0; i < n; i++){    for(int j=0; j <n;j++ ){     if(smallest_color[j] == 0){      count++;      smallest_color[j] = numbs[i];      break;     }     if(numbs[i] % smallest_color[j] == 0){      break;     }    }   }   System.out.println(count);  } }
4	public class D1517 {  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 m = sc.nextInt();  int k = sc.nextInt();  int[][] costRight = new int[n][m - 1];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m - 1; j++) {   costRight[i][j] = sc.nextInt();  }  }  int[][] costDown = new int[n - 1][m];  for (int i = 0; i < n - 1; i++) {  for (int j = 0; j < m; j++) {   costDown[i][j] = sc.nextInt();  }  }  if (k % 2 == 1) {  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   pw.print(-1 + " ");   }   pw.println();  }  pw.close();  return;  }  int[][][] dp = new int[k + 1][n][m];  for (int w = 2; w <= k; w += 2) {  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   dp[w][i][j] = (int) 1e9;   if (i + 1 < n)    dp[w][i][j] = Math.min(dp[w][i][j], 2 * costDown[i][j] + dp[w - 2][i + 1][j]);   if (i - 1 >= 0)    dp[w][i][j] = Math.min(dp[w][i][j], 2 * costDown[i - 1][j] + dp[w - 2][i - 1][j]);   if (j + 1 < m)    dp[w][i][j] = Math.min(dp[w][i][j], 2 * costRight[i][j] + dp[w - 2][i][j + 1]);   if (j - 1 >= 0)    dp[w][i][j] = Math.min(dp[w][i][j], 2 * costRight[i][j - 1] + dp[w - 2][i][j - 1]);   }  }  }  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   pw.print(dp[k][i][j] + " ");  }  pw.println();  }  pw.close(); }  static class Scanner {  BufferedReader br;  StringTokenizer st;  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 int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public int[] nextIntArr(int n) throws IOException {  int[] arr = new int[n];  for (int i = 0; i < n; i++) {   arr[i] = Integer.parseInt(next());  }  return arr;  }  } }
1	public class Main implements Runnable {   final String filename="";   public void solve() throws Exception {   int n = iread(), k = iread();   boolean[] f = new boolean[10000];   int prev = -1;   cycle:for (int i=2; i<=n; i++)   {    for (int j=2; j*j<=i; j++)     if (i%j==0)      continue cycle;    if (prev!=-1)     f[i+prev+1] = true;    if (f[i])     k--;    prev = i;   }   if (k<=0)    out.write("YES\n");   else out.write("NO\n");  }   public void run() {   try {    in = new BufferedReader(new InputStreamReader(System.in));    out = new BufferedWriter(new OutputStreamWriter(System.out));     solve();    out.flush();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }   public int iread() throws Exception {   return Integer.parseInt(readword());  }  public double dread() throws Exception {   return Double.parseDouble(readword());  }  public long lread() throws Exception {   return Long.parseLong(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(new Main()).start();    } }
5	public class A {  public static void main(String[] args) {  Scanner in=new Scanner(System.in);  int n=in.nextInt();  int t=in.nextInt();  pt[] P=new pt[n];  for (int i=0; i<n; ++i)  P[i]=new pt(in.nextInt(), in.nextInt());  Arrays.sort(P);  int res=2;  for (int i=0; i+1<n; ++i)  {  double d=P[i+1].x-P[i].x-P[i+1].a/2.-P[i].a/2.;  if (Math.abs(d-t) <= 1e-11)   ++res;  else if (d>t)   res+=2;  }  System.out.println(res); }  } class pt implements Comparable<pt> { int x,a; pt(int x, int a) {  this.x=x;  this.a=a; }  public int compareTo(pt o) {  return x-o.x; } }
6	public class Main {  static long[][] memo; static boolean[][] adjMat; static int N, endNode; static ArrayList<Integer>[] bits;  static long dp(int idx, int msk)  {  if(memo[idx][msk] != -1)  return memo[idx][msk];  long ret = adjMat[idx][endNode] ? 1 : 0;  for(int i = 0, sz = bits[msk].size(); i < sz; ++i)  {  int j = bits[msk].get(i);  if(j > endNode)   break;  if(adjMat[idx][j])   ret += dp(j, msk | 1 << j);  }  return memo[idx][msk] = ret; }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  N = sc.nextInt();  adjMat = new boolean[N][N];   bits = new ArrayList[1 << N];  for(int i = 0; i < 1 << N; ++i)  {  bits[i] = new ArrayList<>(1);  for(int j = 0; j < N; ++j)   if((i & 1 << j) == 0)   bits[i].add(j);  }  int M = sc.nextInt();  while(M-->0)  {  int u = sc.nextInt() - 1, v = sc.nextInt() - 1;  adjMat[u][v] = adjMat[v][u] = true;  }  long ans = 0;  for(int i = N; i > 1; --i)  {  memo = new long[i][1 << i];  for(long[] x: memo)   Arrays.fill(x, -1);  ans += dp(endNode = i - 1, 1 << endNode);  }  for(int i = 0; i < N; ++i)  for(int j = i + 1; j < N; ++j)   if(adjMat[i][j])   --ans;  out.println(ans >> 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 int nextInt() throws IOException {return Integer.parseInt(next());}  public long nextLong() throws IOException {return Long.parseLong(next());}  public String nextLine() throws IOException {return br.readLine();}  public double nextDouble() throws IOException { return Double.parseDouble(next()); }  public boolean ready() throws IOException {return br.ready();}  } }
3	public class Main {     static BufferedReader in;   static PrintStream out;   static StringTokenizer tok;     @SuppressWarnings("empty-statement") public static void main(String[] args) throws NumberFormatException, IOException, Exception {    in = new BufferedReader(new InputStreamReader(System.in));       out = System.out;       long mod = (long)1e9 + 7;    int n = nextInt();    long[][] dp = new long[n+1][n+1];    Character[] line = new Character[n+1];    line[0] = 'a';    for (int i = 1; i <= n; i++) {     line[i] = nextToken().charAt(0);     if(line[i-1] == 'f')     {      for (int j = 0; j < i; j++) {       dp[i][j+1] = dp[i-1][j];      }     }     else if(line[i-1] == 's')     {      long temp = 0;      for(int j = i; j >=0; j--)      {       temp = (temp + dp[i-1][j]) % mod;       dp[i][j] = temp;      }     }     else dp[i][0] = 1;    }    long total = 0;    for(int j = 0; j <= n; j++)     total = (total + dp[n][j]) % mod;    out.println(total);   }   static String nextToken() throws IOException   {     String line = "";     while(tok == null || !tok.hasMoreTokens()) {       if((line = in.readLine()) != null)         tok = new StringTokenizer(line);       else         return null;     }     return tok.nextToken();   }   static int nextInt() throws NumberFormatException, IOException   {     return Integer.parseInt(nextToken());   }   static long nextLong() throws NumberFormatException, IOException   {     return Long.parseLong(nextToken());   } }
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);  }  }  @Override  public int compareTo(Column col) {  return max - col.max;  } } }
1	public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n= sc.nextInt(); int x= (int)Math.sqrt(n) ; int a[] = new int[n+5]; for(int i=1,o=n,j;i<=n;i+=x) for(j=(int)Math.min(i+x-1,n);j>=i;a[j--]=o--); for(int i=1;i<=n;i++)System.out.print(a[i]+" "); System.out.println();  } }
1	public class B {  static FastScanner fs;  public static void main(String[] args) {   fs=new FastScanner();   int t = fs.nextInt();   while (t-->0)    solve();  }  public static void solve() {   int n = fs.nextInt()*2;   int sq = (int)Math.sqrt(n);   int sq2 = (int)Math.sqrt(n/2);   if (sq*sq==n) System.out.println("YES");   else if (sq2*sq2==n/2.0 && sq2%2==0) System.out.println("YES");   else System.out.println("NO");  }  static int gcd(int a, int b) {   if (a==0) return b;   return gcd(b%a, a);  }  static void ruffleSort(int[] a) {   int n=a.length;   for (int i=0; i<n; i++) {    int oi=random.nextInt(n), temp=a[oi];    a[oi]=a[i]; a[i]=temp;   }   Arrays.sort(a);  }  static final Random random =new Random();  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());   }   int[] readArray(int n) {    int[] a=new int[n];    for (int i=0; i<n; i++) a[i]=nextInt();    return a;   }   long nextLong() {    return Long.parseLong(next());   }  }  static int[] reverse(int[] a) {   int n=a.length;   int[] res=new int[n];   for (int i=0; i<n; i++) res[i]=a[n-1-i];   return res;  } }
5	public class Main{ public static void main(String[] args){  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  TreeSet<Integer> set = new TreeSet<Integer>();  for(int i=0;i<n;i++){  set.add(sc.nextInt());  }  if(set.size() >= 2)  System.out.println(set.toArray()[1]);  else  System.out.println("NO"); } }
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 ques3 { 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 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 boolean isSpaceChar(int c) {    if (filter != null) {     return filter.isSpaceChar(c);    }    return isWhitespace(c);   }    public interface SpaceCharFilter {     public boolean isSpaceChar(int ch);   }    public String next() {    return nextString();   }     public char nextChar(){   int c=read();   while (isSpaceChar(c)) {     c = read();    }   return (char)c;   }    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 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() {    return Long.parseLong(nextString());   }    public Double nextDouble() {    return Double.parseDouble(nextString());   }  }  public static void main(String[] args) {  InputReader sc=new InputReader(System.in);  long n=sc.nextLong();  long s=sc.nextLong();   long start=0,end=n;  while(start<end)  {  long mid=(start+end)/2;  if(func(mid)>=s)   end=mid;  else   start=mid+1;  }  if(func(start)>=s)  System.out.println(n-start+1);  else  System.out.println(0); }  public static long func(long n) {  long temp=n;  int sum=0;  while(temp>0)  {  sum+=temp%10;  temp/=10;  }  return n-sum; } }
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);   G1playlist solver = new G1playlist();   solver.solve(1, in, out);   out.close();  }  static class G1playlist {   int mod = 1000000007;   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    int T = in.scanInt();    int[][] song = new int[n][2];    for (int i = 0; i < n; i++) {     song[i][0] = in.scanInt();     song[i][1] = in.scanInt() - 1;    }    int[][][] dp = new int[T + 1][(1 << n)][3];    for (int i = 0; i < n; i++)     if (song[i][0] <= T) {      dp[song[i][0]][(1 << i)][song[i][1]] = 1;     }    for (int t = 0; t <= T; t++) {     for (int i = 0; i < (1 << n); i++) {      for (int j = 0; j < 3; j++) {       if (dp[t][i][j] == 0) continue;       for (int k = 0; k < n; k++) {        if (((1 << k) & i) == 0 && t + song[k][0] <= T && song[k][1] != j)         dp[t + song[k][0]][(1 << k) | i][song[k][1]] = (dp[t + song[k][0]][(1 << k) | i][song[k][1]] + dp[t][i][j]) % mod;       }      }     }    }    long ans = 0;    for (int i = 0; i < (1 << n); i++) {     for (int j = 0; j < 3; j++) {      ans = (ans + dp[T][i][j]) % mod;     }    }    out.println(ans);   }  }  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 test {  public static void main(String[] args) {   Scanner input = new Scanner(System.in);   String num = input.nextLine();   System.out.println("25");  } }
6	public class MotherOfDragons {  public static void main(String[] args) {   FastScanner scanner = new FastScanner();   PrintWriter out = new PrintWriter(System.out, false);   int n = scanner.nextInt();   double k = scanner.nextInt();   long[] graph = new long[n];   for(Integer i = 0; i < n; i++) {    for(Integer j =0; j < n; j++) {     Integer val = scanner.nextInt();     if (val.equals(1) || i.equals(j)) {   graph[i] |= 1L << j;   }    }   }   int szLeft = n/2;   int szRight = n - szLeft;   int[] dp = new int[1 << szLeft];   int maxMask = 1 << szLeft;   for(int mask = 1; mask <maxMask; mask++) {    int curMask = mask;    for(int j = 0; j < szLeft; j++) {     if (((1 << j) & mask) > 0) {      curMask &= graph[j + szRight] >> szRight;      dp[mask] = Math.max(dp[mask], dp[mask ^ (1 << j)]);     }    }    if (mask == curMask) {     dp[mask] = Math.max(dp[mask],Integer.bitCount(mask));    }   }   int ans = 0;   int rmaxMask = 1 << szRight;   for(int mask = 0; mask < rmaxMask; mask++) {    int curMask = mask;    int oMask = maxMask -1;    for(int j = 0; j < szRight; j++) {     if (((1 << j) & mask) > 0) {      curMask &= (graph[j] & (rmaxMask-1));      oMask &= graph[j] >> szRight;     }    }    if (curMask != mask) continue;    ans = Math.max(ans, Integer.bitCount(mask) + dp[oMask]);   }   k/=ans;   out.println(k * k * (ans * (ans-1))/2);   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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String readNextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
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());  }  long nextLong() throws IOException {   return Long.parseLong(next());  }  final int MOD = 1000 * 1000 * 1000 + 7;  int sum(int a, int b) {   a += b;   return a >= MOD ? a - MOD : a;  }  @SuppressWarnings("unchecked")  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();  } }
6	public class Main {  PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));  private void solution() throws IOException {  int sx = in.nextInt();  int sy = in.nextInt();  int n = in.nextInt();  int[] x = new int[n];  int[] y = new int[n];  for (int i = 0; i < n; ++i) {  x[i] = in.nextInt();  y[i] = in.nextInt();  }  int[] dp = new int[1 << n];  int[] prev = new int[1 << n];  Arrays.fill(dp, Integer.MAX_VALUE / 2);  dp[0] = 0;  prev[0] = -1;  for (int mask = 0; mask < (1 << n); ++mask) {  if (dp[mask] != Integer.MAX_VALUE / 2) {   for (int next = 0; next < n; ++next) {   if (((mask >> next) & 1) == 0) {    int nmask = mask | (1 << next);    int val = dp[mask] + 2 * getDist(sx, sy, x[next], y[next]);    if (dp[nmask] > val) {    dp[nmask] = val;    prev[nmask] = mask;    }    for (int next2 = next + 1; next2 < n; ++next2) {    if (((nmask >> next2) & 1) == 0) {     int nnmask = nmask | (1 << next2);     int nval = dp[mask] + getDist(sx, sy, x[next], y[next])        + getDist(x[next], y[next], x[next2], y[next2])       + getDist(x[next2], y[next2], sx, sy);     if (dp[nnmask] > nval) {     dp[nnmask] = nval;     prev[nnmask] = mask;     }    }    }    break;   }   }  }  }  List<Integer> res = new ArrayList<Integer>();  res.add(0);  int mask = (1 << n) - 1;  while (mask > 0) {  for (int i = 0; i < n; ++i) {   if (((prev[mask] >> i) & 1) == 0 && ((mask >> i) & 1) == 1) {   res.add(i + 1);   }  }  res.add(0);  mask = prev[mask];  }  Collections.reverse(res);  out.println(dp[(1 << n) - 1]);  for (int i = 0; i < res.size(); ++i) {  if (i != 0) {   out.print(" ");  }  out.print(res.get(i));  }  out.println();  out.flush(); }  private int getDist(int x1, int y1, int x2, int y2) {  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); }  private class Scanner {  private StringTokenizer tokenizer;  private BufferedReader reader;  public Scanner(Reader in) {  reader = new BufferedReader(in);  tokenizer = new StringTokenizer("");  }  public boolean hasNext() throws IOException {  while (!tokenizer.hasMoreTokens()) {   String tmp = reader.readLine();   if (tmp == null)   return false;   tokenizer = new StringTokenizer(tmp);  }  return true;  }  public String next() throws IOException {  hasNext();  return tokenizer.nextToken();  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  } }  public static void main(String[] args) throws IOException {  new Main().solution(); } }
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(),m=in.nextInt(),k=in.nextInt();   int ans=-1;   int i;   int a[]=new int[n];   for(i=0;i<n;i++)    a[i]=in.nextInt();   Arrays.sort(a);   int p=k,c=0;   for(i=n-1;i>=0;i--)   {    if(p>=m)     break;    p+=a[i]-1;    c++;   }   if(p>=m)    out.printLine(c);   else out.printLine(-1);  } } 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());  }  } 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 {  private FastScanner in;  private PrintWriter out;  private void solve() throws IOException {   solveC();  }  private void solveA() throws IOException {   HashSet<Character> set = new HashSet<>();   for (char c : new char[]{'a', 'e', 'i', 'o', 'u', '1', '3', '5', '7', '9'})    set.add(c);   int cnt = 0;   for (char c : in.nextLine().toCharArray())    if (set.contains(c))     cnt++;   out.println(cnt);  }  int n, m, cl;  char a[][];  int[] b;  int fromi, fromj, toi, toj;  private void solveB() throws IOException {   n = in.nextInt();   m = in.nextInt();   char[] c;   a = new char[n][m];   for (int i = 0; i < n; i++) {    a[i] = in.next().toCharArray();   }   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     if (a[i][j] == 'S') {      fromi = i;      fromj = j;     }     if (a[i][j] == 'E') {      toi = i;      toj = j;     }    }   }   c = in.next().toCharArray();   cl = c.length;   b = new int[cl];   for (int i = 0; i < cl; i++) {    b[i] = c[i] - '0';   }   ArrayList<Long> ar1 = new ArrayList<>(), ar2 = new ArrayList<>(), ar3 = new ArrayList<>(), ar4 = new ArrayList<>();   ar1.add((long) 12);   ar1.add((long) 10);   ar1.add((long) 01);   ar1.add((long) 21);   long[] str = new long[4];   int ans = 0;   for (long i : ar1) {    str[0] = i;    ar2.clear();    ar2.addAll(ar1);    ar2.remove(i);    for (long j : ar2) {     str[1] = j;     ar3.clear();     ar3.addAll(ar2);     ar3.remove(j);     for (long k : ar3) {      str[2] = k;      ar4.clear();      ar4.addAll(ar3);      ar4.remove(k);      str[3] = ar4.get(0);      if (bfs(str))       ans++;     }    }   }   out.println(ans);  }  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();  }  private void solveD() throws IOException {  }  private void solveE() throws IOException {  }  private void solveF() throws IOException {  }  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();   }   boolean hasNext() throws IOException {    return br.ready() || (st != null && st.hasMoreTokens());   }   int nextInt() throws IOException {    return Integer.parseInt(next());   }   long nextLong() throws IOException {    return Long.parseLong(next());   }   double nextDouble() throws IOException {    return Double.parseDouble(next());   }   String nextLine() throws IOException {    return br.readLine();   }   boolean hasNextLine() throws IOException {    return br.ready();   }  }  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();  } }
3	public class Main {  private static 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() {  @Override  public void run() {   long start = System.currentTimeMillis();   String debug = args.length > 0 ? args[0] : null;   if (debug != null) {   try {    is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));   } catch (Exception e) {    throw new RuntimeException(e);   }   }   reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);   solve();   out.flush();   tr((System.currentTimeMillis() - start) + "ms");  }  }, "", 64000000).start(); }  private static java.io.InputStream is = System.in; private static java.io.PrintWriter out = new java.io.PrintWriter(System.out); private static java.util.StringTokenizer tokenizer = null; private static 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(); }  private static double nd() {  return Double.parseDouble(next()); }  private static long nl() {  return Long.parseLong(next()); }  private static int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = ni();  return a; }  private static char[] ns() {  return next().toCharArray(); }  private static long[] nal(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)  a[i] = nl();  return a; }  private static int[][] ntable(int n, int m) {  int[][] table = new int[n][m];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   table[i][j] = ni();  }  }  return table; }  private static int[][] nlist(int n, int m) {  int[][] table = new int[m][n];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   table[j][i] = ni();  }  }  return table; }  private static int ni() {  return Integer.parseInt(next()); }  private static void tr(Object... o) {  if (is != System.in)  System.out.println(java.util.Arrays.deepToString(o)); } }
1	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)));  int n = nextInt();  int d = nextInt();  int[]x = new int[n];  for (int i = 0; i < n; i++) {  x[i] = nextInt();  }  int ans = 2;  for (int i = 1; i < n; i++) {  if (x[i]-x[i-1]==2*d)   ans++;  else if (x[i]-x[i-1] > 2*d)   ans += 2;  }  System.out.println(ans);  pw.close(); } private static int nextInt() throws IOException {  return Integer.parseInt(next()); } private static long nextLong() throws IOException {  return Long.parseLong(next()); } private static double nextDouble() throws IOException {  return Double.parseDouble(next()); } private static String next() throws IOException {  while (st==null || !st.hasMoreTokens())  st = new StringTokenizer(br.readLine());  return st.nextToken(); } }
1	public class Main {  static class Task {   void solve(int test, FastScanner in, PrintWriter out) throws IOException {    int n = in.nextInt();    int d = in.nextInt();    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = in.nextInt();    }    Arrays.sort(a);    int ans = 2;    for (int i = 0; i < n - 1; i++) {     if (a[i + 1] - d > a[i] + d) {      ans += 2;     } else if (a[i + 1] - d >= a[i] + d) {      ans++;     }    }    out.println(ans);   }  }  public static void main(String[] args) throws IOException {   FastScanner in = new FastScanner(System.in);   PrintWriter out = new PrintWriter(System.out);    new Task().solve(1, in, out);   out.close();  }  static class FastScanner {   BufferedReader br;   StringTokenizer token;   public FastScanner(InputStream is) {    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 (token == null || !token.hasMoreTokens()) {     try {      token = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return token.nextToken();   }   public int nextInt() {    return Integer.parseInt(nextToken());   }   public long nextLong() {    return Long.parseLong(nextToken());   }   public double nextDouble() {    return Double.parseDouble(nextToken());   }  } }
3	public class D {  static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) {  boolean even = true;  int n = in.nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = in.nextInt();  for (int j = 0; j < i; j++) {   if (a[j] > a[i]) {   even = !even;   }  }  }  int m = in.nextInt();  for (int i = 0; i < m; i++) {  if ((1 - in.nextInt() + in.nextInt()) / 2 % 2 == 1) {   even = !even;  }  if (even)   out.println("even");  else   out.println("odd");  }  finish(); }  public static void finish() {  out.close();  in.close();  System.exit(0); }  static class InputReader implements Iterator<String>, Closeable {     private BufferedReader r;  private String line;  private StringTokenizer st;  private String token;  public InputReader(InputStream i) {  r = new BufferedReader(new InputStreamReader(i));  }  public boolean hasNext() {  return peekToken() != null;  }  public int nextInt() {  return Integer.parseInt(nextToken());  }  public double nextDouble() {  return Double.parseDouble(nextToken());  }  public long nextLong() {  return Long.parseLong(nextToken());  }  public String next() {  return nextToken();  }   public String nextLine() {  try {   line = r.readLine();  } catch (IOException e) {   line = null;  }  token = null;  st = null;  return line;  }   public void close() {  try {   r.close();  } catch (IOException e) {  }  }  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;  }   } }
6	public class Main2 {  static int mod = 1000000007;  static FastScanner scanner;   public static void main(String[] args) {   scanner = new FastScanner();   int n = scanner.nextInt();   int T = scanner.nextInt();   int[][] songs = new int[n][2];   for (int i = 0; i < n; i++) {    songs[i][0] = scanner.nextInt();    songs[i][1] = scanner.nextInt() - 1;   }   int[] mapping = new int[65536];   int mask = 1;   for (int k = 0; k < n; k++) {    for (int i = 1; i < mapping.length; i++) {     if ((i & mask) != 0) mapping[i] += songs[k][0];    }    mask <<= 1;   }   int[][][] dp = new int[17][65536][3];   mask = 1;   for (int i = 0; i < n; i++) {    dp[1][mask][songs[i][1]] = 1;    mask <<= 1;   }   for (int i = 1; i < n; i++) {    mask = 1;    for (int k = 0; k < n; k++) {     int cg = songs[k][1];     int g1,g2;     if (cg == 0) {g1 = 1; g2 = 2;}     else if (cg == 1) {g1 = 0; g2 = 2;}     else {g1 = 0; g2 = 1;}     for (int j = 1; j < 65536; j++) {      if ((j & mask) != 0) continue;      dp[i + 1][j | mask][cg] = (dp[i + 1][j | mask][cg] + (dp[i][j][g1] + dp[i][j][g2]) % mod) % mod;     }     mask <<= 1;    }   }   int res = 0;   for (int k = 0; k < 17; k++)   for (int i = 1; i < 65536; i++) {    if (mapping[i] == T) res = (res + dp[k][i][0] + dp[k][i][1] + dp[k][i][2]) % mod;   }   System.out.println(res);  }  static long test(long[] b, long c, int maxSkipped, int startWith) {   int skipped = 0;   long lastSkipped = b[0];   for (int i = startWith; i < b.length; i++) {    long expected = b[0] + c * (i - skipped);    if (b[i] != expected) {     skipped++;     lastSkipped = b[i];     if (skipped > maxSkipped) {      return Long.MAX_VALUE;     }    }   }   return lastSkipped;  }  static boolean test2(long[] b, long c) {   for (int i = 1; i < b.length; i++) {    long expected = b[1] + c * (i - 1);    if (b[i] != expected) {     return false;    }   }   return true;  }    static class WithIdx implements Comparable<WithIdx> {   int val;   int idx;   public WithIdx(int val, int idx) {    this.val = val;    this.idx = idx;   }   @Override   public int compareTo(WithIdx o) {    if (val == o.val) {     return Integer.compare(idx, o.idx);    }    return -Integer.compare(val, o.val);   }  }  public static class FastScanner {   BufferedReader br;   StringTokenizer st;   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();   }   String nextLine() {    try {     return br.readLine();    } catch (Exception e) {     e.printStackTrace();     throw new RuntimeException();    }   }   int nextInt() {    return Integer.parseInt(nextToken());   }   long nextLong() {    return Long.parseLong(nextToken());   }   double nextDouble() {    return Double.parseDouble(nextToken());   }   int[] nextIntArray(int n) {    int[] res = new int[n];    for (int i = 0; i < n; i++) res[i] = nextInt();    return res;   }   long[] nextLongArray(int n) {    long[] res = new long[n];    for (int i = 0; i < n; i++) res[i] = nextLong();    return res;   }   String[] nextStringArray(int n) {    String[] res = new String[n];    for (int i = 0; i < n; i++) res[i] = nextToken();    return res;   }  }  static class PrefixSums {   long[] sums;   public PrefixSums(long[] sums) {    this.sums = sums;   }   public long sum(int fromInclusive, int toExclusive) {    if (fromInclusive > toExclusive) throw new IllegalArgumentException("Wrong value");    return sums[toExclusive] - sums[fromInclusive];   }   public static PrefixSums of(int[] ar) {    long[] sums = new long[ar.length + 1];    for (int i = 1; i <= ar.length; i++) {     sums[i] = sums[i - 1] + ar[i - 1];    }    return new PrefixSums(sums);   }   public static PrefixSums of(long[] ar) {    long[] sums = new long[ar.length + 1];    for (int i = 1; i <= ar.length; i++) {     sums[i] = sums[i - 1] + ar[i - 1];    }    return new PrefixSums(sums);   }  }  static class ADUtils {   static void sort(int[] ar) {    Random rnd = ThreadLocalRandom.current();    for (int i = ar.length - 1; i > 0; i--)    {     int index = rnd.nextInt(i + 1);         int a = ar[index];     ar[index] = ar[i];     ar[i] = a;    }    Arrays.sort(ar);   }   static void reverse(int[] arr) {    int last = arr.length / 2;    for (int i = 0; i < last; i++) {     int tmp = arr[i];     arr[i] = arr[arr.length - 1 - i];     arr[arr.length - 1 - i] = tmp;    }   }   static void sort(long[] ar) {    Random rnd = ThreadLocalRandom.current();    for (int i = ar.length - 1; i > 0; i--)    {     int index = rnd.nextInt(i + 1);         long a = ar[index];     ar[index] = ar[i];     ar[i] = a;    }    Arrays.sort(ar);   }  }  static class MathUtils {   static long[] FIRST_PRIMES = {     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};   static long[] primes(int to) {    long[] all = new long[to + 1];    long[] primes = new long[to + 1];    all[1] = 1;    int primesLength = 0;    for (int i = 2; i <= to; i ++) {     if (all[i] == 0) {      primes[primesLength++] = i;      all[i] = i;     }     for (int j = 0; j < primesLength && i * primes[j] <= to && all[i] >= primes[j]; j++) {      all[(int) (i * primes[j])] = primes[j];     }    }    return Arrays.copyOf(primes, primesLength);   }   static long modpow(long b, long e, long m) {    long result = 1;    while (e > 0) {     if ((e & 1) == 1) {           result = (result * b) % m;     }     b = (b * b) % m;     e >>= 1;    }    return result;   }   static long submod(long x, long y, long m) {    return (x - y + m) % m;   }  } }
2	public class C {  static long x, k; static long mod = 1000000007; public static void main(String[] args) {  JS in = new JS();  x = in.nextLong();  k = in.nextLong();   if(x==0) {  System.out.println(0);  return;  }   long c = pow(2,k);  if(c==0) c = mod;  long sub = c-1;   long low = ((c*(x%mod))%mod - sub);  while(low < 0) low += mod;  long res = ((low*2)%mod + sub)%mod;   System.out.println(res);    }  static long pow(long a, long p) {  if(p==0) return 1;  if(p==1) return a;  if(p%2==0) {  long res = pow(a,p/2)%mod;  return (res*res)%mod;  }  else {  return (pow(a,p-1)*a)%mod;  }   }  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;  }   public double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }   public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }   public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  } } }
0	public class K603 {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);     long a=sc.nextLong();   long b=sc.nextLong();     if(b-a<2){    System.out.println(-1);   }else if(b-a==2 && a%2==1){    System.out.println(-1);   }else if(b-a==2 && a%2==0){    System.out.println(a+" "+(a+1)+" "+(a+2));   }else{    if(a%2==0){     System.out.println(a+" "+(a+1)+" "+(a+2));    }else{     System.out.println((a+1)+" "+(a+2)+" "+(a+3));    }   }  } }
4	public class C35 {  public static void main(String[] args) throws IOException {   Scanner in = new Scanner(new File("input.txt"));   PrintWriter out = new PrintWriter("output.txt");   int n = in.nextInt() , m = in.nextInt();   int k = in.nextInt();   int[] x = new int[k];   int[] y = new int[k];   int res = 0;   for (int i = 0 ; i < k ; i++) {    x[i] = in.nextInt();    y[i] = in.nextInt();   }   int xx = 1 , yy = 1;   for (int i = 1 ; i <= n ; i++)    for (int j = 1 ; j <= m ; j++) {     int cnt = Integer.MAX_VALUE;     for (int l = 0 ; l < k ; l++) {      int time = Math.abs(i - x[l]) + Math.abs(j - y[l]);      cnt = Math.min(cnt , time);     }     if (cnt > res) {      res = cnt;      xx = i;      yy = j;     }     res = Math.max(res , cnt);    }   out.print(xx + " " + yy);   out.close();  } }
4	public class A { String line;  void run()throws IOException{  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));   line = bf.readLine();  int i, j, len = line.length(), max=0;  for(i=0; i<len; i++){  for(j=i; j<len; j++){   if(line.indexOf(line.substring(i,j+1), i+1)>0){   if(j-i+1>max) max = j-i+1;   }  }  }  System.out.println(max); }  public static void main(String[] args)throws IOException {  new A().run(); } }
3	public class Main {  public static void main(String args[]) {   InputReader in = new InputReader(System.in);   PrintWriter out = new PrintWriter(System.out);   IntStream.range(0, 1).forEach(tc -> {    new Solver(tc, in, out).solve();    out.flush();   });   out.close();  } } class InputReader {  BufferedReader reader;  StringTokenizer tokenizer;  InputReader(InputStream in) {   reader = new BufferedReader(new InputStreamReader(in));  }  String next() {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    try {     tokenizer = new StringTokenizer(reader.readLine());    } catch (Exception e) {     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }  int nextInt() {   return Integer.valueOf(next());  }  double nextDouble() {   return Double.valueOf(next());  }  String nextLine() {   try {    return reader.readLine();   } catch (Exception e) {    throw new RuntimeException(e);   }  } } class Solver {  private InputReader in;  private PrintWriter out;  private Integer tc;  Solver(Integer tc, InputReader in, PrintWriter out) {   this.in = in;   this.out = out;   this.tc = tc;  }  void solve() {   Integer n = in.nextInt();   TreeSet<Integer> list = IntStream.range(0, n)     .map(i -> in.nextInt())     .boxed()     .collect(Collectors.toCollection(TreeSet::new));   Integer answer = 0;   while (!list.isEmpty()) {    Integer x = list.pollFirst();    list = list.stream().filter(y -> y % x != 0).collect(Collectors.toCollection(TreeSet::new));    answer++;   }   out.println(answer);  } }
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(); } }
6	public class f{  public static void main(String[] args) {  MyScanner sc = new MyScanner();  out = new PrintWriter(new BufferedOutputStream(System.out));    int n = sc.nextInt();  int m = sc.nextInt();  int[][] arr = new int[n][m];  for(int i=0; i<n; i++) {   for(int j=0; j<m; j++) {    arr[i][j] = sc.nextInt();   }  }  if(n==1) {   int min = Integer.MAX_VALUE;   for(int i=0; i<m-1; i++) {    min = Math.min(min, Math.abs(arr[0][i]-arr[0][i+1]));   }   out.println(min);   out.close();  }  int[][] adj = new int[n][n];  int[][] edgeadj = new int[n][n];  for(int i=0; i<n; i++) {   for(int j=i+1; j<n; j++) {    int min = Integer.MAX_VALUE;    for(int k=0; k<m; k++) {     min = Math.min(min, Math.abs(arr[i][k]-arr[j][k]));    }    adj[i][j]=min;    adj[j][i]=min;    int min1 = Integer.MAX_VALUE;    int min2 = Integer.MAX_VALUE;    for(int k=0; k<m-1; k++) {     min1 = Math.min(min1, Math.abs(arr[i][k]-arr[j][k+1]));     min2 = Math.min(min2, Math.abs(arr[i][k+1]-arr[j][k]));    }    edgeadj[i][j]=min1;    edgeadj[j][i]=min2;   }  }  int power = (int)Math.pow(2,n);  int[][][] dp = new int[power][n][n];  for(int i=0; i<n; i++) {   dp[(int)Math.pow(2,i)][i][i] = Integer.MAX_VALUE;  }  for(int bit=0; bit<power; bit++) {   for(int j=0; j<n; j++) {    for(int k=0; k<n; k++) {     if((bit & (1<<j))>0 && (bit & (1<<k))>0 && j!=k) {      int temp = bit;      temp &= ~(1<<k);      int ans = 0;      for(int l=0; l<n; l++) {       if((temp & (1<<l))>0) {        int min = Math.min(dp[temp][j][l], adj[l][k]);        ans = Math.max(ans, min);       }      }      if(j!=k) {       dp[bit][j][k] = ans;      }           }    }   }  }  int answer = 0;  for(int i=0; i<n; i++) {   for(int j=0; j<n; j++) {    if(i!=j) {     int ans = Math.min(dp[power-1][i][j], edgeadj[i][j]);     answer = Math.max(answer, ans);    }   }  }          out.println(answer);            out.close();  }    public static PrintWriter out;     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());  }   String nextLine(){   String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }  }  }
5	public class CF_111_A {  public static void main(String[] args){   Scanner in = new Scanner(System.in);   int n = in.nextInt(), sum = 0, sum2 = 0;   int[] a = new int[n];   for (int i = 0; i < n; i++){    a[i] = in.nextInt();    sum += a[i];   }     Arrays.sort(a);     for (int i = n - 1; i >=0; i--){    sum2 +=a[i];    if (sum2 * 2 > sum){     System.out.println(n - 1 - i + 1);     System.exit(0);       }   }  } }
0	public class Solution {  private BufferedReader in; private PrintWriter out; private StringTokenizer st;  void solve() throws IOException {  double a = nextDouble();  double v = nextDouble();  double l = nextDouble();  double d = nextDouble();  double w = nextDouble();  if (w > v) {  w = v;  }  double ans1 = 0.;  double v1;  {  double l_ = 0., r_ = 1e+9;  for (int it = 0; it < 100; ++it) {   double mid = (l_ + r_) / 2.;   double V = a * mid;   double t1 = (V + w) / 2. / a;   double t2 = mid - t1;   t1 = Math.min(t1, v / a);   t2 = Math.min(t2, (v - w) / a);   if (V < w) {   t1 = mid;   t2 = 0.;   }   double dist = t1 * t1 * a / 2. + t2 * (w + t2 * a / 2.) + v * (mid - t1 - t2);   if (dist < d) {   l_ = mid;   } else {   r_ = mid;   }  }  ans1 = (l_ + r_) / 2.;  v1 = Math.min(ans1 * a, w);  }  double ans2 = 0.;  {  double tSp = (v - v1) / a;  double l_ = 0., r_ = 1e+9;  for (int it = 0; it < 100; ++it) {   double mid = (l_ + r_) / 2.;   double dist = Math.min(tSp, mid) * (v1 + Math.min(tSp, mid) * a / 2.);   dist += (mid - Math.min(tSp, mid)) * v;   if (dist < l - d) {   l_ = mid;   } else {   r_ = mid;   }  }  ans2 = (l_ + r_) / 2.;  }  out.println(ans1 + ans2); }  Solution() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   eat("");   solve();   in.close();  out.close(); }  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()); }  long nextLong() throws IOException {  return Long.parseLong(next()); }  double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static void main(String[] args) throws IOException {  new Solution(); } }
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 {   @Override   public void run() {    InputStream inputStream = System.in;    OutputStream outputStream = System.out;    FastInput in = new FastInput(inputStream);    FastOutput out = new FastOutput(outputStream);    BSearchingRectangles solver = new BSearchingRectangles();    solver.solve(1, in, out);    out.close();   }  }  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();   }  }  static class DigitUtils {   private DigitUtils() {   }   public static int floorAverage(int x, int y) {    return (x & y) + ((x ^ y) >> 1);   }  }  static abstract 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 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);  }   class Player  {    }   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());  }   long nextLong() throws IOException  {   return Long.parseLong(next());  }   double nextDouble() throws IOException  {   return Double.parseDouble(next());  }   void print(Object... o)  {   System.out.println(deepToString(o));  }   void gcj(Object o)  {   String s = String.valueOf(o);   out.println("Case #" + test + ": " + s);   System.out.println("Case #" + test + ": " + s);  }   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();  }   public void run()  {   try   {    init();    if(TEST)    {     int runs = nextInt();     for(int i = 0; i < runs; i++) solve();    }    else solve();    out.close();     }   catch(Exception e)   {    e.printStackTrace();    System.exit(1);   }  } }
5	public class codef {  public static void main(String ar[]) throws IOException  {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   StringTokenizer nk=new StringTokenizer(br.readLine());   int n=Integer.parseInt(nk.nextToken());   int k=Integer.parseInt(nk.nextToken());   String st[]=br.readLine().split(" ");     int ans[]=new int[n];   int a[]=new int[n];   for(int i=0;i<n;i++)    ans[i]=Integer.parseInt(st[i]);    for(int i=1;i<n;i++)    a[i]=ans[i]-ans[i-1];   a[0]=-1;   Arrays.sort(a);   int count=0,sum=0;   for(int i=0;i<n;i++)    if(a[i]<0)     count++;    else     sum=sum+a[i];     k=k-count;   int i=n-1;   while(k>0 && i>=0)   {    if(a[i]>-1)    {     sum=sum-a[i];     k--;    }    i--;   }   System.out.println(sum);  } }
5	public class Main1    {    private InputStream is;    private PrintWriter out;    static int MOD = (int)(1e9+7);    ArrayList<Integer>[] amp;    public static void main(String[] args) throws Exception    {     new Thread(null, new Runnable()     {     public void run()     {      try {   } catch (Exception e)      {       System.out.println(e);      }     }    }, "1", 1 << 26).start();     new Main1().soln();    }    char ch[][];    static ArrayList<Integer>[] g;    static ArrayList<Integer> ar[];    static long ok[];     static int phi[]=new int[500005];    void solve()    {    int n=ni();     int a[]=na(n);     long sum=0;     HashMap<Integer,Integer> hm=new HashMap();     BigInteger ans=(BigInteger.ZERO);     int count=0;     for(int i=n-1;i>=0;i--)     {      int tmp1=0;      int tmp2=0;      int tmp3=0;      if(hm.containsKey(a[i]))      tmp1=hm.get(a[i]);      if(hm.containsKey(a[i]+1))      tmp2=hm.get(a[i]+1);      if(hm.containsKey(a[i]-1))      tmp3=hm.get(a[i]-1);      long lol=sum;      lol-=((long)tmp1*(long)a[i]);      lol-=((long)tmp2*(long)(a[i]+1));      lol-=((long)tmp3*(long)(a[i]-1));      int fr=(count)-tmp1-tmp2-tmp3;      long fuck=(lol)-((long)fr*(long)a[i]);      ans=ans.add(BigInteger.valueOf(fuck));      if(!hm.containsKey(a[i]))      hm.put(a[i],1);      else      hm.put(a[i],hm.get(a[i])+1);      sum+=(long)a[i];      count++;          }     out.println(ans);    }    public static long multiply(long a)    {    return a*10;    }    public static long query1(int v,int start,int end,int l,int r,int x)    {    if(r < start || end < l)     {      return Long.MAX_VALUE;     }     if(l <= start && end <= r)     {      return (tre[v]);     }     int mid = (start + end) / 2;     long p1 = query1(2*v, start, mid, l, r,x);     long p2 = query1(2*v+1, mid+1, end, l, r,x);     return Math.min(p1, p2);    }    public static void update1(int v,int tl,int tr,int index,long a2)    {    if(tl==tr)     {      tre[v]=a2;     }     else     {      int mid=(tl+tr)/2;      if(tl <= index &&index <= mid)      {       update1(2*v,tl, mid, index, a2);      }      else      {       update1(2*v+1,mid+1,tr, index, a2);      }      tre[v]=(Math.min(tre[2*v],tre[2*v+1]));     }    }  static boolean visited[][];  static int a[][];    public static long query(int v,int start,int end,int l,int r,int x)    {    if(r < start || end < l)     {      return 0;     }     if(l <= start && end <= r)     {      return (tre[v]);     }     int mid = (start + end) / 2;     long p1 = query(2*v, start, mid, l, r,x);     long p2 = query(2*v+1, mid+1, end, l, r,x);     return Math.max(p1, p2);    }    public static void update(int v,int tl,int tr,int index,long a2)    {    if(tl==tr)     {      tre[v]=a2;     }     else     {      int mid=(tl+tr)/2;      if(tl <= index &&index <= mid)      {       update(2*v,tl, mid, index, a2);      }      else      {       update(2*v+1,mid+1,tr, index, a2);      }      tre[v]=(Math.max(tre[2*v],tre[2*v+1]));     }    }    static long tre[]=new long[400005];       boolean isPrime(int x)     {     if(x==0||x==1)      return false;     for(int i = 2;i*1L*i<=x;i++) if(x%i==0) return false;     return true;    }    int p ;    long modInverse(long a, long mOD2){     return power(a, mOD2-2, mOD2);    }    long power(long x, long y, long m)    {    if (y == 0)    return 1;    long p = power(x, y/2, m) % m;    p = (p * p) % m;      return (y%2 == 0)? p : (x * p) % m;    }    public static long gcd(long a, long b){     if(b==0) return a;     return gcd(b,a%b);    }    class Pair1 implements Comparable<Pair1>{     long a;     long b;     long c;     Pair1(long x,long y,long z){     this.a=x;     this.b=y;     this.c=z;     }     public int hashCode() {      return Objects.hash();     }         @Override     public int compareTo(Pair1 arg0) {      return (int)(arg0.c-c);     }     }    long power(long x, long y, int mod){     long ans = 1;     while(y>0){      if(y%2==0){       x = (x*x)%mod;       y/=2;      }      else{       ans = (x*ans)%mod;       y--;      }     }     return ans;    }    void soln() {     is = System.in;     out = new PrintWriter(System.out);     long s = System.currentTimeMillis();     solve();     out.flush();    }    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 double nd() {     return Double.parseDouble(ns());    }    private char nc() {     return (char) skip();    }    private String ns() {     int b = skip();     StringBuilder sb = new StringBuilder();     while (!(isSpaceChar(b))) {      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[][] nm(int n, int m) {     int[][] map = new int[n][m];     for (int i = 0; i < n; i++)     {      for(int j=0;j<m;j++)       map[i][j]=ni();     }     return map;    }    private int[] na(int n) {     int[] a = new int[n];     for (int i = 0; i < n; i++)      a[i] = ni();     return a;    }    private int ni() {     int num = 0, b;     boolean minus = false;     while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))      ;     if (b == '-') {      minus = true;      b = readByte();     }     while (true) {      if (b >= '0' && b <= '9') {       num = num * 10 + (b - '0');      } else {       return minus ? -num : num;      }      b = readByte();     }    }    private long nl() {     long num = 0;     int b;     boolean minus = false;     while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))      ;     if (b == '-') {      minus = true;      b = readByte();     }     while (true) {      if (b >= '0' && b <= '9') {       num = num * 10 + (b - '0');      } else {       return minus ? -num : num;      }      b = readByte();     }    }    private boolean oj = System.getProperty("ONLINE_JUDGE") != null;    private void tr(Object... o) {     if (!oj)      System.out.println(Arrays.deepToString(o));    }   }
0	public class Main {  private static PrintWriter out;  private static FastReader in;  private static 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 String nextLine() {    try {     return reader.readLine();    } catch (IOException ex) {     throw new RuntimeException(ex);    }   }   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();  } }
5	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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    BigInteger ans = new BigInteger("0");    long val, index, index1, index2;    long sum[] = new long[n];    val = in.scanInt();    HashMap<Long, Integer> hs = new HashMap<>();    hs.put(val, 1);    sum[0] = val;    for (int i = 1; i < n; i++) {     val = in.scanInt();     sum[i] += sum[i - 1];     sum[i] += val;     if (!hs.containsKey(val)) hs.put(val, 0);     hs.put(val, hs.get(val) + 1);     ans = ans.add(BigInteger.valueOf(((i + 1) * val) - sum[i]));     index = (hs.containsKey(val + 1)) ? hs.get(val + 1) : 0;     index1 = (hs.containsKey(val - 1)) ? hs.get(val - 1) : 0;     index2 = (hs.containsKey(val)) ? hs.get(val) : 0;     ans = ans.subtract(BigInteger.valueOf(((index + index1 + index2) * val) - ((index * (val + 1)) + (index1 * (val - 1)) + (index2 * (val)))));    }    out.println(ans);    }  }  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;   }  } }
1	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(new BufferedInputStream(System.in));   PrintWriter out = new PrintWriter(new BufferedWriter(     new OutputStreamWriter(System.out)));   while (in.hasNext()) {    int n = in.nextInt(), a = in.nextInt(), b = in.nextInt(), c = 0;    int[] p = new int[n];    TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();    for (int i = 0; i < n; i++) {     p[i] = in.nextInt();     map.put(p[i], i);    }       if (a > b) {     int t = b;     b = a;     a = t;     c = 1;    }    boolean ok = true;    int[] cls = new int[n];    while (ok && map.size() > 0) {     Entry<Integer, Integer> last = map.lastEntry();     int v = last.getKey();     int idx = last.getValue();     if (map.containsKey(a - v)) {      cls[idx] = 0;      cls[map.get(a - v)] = 0;      map.remove(v);      map.remove(a -v);     } else if (map.containsKey(b - v)) {      cls[idx] = 1;      cls[map.get(b - v)] = 1;      map.remove(v);      map.remove(b -v);     } else      ok = false;    }    if (!ok)     System.out.println("NO");    else {     System.out.println("YES");     for (int j = 0; j < cls.length; j++) {      if (j != 0)       System.out.print(" ");      System.out.print(c ^ cls[j]);     }     System.out.println();    }    out.flush();   }   in.close();  } }
4	public class FireAgain {  public static void main(String[] args){  File in = new File("input.txt"); File out = new File("output.txt"); Scanner sc; PrintWriter pw; try{  sc = new Scanner(in);  pw = new PrintWriter(out); }catch(Exception e){  sc = new Scanner(System.in);  pw = null; }  int max_x = sc.nextInt(); int max_y = sc.nextInt(); int start_num = sc.nextInt(); HashSet<int[]> start = new HashSet<int[]>(); for(int i=0; i<start_num; i++){  int[] cell = new int[2];  cell[0] = sc.nextInt();  cell[1] = sc.nextInt();  start.add(cell); }  int[] result = new int[]{1,1}; int resultLen = 0; for(int i=1; i<=max_x; i++){  for(int j=1; j<=max_y; j++){  int[] sh = new int[]{1,1};  int shLen = Integer.MAX_VALUE;  for(int[] fired: start){   int len = Math.abs(i - fired[0]) + Math.abs(j - fired[1]);   if(len < shLen){  sh[0] = i;  sh[1] = j;  shLen = len;   }  }  if(shLen > resultLen){   result[0] = sh[0];   result[1] = sh[1];   resultLen = shLen;  }  } } pw.print(result[0] + " " + result[1]); pw.close(); return ;  } }
0	public class D0005 {  public static void main(String args[]) throws Exception {   new D0005();  }  D0005() throws Exception {   PandaScanner sc = null;   PrintWriter out = null;   try {    sc = new PandaScanner(System.in);    out = new PrintWriter(System.out);   } catch (Exception ignored) {   }   a = sc.nextInt();   max = sc.nextInt();   double length = sc.nextInt();   double dist = sc.nextInt();   double limit = sc.nextInt();   if (max <= limit) {    out.println(travelTime(length, 0));   }   else {    double tLimit = limit / a;    double dLimit = distance(0, tLimit);    if (dLimit >= dist) {     out.println(travelTime(length, 0));    }    else {     double res = tLimit + 2 * (travelTime(0.5 * (dist - dLimit), limit)) +       travelTime(length - dist, limit);     out.println(res);    }   }   out.close();   System.exit(0);  }  double a, max;  double distance(double v, double t) {   return v * t + 0.5 * a * t * t;  }  double travelTime(double d, double v) {   double tAll = (-v + Math.sqrt(v * v + 2 * a * d)) / a;   double tMax = (max - v) / a;   if (tAll <= tMax) {    return tAll;   }   else {    return tMax + (d - distance(v, tMax)) / max;   }  }    public class PandaScanner {   BufferedReader br;   StringTokenizer st;   InputStream in;   PandaScanner(InputStream in) throws Exception {    br = new BufferedReader(new InputStreamReader(this.in = in));   }   public String next() throws Exception {    if (st == null || !st.hasMoreTokens()) {     st = new StringTokenizer(br.readLine().trim());     return next();    }    return st.nextToken();   }   public boolean hasNext() throws Exception {    return (st != null && st.hasMoreTokens()) || in.available() > 0;   }   public long nextLong() throws Exception {    return Long.parseLong(next());   }   public int nextInt() throws Exception {    return Integer.parseInt(next());   }  } }
4	public class Word {  static String word;  private static void check(String subword) {   int i = 0;   int j = 0;   while (j + subword.length() <= word.length()) {    if (word.substring(j).startsWith(subword)){     i++;    }    j++;   }   if (i > 1){    System.out.println(subword.length());    System.exit(0);   }  }  public static void main(String[] arg) {   Scanner in = new Scanner(System.in);   word = in.next();   if (word.length() == 1) {    System.out.println(0);    return;   }   for (int i = word.length() - 1; i > 0; i--) {    int j = 0;    while (j + i <= word.length()) {     check(word.substring(j, i+j));     j++;    }   }   System.out.println(0);  } }
6	public class ElongatedMatrix { static int[][][] memo; static int mn1[][]; static int mn2[][]; static int r, c;  static int dp(int mask, int first, int lastvisited) {  if (memo[first][lastvisited][mask] != -1)  return memo[first][lastvisited][mask];  int ans = 0;  for (int i = 0; i < r; i++) {  if ((mask & (1 << i)) == 0) {   if (Integer.bitCount(mask) != r - 1) {   ans = Math.max(ans, Math.min(mn1[lastvisited][i], dp(((mask) | (1 << i)), first, i)));   } else   ans = Math.max(ans, Math.min(mn2[first][i], mn1[lastvisited][i]));  }  }   return memo[first][lastvisited][mask] = ans; }  public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  PrintWriter out = new PrintWriter(System.out);  r = Integer.parseInt(st.nextToken());   c = Integer.parseInt(st.nextToken());  int[][] arr = new int[r][c];  memo = new int[r][r][1 << r];  mn1 = new int[r][r];  mn2 = new int[r][r];  for(int i=0;i<r;i++) {  st=new StringTokenizer(br.readLine());  for(int j=0;j<c;j++) {   arr[i][j]=Integer.parseInt(st.nextToken());  }  }  for (int i = 0; i < r; i++) {  Arrays.fill(mn1[i], (int)1e9);  Arrays.fill(mn2[i], (int)1e9);  }   for (int i = 0; i < r; i++) {  for (int j = 0; j < r; j++) {   Arrays.fill(memo[i][j], -1);  }  }  for (int i = 0; i < r; i++) {  for (int j = 0; j < r; j++) {   for (int k = 0; k < c; k++) {      mn1[i][j] = Math.min(mn1[i][j], Math.abs(arr[i][k] - arr[j][k]));      }  }  }  for (int i = 0; i < r; i++) {  for (int j = 0; j < r; j++) {   for (int k = 0; k < c-1; k++) {      mn2[i][j] = Math.min(mn2[i][j], Math.abs(arr[j][k] - arr[i][k + 1]));      }  }  }   int ans = 0;  for (int i = 0; i < r; i++) {  ans=Math.max(ans, dp(1<<i,i,i));  }  if(r==1)  ans=mn2[0][0];  out.println(ans);  out.flush(); } }
1	public class Main {  public static void main(String[] args) throws IOException {    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   String[] s = reader.readLine().split(" ");   int n = Integer.parseInt(s[0]);   int d = Integer.parseInt(s[1]);   List<Integer> list = new ArrayList<>();   s = reader.readLine().split(" ");   for (int i = 0; i < n; i++) {    list.add(Integer.parseInt(s[i]));   }   HashSet<Integer> set = new HashSet<>();   for (Integer i : list) {    set.add(i - d);    set.add(i + d);   }   HashSet<Integer> set2 = new HashSet<>();   for (Integer i : set) {    for (Integer x : list) {     if (Math.abs(i - x) < d) {      set2.add(i);    }    }   }   set.removeAll(set2);   System.out.println(set.size());  } }
4	public class SolutionC{ public static void main(String[] args) throws Exception{  Scanner sc = new Scanner(new File("input.txt"));  PrintWriter output = new PrintWriter("output.txt");  int N = sc.nextInt();  int M = sc.nextInt();  int K = sc.nextInt();  int[] x = new int[K];  int[] y = new int[K];  for(int i = 0 ; i < K ; i++){  x[i] = sc.nextInt();  y[i] = sc.nextInt();  }  int max = -1, max_x = -1, max_y = -1;  for(int i = 1 ; i <= N ; i++){  for(int j = 1 ; j <= M ; j++){   int min = Integer.MAX_VALUE;   for(int k = 0 ; k < K ; k++){   min = Math.min(min, Math.abs(x[k] - i) + Math.abs(y[k] - j));   }   if(min > max){   max = min;   max_x = i;   max_y = j;   }  }  }  output.println(max_x + " " + max_y);  output.flush(); } }
0	public class CF275Ad2 {  public static void main(String[] args) throws Exception {   Scanner scan = new Scanner(System.in);   long l = scan.nextLong();  long r = scan.nextLong();   long diff = r-l;  boolean exists = false;  if(diff >= 3){  if(l%2 == 1){   l++;  }  exists = true;  } else if(diff == 2 && l%2 == 0){  exists = true;  } else if(diff == 2 && gcd(l, r) > 1){  exists = true;  }   if(!exists){  System.out.println("-1");  } else {  System.out.println(l + " " + (l+1) + " " + (l+2));  } }  private static long gcd(long a, long b){  if(b == 0){  return 1;  }  return gcd(b, a % b); } }
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());   }   }
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); } }
2	public class CF489_C { static long mod = 1000000007;  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  long x = s.nextLong(), k = s.nextLong();  if (x == 0) {  System.out.println(0);  return;  }  long max = x % mod;  long temp = power(2, k, mod);  temp %= mod;  max = (max % mod) * (temp % mod);  max %= mod;  long min = max % mod;  min = mod(min - (temp - 1));  min %= mod;  long num = mod(max - min + 1);  long n = num % mod;  n = (n % mod) * (min % mod + max % mod);  n = n % mod;  n %= mod;  long ans = n % mod * modInverse(num, mod);  System.out.println(ans % mod);  }  static long modInverse(long a, long m) {  long m0 = m;  long y = 0, x = 1;  if (m == 1)  return 0;  while (a > 1) {    long q = a / m;  long t = m;       m = a % m;  a = t;  t = y;     y = x - q * y;  x = t;  }    if (x < 0)  x += m0;  return x; }  static long mod(long val) {  val %= mod;  if (val < 0)  val += mod;  return val; }  static long power(long x, long y, long p) {   long res = 1;     x = x % p;  while (y > 0) {      if ((y & 1) == 1)   res = (res * x) % p;       y = y >> 1;  x = (x * x) % p;  }  return res; } }
2	public class Main { FastReader scn; PrintWriter out; String INPUT = "";  void solve() {  long n = scn.nextLong(), k = scn.nextLong(), mod = (int)1e9 + 7;  if(n == 0) {  out.println(0);  return;  }  n %= mod;  long x = (pow(2, k + 1, mod) * n) % mod;  long y = (pow(2, k, mod) + mod - 1) % mod;   long ans = ((x - y) % mod + mod) % mod;  out.println(ans); }  long pow(long a, long x, long m) {  if(x == 0) {  return 1;  }  long p = pow(a, x / 2, m);  p *= p;  p %= m;  if(x % 2 == 1) {  p *= a;  p %= m;  }  return p; }  long gcd(long a, long b) {  return b == 0 ? a : gcd(b, a % b); }  void run() throws Exception {  boolean onlineJudge = System.getProperty("ONLINE_JUDGE") != null;  out = new PrintWriter(System.out);  scn = new FastReader(onlineJudge);  long time = System.currentTimeMillis();  solve();  out.flush();  if (!onlineJudge) {  System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));  } }  public static void main(String[] args) throws Exception {  new Main().run(); }  class FastReader {  InputStream is;  public FastReader(boolean onlineJudge) {  is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());  }  byte[] inbuf = new byte[1024];  public int lenbuf = 0, ptrbuf = 0;  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++];  }  boolean isSpaceChar(int c) {  return !(c >= 33 && c <= 126);  }  int skip() {  int b;  while ((b = readByte()) != -1 && isSpaceChar(b))   ;  return b;  }  double nextDouble() {  return Double.parseDouble(next());  }  char nextChar() {  return (char) skip();  }  String next() {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(isSpaceChar(b))) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }  char[] next(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);  }  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 * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }  long nextLong() {  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();  }  }  char[][] nextMatrix(int n, int m) {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)   map[i] = next(m);  return map;  }  int[] nextArray(int n, boolean isOneInd) {  int k = isOneInd ? 1 : 0;  int[] a = new int[n + k];  for (int i = k; i < n + k; i++)   a[i] = nextInt();  return a;  }  int[] shuffle(int[] arr) {  Random r = new Random();  for (int i = 1, j; i < arr.length; i++) {   j = r.nextInt(i);   arr[i] = arr[i] ^ arr[j];   arr[j] = arr[i] ^ arr[j];   arr[i] = arr[i] ^ arr[j];  }  return arr;  } } }
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());   }   long nextLong() {    return Long.parseLong(nextToken());   }   double nextDouble() {    return Double.parseDouble(nextToken());   }  } }
4	public class x23A { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  String input = sc.next();   int longest=0;  if(input.length()==1){  System.out.println(0);  System.exit(0);  }  if(input.length()==2){  if(input.charAt(0)==input.charAt(1)){   System.out.println(1);   System.exit(0);  }  else{  System.out.println(0);  System.exit(0);}  }  for(int a=0;a<input.length()-1;a++){  for(int b=a+1;b<input.length();b++){   for(int c=1;(c+b)<input.length()+1;c++){      if(input.substring(a,a+c).compareTo(input.substring(b,b+c))==0)   if(longest<c)longest=c;   }  }  }  System.out.println(longest);  } }
6	public class CF008C {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   int x = s.nextInt();   int y = s.nextInt();   int n = s.nextInt();   int[] xx = new int[n+1];   int[] yy = new int[n+1];   for(int i = 0;i<n;i++){    xx[i] = s.nextInt();    yy[i] = s.nextInt();   }     xx[n] = x;   yy[n] = y;   int[][] dp = new int[n + 1][n + 1];   for (int i = 0; i <= n; i++)    for (int j = i + 1; j <= n; j++) {     int dx = xx[i] - xx[j];     int dy = yy[i] - yy[j];     dp[i][j] = dx * dx + dy * dy;    }    int[] aa = new int[1 << n];    int[] bb = new int[1 << n];    for (int k = 1; k < 1 << n; k++) {     int a = -1;     for (int b = 0; b < n; b++)      if ((k & 1 << b) > 0) {       a = b;       break;      }     int l = k ^ 1 << a;     int d = dp[a][n] + dp[a][n];     aa[k] = aa[l] + d;     bb[k] = l;     for (int b = a + 1; b < n; b++)      if ((k & 1 << b) > 0) {       l = k ^ 1 << a ^ 1 << b;       d = dp[a][n] + dp[b][n] + dp[a][b];       if (aa[l] + d < aa[k]) {        aa[k] = aa[l] + d;        bb[k] = l;       }      }    }    int k = (1 << n) - 1;    System.out.println(aa[k]);    StringBuilder sb = new StringBuilder();    sb.append(0);    while (k != 0) {     int l = bb[k];     int m = k ^ l;     for (int b = 0; b < n; b++)      if ((m & 1 << b) > 0)       sb.append(' ').append(b + 1);     sb.append(' ').append(0);     k = l;    }    System.out.println(sb);   }                                  private static int calculateDistanceBetweenIandJ(int[] xCoord, int[] yCoord, int i, int j) {   int length = (int) (Math.pow((xCoord[i] - xCoord[j]),2) + Math.pow(yCoord[i] - yCoord[j], 2));   return length;  } }
2	public class Main2 {  static class Reader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;   public Reader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public Reader(String file_name) throws IOException   {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public String readLine() throws IOException   {    byte[] buf = new byte[64];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }   public int nextInt() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do    {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (c == '.')    {     while ((c = read()) >= '0' && c <= '9')     {      ret += (c - '0') / (div *= 10);     }    }    if (neg)     return -ret;    return ret;   }   private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }   private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }   public void close() throws IOException   {    if (din == null)     return;    din.close();   }  }   public static void main(String[] args) throws IOException  {   Reader z = new Reader();   long n=z.nextLong(), k=z.nextLong(), x;   x=9L+8L*(k+n);   x=(long) Math.sqrt(x);   x=(x-3)/2;   System.out.println(n-x);  } }
1	public class GenerateLogin {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  String a = scan.next();  String b = scan.next();  char last = b.charAt(0);  String ans = ""+a.charAt(0);  for(int i = 1;i<a.length();i++){  if(a.charAt(i)>=last)break;  ans+=a.charAt(i);  }  ans+=last;  System.out.println(ans); } }
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();   }   int nextInt()   {    return Integer.parseInt(next());   }   long nextLong()   {    return Long.parseLong(next());   }   double nextDouble()   {    return Double.parseDouble(next());   }   String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  } }
3	public class Main { public static void main(String[] args){  long MOD = 1000000007;  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  long[][]dp = new long[n][5010];  char[] program = new char[n];   for(int i = 0; i < n; i++){  program[i] = sc.next().charAt(0);  }   dp[0][0] = 1;   long[] acc = new long[5010];   acc[0] = 1;   for(int i = 1 ; i < n; i++){  for(int j = 0; j< 5010; j++){   if(program[i-1] == 'f'){   if(j - 1 >= 0){    dp[i][j] = dp[i-1][j-1];   }   }else{   dp[i][j] = acc[j];   }  }  acc[5009] = dp[i][5009];  for(int j = 5008; j >= 0; j--){   acc[j] = (acc[j + 1] + dp[i][j]) % MOD;  }  }  System.out.println(acc[0]); } }
1	public class B { int mod=1000_000_007; public static void main(String[] args) throws Exception {   PrintWriter out=new PrintWriter(System.out);  FastScanner fs=new FastScanner();  int t=fs.nextInt();  while(t-->0) {   double n=fs.nextInt();   if(isp(n/2)||isp(n/4)) {   System.out.println("YES");   }   else System.out.println("NO");  } } static boolean isp(double n) {  if(n==0) return false;  double a=Math.ceil(Math.sqrt(n));  double b=Math.floor(Math.sqrt(n));  return a==b; } static void mysort(long[] a) {   int n=a.length;  Random r=new Random();  for (int i=0; i<a.length; i++) {  int oi=r.nextInt(n);  long temp=a[i];  a[i]=a[oi];  a[oi]=temp;  }     Arrays.sort(a); }   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());  }  int[] readArray(int n) {  int[] a=new int[n];  for (int i=0; i<n; i++) a[i]=nextInt();  return a;  }  long nextLong() {  return Long.parseLong(next());  } }  }
0	public class Main {  long solve(long a, long b) {   return b == 0 ? 0 : a / b + solve(b, a % b);  }  public void run() {   try {    long a = reader.nextLong();    long b = reader.nextLong();    writer.println(solve(a, b));   } catch (IOException ex) {   }   writer.close();  }  InputReader reader;  PrintWriter writer;  Main() {   reader = new InputReader();   writer = new PrintWriter(System.out);  }  public static void main(String[] args) {   new Main().run();  } } class InputReader {  BufferedReader reader;  StringTokenizer tokenizer;  InputReader() {   reader = new BufferedReader(new InputStreamReader(System.in));   tokenizer = new StringTokenizer("");  }  String next() throws IOException {   while (!tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }  Integer nextInt() throws IOException {   return Integer.parseInt(next());  }  Long nextLong() throws IOException {   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);}}
1	public class A { public static void main(String[] args) {  Locale.setDefault(Locale.US);  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  String[] number = new String[n];  sc.nextLine();  String l = sc.nextLine();  number = l.split(" ");  int oe = 1;  if((Integer.valueOf(number[0])%2 +   Integer.valueOf(number[1])%2 +   Integer.valueOf(number[2])%2) > 1) {  oe = 0;  }  for(int i=0;i<n;i++) {  if((Integer.valueOf(number[i])%2)==oe) {   System.out.println(i+1);   break;  }  } } }
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);   ASubtractions solver = new ASubtractions();   solver.solve(1, in, out);   out.close();  }  static class ASubtractions {   public void solve(int testNumber, InputReader c, OutputWriter w) {    int tc = c.readInt();    while (tc-- > 0) {     int a = c.readInt(), b = c.readInt();     int op = 0;     while (a != b) {      if (a > b) {       int tm = b;       b = a;       a = tm;      }      int left = b - a;      int rem = (left - 1) / a + 1;      b -= rem * a;      op += rem;     }     op++;     w.printLine(op);    }   }  }  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;   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);   }  } }
2	public class A {  private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  private StringTokenizer tokenizer = null;  long mod = 1000000007;  public static void main(String[] args) throws IOException  {   new A().solve();  }  private void solve() throws IOException  {   long x = nl();   long k = nl();   if (x == 0)   {    System.out.println(0);    System.exit(0);   }   if (k == 0)   {    System.out.println((x * 2) % mod);    System.exit(0);   }             BigInteger n = BigInteger.valueOf(2)     .modPow(BigInteger.valueOf(k + 1), BigInteger.valueOf(mod))     .multiply(BigInteger.valueOf(x))     .add(BigInteger.ONE)     .subtract(BigInteger.valueOf(2)       .modPow(BigInteger.valueOf(k), BigInteger.valueOf(mod)))     .mod(BigInteger.valueOf(mod));   System.out.println(n.toString());  }  long aux(long x, long k) {   long p1 = 2 * x;   long p2 = 2 * x - 1;   for (int i = 0; i < k - 1; i++)   {    p1 = (p1 * 2) % mod;    p2 = (p2 * 2 - 1) % mod;   }   return ((p1 + p2) % mod);  }  void debug(Object... os)  {   System.out.println(Arrays.deepToString(os));  }  int ni() throws IOException  {   return Integer.parseInt(ns());  }  long nl() throws IOException  {   return Long.parseLong(ns());  }  double nd() throws IOException  {   return Double.parseDouble(ns());  }  String ns() throws IOException  {   while (tokenizer == null || !tokenizer.hasMoreTokens())    tokenizer = new StringTokenizer(br.readLine());   return tokenizer.nextToken();  }  String nline() throws IOException  {   tokenizer = null;   return br.readLine();  }  private static long gcd(long a, long b)  {   while (b > 0)   {    long temp = b;    b = a % b;    a = temp;   }   return a;  }  private static long lcm(long a, long b)  {   return a * (b / gcd(a, b));  } }
2	public class Main { public static void main(String[] args) throws Exception {  Scanner scan = new Scanner(System.in);  long n = scan.nextLong();  long k = scan.nextLong();  long total = k * (k - 1) / 2 + 1;  if (total < n) {  System.out.println(-1);  return;  }   long left = total - n;  long low = 1;  long high = k - 1;  while (low < high) {  long mid = (low + high) / 2;  long temp = mid * (mid + 1) / 2;  if (temp < left) {   low = mid + 1;  } else {   high = mid;  }  }  long temp = low * (low + 1) / 2;  if (temp == left) {  System.out.println(k - 1 - low);  } else {  System.out.println(k - low);  } } }
6	public class Main {  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 from = in.nextInt() - 1;    int to = in.nextInt() - 1;    graph[from][to] = true;    graph[to][from] = true;   }   int max = 1 << n;   long[][] dp = new long[max][n];   for(int mask = 1; mask < max; mask++) {    for(int i = 0; i < n; i++) {     int countMask = Integer.bitCount(mask);     boolean existSubSeti = (mask & (1 << i)) > 0;     if(countMask == 1 && existSubSeti) {      dp[mask][i] = 1;     }     else if(countMask > 1 && existSubSeti) {      int mask1 = mask ^ (1 << i);      for(int j = 0; j < n; j++) {       if(graph[j][i] && i != firstMask(mask, n)) {        dp[mask][i] += dp[mask1][j];       }      }     }    }   }     long counter = 0;   for(int mask = 1; mask < max; mask++) {    for(int i = 0; i < n; i++) {     if(Integer.bitCount(mask) >= 3 && graph[firstMask(mask, n)][i]) {      counter += dp[mask][i];     }    }      }   System.out.println(counter / 2);   in.close();  }   public static int firstMask(int mask, int n) {   for(int i = 0; i < n; i++) {    if((mask & (1 << i)) > 0) return i;   }   return -1;    } }
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 Edge[][] compileWU(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 back = new Edge(origin.to, origin.from, origin.capacity, origin.cost);  edges.add(back);  }  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 void addFirst(int x){ pt = pt+n-1&n-1; q[pt] = x; }  public int pollFirst(){ int ret = q[pt]; pt = pt+1&n-1; return ret; }  public int pollLast(){ ph = ph+n-1&n-1; int ret = q[ph]; return ret; }  public int getFirst(){ return q[pt]; }  public int getFirst(int k){ return q[pt+k&n-1]; }  public int getLast(){ return q[ph+n-1&n-1]; }  public int getLast(int k){ return q[ph+n-k-1&n-1]; }  public void clear(){ pt = ph = 0; }  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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
1	public class Hotels {  public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int n = input.nextInt();  int[] cities = new int[n];  int d = input.nextInt();  for (int i = 0; i<n; i++) {  cities[i] = input.nextInt();  }  int possibilities = 0;  ArrayList<Integer> newHotels = new ArrayList<Integer>();  for (int i = 0; i<n; i++) {  int plusD = cities[i]+d;  if (newHotels.indexOf(cities[i]+d)==-1 && minDist(plusD,cities)==d) {   possibilities++;   newHotels.add(cities[i]+d);  }  if (newHotels.indexOf(cities[i]-d)==-1 && minDist(cities[i]-d,cities)==d) {   possibilities++;   newHotels.add(cities[i]-d);  }  }  System.out.println(possibilities); } public static int minDist(int a, int[] arr) {  int minDist = Integer.MAX_VALUE;  for (int i=0; i<arr.length; i++) {  minDist = Math.min(Math.abs(arr[i]-a), minDist); }  return minDist; } }
6	public class Cycle {   public static void main(String[] args) {  Locale.setDefault(Locale.US);  InputStream inputstream = System.in;  OutputStream outputstream = System.out;  FastReader in = new FastReader(inputstream);  PrintWriter out = new PrintWriter(outputstream);  TaskA solver = new TaskA();    for (int i = 0; i < 1; i++)   solver.solve(i, in, out);  out.close();   }  }  class TaskA {   public void solve(int testnumber, FastReader in, PrintWriter out) {   int n = in.ni();  int m = in.ni();   boolean graph[][] = new boolean[n][n];   for (int i = 0; i < m; i++) {   int a = in.ni() - 1;   int b = in.ni() - 1;    graph[a][b] = true;   graph[b][a] = true;  }      long dp[][] = new long[1 << n][n];   for (int i = 0; i < n; i++) {   dp[1 << i][i] = 1;  }   long answer = 0;  for (int mask = 1; mask < (1 << n); mask++) {   int start = Integer.numberOfTrailingZeros(mask);     for (int i = 0; i < n; i++) {   if ((mask & (1 << i)) == 0) {    continue;   }    for (int j = start + 1; j < n; j++) {    if (graph[i][j] && (mask & (1 << j)) == 0) {    dp[mask + (1 << j)][j] += dp[mask][i];    }    }   if (graph[i][start]) {    answer += dp[mask][i];   }   }   }   out.println((answer - m) / 2);  } }  class FastReader {  public InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  private SpaceCharFilter filter;   public FastReader(InputStream stream) {  this.stream = stream;  }   public FastReader() {   }   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 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 static boolean isWhitespace(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }   public int[] iArr(int n) {  int a[] = new int[n];  for (int i = 0; i < n; i++) {   a[i] = ni();  }  return a;  }   public String next() {  return ns();  }   public interface SpaceCharFilter {  public boolean isSpaceChar(int ch);  }  }
5	public class A { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni();  int[] a = new int[n];  for(int i = 0;i < n;i++){  a[i] = ni();  }  Arrays.sort(a);  if(a[n-1] > 1){  a[n-1] = 1;  Arrays.sort(a);  }else{  a[n-1] = 2;  }  for(int i = 0;i < n;i++){  if(i > 0)out.print(" ");  out.print(a[i]);  }  out.println(); }  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(); }  public int ni() {  try {  int num = 0;  boolean minus = false;  while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));  if(num == '-'){   num = 0;   minus = true;  }else{   num -= '0';  }    while(true){   int b = is.read();   if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');   }else{   return minus ? -num : num;   }  }  } catch (IOException e) {  }  return -1; }  public long nl() {  try {  long num = 0;  boolean minus = false;  while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));  if(num == '-'){   num = 0;   minus = true;  }else{   num -= '0';  }    while(true){   int b = is.read();   if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');   }else{   return minus ? -num : num;   }  }  } catch (IOException e) {  }  return -1; }  public String ns() {  try{  int b = 0;  StringBuilder sb = new StringBuilder();  while((b = is.read()) != -1 && (b == '\r' || b == '\n' || b == ' '));  if(b == -1)return "";  sb.append((char)b);  while(true){   b = is.read();   if(b == -1)return sb.toString();   if(b == '\r' || b == '\n' || b == ' ')return sb.toString();   sb.append((char)b);  }  } catch (IOException e) {  }  return ""; }  public char[] ns(int n) {  char[] buf = new char[n];  try{  int b = 0, p = 0;  while((b = is.read()) != -1 && (b == ' ' || b == '\r' || b == '\n'));  if(b == -1)return null;  buf[p++] = (char)b;  while(p < n){   b = is.read();   if(b == -1 || b == ' ' || b == '\r' || b == '\n')break;   buf[p++] = (char)b;  }  return Arrays.copyOf(buf, p);  } catch (IOException e) {  }  return null; }   double nd() { return Double.parseDouble(ns()); } boolean oj = System.getProperty("ONLINE_JUDGE") != null; void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
0	public class A {  public static void main(String[] args) throws Exception {  new A().doit(); }  private void doit() throws Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  long a = Long.parseLong(st.nextToken());  long b = Long.parseLong(st.nextToken());  long ans = 0;  while(a > 0 && b > 0) {  if (a > b) {   ans += a / b;   a %= b;  } else {   ans += b / a;   b %= a;  }  }   System.out.println(ans); }   }
1	public class CF1027D { 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[] cc = new int[n];  for (int i = 0; i < n; i++)  cc[i] = Integer.parseInt(st.nextToken());  st = new StringTokenizer(br.readLine());  int[] aa = new int[n];  for (int i = 0; i < n; i++)  aa[i] = Integer.parseInt(st.nextToken()) - 1;  int[] used = new int[n];  int ans = 0;  for (int i = 0; i < n; i++) {  if (used[i] == 2)   continue;  int j = i;  while (used[j] == 0) {   used[j] = 1;   j = aa[j];  }  if (used[j] == 1) {   int c = cc[j];   while (used[j] == 1) {   used[j] = 2;   c = Math.min(c, cc[j]);   j = aa[j];   }   ans += c;  }  j = i;  while (used[j] == 1) {   used[j] = 2;   j = aa[j];  }  }  System.out.println(ans); } }
3	public class Main {  void solve() {   int n=ni();   int a[]=new int[n+1];   for(int i=1;i<=n;i++) a[i]=ni();   int vis[]=new int[101];   int ans=0;   Arrays.sort(a,1,n+1);   for(int i=1;i<=n;i++){    if(vis[a[i]]==1) continue;    ans++;    for(int j=a[i];j<=100;j+=a[i]) vis[j]=1;   }   pw.println(ans);  }  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();  }  String nextLine() throws Exception {   String str = "";   try {    str = br.readLine();   } catch (IOException e) {    throw new Exception(e.toString());   }   return str;  }  int ni() {   return Integer.parseInt(ns());  }  long nl() {   return Long.parseLong(ns());  }  double nd() {   return Double.parseDouble(ns());  } }
2	public class Practice{ static long MOD=(long)Math.pow(10,9)+7; public static void main(String args[]) {   new Thread(null, new Runnable() {    public void run() {     try{      solve();      w.close();     }     catch(Exception e){      e.printStackTrace();     }    }   }, "1", 1 << 26).start(); } static InputReader in;  static PrintWriter w;  static void solve(){   in = new InputReader(System.in);   w = new PrintWriter(System.out);   long n=in.nextLong();   long s=in.nextLong();   long low=1,high=n,ans=-1;   while(low<=high){   long mid=(low+high)/2;   if(check(mid,s)){    ans=mid;    high=mid-1;   }else{    low=mid+1;   }   }   if(ans==-1){   w.println(0);   }else   w.println(n-ans+1);  }  static boolean check(long n,long s){  long temp=n;  long sum=0;  while(temp>0){   sum+=temp%10;   temp=temp/10;  }  if(n-sum>=s){   return true;  }  return false;  }  static int adj[][];  static int V;    static void Graph(int v){   V = v;   adj=new int[v][v];    }   static void addEdge(int u,int v,int w){   adj[u][v]=w;  }          static long gcd(long a,long b){  if(a==0){  return b;  }  return gcd(b%a,a); }  static long power(long base, long exponent, long modulus){  long result = 1L;  while (exponent > 0) {   if (exponent % 2L == 1L)    result = (result * base) % modulus;   exponent = exponent >> 1;   base = (base * base) % modulus;  }  return result; }  static HashMap<Long,Long> primeFactors(long n){   HashMap<Long,Long> ans=new HashMap<Long,Long>();     while (n%2L==0L)   {    if(ans.containsKey(2L)){    ans.put(2L,ans.get(2L)+1L);    }else{    ans.put(2L,1L);    }    n /= 2L;   }         for (long i = 3; i <= Math.sqrt(n); i+= 2L)   {       while (n%i == 0)    {    if(ans.containsKey(i)){     ans.put(i,ans.get(i)+1L);     }else{     ans.put(i,1L);     }     n /= i;    }   }         if (n > 2)    ans.put(n,1L);   return ans;  }  static void sieve(int N) {  boolean isPrime[]=new boolean[N+1];  isPrime[0] = true;  isPrime[1] = true;  for(int i = 2; i * i <= N; ++i) {   if(isPrime[i] == false) {    for(int j = i * i; j <= N ;j += i)     isPrime[j] = true;   }  } }    static int Arr[];  static long size[];   static void initialize(int N){  Arr=new int[N];  size=new long[N];   for(int i = 0;i<N;i++){   Arr[ i ] = i ;   size[ i ] = 1;   }  }  static boolean find(int A,int B){   if( root(A)==root(B) )     return true;   else   return false;  }   static void weighted_union(int A,int B,int n){   int root_A = root(A);   int root_B = root(B);   if(size[root_A] < size[root_B ]){   Arr[ root_A ] = Arr[root_B];   size[root_B] += size[root_A];   }   else{   Arr[ root_B ] = Arr[root_A];   size[root_A] += size[root_B];   }  }  static int root (int i){   while(Arr[ i ] != i){    Arr[ i ] = Arr[ Arr[ i ] ] ;    i = Arr[ i ];   }   return i;  }    static boolean isPrime(long n) {  if(n < 2L) return false;  if(n == 2L || n == 3L) return true;  if(n%2L == 0 || n%3L == 0) return false;  long sqrtN = (long)Math.sqrt(n)+1L;  for(long i = 6L; i <= sqrtN; i += 6L) {  if(n%(i-1) == 0 || n%(i+1) == 0) return false;  }  return true; }  static int maxlevel=0;                          static int minPrime[]; static void minimumPrime(int n){  minPrime=new int[n+1];  minPrime[1]=1;   for (int i = 2; i * i <= n; ++i) {    if (minPrime[i] == 0) {       for (int j = i * i; j <= n; j += i) {      if (minPrime[j] == 0) {       minPrime[j] = i;      }     }    }   }   for (int i = 2; i <= n; ++i) {    if (minPrime[i] == 0) {     minPrime[i] = i;    }   } } static long modInverse(long A, long M) {  long x=extendedEuclid(A,M)[0];  return (x%M+M)%M;  } static long[] extendedEuclid(long A, long B) {  if(B == 0) {  long d = A;  long x = 1;  long y = 0;  return new long[]{x,y,d};  }  else {  long arr[]=extendedEuclid(B, A%B);  long temp = arr[0];  arr[0] = arr[1];  arr[1] = temp - (A/B)*arr[1];  return arr;  } }  static class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar, 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() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isEndOfLine(c));    return res.toString();   }    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 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) {    int[] arr = new int[n];    for (int i = 0; i < n; i++) {     arr[i] = 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 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);   } } }
6	public class LookingForOrder {  static int[] x, y; static int[] dp; static int n;  static int dist(int i, int j) {  return ((x[i] - x[j]) * (x[i] - x[j]))   + ((y[i] - y[j]) * (y[i] - y[j])); }  static int solve(int mask) {  if (mask == (1 << n) - 1)  return 0;  if (dp[mask] != -1)  return dp[mask];  int ans = Integer.MAX_VALUE;  int j = 0;  for (int i = 1; i < n; i++)  if ((mask & (1 << i)) == 0) {   if (j == 0) {   ans = Math    .min(ans, 2 * dist(0, i) + solve(mask | (1 << i)));   j = i;   } else   ans = Math.min(ans, dist(0, i) + dist(i, j) + dist(j, 0)    + solve(mask | (1 << i) | (1 << j)));  }  return dp[mask] = ans; }  static void prnt(int mask) {  if (mask == (1 << n) - 1)  return;  int j = 0;  for (int i = 1; i < n; i++)  if ((mask & (1 << i)) == 0) {   if (j == 0) {   j = i;   if (dp[mask] == 2 * dist(0, i) + solve(mask | (1 << i))) {    out.print(" " + i + " 0");    prnt(mask | (1 << i));    return;   }   } else if (dp[mask] == dist(0, i) + dist(i, j) + dist(j, 0)    + solve(mask | (1 << i) | (1 << j))) {   out.print(" " + i + " " + j + " 0");   prnt(mask | (1 << i) | (1 << j));   return;   }  } }  public static void main(String[] args) throws IOException {  sc = new StringTokenizer(br.readLine());  int a = nxtInt();  int b = nxtInt();  n = nxtInt() + 1;  x = new int[n];  y = new int[n];  dp = new int[1 << n];  Arrays.fill(dp, -1);  x[0] = a;  y[0] = b;  for (int i = 1; i < n; i++) {  x[i] = nxtInt();  y[i] = nxtInt();  }  out.println(solve(1 << 0));  out.print(0);  prnt(1 << 0);  out.println();  br.close();  out.close(); }  static BufferedReader br = new BufferedReader(new InputStreamReader(  System.in)); static PrintWriter out = new PrintWriter(System.out);  static StringTokenizer sc;  static String nxtTok() throws IOException {  while (!sc.hasMoreTokens())  sc = new StringTokenizer(br.readLine());  return sc.nextToken(); }  static int nxtInt() throws IOException {  return Integer.parseInt(nxtTok()); }  static long nxtLng() throws IOException {  return Long.parseLong(nxtTok()); } }
6	public class Main {  void solve() {   int n=ni(),m=ni();   int a[][]=new int[n+1][m+1];   for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) a[i][j]=ni();   if(n==1){    int mn=Integer.MAX_VALUE;    for(int i=1;i<m;i++) mn=Math.min(mn,Math.abs(a[1][i]-a[1][i+1]));    pw.println(mn) ;    return ;   }   mn1=new int[n+1][n+1];   mn2=new int[n+1][n+1];   for(int i=1;i<=n;i++){    for(int j=1;j<=n;j++){     if(i==j) continue;     mn1[i][j]=mn2[i][j]=Integer.MAX_VALUE;     for(int k=1;k<=m;k++){      mn1[i][j]=Math.min(mn1[i][j],Math.abs(a[i][k]-a[j][k]));          }     for(int k=1;k<m;k++){      mn2[i][j]=Math.min(mn2[i][j],Math.abs(a[i][k+1]-a[j][k]));     }         }   }     dp=new int[17][1<<16][17];   for(int i=1;i<17;i++) for(int j=0;j<(1<<16);j++) Arrays.fill(dp[i][j],-1);   int ans=0;   for(int i=1;i<=n;i++){    ans=Math.max(ans,go(2,1<<(i-1),i,i,n));   }   pw.println(ans);  }  int mn1[][],mn2[][];  int dp[][][];  int go(int i,int mask,int prev,int first,int n){   if(i>n){      return mn2[first][prev];   }   if(dp[first][mask][prev]!=-1) return dp[first][mask][prev];   int cc=0;   for(int k=1;k<=n;k++){    if((mask&(1<<(k-1)))==0){     cc=Math.max(cc,Math.min(mn1[prev][k],go(i+1,mask|(1<<(k-1)),k,first,n)));        }   }   dp[first][mask][prev]=cc;   return cc;  }   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 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 double nd() { return Double.parseDouble(ns()); }  private char nc() { return (char)skip(); }  private String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b))){    sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }  private char[] ns(int n) {   char[] buf = new char[n];   int b = skip(), p = 0;   while(p < n && !(isSpaceChar(b))){    buf[p++] = (char)b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }  private char[][] nm(int n, int m) {   char[][] map = new char[n][];   for(int i = 0;i < n;i++)map[i] = ns(m);   return map;  }  private int[] na(int n) {   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = ni();   return a;  }  private int ni() {   int num = 0, b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private long nl() {   long num = 0;   int b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null;  private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); } }
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; } void debug(Object... os) {  System.err.println(deepToString(os)); }  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()); }  long nextLong() {  return Long.parseLong(next()); }  double nextDouble() {  return Double.parseDouble(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();  }  private static 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));   }   public String nextLine() throws IOException {    String s = br.readLine();    return s == null ? "-1" : s;   }   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 Long nextLong() throws IOException {    return Long.parseLong(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();  } }
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;  }  }
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);  } }
2	public class B{  public static void main(String args[]){   Scanner input = new Scanner(System.in);   long n = input.nextLong();   long k = input.nextLong();   System.out.println(solve(n, k));   input.close();  }   public static long solve(long n, long k){   long dis = n - k;   if(n == 1)    return 0;   if((((k - 2) * ((k - 2) + 1)) / 2) + 1 <= dis)    return -1;   if(k >= n)    return 1;     long ans = 2;   long now = (((k - 2) * ((k - 2) + 1)) / 2) + 1 + k;   long dist = Math.abs(now - n);   long delta = 1 + 8 * dist;   double ret = (1 + Math.sqrt(delta)) / 2;     now = (((k - 2) * ((k - 2) + 1)) / 2) + 1 + k;   dist = Math.abs(now - k);   delta = 1 + 8 * dist;   double nret = (1 + Math.sqrt(delta)) / 2;     double back = nret - ret;   ans = (long) back;   return ans + 2;  } }
0	public class A { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  long l = in.nextLong();  long r = in.nextLong();  in.close();  if (r - l < 2) {  System.out.println(-1);  return;  }  if ((r - l > 2)||(l%2 ==0 )) {  long s = l + l%2;  System.out.println(s+" "+(s+1)+" "+(s+2));  } else {  if (l%2 == 1) {   System.out.println(-1);  } else{   long s = l;   System.out.println(s+" "+(s+1)+" "+(s+2));  }  }   } static long gcd(long a, long b) {  if(a==0) {  return b;  }  if (b==0) {  return a;  }  if (a > b) {  return gcd (a%b, b);  }  return gcd (b%a, a); } }
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 minof(int a, int b, int c) {return min(a, min(b, c));}  static int minof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); int min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static long minof(long a, long b, long c) {return min(a, min(b, c));}  static long minof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); long min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static int maxof(int a, int b, int c) {return max(a, max(b, c));}  static int maxof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); int max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static long maxof(long a, long b, long c) {return max(a, max(b, c));}  static long maxof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); long max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static int powi(int a, int b) {if (a == 0) return 0; int ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static long powl(long a, int b) {if (a == 0) return 0; long ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static int fli(double d) {return (int) d;}  static int cei(double d) {return (int) ceil(d);}  static long fll(double d) {return (long) d;}  static long cel(double d) {return (long) ceil(d);}  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 lcm(int a, int b) {return a * b / gcf(a, b);}  static long lcm(long a, long b) {return a * b / gcf(a, b);}  static int randInt(int min, int max) {return __rand.nextInt(max - min + 1) + min;}  static long mix(long x) {x += 0x9e3779b97f4a7c15L; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9L; x = (x ^ (x >> 27)) * 0x94d049bb133111ebL; return x ^ (x >> 31);}   static void reverse(int[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {int swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(long[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {long swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(double[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {double swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(char[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {char swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  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 void rsort(int[] a) {shuffle(a); sort(a);}  static void rsort(long[] a) {shuffle(a); sort(a);}  static void rsort(double[] a) {shuffle(a); sort(a);}  static int[] copy(int[] a) {int[] ans = new int[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static long[] copy(long[] a) {long[] ans = new long[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static double[] copy(double[] a) {double[] ans = new double[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static char[] copy(char[] a) {char[] ans = new char[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}   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 dc(List<? extends Collection<Integer>> g, int u, int v) {g.get(u).remove(v); g.get(v).remove(u);}  static void dcto(List<? extends Collection<Integer>> g, int u, int v) {g.get(u).remove(v);}   static void r() throws IOException {input = new StringTokenizer(rline());}  static int ri() throws IOException {return Integer.parseInt(rline());}  static long rl() throws IOException {return Long.parseLong(rline());}  static double rd() throws IOException {return Double.parseDouble(rline());}  static int[] ria(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni(); return a;}  static int[] riam1(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni() - 1; return a;}  static long[] rla(int n) throws IOException {long[] a = new long[n]; r(); for (int i = 0; i < n; ++i) a[i] = nl(); return a;}  static double[] rda(int n) throws IOException {double[] a = new double[n]; r(); for (int i = 0; i < n; ++i) a[i] = nd(); return a;}  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 rnl() throws IOException {r(); return nl();}  static long nl() {return Long.parseLong(n());}  static double rnd() throws IOException {r(); return nd();}  static double nd() {return Double.parseDouble(n());}  static List<List<Integer>> rg(int n, int m) throws IOException {List<List<Integer>> g = g(n); for (int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1); return g;}  static void rg(List<List<Integer>> g, int m) throws IOException {for (int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1);}  static List<List<Integer>> rdg(int n, int m) throws IOException {List<List<Integer>> g = g(n); for (int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1); return g;}  static void rdg(List<List<Integer>> g, int m) throws IOException {for (int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1);}  static List<Set<Integer>> rsg(int n, int m) throws IOException {List<Set<Integer>> g = sg(n); for (int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1); return g;}  static void rsg(List<Set<Integer>> g, int m) throws IOException {for (int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1);}  static List<Set<Integer>> rdsg(int n, int m) throws IOException {List<Set<Integer>> g = sg(n); for (int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1); return g;}  static void rdsg(List<Set<Integer>> g, int m) throws IOException {for (int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1);}   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 pryes() {prln("yes");}  static void pry() {prln("Yes");}  static void prY() {prln("YES");}  static void prno() {prln("no");}  static void prn() {prln("No");}  static void prN() {prln("NO");}  static void pryesno(boolean b) {prln(b ? "yes" : "no");};  static void pryn(boolean b) {prln(b ? "Yes" : "No");}  static void prYN(boolean b) {prln(b ? "YES" : "NO");}  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 h() {prln("hlfd"); flush();}  static void flush() {__out.flush();}  static void close() {__out.close();}}
5	public class A {  static BufferedReader in;  static PrintWriter out;  static StringTokenizer st;  static Random rnd;  void solve() throws IOException {   int n = nextInt();   int[] arr = new int[n];   Integer[] arrCopy = new Integer[n];   for (int i = 0; i < n; i++)    arr[i] = arrCopy[i] = nextInt();   Arrays.sort(arrCopy);   int bad = 0;   for (int i = 0; i < n; i++)    if (arr[i] != arrCopy[i])     ++bad;   boolean fail = bad > 2;   out.println(!fail ? "YES" : "NO");  }  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());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
3	public class cf573 {  public static void main(String[] args){   Scanner scan=new Scanner(System.in);   int n=0;   if(scan.hasNext())    n=scan.nextInt();   TreeSet<Integer> set=new TreeSet<>();   for(int i=0;i<n;i++){    if(scan.hasNext())     set.add(scan.nextInt());   }   int[] arr=new int[set.size()];   Iterator<Integer> it=set.iterator();   int j=0;   while(it.hasNext()){    arr[j++]=it.next();   }   int tot=1,flag;   for(int i=1;i<arr.length;i++){    flag=0;    for(int k=0;k<i;k++){     if(arr[i]%arr[k]==0){      flag=1;      break;     }    }    if(flag==0){     tot++;    }   }   System.out.println(tot);  } }
4	public class Codeforces {  public static void main(String args[])throws Exception  {   BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));   StringBuilder sb=new StringBuilder();   int t=Integer.parseInt(bu.readLine());   while(t-->0)   {    int n=Integer.parseInt(bu.readLine());    int cur[]=new int[n],i,cr=-1;    for(i=0;i<n;i++)    {     int j,d=Integer.parseInt(bu.readLine()),f=-1;     for(j=cr;j>=0;j--)     if(cur[j]==d-1) {f=j; break;}     if(f==-1)     {      cr++;      f=cr;     }     cur[f]=d;     cr=f;     for(j=f+1;j<n;j++) cur[j]=0;     sb.append(cur[0]);     for(j=1;j<n;j++)     if(cur[j]==0) break;     else sb.append("."+cur[j]);     sb.append("\n");    }   }   System.out.print(sb);  } }
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);  } }
3	public class Main {  private static InputReader reader = new InputReader(System.in);  private static PrintWriter writer = new PrintWriter(System.out);  public static void main(String[] args) {   int n = readInt();   long[] a = readLongArray(n);   HashMap<Long, List<Block>> blocks = new HashMap<>();   for (int j = 0; j < n; j++) {    long sum = 0;    for (int i = j; i >= 0; i--) {     sum += a[i];     if (!blocks.containsKey(sum))      blocks.put(sum, new LinkedList<>());     List<Block> blockList = blocks.get(sum);     if (blockList.size() > 0 && blockList.get(blockList.size() - 1).r == j) continue;     blockList.add(new Block(i, j));    }   }   List<Block> bestBlocks = new LinkedList<>();   for(long sum : blocks.keySet()) {    List<Block> blockList = blocks.get(sum);    List<Block> curBest = new LinkedList<>();    int lastR = -1;    for(Block block : blockList) {     if (block.l > lastR) {      curBest.add(block);      lastR = block.r;     }    }    if (curBest.size() > bestBlocks.size()) {     bestBlocks = curBest;    }   }   writer.println(bestBlocks.size());   for(Block block : bestBlocks) {    writer.printf("%d %d\n", block.l + 1, block.r + 1);   }   writer.flush();  }  private static int readInt() {   return reader.nextInt();  }  private static long readLong() {   return Long.parseLong(reader.next());  }  private static int[] readIntArray(int size) {   int[] array = new int[size];   for (int i = 0; i < size; i++) {    array[i] = readInt();   }   return array;  }  private static long[] readLongArray(int size) {   long[] array = new long[size];   for (int i = 0; i < size; i++) {    array[i] = readLong();   }   return array;  }  private static void reverseIntArray(int[] array) {   for (int i = 0; i < array.length / 2; i++) {    int temp = array[i];    array[i] = array[array.length - i - 1];    array[array.length - i - 1] = temp;   }  }  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());   }  }  private static class Block {   int l, r;   Block(int l, int r) {    this.l = l;    this.r = r;   }  } }
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);   }  } }
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_]); } }
6	public class Main{  BufferedReader in;  StringTokenizer str = null;  PrintWriter out;  private String next() throws Exception{  if (str == null || !str.hasMoreElements())   str = new StringTokenizer(in.readLine());  return str.nextToken();  }   private int nextInt() throws Exception{  return Integer.parseInt(next());  }  int []x,y;  int n;  int []dp, prev;   public void run() throws Exception{  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   int xs = nextInt();  int ys = nextInt();  n = nextInt();  x = new int[n];  y = new int[n];  for(int i=0;i<n;i++){   x[i] = nextInt();   y[i] = nextInt();  }   int one[] = new int[n];  for(int i=0;i<n;i++){   one[i] = dist(xs, ys, x[i], y[i]);  }   int two[][] = new int[n][n];  for(int i=0;i<n;i++){   for(int j=i+1;j<n;j++){   two[i][j] = two[j][i] = dist(xs, ys, x[i], y[i]) + dist(x[i], y[i], x[j], y[j]) + dist(xs, ys, x[j], y[j]);   }  }   dp = new int[1<<n];  Arrays.fill(dp, Integer.MAX_VALUE/2);  dp[0] = 0;  prev = new int[1<<n];  Arrays.fill(prev, -1);   for(int mask=1;mask<(1<<n);mask++){   int i = 0;   while((mask & (1<<i)) == 0) i++;   dp[mask] = dp[mask ^ (1<<i)] + 2*one[i];   prev[mask] = i+1;   for(int j=i+1;j<n;j++){   if ((mask & (1<<j)) > 0) {    if (dp[mask] > dp[mask ^ (1<<i) ^ (1<<j)] + two[i][j]) {    dp[mask] = dp[mask ^ (1<<i) ^ (1<<j)] + two[i][j];    prev[mask] = 100 * (i+1) + (j+1);    }   }   }  }   out.println(dp[(1<<n)-1]);  out.print(0 + " ");  int cur = (1<<n)-1;  int i = 0, j = 0;  while(cur > 0) {   i = prev[cur]/100;   j = prev[cur]%100;     if (i > 0) {   cur^=1<<(i-1);   out.print(i + " ");   }   if (j > 0) {   cur^=1<<(j-1);   out.print(j + " ");   }   out.print(0 + " ");  }        out.close();  }  private String bit2str(int mask, int n) {  String s = "";  for(int i=0;i<n;i++){   if ((mask & (1<<i)) > 0){   s+="1";   }else{   s+="0";   }  }  while(s.length() < n)   s+="0";   return new StringBuilder(s).reverse().toString();  }  private int dist(int x1, int y1, int x2, int y2) {  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);  }  public static void main(String args[]) throws Exception{  new Main().run();  } }
5	public class Main {  FastScanner in = new FastScanner(System.in);    PrintWriter out = new PrintWriter(System.out);  public static void main (String[]args) {   Main task = new Main();   task.solve();   task.close();  }  public void close () {   in.close();   out.close();  }   public void solve() {   int n = in.nextInt();   int k = in.nextInt();     Team[]teams = new Team[n];     for (int i = 0; i < n; i++) {    Team t = new Team();    t.tasks = in.nextInt();    t.penalty = in.nextInt();    teams[i] = t;   }     Arrays.sort(teams);     Team t = teams[k - 1];   int ans = 0;   for (int i = 0; i < teams.length; i++) {    if (teams[i].equals(t)) ans++;   }      System.out.println(ans);        }  class Team implements Comparable<Team>{   int tasks;   int penalty;   @Override   public int hashCode() {    final int prime = 31;    int result = 1;    result = prime * result + getOuterType().hashCode();    result = prime * result + penalty;    result = prime * result + tasks;    return result;   }   @Override   public boolean equals(Object obj) {    if (this == obj)     return true;    if (obj == null)     return false;    if (getClass() != obj.getClass())     return false;    Team other = (Team) obj;    if (!getOuterType().equals(other.getOuterType()))     return false;    if (penalty != other.penalty)     return false;    if (tasks != other.tasks)     return false;    return true;   }   @Override   public int compareTo(Team o) {    if (this.tasks > o.tasks) return -1;    else if (this.tasks == o.tasks) {     if (this.penalty <= o.penalty) return -1;     else return 1;    }    else return 1;   }   private Main getOuterType() {    return Main.this;   }    }   public int max (int a, int b) {   if (a > b) return a;   else return b;  }    }  class Algebra {   public static int phi(int n) {   int result = n;   for (int i = 2; i*i <= n; ++i) {    if (n % i == 0) {     while (n % i == 0) {      n /= i;     }     result -= result / i;    }   }   if (n > 1) {    result -= result / n;   }   return result;  }    public static int binpow (int a, int n) {   int res = 1;   while (n != 0) {    if ((n & 1) == 1)     res *= a;    a *= a;    n >>= 1;   }   return res;  }    public static int gcd (int a, int b) {   return (b != 0) ? gcd (b, a % b) : a;  }    public static int lcm (int a, int b) {   return a / gcd (a, b) * b;  }    public static boolean[] sieveOfEratosthenes (int n) {   boolean [] prime = new boolean[n + 1];   Arrays.fill(prime, true);   prime[0] = prime[1] = false;   for (int i=2; i<=n; ++i) {    if (prime[i]) {     if (i * 1L * i <= n) {      for (int j=i*i; j<=n; j+=i) {       prime[j] = false;      }     }    }   }   return prime;  }  } class FastScanner {  BufferedReader br;  StringTokenizer st;   FastScanner(File f) {   try {    br = new BufferedReader(new FileReader(f));   } catch (FileNotFoundException e) {    e.printStackTrace();   }  }   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) {     System.err.println(e);     return "";    }   }   return st.nextToken();  }  int nextInt() {   return Integer.parseInt(next());  }  long nextLong() {   return Long.parseLong(next());  }  double nextDouble() {   return Double.parseDouble(next());  }  float nextFloat() {   return Float.parseFloat(next());  }  BigInteger nextBigInt() {   return new BigInteger(next());  }  void close() {   try {    br.close();   }   catch (IOException e) {   }  } }
1	public class F {  public static void main(String[] args) throws Exception {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = sc.nextInt(), d = sc.nextInt();  int [] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = sc.nextInt();  }  Arrays.sort(a);  TreeSet<Integer> set = new TreeSet<>();  for (int i = 0; i < a.length; i++) {  int tmp = a[i] - d;  if(i == 0 || tmp > a[i-1] && tmp - a[i-1] >= d)   set.add(tmp);  tmp = a[i] + d;  if(i == n-1 || tmp < a[i+1] && a[i+1] - tmp >= d)   set.add(tmp);  }  out.println(set.size());  out.flush();  out.close(); }  static class Scanner {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s)  {  br = new BufferedReader(new InputStreamReader(s));  }  public Scanner(FileReader fileReader)  {  br = new BufferedReader(fileReader);  }  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 String nextLine() throws IOException  {  return br.readLine();  }  public boolean ready() throws IOException  {  return br.ready();  } } }
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());  }  double nextDouble() {   return Double.parseDouble(nextToken());  }  String nextLine() throws IOException {   return br.readLine();  }   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();  }  long md(long x, long y, long x1, long y1) {   return Math.abs(x - x1) + Math.abs(y - y1);  }   double md(double x, double y, double x1, double y1) {   return Math.abs(x - x1) + Math.abs(y - y1);  }  double ed(double x, double y, double x1, double y1) {   return Math.sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));  }  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");       }      }     }    }   }  } }
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)));  } }
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);  } }
6	public class Bag implements Runnable {  private void solve() throws IOException {   int xs = nextInt();   int ys = nextInt();   int n = nextInt();   int[] x = new int[n];   int[] y = new int[n];   for (int i = 0; i < n; ++i) {    x[i] = nextInt();    y[i] = nextInt();   }   int[][] pair = new int[n][n];   for (int i = 0; i < n; ++i)    for (int j = i + 1; j < n; ++j)     pair[i][j] = (x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys) + (x[j] - xs) * (x[j] - xs) + (y[j] - ys) * (y[j] - ys) + (x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i]);   int[] single = new int[n];   for (int i = 0; i < n; ++i) {    single[i] = 2 * ((x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys));   }   int[] best = new int[1 << n];   int[] prev = new int[1 << n];   for (int set = 1; set < (1 << n); ++set) {    int i;    for (i = 0; i < n; ++i)     if ((set & (1 << i)) != 0)      break;    best[set] = best[set ^ (1 << i)] + single[i];    prev[set] = 1 << i;    for (int j = i + 1; j < n; ++j)     if ((set & (1 << j)) != 0) {      int cur = best[set ^ (1 << i) ^ (1 << j)] + pair[i][j];      if (cur < best[set]) {       best[set] = cur;       prev[set] = (1 << i) | (1 << j);      }     }   }   writer.println(best[(1 << n) - 1]);   int now = (1 << n) - 1;   writer.print("0");   while (now > 0) {   int differents = prev[now];   for(int i = 0; i < n; i++)   if((differents & (1 << i)) != 0)   {    writer.print(" ");     writer.print(i + 1);     now ^= 1 << i;   }    writer.print(" ");    writer.print("0");   }   writer.println();  }   public static void main(String[] args) {   new Bag().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();  } }
4	public class Solution {   public static void main(String[] args) {   InputStream inputStream;   try {    inputStream = new FileInputStream("input.txt");   } catch (IOException e) {    throw new RuntimeException(e);   }   OutputStream outputStream;   try {    outputStream = new FileOutputStream("output.txt");   } catch (IOException e) {    throw new RuntimeException(e);   }   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   int[][] or;   int n;   int m;   public void solve(int testNumber, InputReader in, PrintWriter out) {    n = in.nextInt();    m = in.nextInt();    int k = in.nextInt();    ArrayList<Point> arr1 = new ArrayList<>();    ArrayList<Point> arr2 = new ArrayList<>();    for (int i = 0; i < k; i++) {     arr1.add(new Point(in.nextInt(), in.nextInt()));    }    or = new int[n + 1][m + 1];    for (int i = 0; i < k; i++) {     or[arr1.get(i).x][arr1.get(i).y] = -1;    }    Point lastValue = arr1.get(0);    while (arr1.size() > 0 || arr2.size() > 0) {     for (Point p : arr1) {      if (valid(new Point(p.x - 1, p.y))) {       arr2.add(new Point(p.x - 1, p.y));      }      if (valid(new Point(p.x + 1, p.y))) {       arr2.add(new Point(p.x + 1, p.y));      }      if (valid(new Point(p.x, p.y - 1))) {       arr2.add(new Point(p.x, p.y - 1));      }      if (valid(new Point(p.x, p.y + 1))) {       arr2.add(new Point(p.x, p.y + 1));      }     }     arr1.clear();     if (arr2.size() > 0) {      lastValue = arr2.get(0);     }     for (Point p : arr2) {      if (valid(new Point(p.x - 1, p.y))) {       arr1.add(new Point(p.x - 1, p.y));      }      if (valid(new Point(p.x + 1, p.y))) {       arr1.add(new Point(p.x + 1, p.y));      }      if (valid(new Point(p.x, p.y - 1))) {       arr1.add(new Point(p.x, p.y - 1));      }      if (valid(new Point(p.x, p.y + 1))) {       arr1.add(new Point(p.x, p.y + 1));      }     }     arr2.clear();     if (arr1.size() > 0) {      lastValue = arr1.get(0);     }    }    out.println(lastValue.x + " " + lastValue.y);   }   boolean valid(Point p) {    if ((p.x < 1 || p.x > n) ||      (p.y < 1 || p.y > m) ||      or[p.x][p.y] == -1) {     return false;    }    or[p.x][p.y] = -1;    return true;   }   class Point {    int x;    int y;    public Point(int a, int b) {     x = a;     y = 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 D{  static int bot; static int n,m; static int [][]a; static int [][]Min; static int [][]memo; static int K; static int dp(int msk,int ones,int last) {  if(ones==n) {  return Min[last][bot]>=K?1:0;  }  if(memo[last][msk]!=-1)  return memo[last][msk];  int ans=0;  for(int nxt=0;nxt<n;nxt++)  if((msk & (1<<nxt)) ==0 && Min[last][nxt]>=K)  {   ans|=dp(msk|1<<nxt,ones+1,nxt);  }  return memo[last][msk]= ans; } static boolean check(int top,int bottom) {  for(int j=0;j+1<m;j++)  {  int diff=Math.abs(a[bottom][j]-a[top][j+1]);  if(diff<K)   return false;  }  return true; } public static void main(String[] args) throws IOException {  Scanner sc=new Scanner();  PrintWriter out=new PrintWriter(System.out);  n=sc.nextInt();  m=sc.nextInt();  a=new int [n][m];  for(int i=0;i<n;i++)  for(int j=0;j<m;j++)   a[i][j]=sc.nextInt();  Min=new int [n][n];  if(n==1) {  int lo=0,hi=(int)1e9;  int ans=0;  while(lo<=hi) {   K=lo+hi>>1;     if(check(0, 0))   {   ans=K;   lo=K+1;   }   else   hi=K-1;  }  System.out.println(ans);  return;  }  for(int i1=0;i1<n;i1++)  for(int i2=0;i2<n;i2++)  {   if(i1==i2)   continue;   int min=(int) 1e9;   for(int j=0;j<m;j++)   min=Math.min(Math.abs(a[i1][j]-a[i2][j]), min);   Min[i1][i2]=min;  }  memo=new int [n][1<<n];  int ans=0;  int lo=0,hi=(int)1e9;  while(lo<=hi) {  K=lo+hi>>1;  for(int []x:memo)  Arrays.fill(x, -1);  int ok=0;  for(int top=0;top<n && ok==0;top++)  for(int bottom=0;bottom<n && ok==0 ;bottom++) {   bot=bottom;   if(top==bottom || !check(top, bottom))   continue;        int dp=dp(1<<top | 1<<bottom, 2, top);   ok|=dp;     }  if(ok==1)  {  ans=K;  lo=K+1;    }  else  hi=K-1;  }  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();  }  String nextLine() throws IOException {  return br.readLine();  }  int nextInt() throws IOException{  return Integer.parseInt(next());  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(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, 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 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;  } } 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 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;   }  } }
3	public class C { public static Scanner sc = new Scanner(System.in); public static StringTokenizer st; public static PrintWriter pw = new PrintWriter(System.out); final static 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 void debug(String toPrint){  if(!debugmode) {return;}  pw.println("[DEBUG]: "+toPrint); } public static void submit(int[] k){  pw.println(Arrays.toString(k));  pw.close(); } public static void submit(int p){  pw.println(Integer.toString(p));  pw.close(); } public static void submit(String k){  pw.println(k);  pw.close(); } public static void submit(double u){  pw.println(Double.toString(u));  pw.close(); } public static void submit(long lng){  pw.println(Long.toString(lng));  pw.close();   } public static int getInt(){  if (st != null && st.hasMoreTokens()){  return Integer.parseInt(st.nextToken());  }  st = new StringTokenizer(sc.nextLine());  return Integer.parseInt(st.nextToken()); } public static long getLong(){  if (st != null && st.hasMoreTokens()){  return Long.parseLong(st.nextToken());  }  st = new StringTokenizer(sc.nextLine());  return Long.parseLong(st.nextToken()); } public static double getDouble(){  if (st != null && st.hasMoreTokens()){  return Double.parseDouble(st.nextToken());  }  st = new StringTokenizer(sc.nextLine());  return Double.parseDouble(st.nextToken()); } public static String getString(){  if(st != null && st.hasMoreTokens()){  return st.nextToken();  }  st = new StringTokenizer(sc.nextLine());  return st.nextToken(); } public static String getLine(){  return sc.nextLine(); } public static int[][] readMatrix(int lines,int cols){  int[][] matrr = new int[lines][cols];  for (int i = 0;i < lines;i++){  for(int j = 0;j < cols;j++){   matrr[i][j] = getInt();  }  }  return matrr; } public static int[] readArray(int lines){  int[] ar = new int[lines];   for (int i = 0;i<lines;i++) ar[i] =getInt();  return ar; }  }
2	public class Main {  static long MOD = (long) 1e9 + 7; static long[][] identity = {{1, 0}, {0, 1}};  public static void main(String[] args) {  FastScanner input = new FastScanner(System.in);   long x = input.nextLong();  long k = input.nextLong();   long[][] matrix = {  {2, MOD - 1},  {0, 1}  };   if (x == 0)  System.out.println(0);  else if (k == 0) {  System.out.println((x * 2) % MOD);  } else {  x %= MOD;  matrix = matrixexpo(k, matrix);  long low = (x * matrix[0][0] + matrix[0][1]) % MOD;  long hi = x * mathpow(k, 2) % MOD;  System.out.println((low + hi) % MOD);  } }  static long mathpow(long k, long x) {  if (k == 0)  return 1L;  else return mathpow(k / 2, (x * x) % MOD) * (k % 2 == 1 ? x : 1) % MOD; }  static long[][] matrixexpo(long k, long[][] matrix) {  if (k == 0)  return identity;  if (k % 2 == 0)  return matrixexpo(k / 2, multiply(matrix, matrix));  else  return multiply(matrix, matrixexpo(k / 2, multiply(matrix, matrix))); }  static long[][] multiply(long[][] arr, long[][] brr) {  int n = arr.length, m = arr[0].length, p = brr[0].length;   long[][] product = new long[n][p];   for (int i = 0; i < n; i++)  for (int j = 0; j < p; j++)   for (int k = 0; k < m; k++)   product[i][j] = (product[i][j] + arr[i][k] * brr[k][j]) % MOD;  return product; }   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;  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  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 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();  } } }
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)); }
0	public class AAA { 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());  String a="";  String b="";  for(int i=0;i<1129;i++) {  a+="1";  b+="8";  }  a+="9";  b+="1";   System.out.println(a);  System.out.println(b); }  }
4	public class Main {  public static void main(String[] args) throws IOException {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(new FileReader("input.txt"));   PrintWriter out = new PrintWriter("output.txt");   TaskB solver = new TaskB();   solver.solve(in, out);   out.close();  }  private static class TaskB {   static final long max = 1000000000000000000L;   static final double eps = 0.0000001;   static final long mod = 1000000007;   static int N, M, K;   static long X, Y;   static boolean F[][][];   static int D[][];   void solve(InputReader in, PrintWriter out) throws IOException {    N = in.nextInt();    M = in.nextInt();    K = in.nextInt();    F = new boolean[K][N][M];    D = new int[N][M];    for (int i = 0; i < N; i++)     for (int j = 0; j < M; j++)      D[i][j] = Integer.MAX_VALUE;    List<Pair> list = new ArrayList<>();    for (int i = 0; i < K; i++) {     list.add(new Pair(in.nextInt() - 1, in.nextInt() - 1));    }       for (int i = 0; i < N; i++)     for (int j = 0; j < M; j++)      for (int k = 0; k < K; k++)       D[i][j] = Math.min(D[i][j], Math.abs(list.get(k).X - i) + Math.abs(list.get(k).Y - j));    int res = Integer.MIN_VALUE;    for (int j = 0; j < N; j++)     for (int k = 0; k < M; k++)      if (D[j][k] > res) {       X = j + 1;       Y = k + 1;       res = D[j][k];      }    out.println(X + " " + Y);   }     class Pair {    int X, Y;    Pair(int X, int Y) {     this.X = X;     this.Y = Y;    }   }   long gcd(long A, long B) {    if (B == 0) return A;    return gcd(B, A % B);   }   boolean isPrime(long n) {    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))     return false;    for (long i = 5, j = 2; i * i <= n; i += j, j = 6 - j)     if (n % i == 0)      return false;    return true;   }   boolean isEqual(double A, double B) {    return Math.abs(A - B) < eps;   }   double dist(double X1, double Y1, double X2, double Y2) {    return Math.sqrt((X1 - X2) * (X1 - X2) + (Y1 - Y2) * (Y1 - Y2));   }   boolean nextPer(int[] data) {    int i = data.length - 1;    while (i > 0 && data[i] < data[i - 1]) {     i--;    }    if (i == 0) {     return false;    }    int j = data.length - 1;    while (data[j] < data[i - 1]) {     j--;    }    int temp = data[i - 1];    data[i - 1] = data[j];    data[j] = temp;    Arrays.sort(data, i, data.length);    return true;   }   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;    }   }  }  private static class InputReader {   StringTokenizer st;   BufferedReader br;   public InputReader(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }   public InputReader(FileReader s) throws FileNotFoundException {    br = new BufferedReader(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());   }   public long nextLong() {    return Long.parseLong(next());   }   public String nextLine() {    try {     return br.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public double nextDouble() {    return Double.parseDouble(next());   }   public boolean ready() {    try {     return br.ready();    } catch (IOException e) {     throw new RuntimeException(e);    }   }  } }
0	public class A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   long l = sc.nextLong();  long h = sc.nextLong();   sc.close();   if(h-l<2) {  System.out.println(-1);  return ;  }   if(h-l==2 && l%2==1) {  System.out.println(-1);  return ;  }   if(l%2==1) {  ++l;  }   System.out.printf("%d %d %d\n",l,l+1L,l+2L); } }
1	public class Main {  public static void main(String[] args) throws Exception {  int n=ni();  Map<String, Integer> hola=new HashMap<String,Integer>();  hola.put("S", 0);  hola.put("XS", 0);  hola.put("XXS", 0);  hola.put("XXXS", 0);  hola.put("M", 0);  hola.put("L", 0);  hola.put("XL", 0);  hola.put("XXL", 0);  hola.put("XXXL", 0);  for(int i=0; i<n; i++)  {  String te=ns();  hola.put(te,hola.get(te)+1);  }  for(int i=0; i<n; i++)  {  String te=ns();  hola.put(te,hola.get(te)-1);  }  int ans=0;  for(int te:hola.values())  {  ans+=max(te,0);  }  pr(ans);  System.out.print(output); }    static int pow(int a, int b) {  int c=1;  while(b>0)  {  if(b%2!=0)   c*=a;  a*=a;  }  return c; } static class pair {  int a, b;  pair(){}  pair(int c,int d){a=c;b=d;} } static interface combiner {  public long combine(long a,long b); } static final long mod=1000000007; static final double eps=1e-9; static final long inf=100000000000000000L; static Reader in=new Reader(); static StringBuilder output=new StringBuilder(); static Random rn=new Random(); static void reverse(int[]a){for(int i=0; i<a.length/2; i++){a[i]^=a[a.length-i-1];a[a.length-i-1]^=a[i];a[i]^=a[a.length-i-1];}} static void sort(int[]a) {  int te;  for(int i=0; i<a.length; i+=2)  {  te=rn.nextInt(a.length);  if(i!=te)  {   a[i]^=a[te];   a[te]^=a[i];   a[i]^=a[te];  }  }  Arrays.sort(a); } static void sort(long[]a) {  int te;  for(int i=0; i<a.length; i+=2)  {  te=rn.nextInt(a.length);  if(i!=te)  {  a[i]^=a[te];  a[te]^=a[i];  a[i]^=a[te];  }  }  Arrays.sort(a); } static void sort(double[]a) {  int te;  double te1;  for(int i=0; i<a.length; i+=2)  {  te=rn.nextInt(a.length);  if(i!=te)  {  te1=a[te];  a[te]=a[i];  a[i]=te1;  }  }  Arrays.sort(a); } static void sort(int[][]a) {  Arrays.sort(a, new Comparator<int[]>()  {  public int compare(int[]a,int[]b)  {   if(a[0]>b[0])   return -1;   if(b[0]>a[0])   return 1;   return 0;  }  }); } static void sort(pair[]a) {  Arrays.sort(a,new Comparator<pair>()   {  @Override  public int compare(pair a,pair b)  {   if(a.a>b.a)   return 1;   if(b.a>a.a)   return -1;   return 0;  }   }); } static int log2n(long a) {  int te=0;  while(a>0)  {  a>>=1;  ++te;  }  return te; } static class vectorl implements Iterable<Long> {  long a[];  int size;  vectorl(){a=new long[10];size=0;}  vectorl(int n){a=new long[n];size=0;}  public void add(long b){if(++size==a.length)a=Arrays.copyOf(a, 2*size);a[size-1]=b;}  public void sort(){Arrays.sort(a, 0, size);}  public void sort(int l, int r){Arrays.sort(a, l, r);}  @Override  public Iterator<Long> iterator() {  Iterator<Long> hola=new Iterator<Long>()   {   int cur=0;    @Override    public boolean hasNext() {    return cur<size;    }    @Override    public Long next() {    return a[cur++];    }     };  return hola;  } } static class vector implements Iterable<Integer> {  int a[],size;  vector(){a=new int[10];size=0;}  vector(int n){a=new int[n];size=0;}  public void add(int b){if(++size==a.length)a=Arrays.copyOf(a, 2*size);a[size-1]=b;}  public void sort(){Arrays.sort(a, 0, size);}  public void sort(int l, int r){Arrays.sort(a, l, r);}  @Override  public Iterator<Integer> iterator() {  Iterator<Integer> hola=new Iterator<Integer>()   {   int cur=0;    @Override    public boolean hasNext() {    return cur<size;    }    @Override    public Integer next() {    return a[cur++];    }     };  return hola;  } }  static void pr(Object a){output.append(a+"\n");} static void pr(){output.append("\n");} static void p(Object a){output.append(a);} static void pra(int[]a){for(int i:a)output.append(i+" ");output.append("\n");} static void pra(long[]a){for(long i:a)output.append(i+" ");output.append("\n");} static void pra(String[]a){for(String i:a)output.append(i+" ");output.append("\n");} static void pra(double[]a){for(double i:a)output.append(i+" ");output.append("\n");} static void sop(Object a){System.out.println(a);} static void flush(){System.out.println(output);output=new StringBuilder();}   static int ni(){return Integer.parseInt(in.next());} static long nl(){return Long.parseLong(in.next());} static String ns(){return in.next();} static double nd(){return Double.parseDouble(in.next());} static int[] nia(int n){int a[]=new int[n];for(int i=0; i<n; i++)a[i]=ni();return a;} static int[] pnia(int n){int a[]=new int[n+1];for(int i=1; i<=n; i++)a[i]=ni();return a;} static long[] nla(int n){long a[]=new long[n];for(int i=0; i<n; i++)a[i]=nl();return a;} static String[] nsa(int n){String a[]=new String[n];for(int i=0; i<n; i++)a[i]=ns();return a;} static double[] nda(int n){double a[]=new double[n];for(int i=0; i<n; i++)a[i]=nd();return a;}   static void exit(){System.out.print(output);System.exit(0);} static int min(int... a){int min=a[0];for(int i:a)min=Math.min(min, i);return min;} static int max(int... a){int max=a[0];for(int i:a)max=Math.max(max, i);return max;}  static int gcd(int... a){int gcd=a[0];for(int i:a)gcd=gcd(gcd, i);return gcd;}  static long min(long... a){long min=a[0];for(long i:a)min=Math.min(min, i);return min;} static long max(long... a){long max=a[0];for(long i:a)max=Math.max(max, i);return max;}  static long gcd(long... a){long gcd=a[0];for(long i:a)gcd=gcd(gcd, i);return gcd;}  static String pr(String a, long b){String c="";while(b>0){if(b%2==1)c=c.concat(a);a=a.concat(a);b>>=1;}return c;} static long powm(long a, long b, long m){long an=1;long c=a;while(b>0){if(b%2==1)an=(an*c)%m;c=(c*c)%m;b>>=1;}return an;} static int gcd(int a, int b){if(b==0)return a;return gcd(b, a%b);} static long gcd(long a, long b){if(b==0)return a;return gcd(b, a%b);} static class Reader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public Reader() {    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();   }  } }
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());   }     long nextLong() {    return Long.parseLong(next());   }     double nextDouble() {    return Double.parseDouble(next());   }     String readNextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
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;  } } 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;  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)); } }
5	public class VkR2A{  static BufferedReader br;  public static void main(String args[])throws Exception{   br=new BufferedReader(new InputStreamReader(System.in));   int nm[] = toIntArray();   int n = nm[0];   int a = nm[1];   int b = nm[2];   nm=toIntArray();   Arrays.sort(nm);   int k=nm[b-1];   int res=nm[b]-k;   System.out.println(res);  }    public static int[] toIntArray()throws Exception{   String str[]=br.readLine().split(" ");   int k[]=new int[str.length];   for(int i=0;i<str.length;i++){    k[i]=Integer.parseInt(str[i]);   }   return k;  }  public static int toInt()throws Exception{   return Integer.parseInt(br.readLine());  }  public static long[] toLongArray()throws Exception{   String str[]=br.readLine().split(" ");   long k[]=new long[str.length];   for(int i=0;i<str.length;i++){    k[i]=Long.parseLong(str[i]);   }   return k;  }  public static long toLong()throws Exception{   return Long.parseLong(br.readLine());  }  public static double[] toDoubleArray()throws Exception{   String str[]=br.readLine().split(" ");   double k[]=new double[str.length];   for(int i=0;i<str.length;i++){    k[i]=Double.parseDouble(str[i]);   }   return k;  }  public static double toDouble()throws Exception{   return Double.parseDouble(br.readLine());  }  public static String toStr()throws Exception{   return br.readLine();  }  public static String[] toStrArray()throws Exception{   String str[]=br.readLine().split(" ");   return str;  }   }
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++]);  }  long nextLong() throws IOException {  if (cacheIndex >= cache.length) {   cache = br.readLine().split(" ");   cacheIndex = 0;  }  return Long.parseLong(cache[cacheIndex++]);  }  String next() throws IOException {  if (cacheIndex >= cache.length) {   cache = br.readLine().split(" ");   cacheIndex = 0;  }  return 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();  } } }
3	public class Main {   public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));     int n = Integer.parseInt(br.readLine());   StringTokenizer tokenizer = new StringTokenizer(br.readLine());   boolean[] arr = new boolean[101];   int[] nums = new int[n+1];   int colors = 0;   for(int i = 1; i <= n; i++) {    nums[i] = Integer.parseInt(tokenizer.nextToken());    arr[nums[i]] = true;   }   Arrays.parallelSort(nums);   for(int i = 1; i <= n; i++) {    boolean newColor = false;    if(!arr[nums[i]]) {     continue;    }    for(int j = nums[i]; j <= 100; j += nums[i]) {     if(arr[j]) {      arr[j] = false;      newColor = true;     }    }    if(newColor) {     colors++;    }   }     bw.write(String.valueOf(colors));   br.close();   bw.close();  } }
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); }  void debug(Object... os){  System.err.println(Arrays.deepToString(os)); }  public static void main(String[] args){  Locale.setDefault(Locale.US);  new P111C().run(); } }
4	public class a { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  String s = sc.next();   int len = s.length();  for(int i=len-1; i>=1; --i) {  for(int j=0; j<=len - i; ++j) {   String ss = s.substring(j, j+i);   if(s.substring(j+1).indexOf(ss)!=-1) {   System.out.println(ss.length());   return;   }   }  }  System.out.println(0); } }
4	public class Main {  public static void main(String[] args) {   Scanner r = new Scanner(System.in);     String a = r.next();   char[] c = a.toCharArray();     for(int l = a.length()-1; l >= 1; l--){    for(int i = 0; i <= a.length()-l; i++){     int j = i+l-1;         for(int s = 0; s <= a.length()-l; s++){      if(i == s)continue;      if(a.substring(i, i+l).equals(a.subSequence(s, s+l))){       System.out.println(l);       System.exit(0);      }           }    }   }     System.out.println(0);    } }
3	public class InVoker {   public static void main(String args[]) {     Scanner inp = new Scanner(System.in);  PrintWriter out= new PrintWriter(System.out);    int n=inp.nextInt();  int a[]=new int[n];  for(int i=0;i<n;i++)   a[i]=inp.nextInt();  Arrays.sort(a);  int gg=0;  for(int i=0;i<n;i++) {   if(a[i]==0)   continue;   gg++;   for(int j=i+1;j<n;j++) {   if(a[j]%a[i]==0) {    a[j]=0;   }   }  }  out.println(gg);  out.close();  inp.close();     }   }
4	public class StringsProb {  private void solve() throws IOException {   String s = nextToken();   int res = 0;   Map<String , Integer> m = new HashMap<String, Integer>();   for (int i = 0; i < s.length(); i++)    for (int j = 0; j <= s.length(); j++) {     if (i > j) continue;     String a = s.substring(i , j);     if (a.equals("")) continue;     if (m.containsKey(a)) {      m.put(a, m.get(a) + 1);     }     else      m.put(a, 1);    }   for (Entry<String , Integer> e : m.entrySet()) {    if (e.getValue() >= 2)     res = Math.max(res, e.getKey().length());   }   System.out.println(res);  }  public static void main(String[] args) {   new StringsProb().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[] readIntArray(int size) throws IOException {   int[] res = new int[size];   for (int i = 0; i < size; i++) {    res[i] = nextInt();   }   return res;  }  long[] readLongArray(int size) throws IOException {   long[] res = new long[size];   for (int i = 0; i < size; i++) {    res[i] = nextLong();   }   return res;  }  double[] readDoubleArray(int size) throws IOException {   double[] res = new double[size];   for (int i = 0; i < size; i++) {    res[i] = nextDouble();   }   return res;  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  BigInteger nextBigInteger() throws IOException {   return new BigInteger(nextToken());  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  } }
2	public class Solution {   private static final long MODULUS = 1000000007;  private static final boolean DEBUG = false;  private static long modularPow(long base, long exponent, long modulus) {   long result = 1;   while (exponent > 0) {    if (exponent % 2 == 1) {     result = (result * base) % modulus;    }    exponent >>= 1;    base = (base * base) % modulus;   }   return result;  }  public static void main(String[] args) throws FileNotFoundException {   long beginTime = System.nanoTime();   InputStream is = DEBUG ? new FileInputStream("resources/codeforcesedu43/ProblemC-1.in") : System.in;   try (Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(is)))) {    long x = scanner.nextLong();    long k = scanner.nextLong();    if (x != 0) {     x = (2 * x - 1) % MODULUS;     long twoPowK = modularPow(2, k, MODULUS);     x = (x * twoPowK + 1) % MODULUS;    }    System.out.println(x % 1000000007);   }   System.err.println( "Done in " + ((System.nanoTime() - beginTime) / 1e9) + " seconds.");  } }
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()); }  private long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  private double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.nextInt();    int[] arr = new int[n + 1];    for (int i = 1; i <= n; i++) {     arr[i] = in.nextInt();    }    int inversions = 0;    for (int i = 1; i <= n; i++) {     for (int j = i + 1; j <= n; j++) {      if (arr[i] > arr[j])       inversions++;     }    }    inversions %= 2;    int q = in.nextInt();    for (int i = 0; i < q; i++) {     int l = in.nextInt(), r = in.nextInt();     int d = r - l + 1;     d = d * (d - 1) / 2;     if ((d & 1) == 1) inversions ^= 1;     out.println((inversions & 1) == 1 ? "odd" : "even");    }   }  }  static class FastScanner {   private BufferedReader br;   private 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));   }   public String nextString() {    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();   }   public int nextInt() {    return Integer.parseInt(nextString());   }  } }
4	public class Main { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int t = sc.nextInt();  for (int tc = 0; tc < t; ++tc) {  int n = sc.nextInt();  int[] a = new int[n];  for (int i = 0; i < a.length; ++i) {   a[i] = sc.nextInt();  }   System.out.println(solve(a));  }  sc.close(); }  static String solve(int[] a) {  List<String> result = new ArrayList<>();  Stack<Integer> stack = new Stack<>();  for (int ai : a) {  if (ai != 1) {   while (stack.peek() + 1 != ai) {   stack.pop();   }   stack.pop();  }  stack.push(ai);   result.add(stack.stream().map(String::valueOf).collect(Collectors.joining(".")));  }  return String.join("\n", result); } }
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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   int n;   ArrayList<Integer>[] adj;   long[] mem;   int start;   long cycles(int cur, int visited) {    if (cur == start && visited > 0) {     return Integer.bitCount(visited) >= 3 ? 1 : 0;    }    int index = visited * n + cur;    if (mem[index] != -1) return mem[index];    long res = 0;    int newvisited = visited | (1 << cur);    for (int nxt : adj[cur]) {     if (nxt >= start && (nxt == start || ((visited >> nxt) & 1) == 0)) {      res += cycles(nxt, newvisited);     }    }    return mem[index] = res;   }   public void solve(int testNumber, InputReader in, OutputWriter out) {    n = in.readInt();    int m = in.readInt();    adj = new ArrayList[n];    mem = new long[n * (1 << n)];    for (int i = 0; i < adj.length; i++) adj[i] = new ArrayList<>();    for (int i = 0; i < m; i++) {     int a = in.readInt() - 1, b = in.readInt() - 1;     adj[a].add(b);     adj[b].add(a);    }    long res = 0;    for (int start = 0; start < n; start++) {     Arrays.fill(mem, -1);     this.start = start;     res += cycles(start, 0) / 2;    }    out.printLine(res);   }  }  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);   }  }  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);   }  } }
1	public class Speadsheets {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = Integer.parseInt(sc.nextLine());   String code = "";     for (int i = 0; i < n; i++) {   long chResult = 0;   long chResult1 = 0;   long nResult = 0;   long nResult1 = 0;   boolean t = false;   boolean k = false;   code = sc.nextLine();   for (int j = 0; j < code.length(); j++) {    char c = code.charAt(j);    if (('Z' - c) < 33) {     if (t) {      chResult1 = chResult;      chResult = 0;      t = false;      k = true;     }     chResult = chResult * 26 + (26 - ('Z' - c));    } else {     t = true;     if (k) {      nResult1 = nResult;      nResult = 0;      k = false;     }     nResult = nResult * 10 + (9 - ('9' - c));    }   }   if (chResult1 == 0) {    System.out.println("R" + nResult + "C" + chResult);   } else {    System.out.println(convert(nResult) + nResult1);   }  }  }  private static String convert(long number) {   String [] chars = new String[]{"Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y"};   String result = "";   int rem = 0;   int m = 0;   while (number > 0) {   m = 0;    rem = (int) (number % 26);    result = chars[rem] + result;       if (number % 26 == 0) {    m = 1;    }    number = number / 26;    number = number - m;   }   return result;  } }
2	public class con67 {     public static void main(String[] args) throws IOException  {  long x=l(); long k=l(); if(x!=0) { long f=x%1000000007; long s=(f*power(2,k+1,1000000007))%1000000007;  long e= (power(2,k,1000000007)-1)%1000000007;  long ans=(s-e+1000000007)%1000000007;  out.println(ans);  } else { out.println(0); } out.close(); }   static long power(long x, long y, long p)  {     long res = 1;            x = x % p;     while (y > 0)   {           if((y & 1)==1)     res = (res * x) % p;             y = y >> 1;    x = (x * x) % p;   }   return res;  }   static InputReader in = new InputReader(System.in);  static OutputWriter out = new OutputWriter(System.out);    static int i()  {   return in.readInt();  }    static long l()  {   return in.readLong();  }    static double d()  {   return in.readDouble();  }    static String s()  {   return in.readString();  }    static void Iarr( int[] array, int no )  {   for( int i=0 ; i<no ; i++ )   {   array[i] = i();   }  }    static void Larr( long[] array, int no )  {   for( int i=0 ; i<no ; i++ )   {   array[i] = l();   }  }    static void Darr( double[] array, int no )  {   for( int i=0 ; i<no ; i++ )   {   array[i] = d();   }  }    static void Sarr( String[] array, int no )  {   for( int i=0 ; i<no ; i++ )   {   array[i] = s();   }  }    private 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 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 double readDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, readInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, readInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }   public 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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }     public String next()   {    return readString();   }     public interface SpaceCharFilter   {    public boolean isSpaceChar(int ch);   }  }    private 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 Main3 {  static long x, k;  static long MOD = (long)1e9 + 7;  public static void main(String args[]) throws Exception{   FastInput fi = new FastInput(new InputStreamReader(System.in));   PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   x = fi.nextLong();   k = fi.nextLong();   if(x == 0) {    System.out.println(0);    return;   }    long q1 = (pow(2, k+1) * (x%MOD)) % MOD;   long q2 = pow(2, k);   long q3 = 1;     long exp = (q1-q2 + MOD + MOD)%MOD;   exp = (exp + q3)%MOD;    pw.println(exp);   pw.close();  }  static long pow(long n, long k) {   if(k == 0)    return 1;   if(k == 1)    return n;   long ret = pow(n, k/2)%MOD;   ret = (ret*ret)%MOD;   if(k%2 == 1)    ret = (ret*n)%MOD;   return ret;  }  static class FastInput {   private Reader in;   private BufferedReader br;   private StringTokenizer st;   public FastInput(Reader in) {    this.in=in;    br = new BufferedReader(in);   }   public String nextString() {    while(st==null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     }     catch (IOException e) {      System.out.println(e.getStackTrace());     }    }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(nextString());   }   public long nextLong() {    return Long.parseLong(nextString());   }   public double nextDouble() {    return Double.parseDouble(nextString());   }  } }
1	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 { public void solve(int testNumber, InputReader in, PrintWriter out) {   int n=in.nextInt(),k=in.nextInt();   int a[]=new int[n];   int i;   for(i=0;i<n;i++)    a[i]=in.nextInt();   HashSet<Integer> hs=new HashSet<Integer>();   boolean status=false;   int index=-1;   for(i=0;i<n;i++)   {       hs.add(a[i]);    if(hs.size()==k)    {     index=i;     status=true;     break;    }   }   if(!status)   {    out.println(-1+" "+ -1);    return;   }   HashSet<Integer> hash=new HashSet<Integer>();   for(i=index;i>=0;i--)   {    hash.add(a[i]);    if(hash.size()==k)    {     break;    }   }   out.println((i+1)+" "+(index+1));  } } 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());  } }
1	public class C{ static String s; static long val[]; static int N,size; static int index(char c){  if(c <= 'Z'){  return c - 'A';  }else{  return c - 'a' + ('Z' - 'A' + 1);  } }  static int l(int i){  return (i<<1)+1; } static int r(int i){  return (i<<1)+2; }  static void setup(int l, int r, int i){  if(l==r){  val[i] = (1L<<index(s.charAt(l)));  }else{  int mid = (l+r)/2;  setup(l,mid,l(i));  setup(mid+1,r,r(i));  val[i] = val[l(i)] | val[r(i)];  } }  static long query(int min, int max, int l, int r, int i){  if(min <= l && r <= max){  return val[i];  }  if(max < l || r < min)  return 0;  int mid = (l+r)/2;  return query(min,max,l,mid,l(i)) | query(min,max,mid+1,r,r(i)); } static long query(int min, int max){  return query(min,max,0,N-1,0); }  static int binarySearch(int start, long toFind){  int max = N-1;  int min = start;  if(query(start,max) != toFind)  return 1<<29;  if(query(start,start) == toFind){  return 1;  }  int ret = max - min + 1;  while(min + 1 < max){  int mid = (min+max)/2;  if(query(start,mid) == toFind){   max = mid;  }else{   min = mid;  }  }  return max-start+1; }  public static void main(String args[]){  Scanner sc = new Scanner(System.in);  N = sc.nextInt();  s = sc.next();  int size = 1;  while(size <= N) size*=2;  val = new long[size*2];  setup(0,N-1,0);  long toFind = query(0,N-1,0,N-1,0);  long ans = 1L<<29;  for(int i = 0; i < N; i++)  ans = Math.min(ans,binarySearch(i,toFind));  System.out.println(ans); } }
4	public class Main {   public static void main(String[] args) throws IOException {  StreamTokenizer in = new StreamTokenizer(new BufferedReader(   new InputStreamReader(System.in)));   in.nextToken();  String s = in.sval;  int l = s.length();  int n = l - 1;  String st, sub;  while (n > 0) {  for (int i = 0; i < l - n; ++i) {   st = s.substring(i, n + i);   sub = s.substring(i + 1);   if (sub.indexOf(st) != -1) {   System.out.println(n);   System.exit(0);   }  }  n--;  }  System.out.println(0); } }
1	public class B {   public static void main(String[] args) {  Scanner scr = new Scanner(System.in);  int n = scr.nextInt();  int k = scr.nextInt();   int[] a = new int[n+1];   int[] d = new int[100001];   int tk = 0;  int l = 1;  int r = -1;  boolean find = false;  for (int i = 1; i <= n; i++){  a[i] = scr.nextInt();  if (d[a[i]] == 0){   d[a[i]] = 1;   tk++;   if ((!find) && (tk == k)){   find = true;   r = i;   }   }  }     if (r > 0) {  int[] cd = new int[100001];  tk = 0;  find = false;  for (int j = r; j >= l; j--){   if(cd[a[j]] == 0){   cd[a[j]] = 1;   tk++;   if ((!find) && (tk == k)){    find = true;    l = j;    break;   }   }   }   System.out.println(l + " " + r);  }  else {  System.out.println("-1 -1");  }   } }
5	public class A {    public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   HashSet<Integer> set = new HashSet<Integer>();     for ( int i = 0 ; i < n ; ++i ) {    set.add(sc.nextInt());   }      ArrayList<Integer> list = new ArrayList<Integer>(set);   Collections.sort(list);   if(list.size() > 1)   System.out.println(list.get(1));   else    System.out.println("NO");  } }
1	public class 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();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  }  static FastReader s = new FastReader();  static PrintWriter out = new PrintWriter(System.out);  private static int[] rai(int n) {   int[] arr = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = s.nextInt();   }   return arr;  }  private static int[][] rai(int n, int m) {   int[][] arr = new int[n][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     arr[i][j] = s.nextInt();    }   }   return arr;  }  private static long[] ral(int n) {   long[] arr = new long[n];   for (int i = 0; i < n; i++) {    arr[i] = s.nextLong();   }   return arr;  }  private static long[][] ral(int n, int m) {   long[][] arr = new long[n][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     arr[i][j] = s.nextLong();    }   }   return arr;  }  private static int ri() {   return s.nextInt();  }  private static long rl() {   return s.nextLong();  }  private static String rs() {   return s.next();  }  static int gcd(int a,int b)  {   if(b==0)   {    return a;   }   return gcd(b,a%b);  }  static long gcd(long a,long b)  {   if(b==0)   {    return a;   }   return gcd(b,a%b);  }  static boolean isPrime(int n) {     if(n==1)   {    return false;   }   if(n==2)   {    return true;   }   if (n % 2 == 0) return false;     for (int i = 3; i <= Math.sqrt(n); i += 2) {    if (n % i == 0)     return false;   }   return true;  }  static boolean[] sieveOfEratosthenes(int n)  {          boolean prime[] = new boolean[n+1];   for(int i=0;i<n;i++)    prime[i] = true;   for(int p = 2; p*p <=n; p++)   {       if(prime[p] == true)    {         for(int i = p*p; i <= n; i += p)      prime[i] = false;    }   }   return prime;  }   public static void main(String[] args) {   StringBuilder ans = new StringBuilder();   int t = ri();   while (t-- > 0)   {    long n=rl();    if(n%2==1)    {     ans.append("NO\n");     continue;    }    if(n%4==0)    {     long val = n/4;     long sq = (long) Math.sqrt(val);     if(sq*sq == val)     {      ans.append("YES\n");      continue;     }    }    if(n%2==0)    {     long val = n/2;     long sq = (long) Math.sqrt(val);     if(sq*sq == val)     {      ans.append("YES\n");      continue;     }    }    ans.append("NO\n");   }   out.print(ans.toString());   out.flush();  }  }
4	@SuppressWarnings("unused") public class round35C {  static class state{   int x, y, time;   public state(int xx, int yy, int t){    x = xx;    y = yy;    time = t;   }  }  static int N,M;  static int [] dx = new int [] {1,-1,0,0};  static int [] dy = new int [] {0,0,1,-1};  static Queue<state> bfs = new LinkedList<round35C.state>();  public static Point runBFS(){   boolean [][] vis = new boolean [N + 1][M + 1];   int max = -(int)1e9;   int bestx = -1;   int besty = -1;   while(!bfs.isEmpty()){    state p = bfs.poll();    int x = p.x;    int y = p.y;    int time = p.time;    if(vis[x][y])     continue;    vis[x][y] = true;    if(time > max){     max = time;     bestx = x + 1;     besty = y + 1;    }    for(int i = 0 ; i < 4 ; ++i){     int nx = x + dx[i];     int ny = y + dy[i];     if(nx < 0 || ny < 0 || nx >= N || ny >= M)      continue;     if(vis[nx][ny] == false)      bfs.offer(new state(nx, ny, time + 1));    }   }   return new Point(bestx, besty);  }  public static void main(String[] args)throws IOException {   BufferedReader br = new BufferedReader(new FileReader("input.txt"));   PrintWriter out = new PrintWriter("output.txt");   String [] use = null;   use = br.readLine().split(" ");   N = parseInt(use[0]);   M = parseInt(use[1]);   int K = parseInt(br.readLine());   use = br.readLine().split(" ");   for(int i = 0 ; i < 2 * K ; i += 2){    int f = parseInt(use[i]) - 1;    int t = parseInt(use[i + 1]) - 1;    bfs.offer(new state(f, t, 0));   }   Point ans = runBFS();   out.println(ans.x + " " + ans.y);   out.flush();   out.close();  } }
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;  }  } }
0	public class KF {    public static void main(String[] args) throws IOException { B jk = new B();  } }  class B {  PrintWriter out = new PrintWriter(System.out);  Scanner in = new Scanner(System.in);  long l = in.nextLong();  long r=in.nextLong(); B(){ if(Math.abs(r-l)>=2){ if(l%2==0){ out.print(l+" "+(l+1)+" "+(l+2)); } else{ if(Math.abs(r-l)==2){ out.print("-1"); }else{ out.print((l+1)+" "+(l+2)+" "+(l+3)); } } }else{ out.print("-1"); } out.flush(); } }
3	public class R455D2PC {  public static void main(String[] args) {   final int MAX = 5000;   final int MODULO = 1000000007;   Scanner in = new Scanner(System.in);   int n = in.nextInt();   in.nextLine();   int pre = 0;   int size = 0;   int[] block = new int[MAX];   for (int i = 0; i < n; i++) {    String command = in.nextLine();    if (command.startsWith("s")) {     block[size++] = pre;     pre = 0;    } else {     pre++;    }   }   if (pre != 0) {    System.out.println(0);    return;   }   int[][] result = new int[2][MAX + 1];   int currentMax = 0;   int preIndex = 0;   result[preIndex][0] = 1;   for (int i = 1; i < size; i++) {    int currentIndex = preIndex ^ 1;    int j = block[i - 1];    for (int k = currentMax; k >= 0; k--) {     result[currentIndex][k + j] = (result[currentIndex][k + j + 1] + result[preIndex][k]) % MODULO;    }    for (int k = j - 1; k >= 0; k--) {     result[currentIndex][k] = result[currentIndex][j];    }    currentMax += j;    preIndex = currentIndex;     }   int sum = 0;   for (int i = 0; i <= currentMax; i++) {    sum = (sum + result[preIndex][i]) % MODULO;   }     System.out.println(sum);  } }
0	public class Main { boolean eof;  public static void main(String[] args) throws IOException {  new Main().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()); }  BufferedReader br; StringTokenizer st; PrintWriter out;  void run() throws IOException {  InputStream input = System.in;  PrintStream output = System.out;  try {  File f = new File("trips.in");  if (f.exists() && f.canRead()) {   input = new FileInputStream(f);   output = new PrintStream("trips.out");  }  } catch (Throwable e) {  }  br = new BufferedReader(new InputStreamReader(input));  out = new PrintWriter(output);  solve();  br.close();  out.close(); }  class Pair implements Comparable<Pair> {  int x, y;  Pair(int x, int y) {  this.x = x;  this.y = y;  }  public int compareTo(Pair p) {  if (x > p.x) {   return 1;  } else if (x < p.x) {   return -1;  } else {   return 0;  }  } }  long nextLong() {  return Long.parseLong(nextToken()); }  long ans;  void nod(long a, long b){  if (a == 0 || b == 0){    } else if (a > b){  ans += a / b;  nod(a % b, b);  } else {  ans += b / a;  nod(a, b % a);  } }  void solve() {  long a = nextLong(), b = nextLong();  ans = 0;  nod(a, b);  out.println(ans); } }
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());}  double nextDouble() { return Double.parseDouble(next());}  long nextLong() { return Long.parseLong(next());}  int[] NIA(int n) {  int r[] = new int[n];  for(int i = 0; i < n; i++) r[i] = nextInt();  return r;  }  long[] NLA(int n) {  long r[] = new long[n];  for(int i = 0; i < n; i++) r[i] = nextLong();  return r;  }  char[][] grid(int r, int c){  char res[][] = new char[r][c];  for(int i = 0; i < r; i++) {   char l[] = next().toCharArray();   for(int j = 0; j < c; j++) {   res[i][j] = l[j];   }  }  return res;  } }  }
1	public class Elektronnietablici { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer in; static PrintWriter out = new PrintWriter(System.out);  public static String nextToken() throws IOException{  while (in == null || !in.hasMoreTokens()){  in = new StringTokenizer(br.readLine());  }   return in.nextToken(); }  public static int nextInt() throws IOException{  return Integer.parseInt(nextToken()); }  public static double nextDouble() throws IOException{  return Double.parseDouble(nextToken()); }  public static void main(String[] args) throws IOException{  int n = nextInt();   String S;  for (int i = 0; i < n; i++) {  S = nextToken();    int f = 0;  if (S.charAt(0) == 'R' && S.charAt(1) >= '1' && S.charAt(1) <= '9'){   for (int j = 2; j < S.length(); j++) {   if (S.charAt(j) >= 'A' && S.charAt(j) <= 'Z'){    f = 1;    break;   }   }  }    if (f == 0){   String T1 = "";   String ans = "R";     int j;     for (j = 0; S.charAt(j) >= 'A' && S.charAt(j) <= 'Z'; j++) {   T1 += S.charAt(j);   }     ans += S.substring(j, S.length()) + "C";     int len = j;     j--;     int p = 1;   int z = 0;   for (; j >= 0; j--) {   z += (S.charAt(j) - 'A') * p;   p *= 26;   }     p = 1;   for (int k = 0; k < len; k++) {   z += p;   p *= 26;   }     ans += z;     out.println(ans);  }  else{   String T1 = "";   String ans = "";     int j;   for (j = 1; S.charAt(j) != 'C'; j++) {   ans += S.charAt(j);   }     T1 = S.substring(j + 1, S.length());   int z = Integer.parseInt(T1);   int p = 1;   int len = 0;     while (p <= z){   z -= p;   p *= 26;   len++;   }   p /= 26;     T1 = "";     for (int k = len - 1; k >= 0; k--) {   int l = z / p;      T1 += (char)(z / p + 'A');      z -= l * p;      p /= 26;   }   ans = T1 + ans;     out.println(ans);  }  }         out.close(); } }
1	public class Main { public static void main (String [] args) throws IOException {  BufferedReader br = new BufferedReader (new InputStreamReader (System.in));  do {  int n = Integer.parseInt (br.readLine ());    int [] ns = new int [(args = br.readLine ().split (" ")).length];  int evenCount = 0, oddCount = 0, evI = 1, oddI = 1;  for (int i = 0; i < ns.length; i++) {   if ((ns [i] = Integer.parseInt (args [i])) % 2 == 0) {   evenCount ++;   evI = i;      } else {   oddCount ++;   oddI = i;   }  }  if (evenCount == 1) System.out.println (evI + 1);  else System.out.println (oddI + 1);  } while (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));   }    } }
0	public class solution {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   boolean ok = (n % 4 == 0) || (n % 7 == 0) || (n % 47 == 0) || (n % 74 == 0) || (n % 447 == 0) || (n % 474 == 0) || (n % 477 == 0) || (n % 744 == 0) || (n % 747 == 0) || (n % 774 == 0);   if (ok) System.out.println("YES"); else System.out.println("NO");  } }
3	public class Problem1 {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);  int n = sc.nextInt();  int a []=new int[n];  for(int i=0;i<n;i++) {  a[i]=sc.nextInt();  }  Arrays.sort(a);  int k=a.length;  for(int i=a.length-1;i>=0;i--) {  int A=a[i];  for (int j=0;j<i;j++) {   if(A%a[j]==0) {   k--;   break;   }  }  }  System.out.println(k);  sc.close(); } }
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());   }   double nextDouble() throws IOException {    return Double.parseDouble(next());   }   char nextChar() throws IOException {    return (char) (br.read());   }   String nextLine() throws IOException {    return br.readLine();   }  } }
5	public class Main { public static void main(String args[]) throws IOException  {  Scanner c=new Scanner(System.in);  int n=c.nextInt();  int a=c.nextInt();   int b=c.nextInt();   int C[]=new int[n];  for(int i=0;i<n;i++)   C[i]=c.nextInt();  Arrays.sort(C);   int petya=C[n-a];  System.out.println((C[n-a]-C[n-a-1]));  } }
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 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 int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-') {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.') {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public boolean ready() throws IOException {  return br.ready();  }  } }
4	public class ArFireAgain {   int n, m, k;  int dx[] = { 0, 0, 1, -1, 1, 1, -1, -1 };  int dy[] = { 1, -1, 0, 0, 1, -1, 1, -1 };  int[][] dist;  ArrayList<Pair> arr;    Scanner sc;  PrintWriter out;  public void solve() {   try {    sc = new Scanner(new FileReader("input.txt"));    out = new PrintWriter("output.txt");   } catch (FileNotFoundException e) {    e.printStackTrace();   }     n = sc.nextInt();   m = sc.nextInt();   k = sc.nextInt();   arr = new ArrayList<Pair>();   for (int i=0; i<k; i++) {    int x = sc.nextInt()-1;    int y = sc.nextInt()-1;    Pair p = new Pair(x, y);    arr.add(p);   }      Pair last = bfs();   out.println(last.x + " " + last.y);   out.flush();   out.close();  }   boolean inBoard(int x, int y) {   return x >= n || x < 0 || y >= m || y < 0;  }  boolean isValid(int x, int y) {   return x >= 0 && y >= 0 && x < n && y < m;  }  private Pair bfs() {     Queue<Pair> q = new LinkedList<Pair>();   dist = new int[n][m];      for (int i=0; i<n; i++) {    for (int j=0; j<m; j++) {     dist[i][j] = -1;    }   }      for (int i=0; i<k; i++) {    dist[arr.get(i).x][arr.get(i).y] = 0;    q.add(arr.get(i));   }      while(!q.isEmpty()) {    Pair cur = q.remove();    for (int d=0; d<4; d++) {     int X = cur.x + dx[d];     int Y = cur.y + dy[d];     if (isValid(X, Y) && dist[X][Y] == -1) {      dist[X][Y] = dist[cur.x][cur.y] + 1;      Pair p = new Pair(X, Y);      q.add(p);     }    }       }      Pair res = null;   int maxx = -1;   for (int i=0; i<n; i++) {    for (int j=0; j<m; j++) {     if (dist[i][j] > maxx) {      maxx = dist[i][j];      res = new Pair(i+1, j+1);     }    }   }   return res;  }    class Pair {   int x, y;   Pair(int x, int y) {    this.x = x;    this.y = y;   }  }  public static void main(String[] args) {   new ArFireAgain().solve();  } }
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());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  int[] readArr(int n) throws IOException {   int[] res = new int[n];   for (int i = 0; i < n; i++) {    res[i] = readInt();   }   return res;  }  long[] readArrL(int n) throws IOException {   long[] res = new long[n];   for (int i = 0; i < n; i++) {    res[i] = readLong();   }   return res;  }  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);   }  } }
1	public class A {  static double eps=(double)1e-15; static long mod=(int)1e9+7; public static void main(String args[]){  InputReader in = new InputReader(System.in);  OutputStream outputStream = System.out;  PrintWriter out = new PrintWriter(outputStream);   int n=in.nextInt();  int l=0,r=0;  String s=in.nextLine();  HashSet<Character> size=new HashSet<>();  for(int i=0;i<n;i++){  char p=s.charAt(i);  size.add(p);  }  int chk=size.size();  HashMap<Character, Integer> hm=new HashMap<>();  int ans=Integer.MAX_VALUE;  while(l<n){  if(hm.size()<chk && r<n){   char p=s.charAt(r);   if(hm.containsKey(p)){   hm.put(p, hm.get(p)+1);   }   else{   hm.put(p, 1);   }   r++;  }  else{   char p=s.charAt(l);   if(hm.get(p)==1){   hm.remove(p);   }   else{   hm.put(p, hm.get(p)-1);   }   l++;  }  if(hm.size()==chk){   ans=Math.min(ans, r-l);  }  }  out.println(ans);  out.close();    } static class Pair implements Comparable<Pair> {  int u;  int v;   public Pair(int u, int v) {  this.u = u;  this.v = v;  }   public int hashCode() {  int hu = (int) (u ^ (u >>> 32));  int hv = (int) (v ^ (v >>> 32));  return 31 * hu + hv;  }   public boolean equals(Object o) {  Pair other = (Pair) o;  return u == other.u && v == other.v;  }   public int compareTo(Pair other) {  return Long.compare(u, other.u) != 0 ? Long.compare(u, other.u) : Long.compare(v, other.v);  }   public String toString() {  return "[u=" + u + ", v=" + v + "]";  } } public static void debug(Object... o) {  System.out.println(Arrays.deepToString(o)); } static long modulo(long a,long b,long c) {  long x=1;  long y=a;  while(b > 0){  if(b%2 == 1){   x=(x*y)%c;  }  y = (y*y)%c;   b /= 2;  }  return x%c; } static long gcd(long x, long y) {  if(x==0)  return y;  if(y==0)  return x;  long r=0, a, b;  a = (x > y) ? x : y;  b = (x < y) ? x : y;  r = b;  while(a % b != 0)  {  r = a % b;  a = b;  b = r;  }  return r; } 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();  }  public long nextLong() {  return Long.parseLong(next());  }  public int nextInt() {  return Integer.parseInt(next());  } } }
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 int INF = (int)1e9; static int MAXN = (int)4e5 + 5; static int MOD = (int)1e9+7; static int q, t, n, m, k; static double pi = Math.PI;  void solve() throws IOException {  n = in.nextInt();  m = in.nextInt();  k = in.nextInt();  int[][] right = new int[n][m],   left = new int[n][m],   up = new int[n][m],   down = new int[n][m];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m-1; j++) {   right[i][j] = in.nextInt();   left[i][j+1] = right[i][j];  }  }  for (int i = 0; i < n-1; i++) {  for (int j = 0; j < m; j++) {   down[i][j] = in.nextInt();   up[i+1][j] = down[i][j];  }  }  if (k%2 == 1) {  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   out.print("-1 ");   }   out.println();  }  return;  }  int[][][] dp = new int[n][m][k+1];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   for (int kk = 1; kk <= k; kk++) {   dp[i][j][kk] = INF;   }  }  }  for (int step = 2; step <= k; step+=2) {  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   if (i != 0) {    dp[i][j][step] = Math.min(dp[i][j][step], dp[i-1][j][step-2]+up[i][j]*2);   }   if (i != n-1) {    dp[i][j][step] = Math.min(dp[i][j][step], dp[i+1][j][step-2]+down[i][j]*2);    }   if (j != 0) {    dp[i][j][step] = Math.min(dp[i][j][step], dp[i][j-1][step-2]+left[i][j]*2);   }   if (j != m-1) {    dp[i][j][step] = Math.min(dp[i][j][step], dp[i][j+1][step-2]+right[i][j]*2);   }   }  }  }  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   out.print(dp[i][j][k]+" ");  }  out.println();  } }  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 nextLine() {  int c = read();  while (isSpaceChar(c)) {   c = read();  }  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isEndOfLine(c));  return res.toString();  }  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();  }  double nextDouble() {  return Double.parseDouble(next());  }  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 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); } }
3	public class A { public static void main(String[] args) {  MyScanner sc = new MyScanner();  int n = sc.nextInt();  Integer[] a = new Integer[n];  for(int i = 0; i < n; i++)  a[i] = sc.nextInt();  Arrays.sort(a);  boolean[] b = new boolean[n];  int ans = 0;  for(int i = 0; i < n; i++)  if(!b[i]) {   ans++;   for(int j = i + 1; j < n; j++)   if(a[j] % a[i] == 0)    b[j] = true;  }  out.println(ans);  out.close(); } public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static class MyScanner {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st;  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());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  } } }
3	public class F_DSU {  public static void main(String[] args)throws Exception {   FastReader in = new FastReader(System.in);   PrintWriter pw = new PrintWriter(System.out);   n = in.nextInt();     int brr[] = new int[2*n];   for (int i = 0; i < 2*n; i+= 2) {    brr[i] = in.nextInt();    brr[i+1] = in.nextInt();   }   arr = shrink(brr);   int imap[] = new int[2*n];   for (int i = 0; i < 2*n; i++) {    imap[arr[i]] = brr[i];   }   int idx = binarySearch(arr.length);   if(idx >= arr.length) pw.println(-1);   else pw.println(imap[idx]);   pw.close();  }  static int n, arr[];  static int binarySearch(int H) {   int lo = 0, hi = H, mid;   while (lo < hi) {    mid = (lo + hi) / 2;    if (check(mid)) hi = mid;    else lo = mid + 1;   }   if(lo > 0 && check(lo-1)) return lo-1;   return lo;  }  static boolean check(int m){   DSU dsu = new DSU(2*n);   for (int i = 0; i < n; i++) {    int u = arr[2*i], v = arr[2*i+1];    if(u > m) return false;    if(v > m){     if(++dsu.cycle[dsu.find(u)] >= 2) return false;    }    else{     if(!dsu.union(u, v)){      if(++dsu.cycle[dsu.find(u)] >= 2) return false;     }     else{      if(dsu.cycle[dsu.find(u)] >= 2) return false;     }    }   }   return true;  }  static class DSU{   int parent[], cycle[], n;   DSU(int N){    n = N;    parent = new int[N];    cycle = new int[N];    for(int i = 0; i < N; i++){     parent[i] = i;    }   }   DSU(int [] p){    parent = p; n = p.length;   }   int find(int i) {    int p = parent[i];    if (i == p) return i;    return parent[i] = find(p);   }   boolean equiv(int u, int v){    return find(u) == find(v);   }   boolean union(int u, int v){    u = find(u); v = find(v);    if(u != v) {     parent[u] = parent[v];     cycle[v] += cycle[u];    }    return u != v;   }   int count(){    int cnt = 0;    for(int i = 0; i < n; i++){     if(i == find(i)) cnt++;    }    return cnt;   }  }  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;  }  static void debug(Object...obj) {   System.err.println(Arrays.deepToString(obj));  }  static class FastReader {   InputStream is;   private byte[] inbuf = new byte[1024];   private int lenbuf = 0, ptrbuf = 0;   static final int ints[] = new int[128];   public FastReader(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 boolean isSpaceChar(int c) {    return !(c >= 33 && c <= 126);   }   public int skip() {    int b;    while((b = readByte()) != -1 && isSpaceChar(b));    return b;   }   public String next(){    int b = skip();    StringBuilder sb = new StringBuilder();    while(!(isSpaceChar(b))){     sb.appendCodePoint(b);     b = readByte();    }    return sb.toString();   }   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();    }   }   public long nextLong() {    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<<3) + (num<<1) + ints[b];     }else{      return minus ? -num : num;     }     b = readByte();    }   }   public double nextDouble() {    return Double.parseDouble(next());   }      public char[] next(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);   }     } }
5	public class CottageTown {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   String[] in = sc.nextLine().split(" ");   int n = Integer.parseInt(in[0]);   int t = Integer.parseInt(in[1]);   int[] coor = new int[n];   int[] side = new int[n];   for (int i = 0; i < n; i++) {    in = sc.nextLine().split(" ");    coor[i] = Integer.parseInt(in[0]);    side[i] = Integer.parseInt(in[1]);   }   quickSort(coor, 0, n - 1, side);   int count = 2;   double dist;   for (int i = 0; i < n - 1; i++) {    dist = (coor[i + 1] - coor[i]) - (double)(side[i + 1] + side[i]) / 2.0;    if (dist > t) {     count += 2;    } else if (dist == t) {     count += 1;    }   }   System.out.println(count);  }  private static int partition(int[] arr, int left, int right, int[] temp) {   int i = left, j = right;   int tmp;   int pivot = arr[(left + right) / 2];   while (i <= j) {    while (arr[i] < pivot) {     i++;    }    while (arr[j] > pivot) {     j--;    }    if (i <= j) {     tmp = arr[i];     arr[i] = arr[j];     arr[j] = tmp;     tmp = temp[i];     temp[i] = temp[j];     temp[j] = tmp;     i++;     j--;    }   }   return i;  }  private static void quickSort(int[] arr, int left, int right, int[] temp) {   int index = partition(arr, left, right, temp);   if (left < index - 1) {    quickSort(arr, left, index - 1, temp);   }   if (index < right) {    quickSort(arr, index, right, temp);   }  } }
1	public class B138 {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int a[] = new int[100004];   int b[] = new int[100004];   int n, m, ans = 0, dau, cuoi=-1;   n = sc.nextInt();   m = sc.nextInt();   for(int i=0;i<100004;i++) a[i] = 0;   for(int i=0;i<n;i++){    b[i] = sc.nextInt();    if(a[b[i]]==0){     a[b[i]] = 1;     ans++;     if(ans==m){      cuoi = i+1;      break;     }    }   }   for(int i=cuoi-1;i>=00;i--){    if(a[b[i]]==1){     a[b[i]] = 0;     ans--;     if(ans==0){      System.out.println((i+1)+" "+cuoi);      System.exit(0);     }    }   }   System.out.println("-1 -1");  } }
1	public class Main { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter; private PrintWriter pw; private long mod = 1000000000 + 7;  private StringBuilder ans_sb; private int size = 1000005; private long[] fact; private void soln() {  int n = nextInt();  HashMap<String, Integer>[] s1 = new HashMap[4];  for(int i=0;i<=3;i++) {  s1[i] = new HashMap<>();  }  int cnt = 0;  for(int i=0;i<n;i++) {  String s = nextLine();  if(s1[s.length()-1].containsKey(s)) {   s1[s.length()-1].put(s, s1[s.length()-1].get(s)+1);  }else   s1[s.length()-1].put(s, 1);  }  for(int i=0;i<n;i++) {  String s = nextLine();  if(s1[s.length()-1].containsKey(s)) {   s1[s.length()-1].put(s, s1[s.length()-1].get(s)-1);   if(s1[s.length()-1].get(s) == 0)   s1[s.length()-1].remove(s);  }else {   cnt++;  }  }  pw.println(cnt); } private class Pair implements Comparable<Pair>{  long x, y;  int i;  public Pair(long a,long b,int c) {  x = a;  y = b;  i = c;  }  @Override  public int compareTo(   Pair o)  {  return Long.compare(this.x, o.x);  }  public String toString() {  return ""+i;  } } private void debug(Object... o) {  System.out.println(Arrays.deepToString(o)); } private long pow(long a, long b, long c) {  if (b == 0)  return 1;  long p = pow(a, b / 2, c);  p = (p * p) % c;  return (b % 2 == 0) ? p : (a * p) % c; }  private long gcd(long n, long l) {  if (l == 0)  return n;  return gcd(l, n % l); }  public static void main(String[] args) throws Exception {  new Thread(null, new Runnable() {  @Override  public void run() {   new Main().solve();  }  }, "1", 1 << 26).start();   }  public StringBuilder solve() {  InputReader(System.in);   pw = new PrintWriter(System.out);   soln();  pw.close();   return ans_sb; }  public void InputReader(InputStream stream1) {  stream = stream1; }  private boolean isWhitespace(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  private boolean isEndOfLine(int c) {  return c == '\n' || c == '\r' || 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++]; }  private 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 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; }  private String nextToken() {  int c = read();  while (isSpaceChar(c))  c = read();  StringBuilder res = new StringBuilder();  do {  res.appendCodePoint(c);  c = read();  } while (!isSpaceChar(c));  return res.toString(); }  private String nextLine() {  int c = read();  while (isSpaceChar(c))  c = read();  StringBuilder res = new StringBuilder();  do {  res.appendCodePoint(c);  c = read();  } while (!isEndOfLine(c));  return res.toString(); }  private int[] nextIntArray(int n) {  int[] arr = new int[n];  for (int i = 0; i < n; i++) {  arr[i] = nextInt();  }  return arr; }  private long[] nextLongArray(int n) {  long[] arr = new long[n];  for (int i = 0; i < n; i++) {  arr[i] = nextLong();  }  return arr; }  private void pArray(int[] arr) {  for (int i = 0; i < arr.length; i++) {  System.out.print(arr[i] + " ");  }  System.out.println();  return; }  private void pArray(long[] arr) {  for (int i = 0; i < arr.length; i++) {  System.out.print(arr[i] + " ");  }  System.out.println();  return; }  private boolean isSpaceChar(int c) {  if (filter != null)  return filter.isSpaceChar(c);  return isWhitespace(c); }  private char nextChar() {  int c = read();  while (isSpaceChar(c))  c = read();  char c1 = (char) c;  while (!isSpaceChar(c))  c = read();  return c1; }  private interface SpaceCharFilter {  public boolean isSpaceChar(int ch); } }
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);    }  private static 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;  }  public String toString(){   return String.format("[%d, %d]", l, p);  } }
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);   }  } }
6	public class Hello {  public static void main(String[] args){    Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int m = scan.nextInt();  boolean[][] graph = new boolean[n][n];    for(int i = 0; i < m; i++) {   int from = scan.nextInt() - 1;   int to = scan.nextInt() - 1;   graph[from][to] = graph[to][from] = true;  }    int max = 1 << n;  long[][] dp = new long[max][n];    for(int mask = 1; mask < max; mask++) {   for(int i = 0; i < n; i++) {   boolean existI = (mask & (1 << i)) > 0;   if(Integer.bitCount(mask) == 1 && existI) {    dp[mask][i] = 1;   } else if(Integer.bitCount(mask) > 1 && existI && first(mask) != i) {    long sum = 0;    for(int j = 0; j < n; j++) {    if(graph[i][j]) sum += dp[mask ^ (1 << i)][j];    }    dp[mask][i] = sum;   }   }  }    long countCycles = 0;  for(int mask = 7; mask < max; mask++) {   for(int i = 0; i < n; i++) {   if(Integer.bitCount(mask) >= 3 && graph[first(mask)][i]) {    countCycles += dp[mask][i];   }   }  }  System.out.println(countCycles / 2);  }     public static int first(int mask) {  int i = 0;  while((mask & (1 << i++)) == 0);  return i - 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); }  void debug(Object... os){  System.err.println(Arrays.deepToString(os)); }  public static void main(String[] args){  Locale.setDefault(Locale.US);  new P111C().run(); } }
4	public class Main {  static void debug(Object... args) {   System.out.println(Arrays.deepToString(args));  }  public static void main(String[] args) throws Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   PrintWriter pw = new PrintWriter(System.out);   int T = Integer.parseInt(br.readLine());   while (T-- > 0) {    int N = Integer.parseInt(br.readLine());    Stack<LN> nodes = new Stack<>();    int a0 = Integer.parseInt(br.readLine());    LN root = new LN(1, 0, "");    nodes.add(root);    pw.println(root);    for (int i = 0; i < N - 1; i++) {     int ai = Integer.parseInt(br.readLine());     while (!nodes.isEmpty()) {      LN nn = nodes.pop();      if (ai == 1) {       LN e = new LN(1, nn.depth + 1, nn.toString());       nodes.add(nn);       nodes.add(e);       pw.println(e);       break;      } else if (nn.lv == ai - 1) {       LN e = new LN(ai, nn.depth, nn.base);       nodes.add(e);       pw.println(e);       break;      }     }    }   }   pw.flush();  }  static class LN {   int lv;   int depth;   String base;   public LN(int lv, int depth, String prev) {    this.lv = lv;    this.depth = depth;    base = prev;   }   @Override   public String toString() {    StringBuilder bob = new StringBuilder(base);    if (depth > 0) {     bob.append(".");    }    bob.append(lv);    return bob.toString();   }  } }
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 static boolean nextPer(int[] data) {   int i = data.length - 1;   while (i > 0 && data[i] < data[i - 1]) {    i--;   }   if (i == 0) {    return false;   }   int j = data.length - 1;   while (data[j] < data[i - 1]) {    j--;   }   int temp = data[i - 1];   data[i - 1] = data[j];   data[j] = temp;   Arrays.sort(data, i, data.length);   return true;  }  public static class Point {   int x, y, z;   public Point(int x, int y, int z) {    this.x = x;    this.y = y;    this.z = z;   }  }  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);  }  public static long lcm(long a, long b) {   return a * b / gcd(a, b);  } }
4	public class B {  public static void main(String[] args) throws IOException {   Reader scan = new Reader();  int t = scan.nextInt();  for(int tt = 0;tt<t;tt++) {    int n = scan.nextInt();  int arr[] = new int[n];  for(int i = 0;i<n;i++) arr[i] = scan.nextInt();    List<Integer> list = new ArrayList<>();  int j = -1;  StringBuilder s = new StringBuilder();  for(int i = 0;i<n;i++) {   if(list.isEmpty() || arr[i]==1) {    list.add(arr[i]);   j++;   }   else if(arr[i] == list.get(j)+1) {    list.set(j, arr[i]);   }   else {   for(int k = j;k>=0;k--) {    if(arr[i] == list.get(k)+1) {    list.set(k, arr[i]);    break;    }    else {    list.remove(k);    j--;    }   }   }   s.delete(0, s.length());   for(Integer p:list) {   s.append(p+".");   }   s.deleteCharAt(s.length()-1);   System.out.println(s.toString());  }  }  scan.close();   }  static class Reader  {  final private int BUFFER_SIZE = 1 << 16;  private DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;   public Reader()  {   din = new DataInputStream(System.in);   buffer = new byte[BUFFER_SIZE];   bufferPointer = bytesRead = 0;  }   public Reader(String file_name) throws IOException  {   din = new DataInputStream(new FileInputStream(file_name));   buffer = new byte[BUFFER_SIZE];   bufferPointer = bytesRead = 0;  }   public String readLine() throws IOException  {   byte[] buf = new byte[64];   int cnt = 0, c;   while ((c = read()) != -1)   {   if (c == '\n')    break;   buf[cnt++] = (byte) c;   }   return new String(buf, 0, cnt);  }   public int nextInt() throws IOException  {   int ret = 0;   byte c = read();   while (c <= ' ')   c = read();   boolean neg = (c == '-');   if (neg)   c = read();   do  {   ret = ret * 10 + c - '0';   } while ((c = read()) >= '0' && c <= '9');   if (neg)   return -ret;   return ret;  }   public long nextLong() throws IOException  {   long ret = 0;   byte c = read();   while (c <= ' ')   c = read();   boolean neg = (c == '-');   if (neg)   c = read();   do {   ret = ret * 10 + c - '0';   }   while ((c = read()) >= '0' && c <= '9');   if (neg)   return -ret;   return ret;  }   public double nextDouble() throws IOException  {   double ret = 0, div = 1;   byte c = read();   while (c <= ' ')   c = read();   boolean neg = (c == '-');   if (neg)   c = read();   do {   ret = ret * 10 + c - '0';   }   while ((c = read()) >= '0' && c <= '9');   if (c == '.')   {   while ((c = read()) >= '0' && c <= '9')   {    ret += (c - '0') / (div *= 10);   }   }   if (neg)   return -ret;   return ret;  }   private void fillBuffer() throws IOException  {   bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);   if (bytesRead == -1)   buffer[0] = -1;  }   private byte read() throws IOException  {   if (bufferPointer == bytesRead)   fillBuffer();   return buffer[bufferPointer++];  }   public void close() throws IOException  {   if (din == null)   return;   din.close();  }  } }
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 void initB() {   try {    br = new BufferedReader(new FileReader("input.txt"));    sc = new Scanner(new FileReader("input.txt"));    out = new PrintWriter("output.txt");   } catch (Exception e) {   }  }  public static String getString() {   try {    return br.readLine();   } catch (Exception e) {   }   return "";  }  public static Integer getInt() {   try {    return Integer.parseInt(br.readLine());   } catch (Exception e) {   }   return 0;  }  public static Integer[] getIntArr() {   try {    StringTokenizer temp = new StringTokenizer(br.readLine());    int n = temp.countTokens();    Integer temp2[] = new Integer[n];    for (int i = 0; i < n; i++) {     temp2[i] = Integer.parseInt(temp.nextToken());    }    return temp2;   } catch (Exception e) {   }   return null;  }  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 String[] getStringArr() {   try {    StringTokenizer temp = new StringTokenizer(br.readLine());    int n = temp.countTokens();    String temp2[] = new String[n];    for (int i = 0; i < n; i++) {     temp2[i] = (temp.nextToken());    }    return temp2;   } catch (Exception e) {   }   return null;  }  public static int getMax(Integer[] ar) {   int t = ar[0];   for (int i = 0; i < ar.length; i++) {    if (ar[i] > t) {     t = ar[i];    }   }   return t;  }  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;    }   }  } }
1	public class Main { public static void main(String[] args) {  Scanner scn = new Scanner(System.in);   int t = scn.nextInt();  while(t-- >0){  String str = scn.next();  Pattern p = Pattern.compile("R[0-9]+C[0-9]+");  Matcher m = p.matcher(str);  if (m.matches()){   String nums[] = str.split("[RC]");   String first = nums[1];   String second = nums[2];     String ans = "";   long num = Integer.parseInt(second);   while(num >0){   if (num % 26 > 0){    ans += (char)(num%26+'A'-1);    num/=26;   } else {    ans += 'Z';    num/=26;    num--;   }   }   for (int i = ans.length()-1; i>=0;--i){   System.out.print(ans.charAt(i));   }     System.out.println(first);  } else {   String first = str.split("[0-9]+")[0];   String second = str.split("[A-Z]+")[1];   System.out.print("R"+second);     long num = 0, pow = 1;   for (int i = first.length()-1; i>=0; --i){   num += (long)(first.charAt(i)-'A'+1) * pow;   pow*=26;   }   System.out.println("C"+num);  }    } } }
0	public class CFA_200 {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  long x = sc.nextLong();  long y = sc.nextLong();   System.out.println(Wilf_tree(x, y));   sc.close(); }  static long Wilf_tree(long a,long b) {  if(a==0||b==0)  return 0;  if(a>=b)  return a/b+Wilf_tree(a%b, b);  else  return b/a+Wilf_tree(a, b%a); } }
1	public class R025A { int n; int[] nums; public R025A() {  Scanner scanner = new Scanner(System.in);  n = scanner.nextInt();  nums = new int[n];  for(int i=0; i<n; i++) {  nums[i] = scanner.nextInt();  } }  private void process() {  int odd = 0;  int even = 0;  int lastOdd = 0;  int lastEven = 0;  for(int i=0; i<n; i++) {  if(nums[i] % 2 == 0) {   even++;   lastEven = i+1;  } else {   odd++;   lastOdd = i+ 1;  }  }  if(odd == 1) System.out.println(lastOdd);  else System.out.println(lastEven); }  public static void main(String[] args) {  new R025A().process(); } }
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;   }  }  private static 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());   }   String nextLine() throws IOException {    return reader.readLine();   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }  } }
0	public class Main { static Scanner scan = new Scanner (System.in); static PrintStream out = System.out;  static int n; static void solve () {  System.out.println (0 + " " + 0 + " " + n); }  public static void main (String[] args) {  n = scan.nextInt();  solve (); } }
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 String nextLine() {   try {    return br.readLine();   } catch (IOException e) {    e.printStackTrace();    return "";   }  }  public String nextWord() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return stk.nextToken();  }  public Integer nextInt() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return Integer.valueOf(stk.nextToken());  }  public Long nextLong() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return Long.valueOf(stk.nextToken());  }  public Double nextDouble() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return Double.valueOf(stk.nextToken());  }   public Float nextFloat() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return Float.valueOf(stk.nextToken());  }   public void run() {  int n = nextInt();  int m = nextInt();  if (n > m) {   int sw = n;   n = m;   m = sw;  }  int[][] A = new int[1<<n][1<<n];  for (int m1 = 0; m1 < 1<<n; ++m1) {   for (int m2 = 0; m2 < 1<<n; ++m2) {    int[] arr = new int[n];    for (int i = 0; i < n; ++i) {    arr[i] = (~(m1>>i))&1;    }   int[] m2a = new int[n];   for (int i = 0; i < n; ++i) {    m2a[i] = (m2>>i)&1;    }   int cnt = 0;   for (int i = 0; i < n; ++i) {    if (arr[i] == 1) {    if (i > 0 && m2a[i-1] == 1) {     continue;    }    if (i < n-1 && m2a[i+1] == 1) {     continue;    }    if (m2a[i] == 1) {     continue;    }    if (i < n-1) {     m2a[i+1] = 1;    } else {     m2a[i] = 1;    }    }   }   for (int i = 0; i < n; ++i) {    if (m2a[i] == 1) {    cnt++;    }   }   A[m1][m2] = cnt;   }  }  int MAX = 10000;  int[][][] dp = new int[m+1][1<<n][1<<n];  for (int i = 0; i < m+1; i++) {   for (int m1 = 0; m1 < 1<<n; ++m1) {   Arrays.fill(dp[i][m1], MAX);   }  }    dp[0][0][0] = 0;    for (int i = 0; i < m; i++) {   for (int m1 = 0; m1 < 1<<n; ++m1) {   for (int m2 = 0; m2 < 1<<n; ++m2) {    if (dp[i][m1][m2] != MAX) {    for (int nm1 = 0; nm1 < 1<<n; ++nm1) {     for (int nm2 = 0; nm2 < 1<<n; ++nm2) {      if ((m1 & nm1) == 0) {       int sm1 = m1|nm1;       int sm2 = m2|nm2;       int cnt = A[sm1][sm2];       dp[i+1][nm2][nm1] = Math.min(dp[i+1][nm2][nm1], dp[i][m1][m2]+cnt);      }      }     }    }    }   }  }    out.println(n*m-dp[m][0][0]);  out.flush();  } }
0	public class Main { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  if (((n % 4) == 0) || ((n % 7) == 0) || ((n % 44) == 0) || ((n % 47) == 0) || ((n % 74) == 0) || ((n % 77) == 0) || ((n % 444) == 0) || ((n % 447) == 0) || ((n % 474) == 0) || ((n % 477) == 0) || ((n % 744) == 0) || ((n % 747) == 0) || ((n % 774) == 0) || ((n % 777) == 0))  System.out.print("YES");  else  System.out.print("NO");  in.close(); } }
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();  } } }
2	public class Main {  public static void main(String[] args) throws IOException {   new Main().run();  }  StreamTokenizer in;  PrintWriter out;    public static void deb(String n, Object n1) {   System.out.println(n + " is : " + n1);  }  public static void deb(int[] A) {   for (Object oo : A) {    System.out.print(oo + " ");   }   System.out.println("");  }  public static void deb(long[] A) {   for (Object oo : A) {    System.out.print(oo + " ");   }   System.out.println("");  }  public static void deb(BigInteger[] A) {   for (Object oo : A) {    System.out.print(oo + " ");   }   System.out.println("");  }  public static void deb(int[][] A) {   for (int i = 0; i < A.length; i++) {    for (Object oo : A[i]) {     System.out.print(oo + " ");    }    System.out.println("");   }  }  public static void deb(long[][] A) {   for (int i = 0; i < A.length; i++) {    for (Object oo : A[i]) {     System.out.print(oo + " ");    }    System.out.println("");   }  }  public static void deb(String[][] A) {   for (int i = 0; i < A.length; i++) {    for (Object oo : A[i]) {     System.out.print(oo + " ");    }    System.out.println("");   }  }    int nextInt() throws IOException {   in.nextToken();   return (int) in.nval;  }  long nextLong() throws IOException {   in.nextToken();   return (long) in.nval;  }  class Pair<X, Y> {   public X x;   public Y y;   public Pair(X x, Y y) {    this.x = x;    this.y = y;   }   public void setX(X x) {    this.x = x;   }   public void setY(Y y) {    this.y = y;   }  }  boolean inR(int x, int y) {   return (x >= 0) && (x < nn) && (y >= 0) && (y < nn);  }  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);  } }
1	public class Main {  static class FastReader  {   private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public FastReader() { this(System.in); }public FastReader(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 nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}   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 l(){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 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 double d() throws IOException {return Double.parseDouble(next()) ;}   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 void scanIntArr(int [] arr){ for(int li=0;li<arr.length;++li){ arr[li]=i();}}   public void scanLongArr(long [] arr){for (int i=0;i<arr.length;++i){arr[i]=l();}}   public void shuffle(int [] arr){ for(int i=arr.length;i>0;--i) { int r=(int)(Math.random()*i); int temp=arr[i-1]; arr[i-1]=arr[r]; arr[r]=temp; } }  }  public static void main(String[] args)throws IOException {     PrintWriter pw = new PrintWriter(System.out);   FastReader fr = new FastReader();   int n=fr.i();   int [] arr=new int[n];   fr.scanIntArr(arr);   int min=Integer.MAX_VALUE;   int max=Integer.MIN_VALUE;   long sum=0;   if(n==1)   {    pw.println(arr[0]);    pw.flush();    pw.close();    return;   }   for(int i=0;i<n;++i)   {    if(arr[i]<min)     min=arr[i];    if(arr[i]>max)     max=arr[i];    sum+=Math.abs(arr[i]);   }   if(min>0)   {    sum-=2*min;   }   if(max<0)   {    sum+=2*max;   }   pw.println(sum);   pw.flush();   pw.close();  } }
0	public class LuckyDivison {  public static void main(String[] args)  {   Scanner in = new Scanner(System.in);   int inp = in.nextInt();   if(inp%4==0||inp%7==0||inp%47==0||inp%74==0||inp%447==0||inp%474==0||inp%477==0||inp%747==0||inp%774==0||inp%777==0)   {   System.out.println("YES");   }   else System.out.println("NO");       } }
0	public class Solution {  public static void main(String[] args) {     Scanner t=new Scanner(System.in);   long l=t.nextLong();   long r=t.nextLong();   if(r-l<2) System.out.println(-1);   else if(r-l<3 && l%2!=0){    if(l%3!=0) System.out.println(-1);    else if ((l+3)%2==0) System.out.println(-1);     else System.out.println(l+" "+(l+1)+" "+(l+3));   } else{    while (l%2!=0) l++;    System.out.println(l+" "+(l+1)+" "+(l+2));   }  } }
2	public class C { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  long n = nl();  long S = nl();  long d = 1000000000000000000L;  out.println(dfs(d, n, S)); }  long dfs(long d, long n, long S) {  if(d == 0)return 0L;  long ret = 0;  for(int i = 0;i <= n/d;i++){  if(S <= 0){   ret += Math.min(n-i*d+1, d);  }else if(S < d){   ret += dfs(d/10, i == n/d ? n%d : d-1, S);  }  S -= d-1;  }  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 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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
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();  } } class TaskB { public void solve(int testNumber, Scanner in, PrintWriter out) {  long n = in.nextLong() ;  int k = in.nextInt();  long top = 1L * k * (k+1) / 2L - k + 1;  if ( n == 1L ){  out.print(0);  return;  }  if ( n > top ){  out.print(-1);  return;  }  int ans = 0;  if ( n > 0 ){  ++ans;  n -= k;  k -= 2;  }  while ( n > 0 ){  ++ans;  n -= k;  k--;  }  out.print(ans); } }
5	public class Task15a {  public static class House implements Comparable<House>{  int x, s;  public House(int x, int s) {  super();  this.x = x;  this.s = s;  }  public int compareTo(House o) {  return x - o.x;  }   } public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int t = sc.nextInt() * 2;  House[] hs = new House[n];  for (int i = 0; i < n; i++){  hs[i] = new House(sc.nextInt()*2, sc.nextInt());  }  Arrays.sort(hs);  int res = 2;  for (int i = 0; i < n - 1; i++) {  int curr = hs[i+1].x - hs[i].x - hs[i+1].s - hs[i].s;  if (curr > t) res += 2;  if (curr == t) res += 1;  }  System.out.println(res); } }
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();   }   int nextInt()   {    return Integer.parseInt(next());   }   long nextLong()   {    return Long.parseLong(next());   }   double nextDouble()   {    return Double.parseDouble(next());   }   String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  } }
5	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(new BufferedReader(new InputStreamReader(System.in)));  int n = in.nextInt();  int t = in.nextInt();  House list[] = new House[n];  for (int i = 0; i < n; i++) {  int x = in.nextInt();  int a = in.nextInt();  list[i] = new House(x, a);  }  Arrays.sort(list);  int c = 2;  for (int i = 1; i < n; i++) {  float d = list[i].left - list[i - 1].right;  if (d == t) c++;  else if (d > t) c += 2;  }  System.out.println(c); } }  class House implements Comparable<House> { public int x; public float left, right; public House(int x, int a) {  this.x = x;  float h = a / 2f;  this.left = x - h;  this.right = x + h; }  public int compareTo(House h) {  return this.x == h.x ? 0 : this.x < h.x ? -1 : 1; }  }
1	public class Main2 {  static List<List<Integer>> getLayers(int[] numbers, int a, int b) {  boolean[] used = new boolean[numbers.length];  HashSet<Integer> hs = new HashSet<Integer>();  for (int i = 0; i < numbers.length; i++) {  hs.add(numbers[i]);  }  HashMap<Integer, Integer> numberToIndex = new HashMap<Integer, Integer>();  for (int i = 0; i < numbers.length; i++) {  numberToIndex.put(numbers[i], i);  }  List<List<Integer>> ans = new ArrayList<List<Integer>>();  for (int i = 0; i < numbers.length; i++) {  if (!used[i]) {   List<Integer> ansRow = new ArrayList<Integer>();   LinkedList<Integer> current = new LinkedList<Integer>();   current.add(numbers[i]);   while (!current.isEmpty()) {   int c = current.removeFirst();   used[numberToIndex.get(c)] = true;    boolean found = false;    if (hs.contains(a - c)) {    found = true;    if (a - c != c)    current.add(a - c);   }    if (hs.contains(b - c)) {    found = true;    if (b - c != c)    current.add(b - c);   }    if (found || ansRow.size() > 0)    ansRow.add(c);    hs.remove(c);   }   ans.add(ansRow);  }  }  return ans; }  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int a = sc.nextInt();  int b = sc.nextInt();  int[] numbers = new int[n];  for (int i = 0; i < numbers.length; i++) {  numbers[i] = sc.nextInt();  }  HashSet<Integer> hs = new HashSet<Integer>();  for (int i = 0; i < numbers.length; i++) {  hs.add(numbers[i]);  }  int[] belongs = new int[n];  for (int i = 0; i < belongs.length; i++) {  belongs[i] = -1;  }  HashMap<Integer, Integer> numberToIndex = new HashMap<Integer, Integer>();  for (int i = 0; i < numbers.length; i++) {  numberToIndex.put(numbers[i], i);  }  boolean possible = true;  List<List<Integer>> layers = getLayers(numbers, a, b);  for (List<Integer> layer : layers) {   if (layer.size() == 0) {   System.out.println("NO");   return;  }   int starting = -1;  for (int j = 0; j < layer.size(); j++) {   int cur = layer.get(j);   int nei = 0;   if (hs.contains(a - cur)) {   nei++;   }   if (hs.contains(b - cur)) {   nei++;   }   if (nei == 1 || (a == b && nei == 2)) {   starting = j;   }  }   if (starting == -1)   throw new Error();   int c = layer.get(starting);  HashSet<Integer> layerset = new HashSet<Integer>(layer);  while (true) {   if (layerset.contains(c) && layerset.contains(a - c)) {   belongs[numberToIndex.get(c)] = 0;   belongs[numberToIndex.get(a - c)] = 0;   layerset.remove(c);   layerset.remove(a - c);   c = b - (a - c);   } else if (layerset.contains(c) && layerset.contains(b - c)) {   belongs[numberToIndex.get(c)] = 1;   belongs[numberToIndex.get(b - c)] = 1;   layerset.remove(c);   layerset.remove(b - c);   c = a - (b - c);   } else {   break;   }   }  }  printResult(belongs);  }  static void printResult(int[] belongs) {  boolean ok = true;  for (int i = 0; i < belongs.length; i++) {  if (belongs[i] < 0)   ok = false;  }  if (ok) {  System.out.println("YES");  StringBuffer sb = new StringBuffer();   for (int i = 0; i < belongs.length; i++) {   sb.append(belongs[i]);   if (i != belongs.length - 1)   sb.append(" ");  }   System.out.println(sb.toString());  } else {  System.out.println("NO");  } } }
1	public class CodehorsesTshirts {           private static void solve() {        int n = nextInt();     HashMap<String, Integer> a = new HashMap<>();   HashMap<String, Integer> b = new HashMap<>();     for(int i = 0; i < n; i++)    a.merge(nextLine(), 1, Integer::sum);     for(int i = 0; i < n; i++)    b.merge(nextLine(), 1, Integer::sum);     b.forEach((k , v) -> {    if(a.containsKey(k))     a.put(k, a.get(k) - Math.min(v , a.get(k)));   });     int cost = a.values().stream().reduce(0, Integer::sum);     println(cost);     }                  public static void main(String[] args) throws IOException {   reader = new BufferedReader(new InputStreamReader(System.in));   writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);   st  = null;   solve();   reader.close();   writer.close();  }   static BufferedReader reader;  static PrintWriter writer;  static StringTokenizer st;   static 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();}  static String nextLine() {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}     static int nextInt() {return Integer.parseInt(next());}  static long nextLong() {return Long.parseLong(next());}   static double nextDouble(){return Double.parseDouble(next());}  static char nextChar() {return next().charAt(0);}  static int[] nextIntArray(int n)   {int[] a= new int[n]; int i=0;while(i<n){a[i++]=nextInt();} return a;}  static long[] nextLongArray(int n)  {long[]a= new long[n]; int i=0;while(i<n){a[i++]=nextLong();} return a;}   static int[] nextIntArrayOneBased(int n) {int[] a= new int[n+1]; int i=1;while(i<=n){a[i++]=nextInt();} return a;}     static long[] nextLongArrayOneBased(int n){long[]a= new long[n+1];int i=1;while(i<=n){a[i++]=nextLong();}return a;}     static void print(Object o) { writer.print(o); }  static void println(Object o){ writer.println(o);}     }
5	public class Main {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);   int n = sc.nextInt(), sum = 0;   Integer[] A = new Integer[n];   for (int i = 0 ; i < n ; i++) {  A[i] = sc.nextInt();  sum += A[i];  }   Arrays.sort(A, Collections.reverseOrder());   int c = 0, ans = 0;   while (ans <= sum) {  ans += A[c];  sum -= A[c];  c++;  }   System.out.println(c); } }
5	public class C15A {  public static void main(String args[]){   Scanner sc=new Scanner(System.in);   int n=sc.nextInt();   int t=sc.nextInt();   double nm[][]=new double[n][2];   int a=0;   int b=0;   for(int i=0;i<n;i++){    a=sc.nextInt();    b=sc.nextInt();    nm[i][0]=a-(double)b/2;    nm[i][1]=a+(double)b/2;   }    Arrays.sort(nm, new ArrayColumnComparator(1));   int sum=0;   for(int i=0;i<n-1;i++){    if(nm[i+1][0]-nm[i][1]==t)     sum++;    else if(nm[i+1][0]-nm[i][1]>t){     sum+=2;    }   }   System.out.println(sum+2);  } } class ArrayColumnComparator implements Comparator {  private int cm = 0;  ArrayColumnComparator(int cm) {   this.cm = cm;  }  public int compare(Object o1, Object o2) {   double[] row1 = (double[])o1;   double[] row2 = (double[])o2;   int i;   if (row1[cm]>row2[cm])    i=1;   else if(row1[cm]<row2[cm])    i=-1;   else i=0;   return i;  } }
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));  }  } } }
1	public class Main implements Runnable { BufferedReader in;  StringTokenizer st = new StringTokenizer("");  public static void main(String [] args) throws Exception {  new Thread(new Main()).start(); }  void printExit(String s) {  System.out.println(s);  System.exit(0); }  public void run() {  try {  Locale.setDefault(Locale.US);  in = new BufferedReader(new InputStreamReader(System.in));  int n = nextInt();  int k = nextInt();  int max = 5000;  ArrayList <Integer> primes = new ArrayList <Integer> ();  boolean [] p = new boolean [max];  Arrays.fill(p, true);  for (int i = 2; i < max; i++) {   if (p[i]) {   primes.add(i);   for (int j = i * i; j < max; j += i)    p[j] = false;   }      }   HashSet <Integer> good = new HashSet <Integer> ();  for (int i = 0; i < primes.size() - 1; i++) {   good.add(primes.get(i) + primes.get(i + 1) + 1);  }   int have = 0, pos = 0;  while (true) {   int i = primes.get(pos);    if (i > n) break;   if (good.contains(i)) have++;   pos++;  }  System.out.println(have >= k ? "YES" : "NO");  }  catch (Exception e) {  e.printStackTrace();  } }  boolean seekForToken() {  try {  while (!st.hasMoreTokens()) {   String s = in.readLine();   if (s == null) {    return false;   }   st = new StringTokenizer(s);  }  return true;  }  catch (IOException e) {   e.printStackTrace();   return false;  }  }   int nextInt() {  return Integer.parseInt(nextToken());  }   long nextLong() {  return Long.parseLong(nextToken());  }   double nextDouble() {  return Double.parseDouble(nextToken());  }   BigInteger nextBigInteger() {   return new BigInteger(nextToken());  }   String nextToken() {   seekForToken();   return st.nextToken();  } }
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);  }  }
4	public class C { InputStream is; FastWriter out; String INPUT = "";  void solve() {  for(int T = ni();T > 0;T--)go(); }  void go() {  int n = ni();  int[] st = new int[n];  int sp = 0;  for(int i = 0;i < n;i++){  int x = ni();  if(x == 1){   st[sp++] = 1;  }else{   while(sp > 0){   if(st[sp-1] + 1 == x){    st[sp-1]++;    break;   }else{    sp--;   }   }  }  for(int j = 0;j < sp;j++){   if(j > 0)out.print(".");   out.print(st[j]);  }  out.println();  } }  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 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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   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 long[] nal(int n) {  long[] a = new long[n];  for(int i = 0;i < n;i++)a[i] = nl();  return a; }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[][] nmi(int n, int m) {  int[][] map = new int[n][];  for(int i = 0;i < n;i++)map[i] = na(m);  return map; }  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 {  private static 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;  }  private static 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;  }  private static 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(); } }  public void trnz(int... o) {  for(int i = 0;i < o.length;i++)if(o[i] != 0)System.out.print(i+":"+o[i]+" ");  System.out.println(); }   public void trt(long... o) {  Queue<Integer> stands = new ArrayDeque<>();  for(int i = 0;i < o.length;i++){  for(long x = o[i];x != 0;x &= x-1)stands.add(i<<6|Long.numberOfTrailingZeros(x));  }  System.out.println(stands); }  public void tf(boolean... r) {  for(boolean x : r)System.out.print(x?'#':'.');  System.out.println(); }  public void tf(boolean[]... b) {  for(boolean[] r : b) {  for(boolean x : r)System.out.print(x?'#':'.');  System.out.println();  }  System.out.println(); }  public void tf(long[]... b) {  if(INPUT.length() != 0) {  for (long[] r : b) {   for (long x : r) {   for (int i = 0; i < 64; i++) {    System.out.print(x << ~i < 0 ? '#' : '.');   }   }   System.out.println();  }  System.out.println();  } }  public void tf(long... b) {  if(INPUT.length() != 0) {  for (long x : b) {   for (int i = 0; i < 64; i++) {   System.out.print(x << ~i < 0 ? '#' : '.');   }  }  System.out.println();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
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 String next()throws Exception{   StringBuilder sb=new StringBuilder(1<<16);   InputStream in=System.in;   byte b=0;   do{    if(!isWhiteSpace(b))     sb.append((char)b);    b=(byte)in.read();   }while(!isWhiteSpace(b) || sb.length()==0);   return sb.toString();  }  static boolean isWhiteSpace(byte b){   char ch=(char)b;   return ch=='\0' || ch==' ' || ch=='\n';  } }
2	public class C {  private static final String REGEX = " "; private static final Boolean DEBUG = false; private static final String FILE_NAME = "input.txt";  public static void main(String[] args) throws IOException {  if (DEBUG) {  generate();  }  Solver solver = new Solver();  solver.readData();  solver.solveAndPrint(); }  private static void generate() throws IOException {  }  private static class Solver {  long n, s;  void readData() throws IOException {  InputStream in = DEBUG ? new FileInputStream(FILE_NAME) : System.in;  Scanner scanner = new Scanner(in);  n = scanner.nextLong();  s = scanner.nextLong();  scanner.close();  }  void solveAndPrint() {  long cur = s + 1;  long sum = getSum(cur);  long res = 0;  while (cur <= n) {   if (cur - sum >= s) {   System.out.println(n - cur + 1);   return;   }   cur++;   if (cur % 10 != 0) {   sum++;   } else {   sum = getSum(cur);   }  }  System.out.println(0);  }  long getSum(long cur) {  long res = 0;  while (cur > 0) {   res += cur % 10;   cur /= 10;  }  return res;  }   @SuppressWarnings("SameParameterValue")  int[] splitInteger(String string, int n) {  final String[] split = string.split(REGEX, n);  int[] result = new int[split.length];  for (int i = 0; i < n; ++i) {   result[i] = Integer.parseInt(split[i]);  }  return result;  }  public int[] splitInteger(String string) {  return splitInteger(string, 0);  }   @SuppressWarnings("SameParameterValue")  long[] splitLong(String string, int n) {  final String[] split = string.split(REGEX, n);  long[] result = new long[split.length];  for (int i = 0; i < n; ++i) {   result[i] = Long.parseLong(split[i]);  }  return result;  }  public long[] splitLong(String string) {  return splitLong(string, 0);  }  @SuppressWarnings("SameParameterValue")  double[] splitDouble(String string, int n) {  final String[] split = string.split(REGEX, n);  double[] result = new double[split.length];  for (int i = 0; i < n; ++i) {   result[i] = Double.parseDouble(split[i]);  }  return result;  }  public double[] splitDouble(String string) {  return splitDouble(string, 0);  }  @SuppressWarnings("SameParameterValue")  String[] splitString(String string, int n) {  return string.split(REGEX, n);  }  public String[] splitString(String string) {  return splitString(string, 0);  }  public int max(int a, int b) {  return Math.max(a, b);  }  public long max(long a, long b) {  return Math.max(a, b);  }  public int min(int a, int b) {  return Math.min(a, b);  }  public long min(long a, long b) {  return Math.min(a, b);  }  public double max(double a, double b) {  return Math.max(a, b);  }  public double min(double a, double b) {  return Math.min(a, b);  }  private final static int MOD = 1000000009;  int multMod(int a, int b) {  return ((a % MOD) * (b % MOD)) % MOD;  }  int sumMod(int a, int b) {  return ((a % MOD) + (b % MOD)) % MOD;  }  long multMod(long a, long b) {  return ((a % MOD) * (b % MOD)) % MOD;  }  long sumMod(long a, long b) {  return ((a % MOD) + (b % MOD)) % MOD;  } }  }
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);  } }
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 int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  public long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  in.close();  out.close();  } catch (IOException e) {  } }  public static void main(String[] args) {  new Thread(new Proj()).start(); } }
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;  }  int nextInt()  {   return Integer.parseInt(next());  }  long nextLong()  {   return Long.parseLong(next());  }  double nextDouble()  {   return Double.parseDouble(next());  }  BigInteger nextBigInteger()  {   return new BigInteger(next());  }  BigDecimal nextBigDecimal()  {   return new BigDecimal(next());  } }
3	public class Solve6 {  public static void main(String[] args) throws IOException {   PrintWriter pw = new PrintWriter(System.out);   new Solve6().solve(pw);   pw.flush();   pw.close();  }  public void solve(PrintWriter pw) throws IOException {   FastReader sc = new FastReader();   int n = sc.nextInt();   int[] a = new int[n + 1];   for (int i = 1; i <= n; i++) {    a[i] = sc.nextInt();   }   HashMap<Integer, LinkedList<Pair<Integer, Integer>>> h = new HashMap();   for (int i = 1; i <= n; i++) {    int s = 0;    for (int j = i; j >= 1; j--) {     s += a[j];     LinkedList<Pair<Integer, Integer>> l;     if (!h.containsKey(s)) {      l = new LinkedList();     } else {      l = h.get(s);     }     l.add(new Pair(j, i));     h.put(s, l);    }   }   LinkedList<Pair<Integer, Integer>>[] l = new LinkedList[h.size() + 1];   for (int i = 1; i <= h.size(); i++) {    l[i] = new LinkedList();   }   int k = 0, max = 0, index = 0;   for (LinkedList<Pair<Integer, Integer>> temp : h.values()) {    k++;    int i = 0, size = 0;    for (Pair<Integer, Integer> pair : temp) {     if (pair.getKey() > i) {      i = pair.getValue();      l[k].add(pair);      size++;      if (size > max) {       max = size;       index = k;      }     }    }   }   pw.println(l[index].size());   for (Pair<Integer, Integer> pair : l[index]) {    pw.println(pair.getKey() + " " + pair.getValue());   }  }  static class FastReader {   StringTokenizer st;   BufferedReader br;   public FastReader() {    br = new BufferedReader(new InputStreamReader(System.in));   }   public boolean hasNext() throws IOException {    String s = br.readLine();    if (s == null || s.isEmpty()) {     return false;    }    st = new StringTokenizer(s);    return true;   }   public String next() throws IOException {    if (st == null || !st.hasMoreTokens()) {     String s = br.readLine();     if (s.isEmpty()) {      return null;     }     st = new StringTokenizer(s);    }    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 String nextLine() throws IOException {    return br.readLine();   }  } }
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());  }  public Double nextDouble() throws Exception {  return Double.parseDouble(next());  }  public String nextLine() throws Exception {  if (st.hasMoreTokens()) {   StringBuilder str = new StringBuilder();   boolean first = true;   while (st.hasMoreTokens()) {   if (first) {    first = false;   } else {    str.append(" ");   }   str.append(st.nextToken());   }   return str.toString();  } else {   return br.readLine();  }  } }  }
1	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  StreamInputReader in = new StreamInputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskB solver = new TaskB();  solver.solve(1, in, out);  out.close(); } } class TaskB { public void solve(int testNumber, StreamInputReader in, PrintWriter out) {   int N = in.readInt();   int K = in.readInt();   int[] A = new int[N];   for(int i = 0; i < N; i++)    A[i] = in.readInt();   int num = 0;   int left = 0;   int right = 0;   int[] seen = new int[100005];   while(right < N && num < K) {    if(seen[A[right]] == 0)     num++;    seen[A[right]]++;    right++;   }   right--;   if(num == K) {    while(seen[A[left]] > 1) {     seen[A[left]]--;     left++;    }    out.print((left + 1) + " " + (right + 1));    return;   }   out.print("-1 -1"); } } 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++];  }  } abstract class InputReader {  public abstract int read();  public int readInt() {   return Integer.parseInt(readString());  }  public String readString() {   int c = read();   while (isSpaceChar(c))    c = read();   StringBuffer res = new StringBuffer();   do {    res.appendCodePoint(c);    c = read();   } while (!isSpaceChar(c));   return res.toString();  }  private boolean isSpaceChar(int c) {   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  }
1	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int a[] = new int[100004];   int b[] = new int[100004];   int n, m, ans = 0, dau, cuoi=-1;   n = sc.nextInt();   m = sc.nextInt();   for(int i=0;i<100004;i++) a[i] = 0;   for(int i=0;i<n;i++){    b[i] = sc.nextInt();    if(a[b[i]]==0){     a[b[i]] = 1;     ans++;     if(ans==m){      cuoi = i+1;      break;     }    }   }   for(int i=cuoi-1;i>=00;i--){    if(a[b[i]]==1){     a[b[i]] = 0;     ans--;     if(ans==0){      System.out.println((i+1)+" "+cuoi);      System.exit(0);     }    }   }   System.out.println("-1 -1");  } }
4	public class Mulitple { public static void main(String[] args) throws IOException {  BufferedReader r = new BufferedReader(new InputStreamReader(System.in));   String s = r.readLine();  System.out.println(num(s)); }  public static int num(String s) {  int answer = 0;  Set<String> set = new HashSet<String>();  for(int j = s.length()-1; j>=1; j--)  {  for(int i = 0; i<s.length()-j+1; i++)  {   if(set.contains(s.substring(i,i+j)))   {   return s.substring(i,i+j).length();   }   else   {   set.add(s.substring(i,i+j));   }  }  }  return 0;  } }
5	public class D { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni();  int[] a = na(n);  int[] xs = new int[3*n];  for(int i = 0;i < n;i++){  xs[3*i] = a[i];  xs[3*i+1] = a[i]-1;  xs[3*i+2] = a[i]+1;  }  xs = shuffle(xs, new Random());  int[] imap = shrinkX(xs);   BigInteger ans = BigInteger.valueOf(0L);  {  int[] ft = new int[3*n+3];  for(int i = 0;i < n;i++){   int y = Arrays.binarySearch(imap, a[i]);   int num =    i - sumFenwick(ft, y + 1) + sumFenwick(ft, y - 2);   ans = ans.add(BigInteger.valueOf((long)a[i] * num));   addFenwick(ft, y, 1);  }  }   {  int[] ft = new int[3*n+3];  for(int i = n-1;i >= 0;i--){   int y = Arrays.binarySearch(imap, a[i]);   int num =    n-1-i - sumFenwick(ft, y + 1) + sumFenwick(ft, y - 2);   ans = ans.subtract(BigInteger.valueOf((long)a[i] * num));   addFenwick(ft, y, 1);  }  }  out.println(ans); }  public static int sumFenwick(int[] ft, int i) {  int sum = 0;  for(i++;i > 0;i -= i&-i)sum += ft[i];  return sum; }  public static void addFenwick(int[] ft, int i, int v) {  if(v == 0 || i < 0)return;  int n = ft.length;  for(i++;i < n;i += i&-i)ft[i] += v; }   public static int[] shuffle(int[] a, Random gen){ for(int i = 0, n = a.length;i < n;i++){ int ind = gen.nextInt(n-i)+i; int d = a[i]; a[i] = a[ind]; a[ind] = d; } return a; }   public static int[] shrinkX(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;  ret[0] = (int) (b[0] >> 32);  for (int i = 0; i < n; i++) {  if (i > 0 && (b[i] ^ b[i - 1]) >> 32 != 0) {   p++;   ret[p] = (int) (b[i] >> 32);  }  a[(int) b[i]] = p;  }  return Arrays.copyOf(ret, p + 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 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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
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();  } }
4	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);  String s = in.readLine();   for (int len = s.length() - 1; len > 0; len--) {  Set<String> set = new HashSet<String>();  for (int i = 0; i + len <= s.length(); i++) {   String ss = s.substring(i, i + len);   if (set.contains(ss)) {   out.println(len);   out.close();   return;   }   set.add(ss);  }  }  out.println(0);  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()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  String nextLine() throws IOException {  st = new StringTokenizer("");  return in.readLine(); }  boolean EOF() throws IOException {  while (!st.hasMoreTokens()) {  String s = in.readLine();  if (s == null)   return true;  st = new StringTokenizer(s);  }  return false; } }
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.nextInt();    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = in.nextInt();    }    int inv = 0;    for (int i = 0; i < n; i++) {     for (int j = 0; j < i; j++) {      if (a[j] > a[i]) {       inv++;      }     }    }    int m = in.nextInt();    for (int i = 0; i < m; i++) {     int l = in.nextInt();     int r = in.nextInt();     int s = (r - l + 1) * (r - l) / 2;     inv = (inv + s) % 2;     out.println(inv % 2 == 0 ? "even" : "odd");    }   }  }  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());   }  } }
0	public class taskA {  void solve() throws IOException {  long a = nextLong();  long b = nextLong();  long ans = 0;  while (a != 0 && b != 0) {  if (a > b) {   ans += a / b;   a %= b;  } else {   long c = b % a;   ans += b / a;   b = a;   a = c;  }  }  out.println(ans); }  BufferedReader br; StringTokenizer st; PrintWriter out;  void run() {  try {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);       solve();   out.close();  } catch (IOException e) {  e.printStackTrace();  } }  public static void main(String[] args) {  new taskA().run(); }  String nextToken() throws IOException {  while ((st == null) || !st.hasMoreTokens())  st = new StringTokenizer(br.readLine());  return st.nextToken(); }  int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(nextToken()); }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(nextToken()); }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(nextToken()); } }
2	public class Main {  static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  static StringTokenizer st = new StringTokenizer("");  static PrintWriter pw = new PrintWriter(System.out);  public static String next() throws IOException {   while (!st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return st.nextToken();  }  public static int nextInt() throws IOException {   return Integer.parseInt(next());  }  public static long nextLong() throws IOException {   return Long.parseLong(next());  }  public static void main(String[] args) throws IOException {   new Main().run();  }  void run() throws IOException {   long n = nextInt();   long k = nextInt();   long d = 9 + 8 * (n + k);   pw.print(n - (-3 + (int)Math.sqrt(d)) / 2);   pw.close();  } }
0	public class D5 { public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int a = input.nextInt(), v = input.nextInt();  int l = input.nextInt(), d = input.nextInt(), w = input.nextInt();  double lo = 0, hi = v;  for(int iter = 0; iter < 1000; iter++)  {   double mid = (lo+hi)/2;   if(can(mid, a, d, w)) lo = mid;   else hi = mid;  }   double t1 = lo / a;  double gone = .5 * t1 * t1 * a;  if(lo > w)  {   gone += -a * .5 * (lo - w) / a * (lo - w) / a + lo * (lo - w) / a;   t1 += (lo - w) / a;  }  t1 += (d - gone) / lo;   double v0 = Math.min(lo, w);  double togo = l - d;  double toAdd = (-v0 + Math.sqrt(v0 * v0 + 4 * togo * .5 * a)) / a;  if(toAdd * a + v0 > v)  {   double tt = (v - v0) / a;   t1 += tt;   togo -= .5 * a * tt * tt + v0 * tt;   t1 += togo / v;  }  else t1 += toAdd;  System.out.println(t1); } static boolean can(double v, double a, double d, double max) {  double t1 = v / a;  double distGone = .5 * a * t1 * t1;  if(v > max)  {   t1 = (v - max) / a;   distGone += -.5 * a * t1 * t1 + v * t1;  }  return distGone <= d; } }
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());   }     public double nextDouble() {    return Double.parseDouble(nextToken());   }  } }
0	public class CF {   BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st=null;   private void solution() throws IOException{  int n=nextInt();  if((n % 4==0 && n>=4)||(n % 7==0 && n>=7) || (n % 44==0 && n>=44) || (n % 47==0 && n>=47) || (n % 77==0 && n>=77) || (n % 74==0 && n>=74)  || (n % 444==0 && n>=444) || (n % 447==0 && n>=447) || (n % 474==0 && n>=74) || (n % 477==0 && n>=477) || (n % 744==0 && n>=744)  || (n % 747==0 && n>=747) || (n % 777==0 && n>=777) || (n % 774==0 && n>=774)){    System.out.println("YES");  }else{     System.out.println("NO");}   }   String nextToken()throws IOException {     if(st==null || !st.hasMoreTokens()){       st = new StringTokenizer(bf.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());   }   public static void main(String args[]) throws IOException {     new CF().solution();   } }
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);   solve(in, out);   out.close();  }  static String reverse(String s) {   return (new StringBuilder(s)).reverse().toString();  }  static void sieveOfEratosthenes(int n, int factors[], ArrayList<Integer> ar)  {   factors[1]=1;   int p;   for(p = 2; p*p <=n; p++)   {    if(factors[p] == 0)    {     ar.add(p);     factors[p]=p;     for(int i = p*p; i <= n; i += p)      factors[i] = p;    }   }   for(;p<=n;p++){    if(factors[p] == 0)    {     ar.add(p);    }   }  }  static void sort(int ar[]) {   int n = ar.length;   ArrayList<Integer> a = new ArrayList<>();   for (int i = 0; i < n; i++)    a.add(ar[i]);   Collections.sort(a);   for (int i = 0; i < n; i++)    ar[i] = a.get(i);  }  static void sort1(long ar[]) {   int n = ar.length;   ArrayList<Long> a = new ArrayList<>();   for (int i = 0; i < n; i++)    a.add(ar[i]);   Collections.sort(a);   for (int i = 0; i < n; i++)    ar[i] = a.get(i);  }  static long ncr(long n, long r, long mod) {   if (r == 0)    return 1;   long val = ncr(n - 1, r - 1, mod);   val = (n * val) % mod;   val = (val * modInverse(r, mod)) % mod;   return val;  }  static int findMax(int a[], int n, int vis[], int i, int d){   if(i>=n)    return 0;   if(vis[i]==1)    return findMax(a, n, vis, i+1, d);   int max = 0;   for(int j=i+1;j<n;j++){    if(Math.abs(a[i]-a[j])>d||vis[j]==1)     continue;    vis[j] = 1;    max = Math.max(max, 1 + findMax(a, n, vis, i+1, d));    vis[j] = 0;   }   return max;  }  public static void solve(InputReader sc, PrintWriter pw){   int i, j = 0;     int t = sc.nextInt();   u: while (t-- > 0) {    int n = sc.nextInt();    int a[] = new int[n];    ArrayList<Integer> ar = new ArrayList<>();    ar.add(0);    for(i=0;i<1000;i++){     ar.add(0);    }    int m = 1;    for(i=0;i<n;i++){     a[i] = sc.nextInt();     if(a[i]==1){      ar.set(m,1);      m++;     }     else{      while(m>0&&ar.get(m-1)!=a[i]-1){       m--;      }      ar.set(m-1,a[i]);     }     pw.print(ar.get(1));     for(j=2;j<m;j++){      pw.print("."+ar.get(j));     }     pw.println();    }   }  }  static long findOne(int n, int sz[], ArrayList<Integer> ar){   long paths = n-1;   long till = 0;   for(int v:ar){    paths += till*sz[v];    till += sz[v];   }   return paths;  }  static void assignAnc(ArrayList<Integer> ar[],int sz[], int pa[] ,int curr, int par){   sz[curr] = 1;   pa[curr] = par;   for(int v:ar[curr]){    if(par==v)     continue;    assignAnc(ar, sz, pa, v, curr);    sz[curr] += sz[v];   }  }  static int findLCA(int a, int b, int par[][], int depth[]){   if(depth[a]>depth[b]){    a = a^b;    b = a^b;    a = a^b;   }   int diff = depth[b] - depth[a];   for(int i=19;i>=0;i--){    if((diff&(1<<i))>0){     b = par[b][i];    }   }   if(a==b)    return a;   for(int i=19;i>=0;i--){    if(par[b][i]!=par[a][i]){     b = par[b][i];     a = par[a][i];    }   }   return par[a][0];  }  static void formArrayForBinaryLifting(int n, int par[][]){   for(int j=1;j<20;j++){    for(int i=0;i<n;i++){     if(par[i][j-1]==-1)      continue;     par[i][j] = par[par[i][j-1]][j-1];    }   }  }  static long lcm(int a, int b){   return a*b/gcd(a,b);  }  static class Pair1 {   long a;   long b;     Pair1(long a, long b) {    this.a = a;    this.b = b;   }  }  static class Pair implements Comparable<Pair> {   int a;   int b;   int c;     Pair(int a, int b, int c) {    this.a = a;    this.b = b;    this.c = c;   }    public int compareTo(Pair p) {              return p.c - c;   }  }                     static long gcd(long a, long b) {   if (b == 0)    return a;   return gcd(b, a % b);  }  static long fast_pow(long base, long n, long M) {   if (n == 0)    return 1;   if (n == 1)    return base % M;   long halfn = fast_pow(base, n / 2, M);   if (n % 2 == 0)    return (halfn * halfn) % M;   else    return (((halfn * halfn) % M) * base) % M;  }  static long modInverse(long n, long M) {   return fast_pow(n, M - 2, M);  }  static class InputReader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public InputReader(InputStream stream) {    reader = new BufferedReader(new InputStreamReader(stream), 9992768);    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());   }  } }
6	public class Main {  static int n, memo[], dS[], dd[][];  static int dp(int idx, int msk) {  if(msk == (1 << n) - 1)  return 0;  if(memo[msk] != -1)  return memo[msk];  while((msk & 1 << idx) != 0)  ++idx;  int ret = dS[idx] * 2 + dp(idx + 1, msk | 1 << idx);  for(int i = 0; i < n; ++i)  if((msk & 1 << i) == 0)   ret = Math.min(ret, dS[i] + dS[idx] + dd[i][idx] + dp(idx + 1, msk | 1 << i | 1 << idx));  return memo[msk] = ret; }  static StringBuilder sb = new StringBuilder("0 ");  static void print(int idx, int msk) {  if(msk == (1 << n) - 1)  return;  int opt = dp(idx, msk);  while((msk & 1 << idx) != 0)  ++idx;  if(dS[idx] * 2 + dp(idx + 1, msk | 1 << idx) == opt)  {  sb.append((idx + 1) + " 0 ");  print(idx + 1, msk | 1 << idx);  return;  }  for(int i = 0; i < n; ++i)  if((msk & 1 << i) == 0)   if(opt == dS[i] + dS[idx] + dd[i][idx] + dp(idx + 1, msk | 1 << i | 1 << idx))   {   sb.append((idx + 1) + " " + (i + 1) + " 0 ");   print(idx + 1, msk | 1 << i | 1 << idx);   return;   } }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  Point s = new Point(sc.nextInt(), sc.nextInt());  n = sc.nextInt();  Point[] a = new Point[n];  for(int i = 0; i < n; ++i)  a[i] = new Point(sc.nextInt(), sc.nextInt());  dS = new int[n];  dd = new int[n][n];  for(int i = 0; i < n; ++i)  {  dS[i] = dist2(s, a[i]);  for(int j = 0; j < n; ++j)   dd[i][j] = dist2(a[i], a[j]);  }  memo = new int[1 << n];  Arrays.fill(memo, -1);  out.println(dp(0, 0));  print(0, 0);  out.println(sb);  out.flush();  out.close(); }  static int dist2(Point a, Point b) { return sq(a.x - b.x) + sq(a.y - b.y); }  static int sq(int x) { return x * x; }  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 long nextLong() throws IOException {return Long.parseLong(next());}  public String nextLine() throws IOException {return br.readLine();}  public double nextDouble() throws IOException { return Double.parseDouble(next()); }  public boolean ready() throws IOException {return br.ready();}  } }
4	public class YouAreGivenAString {  void run() {   try {    BufferedReader bfd = new BufferedReader(new InputStreamReader(      System.in));    int i, j, k, mxLen = 0;    String s= bfd.readLine();    for(i=0; i<s.length(); ++i){     for(j=i+1; j<s.length()+1; ++j){      String s2 = s.substring(i, j);      if(s2.length()<=mxLen) continue;      int cnt=0;      for(k=0; k<s.length(); ++k){       if(s.length()>=k+s2.length())       if(s2.equals(s.substring(k,k+s2.length()))){        cnt++;        if(cnt>1)mxLen = Math.max(mxLen, s2.length());       }      }     }    }    System.out.println(mxLen);   } catch (Exception e) {   }  }  public static void main(String[] args) {   new YouAreGivenAString().run();  } }
6	public class Main {  public static int n, m;  public static int[][] arr;  public static class Item implements Comparable<Item> {   int i, x;   public Item(int i, int x) {    this.i = i;    this.x = x;   }   public int compareTo(Item other) {    if (x == other.x) {     return i - other.i;    }    return other.x - x;   }  }  public static int calc(int[] cols, int k, String mask) {   if (k == cols.length) {    int res = 0;    for (int i = 0; i < n; i++) {     int max = 0;     for (int j = 0; j < cols.length; j++) {      int shift = mask.charAt(j) - '0';      max = Math.max(max, arr[(shift + i) % n][cols[j]]);     }     res += max;    }    return res;   } else {    int best = 0;    for (int i = 0; i < n; i++) {     best = Math.max(best, calc(cols, k + 1, mask + i));    }    return best;   }  }  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int t = in.nextInt();   for (int i = 0; i < t; i++) {    n = in.nextInt();    m = in.nextInt();    arr = new int[n][m];    for (int j = 0; j < n; j++) {     for (int k = 0; k < m; k++) {      arr[j][k] = in.nextInt();     }    }    Item[] max = new Item[m];    for (int j = 0; j < m; j++) {     max[j] = new Item(j, 0);     for (int k = 0; k < n; k++) {      max[j].x = Math.max(max[j].x, arr[k][j]);     }    }    Arrays.sort(max);    int[] cols = new int[Math.min(n, m)];    for (int j = 0; j < cols.length; j++) {     cols[j] = max[j].i;    }    System.out.println(calc(cols, 0, ""));   }  } }
4	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);   DExplorerSpace solver = new DExplorerSpace();   solver.solve(1, in, out);   out.close();  }  static class DExplorerSpace {   int n;   int m;   int k;   int[][] col;   int[][] row;   long[][][] memo;   public void readInput(Scanner sc) {    n = sc.nextInt();    m = sc.nextInt();    k = sc.nextInt();    col = new int[n][m - 1];    for (int i = 0; i < n; i++)     for (int j = 0; j < m - 1; j++)      col[i][j] = sc.nextInt();    row = new int[n - 1][m];    for (int i = 0; i < n - 1; i++)     for (int j = 0; j < m; j++)      row[i][j] = sc.nextInt();   }   public void solve(int testNumber, Scanner sc, PrintWriter pw) {    int q = 1;    while (q-- > 0) {     readInput(sc);     if (k % 2 == 1) {      for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++)        pw.print(-1 + " ");       pw.println();      }      return;     }     memo = new long[k + 1][n][m];     for (long[][] x : memo)      for (long[] y : x)       Arrays.fill(y, -1);     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       pw.print(2l * dp(i, j, k / 2) + " ");      }      pw.println();     }    }   }   private long dp(int i, int j, int rem) {    if (rem == 0)     return 0;    if (memo[rem][i][j] != -1)     return memo[rem][i][j];    long min = (long) 1e18;    if (j <= m - 2)     min = Math.min(min, col[i][j] + dp(i, j + 1, rem - 1));    if (j > 0)     min = Math.min(min, col[i][j - 1] + dp(i, j - 1, rem - 1));    if (i <= n - 2)     min = Math.min(min, row[i][j] + dp(i + 1, j, rem - 1));    if (i > 0)     min = Math.min(min, row[i - 1][j] + dp(i - 1, j, rem - 1));    return memo[rem][i][j] = min;   }  }  static class Scanner {   StringTokenizer st;   BufferedReader br;   public Scanner(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }   public String next() {    try {     while (st == null || !st.hasMoreTokens())      st = new StringTokenizer(br.readLine());     return st.nextToken();    } catch (Exception e) {     throw new RuntimeException(e);    }   }   public int nextInt() {    return Integer.parseInt(next());   }  } }
1	public class Ideone { static int check(int temp) {  int count1 = 0;  while (temp>0)  {   if(temp % 2 != 0)   count1++;   temp/= 2;  }  return count1; } 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); } }
3	public class codea{ public static void main(String args[]) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  int arr[] = new int[n];  for(int i =0;i<n;i++)  arr[i]= in.nextInt();  Arrays.sort(arr);  int max =0;  boolean check[]= new boolean [n];  int count=0;  for(int i =0;i<n;i++)  {    if(!check[i])  {   count++;    for(int j=i;j<n;j++)  {    if(arr[j]%arr[i]==0)   check[j]=true;  }    }  }  System.out.println(count);  } }
1	public class Main { int work(int x){  if(x%2==0)return x+1;  else return x-1; } static int N = 200050; class Node implements Comparable <Node>{  int x, id;  Node(int x, int id){  this.x = x; this.id = id;  }  public int compareTo(Node o){  return Integer.compare(x, o.x);  }  public String toString(){  return id + "=" + x;  } } class Edge{  int from, to, nex;  Edge (int from, int to, int nex){  this.from = from;  this.to = to;  this.nex = nex;  } } Edge[] edge = new Edge[N*10]; int[] head = new int[N]; int edgenum;  void addedge(int u, int v){   Edge E = new Edge(u, v, head[u]);   edge[edgenum] = E;   head[u] = edgenum ++;  }   int n; int[] p = new int[N], ans = new int[N]; int a, b, max;  Map<Integer, Integer> map = new HashMap();  boolean match(int x, int y, int col){  int P = map.get(x);  if(map.containsKey(y-x) == false)   return false;  int Q = map.get(y - x);  if(ans[Q] == -1 || x * 2 == y){   ans[Q] = ans[P] = col;  }  else {   if(match(a+b-2*y+x, y, col))   ans[Q] = ans[P] = col;    else return false;  }  return true;  }  boolean solve(){  if(max >= a && max >= b)return false;  for(int i = 1; i <= n; i++)   if(ans[i] == -1)   {   if(match(p[i], a, 0)==false && match(p[i], b, 1) == false)    return false;   }    return true;  } void init(){  n = cin.nextInt();  a = cin.nextInt(); b = cin.nextInt();  max = 0;  for(int i = 1; i <= n; i++){  ans[i] = -1;  p[i] = cin.nextInt();  map.put(p[i], i);  if(p[i] > max) max = p[i];  } } public void work(){  init();  if(solve()){  out.println("YES");  for(int i = 1; i <= n; i++)out.print(ans[i]+" "); out.println();  }  else   out.println("NO"); } Main() {   cin = new Scanner(System.in);   out = new PrintWriter(System.out);  }  public static void main(String[] args) {   Main e = new Main();   e.work();   out.close();  }  public Scanner cin;  public static PrintWriter out; }
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 A {  void run(){   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[] a = new int[n];   boolean dif = false;   for(int i=0;i<n;i++)a[i]=sc.nextInt();   Arrays.sort(a);   if(n==1){    System.out.println(a[0]==1?2:1);return;   }   int[] m = new int[n];   for(int i=1;i<n;i++)if(a[i]!=a[i-1])dif=true;   m[0] = 1;   for(int i=1;i<n;i++)m[i]=a[i-1];   if(!dif&&a[0]==1)m[n-1]++;     for(int i=0;i<n;i++)System.out.print(m[i]+(i==n-1?"\n":" "));  }   public static void main(String[] args) {   new A().run();  } }
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); } }
1	public class C{  static PrintWriter out;  static InputReader in;  public static void main(String args[]){   out = new PrintWriter(System.out);   in = new InputReader();   new C();   out.flush(); out.close();  }   C(){   int a = solve();   out.print(a == 0 ? "tokitsukaze" : a == 1 ? "quailty" : "once again");  }  int n, k;  char ch[]; int a[], c0 = 0, c1 = 0;  TreeSet<Integer> ts[] = new TreeSet[2];  boolean check(){   int min = 0, max = n;   if(!ts[0].isEmpty()){    min = ts[0].first(); max = ts[0].last();    if(max - min + 1 > k)return true;   }   if(!ts[1].isEmpty()){    min = ts[1].first(); max = ts[1].last();    if(max - min + 1 > k)return true;    }   return false;  }  int solve(){   n = in.nextInt(); k = in.nextInt();   ch = in.next().trim().toCharArray(); a = new int[n];   for(int i = 0; i < n; i++)c1 += a[i] = ch[i] - '0';   c0 = n - c1;   for(int i = 0; i < k; i++){    if(a[i] == 0)c0--; else c1--;   }   if(c0 == 0 || c1 == 0)return 0;   for(int i = k; i < n; i++){    if(a[i] == 0)c0--; else c1--;    if(a[i - k] == 0)c0++; else c1++;    if(c0 == 0 || c1 == 0)return 0;   }   for(int i = 0; i < 2; i++)ts[i] = new TreeSet<>();   for(int i = 0; i < n; i++){    ts[a[i]].add(i);   }   for(int i = 0; i < k; i++){    ts[a[i]].remove(i);   }   if(check())return 2;   for(int i = k; i < n; i++){    ts[a[i]].remove(i); ts[a[i - k]].add(i - k);    if(check())return 2;   }   return 1;  }  public static class InputReader{   BufferedReader br;   StringTokenizer st;   InputReader(){    br = new BufferedReader(new InputStreamReader(System.in));   }   public int nextInt(){    return Integer.parseInt(next());   }   public long nextLong(){    return Long.parseLong(next());   }   public double nextDouble(){    return Double.parseDouble(next());   }   public String next(){    while(st == null || !st.hasMoreTokens()){     try{      st = new StringTokenizer(br.readLine());     }catch(IOException e){}    }    return st.nextToken();   }  } }
2	public class Main {  public static void main(String[] args) throws Exception {   new Solver().run(1);  } } class Solver {  private BufferedReader reader = null;  private StringTokenizer st = null;  private static final long MOD = (long)1e9 + 7;  private long x, k;  public void run(int inputType) throws Exception {   if (inputType == 0)    reader = new BufferedReader(new FileReader("input.txt"));   else    reader = new BufferedReader(new InputStreamReader(System.in));   st = new StringTokenizer(reader.readLine());   x = Long.parseLong(st.nextToken());   k = Long.parseLong(st.nextToken());   if (x == 0) {    System.out.println(0);    return;   }   long pow = binpow(2, k);   long m = (2 * x) % MOD;   m = (m - 1 < 0) ? MOD - 1 : m - 1;   m = (m * pow) % MOD;   m = (m + 1) % MOD;   System.out.println(m);   reader.close();  }  long binpow(long v, long p) {   long res = 1L;   while(p > 0) {    if ((p & 1) > 0)     res = (res * v) % MOD;    v = (v * v) % MOD;    p /= 2;   }   return res;  } }
1	public class Tsk1 {  static void metod() throws Exception {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   String s = in.next();   String ss = s + s;   int t = 0;   for (int i = 0; i < n; i++) {    if (s.charAt(i) == 'T') {     t++;    }   }   if (t == 1 || t == n - 1) {    System.out.println(0);   } else {    int sum = 0;    for (int i = 0; i < t; i++) {     if (s.charAt(i) == 'T') {      sum++;     }    }       int max = sum;    for (int i = 0; i < s.length(); i++) {     if (ss.charAt(i) == 'T') {      if (ss.charAt(i + t) == 'H') {       sum--;      }     } else {      if (ss.charAt(i + t) == 'T') {       sum++;       max = Math.max(max, sum);      }     }    }    System.out.println(t - max);   }  }  public static void main(String[] args) throws Exception {   Tsk1.metod();  } }
4	public class C { public static void main(String[] args) throws Exception {  final int fuck = 2001;  Scanner in = new Scanner(new File("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  int n = in.nextInt(), m = in.nextInt();  int[] D = new int[ fuck*fuck ],  dx = new int[] { 1, -1, 0, 0},  dy = new int[] { 0, 0, -1, 1};  Arrays.fill(D, -1);  ArrayDeque<Integer> Q = new ArrayDeque<>();  int k = in.nextInt(), ans = 0;  for(int i = 0; i < k; ++i) {  int x = in.nextInt(), y = in.nextInt();  D[ans = (x * fuck + y)] = 0;  Q.offer(ans);  }   while(!Q.isEmpty()) {  int idx = Q.poll();  int x = idx / fuck, y = idx % fuck;  for(int i = 0; i < 4; ++i) {   int wtf = (dx[i] + x) * fuck + (dy[i] + y);   if(dx[i] + x <= n && dx[i] + x >= 1 && dy[i] + y <= m && dy[i] + y >= 1 && D[wtf] == -1) {   D[wtf] = D[idx] + 1;   Q.offer(wtf);    if(D[wtf] >= D[ans])    ans = wtf;   }  }  }  out.println((ans / fuck) + " " + (ans % fuck));  out.close();  in.close(); } }
2	public class first { public static long power(long x, long y, long p)  {   long res = 1;   x = x % p;   while (y > 0)   { if((y & 1)==1)     res = (res * x) % p;    y = y >> 1;    x = (x * x) % p;   }   return res;  }  public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  long x=sc.nextLong();  long k=sc.nextLong();  long mod=1000000007;  if(k==0 || x==0)  System.out.println((2*x)%mod);  else  { long answer=1;  answer+=(power(2,k,mod))*(((2*x)-1)%mod);  System.out.println(answer%mod);  } } }
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.nextInt();    int[] a = in.readIntArray(n);    long count = 0;    for (int i = 1; i < n; i++) {     for (int j = 0; j < i; j++) {      if (a[j] > a[i]) count++;     }    }    boolean even = count % 2 == 0 ? true : false;    int m = in.nextInt();    for (int i = 0; i < m; i++) {     int left = in.nextInt();     int right = in.nextInt();     int diff = right - left;     if ((diff % 4 == 1) || (diff % 4 == 2)) {      even = !even;     }     if (even) {      out.println("even");     } else {      out.println("odd");     }    }   }  }  static class InputReader {   private static BufferedReader in;   private static 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 ques3 { public static void main(String[] args)throws Exception{ new ques3().run();}  long mod=1000000000+7;  void solve() throws Exception {  for(int ii=ni();ii>0;ii--)  {  int n=ni();    Stack<Integer> st=new Stack<Integer>();  int x=ni();    st.add(1);  out.println("1");  for(int i=2;i<=n;i++)  {   x=ni();   if(x==1)   {    st.add(1);    Stack<Integer> tep=(Stack<Integer>) st.clone();    display(tep);    continue;   }   int top=st.peek();   if(top+1==x)   {    st.pop();    st.add(x);    Stack<Integer> tep=(Stack<Integer>) st.clone();    display(tep);    continue;   }   while(true)   {    top=st.peek();    if(top+1==x)    {    st.pop();    st.add(x);    Stack<Integer> tep=(Stack<Integer>) st.clone();    display(tep);    break;    }    top=st.pop();   }  }  } }   void display(Stack<Integer> st) {  ArrayList<Integer> al = new ArrayList<>();  while(st.size()!=0)  {  int tem=st.pop();  al.add(tem);  }  Collections.reverse(al);  for (int i = 0; i <al.size()-1; i++) {  out.print(al.get(i)+".");  }  out.println(al.get(al.size()-1)); }    private byte[] buf=new byte[1024]; private int index; private InputStream in; private int total; private SpaceCharFilter filter; PrintWriter out;  int min(int... ar){int min=Integer.MAX_VALUE;for(int i:ar)min=Math.min(min, i);return min;} long min(long... ar){long min=Long.MAX_VALUE;for(long i:ar)min=Math.min(min, i);return min;} int max(int... ar) {int max=Integer.MIN_VALUE;for(int i:ar)max=Math.max(max, i);return max;} long max(long... ar) {long max=Long.MIN_VALUE;for(long i:ar)max=Math.max(max, i);return max;} void reverse(int a[]){for(int i=0;i<a.length>>1;i++){int tem=a[i];a[i]=a[a.length-1-i];a[a.length-1-i]=tem;}} void reverse(long a[]){for(int i=0;i<a.length>>1;i++){long tem=a[i];a[i]=a[a.length-1-i];a[a.length-1-i]=tem;}} String reverse(String s){StringBuilder sb=new StringBuilder(s);sb.reverse();return sb.toString();}  void shuffle(int a[]) {  ArrayList<Integer> al = new ArrayList<>();  for(int i=0;i<a.length;i++)   al.add(a[i]);   Collections.sort(al);  for(int i=0;i<a.length;i++)   a[i]=al.get(i); } long lcm(long a,long b) {  return (a*b)/(gcd(a,b)); }  int gcd(int a, int b)  {  if (a == 0)   return b;  return gcd(b%a, a);  }  long gcd(long a, long b)  {  if (a == 0)   return b;  return gcd(b%a, a);  }  long expo(long p,long q)  {  long z = 1;  while (q>0) {  if (q%2 == 1) {   z = (z * p)%mod;  }  p = (p*p)%mod;  q >>= 1;  }  return z; } void run()throws Exception {  in=System.in; out = new PrintWriter(System.out);  solve();  out.flush(); } private int scan()throws IOException {  if(total<0)  throw new InputMismatchException();  if(index>=total)  {  index=0;  total=in.read(buf);  if(total<=0)   return -1;  }  return buf[index++]; } private int ni() throws IOException  {  int c = scan();  while (isSpaceChar(c))  c = scan();  int sgn = 1;  if (c == '-') {  sgn = -1;  c = scan();  }  int res = 0;  do {  if (c < '0' || c > '9')   throw new InputMismatchException();  res *= 10;  res += c - '0';  c = scan();  } while (!isSpaceChar(c));  return res * sgn; } private long nl() throws IOException  {  long num = 0;  int b;  boolean minus = false;  while ((b = scan()) != -1 && !((b >= '0' && b <= '9') || b == '-'))  ;  if (b == '-') {  minus = true;  b = scan();  }   while (true) {  if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');  } else {   return minus ? -num : num;  }  b = scan();  } } private double nd() throws IOException{  return Double.parseDouble(ns()); } private String ns() throws IOException {  int c = scan();  while (isSpaceChar(c))  c = scan();  StringBuilder res = new StringBuilder();  do {  if (Character.isValidCodePoint(c))   res.appendCodePoint(c);  c = scan();  } while (!isSpaceChar(c));  return res.toString(); } private String nss() throws IOException {  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  return br.readLine(); } private char nc() throws IOException  {  int c = scan();  while (isSpaceChar(c))  c = scan();  return (char) c; } private boolean isWhiteSpace(int n) {  if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)  return true;  return false; } private boolean isSpaceChar(int c) {  if (filter != null)  return filter.isSpaceChar(c);  return isWhiteSpace(c); } private interface SpaceCharFilter {  public boolean isSpaceChar(int ch); } }
4	public class incendio {  void dbg(Object...os) { System.err.println(Arrays.deepToString(os)); }  static StringTokenizer _stk; static BufferedReader input; static PrintWriter output;  static String next(){return _stk.nextToken();} static int nextInt(){return Integer.parseInt(next());}  static String readln()throws IOException {String l=input.readLine();_stk=l==null?null:new StringTokenizer(l," ");return l;}  public static void main(String[] args) throws IOException {   input = new BufferedReader(new FileReader("input.txt"));   output = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));   new incendio();   output.close();  }    incendio() throws IOException {   readln();   M = nextInt(); N = nextInt();   readln();   final int K = nextInt();   int xf[]=new int[K], yf[]=new int[K];   readln();   for(int i=0; i<K; i++) {    xf[i]=nextInt();    yf[i]=nextInt();   }     int best=-1, xbest=0, ybest=0;   for(int i=1; i<=M; i++) {    for(int j=1; j<=N; j++) {     int dist=Integer.MAX_VALUE;     for(int k=0; k<K; k++) {      dist = Math.min(dist, Math.abs(i-xf[k])+Math.abs(j-yf[k]));     }     if(dist>best) {      best=dist;      xbest=i;      ybest=j;     }    }   }   output.println(xbest+" "+ybest);  }   int M, N; }
5	public class A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   int n = sc.nextInt();   int a = sc.nextInt();   int b = sc.nextInt();   int[] h = new int[n];   for (int i = 0; i < n; i++)    h[i] = sc.nextInt();   Arrays.sort(h);     pw.print(h[b]-h[b-1]);   pw.close();  } }
6	public class SimpleCycle {  int first(int x){  return x - (x & (x - 1)); }  void run(){  int N = nextInt(), M = nextInt();  int[] graph = new int[N];  for(int i = 0; i < M; i++){  int a = nextInt() - 1, b = nextInt() - 1;  graph[a] |= (1<<b);  graph[b] |= (1<<a);  }  int[] bitcount = new int[1<<N];  for(int i = 0; i < (1<<N); i++){  bitcount[i] = bitcount[i>>1];  if(i % 2 == 1) bitcount[i]++;  }  long[][] dp = new long[1<<N][N];  for(long[] f : dp) Arrays.fill(f, 0);  long ans = 0;  for(int mask = 1; mask < (1<<N); mask++){  for(int i = 0; i < N; i++)if((mask & (1<<i)) > 0){   if(bitcount[mask] == 1) dp[mask][i] = 1;   else{   if(first(mask) != (1<<i)){    for(int j = 0; j < N; j++)if((graph[i] & (1<<j)) > 0 && (mask & (1<<j)) > 0){    dp[mask][i] += dp[mask - (1<<i)][j];    }   }   }   if(bitcount[mask] >= 3 && (graph[i] & first(mask)) > 0) ans += dp[mask][i];  }  }  System.out.println(ans / 2);  }  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;   }  }  double nextDouble(){   return Double.parseDouble(next());  }  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;   }  }  String nextLine(){   try{    StringBuilder res = new StringBuilder("");    int c = System.in.read();    while(c == '\r' || c == '\n')     c = System.in.read();    do{     res.append((char)c);     c = System.in.read();    }while(c != '\r' && c != '\n');    return res.toString();   }catch(Exception e){    return null;   }  }  public static void main(String[] args){   new SimpleCycle().run();  } }
2	public class Main { public static void main(String args[]) throws IOException  {  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   String S[]=br.readLine().split(" ");  int N=Integer.parseInt(S[0]);  int x=Integer.parseInt(S[1]);  int y=Integer.parseInt(S[2]);  int c=Integer.parseInt(S[3]);  int lo=0;   int hi=1000000000;  while(hi-lo>=10)  {  int steps=(hi+lo)/2;    long total=f(x,y,steps)+f(N-x+1,y,steps)+f(N-x+1,N-y+1,steps)+f(x,N-y+1,steps);    total-=3;    total-=Math.min(steps,x-1);    total-=Math.min(steps,y-1);    total-=Math.min(steps,N-x);    total-=Math.min(steps,N-y);      if(total>=c)   hi=steps+1;  else   lo=steps-1;  }  for(int steps=lo;steps<=hi;steps++)  {    long total=f(x,y,steps)+f(N-x+1,y,steps)+f(N-x+1,N-y+1,steps)+f(x,N-y+1,steps);  total-=3;    total-=Math.min(steps,x-1);    total-=Math.min(steps,y-1);    total-=Math.min(steps,N-x);    total-=Math.min(steps,N-y);      if(total>=c)   {   System.out.println(steps);   return;   }  }  } public static long f(long a, long b, long steps)  {   steps++;  long A=Math.min(a,b);  long B=Math.max(a,b);  long ans=0;  if(steps>=(A+B))  {    ans= A*B;  }  else if(steps<=A)  {    ans= (steps*(steps+1))/2;  }  else if(steps>A&&steps<=B)  {    ans= (A*(A+1))/2+(steps-A)*A;  }  else if(steps>B)  {    ans= (A*(A+1))/2+(B-A)*A+(steps-B)*A-((steps-B)*(steps-B+1))/2;  }   return ans;  } }
6	public class Main implements Runnable { private void solution() throws IOException {  int n = in.nextInt();  int m = in.nextInt();  boolean[][] adj = new boolean[n][n];  long res = 0;  for (int i = 0; i < m; ++i) {  int x = in.nextInt();  int y = in.nextInt();  adj[x - 1][y - 1] = true;  adj[y - 1][x - 1] = true;  }  final long[][] dp = new long[1 << n][n];  for (int i = 0; i < n; ++i) {  for (int mask = 0; mask < (1 << (n - i)); ++mask) {   for (int j = 0; j < n - i; ++j) {   dp[mask][j] = 0;   }  }  dp[0][0] = 1;  for (int mask = 0; mask < (1 << (n - i)); ++mask) {   for (int j = 0; j < n - i; ++j) {   if (dp[mask][j] != 0) {    long am = dp[mask][j];    for (int k = 0; k < n - i; ++k) {    if (((mask >> k) & 1) == 0 && adj[j + i][k + i]) {     dp[mask | (1 << k)][k] += am;    }    }   }   }   if (((mask >> 0) & 1) != 0) {   res += dp[mask][0];   }  }  }  out.println((res - m) / 2); }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  private class Scanner {  BufferedReader reader;  StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  public boolean hasNext() throws IOException {  while (!tokenizer.hasMoreTokens()) {   String next = reader.readLine();   if (next == null) {   return false;   }   tokenizer = new StringTokenizer(next);  }  return true;  }  public String next() throws IOException {  hasNext();  return tokenizer.nextToken();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
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));   }  } }
6	public class Main2 {  static long mod = 998244353;  static FastScanner scanner;  static StringBuilder result = new StringBuilder();  public static void main(String[] args) {   scanner = new FastScanner();   int t = scanner.nextInt();   for (int i = 0; i < t; i++) {    solve();    result.append("\n");   }   System.out.print(result.toString());  }   static void solve() {   int n = scanner.nextInt();   int m = scanner.nextInt();   PriorityQueue<WithIdx2> queue = new PriorityQueue<>();   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     queue.add(new WithIdx2(scanner.nextInt(), i, j));    }   }   if (n <= 3) {    int res = 0;    for (int k = 0; k < n; k++) {     res += queue.poll().val;    }    result.append(res);   } else {    List<WithIdx2> a = new ArrayList<>();    for (int i = 0; i < 9; i++) {     if (!queue.isEmpty()) a.add(queue.poll());    }    int[] offsets = new int[m];    best = -1;    Arrays.fill(offsets, -100);    put(0, a, offsets, new int[4]);    result.append(best);   }  }  static int best = -1;  static void put(int current, List<WithIdx2> vals, int[] offsets, int[] rows) {   if (current == vals.size()) {    for (int i = 0; i < rows.length; i++) if (rows[i] == 0) return;    int sum = IntStream.of(rows).sum();    best = Math.max(best, sum);    return;   }   for (int row = 0; row < 4; row++) {    if (rows[row] == 0) {     WithIdx2 c = vals.get(current);     if (offsets[c.y] == -100) {      rows[row] = c.val;      offsets[c.y] = row - c.x;      put(current + 1, vals, offsets, rows);      rows[row] = 0;      offsets[c.y] = -100;     } else {      int bind = c.x + offsets[c.y];      if (bind < 0) bind += 4;      if (bind >= 4) bind -= 4;      if (row == bind) {       rows[row] = c.val;       put(current + 1, vals, offsets, rows);       rows[row] = 0;      }     }    }   }   put(current + 1, vals, offsets, rows);  }  static class WithIdx2 implements Comparable<WithIdx2>{   int x, y, val;   public WithIdx2(int val, int x, int y) {    this.val = val;    this.x = x;    this.y = y;   }   @Override   public int compareTo(WithIdx2 o) {    return -Integer.compare(val, o.val);   }  }   static class WithIdx implements Comparable<WithIdx>{   int val, idx;   public WithIdx(int val, int idx) {    this.val = val;    this.idx = idx;   }   @Override   public int compareTo(WithIdx o) {    return Integer.compare(val, o.val);   }  }  public static class FastScanner {   BufferedReader br;   StringTokenizer st;   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();   }   String nextLine() {    try {     return br.readLine();    } catch (Exception e) {     e.printStackTrace();     throw new RuntimeException();    }   }   int nextInt() {    return Integer.parseInt(nextToken());   }   long nextLong() {    return Long.parseLong(nextToken());   }   double nextDouble() {    return Double.parseDouble(nextToken());   }   int[] nextIntArray(int n) {    int[] res = new int[n];    for (int i = 0; i < n; i++) res[i] = nextInt();    return res;   }   long[] nextLongArray(int n) {    long[] res = new long[n];    for (int i = 0; i < n; i++) res[i] = nextLong();    return res;   }   String[] nextStringArray(int n) {    String[] res = new String[n];    for (int i = 0; i < n; i++) res[i] = nextToken();    return res;   }  }  static class PrefixSums {   long[] sums;   public PrefixSums(long[] sums) {    this.sums = sums;   }   public long sum(int fromInclusive, int toExclusive) {    if (fromInclusive > toExclusive) throw new IllegalArgumentException("Wrong value");    return sums[toExclusive] - sums[fromInclusive];   }   public static PrefixSums of(int[] ar) {    long[] sums = new long[ar.length + 1];    for (int i = 1; i <= ar.length; i++) {     sums[i] = sums[i - 1] + ar[i - 1];    }    return new PrefixSums(sums);   }   public static PrefixSums of(long[] ar) {    long[] sums = new long[ar.length + 1];    for (int i = 1; i <= ar.length; i++) {     sums[i] = sums[i - 1] + ar[i - 1];    }    return new PrefixSums(sums);   }  }  static class ADUtils {   static void sort(int[] ar) {    Random rnd = ThreadLocalRandom.current();    for (int i = ar.length - 1; i > 0; i--)    {     int index = rnd.nextInt(i + 1);         int a = ar[index];     ar[index] = ar[i];     ar[i] = a;    }    Arrays.sort(ar);   }   static void reverse(int[] arr) {    int last = arr.length / 2;    for (int i = 0; i < last; i++) {     int tmp = arr[i];     arr[i] = arr[arr.length - 1 - i];     arr[arr.length - 1 - i] = tmp;    }   }   static void sort(long[] ar) {    Random rnd = ThreadLocalRandom.current();    for (int i = ar.length - 1; i > 0; i--)    {     int index = rnd.nextInt(i + 1);         long a = ar[index];     ar[index] = ar[i];     ar[i] = a;    }    Arrays.sort(ar);   }  }  static class MathUtils {   static long[] FIRST_PRIMES = {     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};   static long[] primes(int to) {    long[] all = new long[to + 1];    long[] primes = new long[to + 1];    all[1] = 1;    int primesLength = 0;    for (int i = 2; i <= to; i ++) {     if (all[i] == 0) {      primes[primesLength++] = i;      all[i] = i;     }     for (int j = 0; j < primesLength && i * primes[j] <= to && all[i] >= primes[j]; j++) {      all[(int) (i * primes[j])] = primes[j];     }    }    return Arrays.copyOf(primes, primesLength);   }   static long modpow(long b, long e, long m) {    long result = 1;    while (e > 0) {     if ((e & 1) == 1) {           result = (result * b) % m;     }     b = (b * b) % m;     e >>= 1;    }    return result;   }   static long submod(long x, long y, long m) {    return (x - y + m) % m;   }  } }
1	public class Solution1 implements Runnable      {       static final long MAX = 1000000007L;       static class InputReader       {       private InputStream stream;       private byte[] buf = new byte[1024];       private int curChar;       private int numChars;       private SpaceCharFilter filter;       private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));              public InputReader(InputStream stream)       {        this.stream = stream;       }              public int read()       {        if (numChars==-1)         throw new InputMismatchException();               if (curChar >= numChars)        {        curChar = 0;        try         {         numChars = stream.read(buf);        }        catch (IOException e)        {         throw new InputMismatchException();        }                if(numChars <= 0)           return -1;        }        return buf[curChar++];       }              public String nextLine()       {        String str = "";         try         {          str = br.readLine();         }         catch (IOException e)         {          e.printStackTrace();         }         return str;       }       public int nextInt()       {        int c = read();               while(isSpaceChar(c))         c = read();               int sgn = 1;               if (c == '-')        {        sgn = -1;        c = read();        }               int res = 0;        do        {        if(c<'0'||c>'9')         throw new InputMismatchException();        res *= 10;        res += c - '0';        c = read();        }        while (!isSpaceChar(c));                return res * sgn;       }              public long nextLong()        {        int c = read();        while (isSpaceChar(c))        c = read();        int sgn = 1;        if (c == '-')        {        sgn = -1;        c = read();        }        long res = 0;               do        {        if (c < '0' || c > '9')         throw new InputMismatchException();        res *= 10;        res += c - '0';        c = read();        }        while (!isSpaceChar(c));        return res * sgn;       }              public double nextDouble()        {        int c = read();        while (isSpaceChar(c))        c = read();        int sgn = 1;        if (c == '-')        {        sgn = -1;        c = read();        }        double res = 0;        while (!isSpaceChar(c) && c != '.')        {        if (c == 'e' || c == 'E')         return res * Math.pow(10, nextInt());        if (c < '0' || c > '9')         throw new InputMismatchException();        res *= 10;        res += c - '0';        c = read();        }        if (c == '.')        {        c = read();        double m = 1;        while (!isSpaceChar(c))         {         if (c == 'e' || c == 'E')         return res * Math.pow(10, nextInt());         if (c < '0' || c > '9')         throw new InputMismatchException();         m /= 10;         res += (c - '0') * m;         c = read();        }        }        return res * sgn;       }              public String readString()        {        int c = read();        while (isSpaceChar(c))        c = read();        StringBuilder res = new StringBuilder();        do        {        res.appendCodePoint(c);        c = read();        }        while (!isSpaceChar(c));               return res.toString();       }              public boolean isSpaceChar(int c)        {        if (filter != null)        return filter.isSpaceChar(c);        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;       }              public String next()        {        return readString();       }              public interface SpaceCharFilter        {        public boolean isSpaceChar(int ch);       }       }              public static void main(String args[]) throws Exception       {       new Thread(null, new Solution1(),"Solution1",1<<26).start();       }       long gcd(long a, long b)       {        if (a == 0)         return b;                 return gcd(b%a, a);       }              long lcm(long a, long b)        {         return (a*b)/gcd(a, b);        }       int root(int a){        while(arr[a] != a){        arr[a] = arr[arr[a]];        a = arr[a];        }        return a;       }       void union(int a,int b){        int xroot = root(a);        int yroot = root(b);        if(arr[xroot] < arr[yroot]){        arr[xroot] = yroot;        }else{        arr[yroot] = xroot;        }       }       boolean find(int a,int b){        int roota = root(a);        int rootb = root(b);        if(roota == rootb){        return true;        }else{        return false;        }       }       int[] arr;       final int level = 20;              public void run()       {       InputReader sc= new InputReader(System.in);       PrintWriter w= new PrintWriter(System.out);       int n = sc.nextInt();       char[] ch = new char[n];       char[] ch2 = new char[n];       ch = sc.next().toCharArray();       ch2 = sc.next().toCharArray();       HashSet<Integer> hset[] = new HashSet[26];       for(int i = 0;i < 26;i++){        hset[i] =new HashSet();       }       int count = 0;       for(int i = 0;i < ch.length;i++){        if(ch[i] != ch2[i]){        hset[ch[i]-97].add(ch2[i]-97);        count++;        }       }       boolean flag = false;       int swap1 = -1;       int swap2 = -1;       int rem = -1;       for(int i = 0;i < ch.length;i++){        if(ch[i] != ch2[i]){        if(hset[ch2[i]-97].size() != 0){         swap1 = i;         flag = true;         if(hset[ch2[i]-97].contains(ch[i]-97)){         rem = i;         count-=2;         flag = false;         break;         }        }        }       }       if(flag){        count--;        w.println(count);        for(int i = 0;i < n;i++){        if(i != swap1 && ch[i] == ch2[swap1] && ch[i] != ch2[i]){         w.println((swap1+1) + " " + (i+1));         w.close();         System.exit(0);        }        }       }else{        if(rem == -1){        w.println(count);        w.println("-1 -1");        }else{        w.println(count);        for(int i = 0;i < n;i++){         if(i != rem && ch[i] == ch2[rem] && ch[rem] == ch2[i] && ch[i] != ch2[i]){         w.println((rem+1) + " " + (i+1));         w.close();         System.exit(0);         }        }        }       }       w.close();       }       boolean fun(long[] prefix,long mid,long temp,long[] arr){       if(temp >= prefix[(int)mid]){        return true;       }       return false;       }       static class Pair implements Comparable<Pair>{       int x;       int y;              Pair(){}        Pair(int x,int y){        this.x = x;        this.y = y;                      }       public int compareTo(Pair p){               return Long.compare(this.x,p.x);       }       }     }
5	public class Main implements Runnable {   boolean TEST = System.getProperty("ONLINE_JUDGE") == null;   void solve() throws IOException {  int n = nextInt();  Pair[] ps = new Pair[n];  for (int i = 0; i < n; i++) {   ps[i] = new Pair(nextInt(), i + 1);  }  sort(ps, new Comparator<Pair>() {   public int compare(Pair a, Pair b) {   return a.x - b.x;   }  });  BigInteger res = find(ps, n);  for (int i = 0; i * 2 < n; i++) {   Pair t = ps[i];   ps[i] = ps[n - i - 1];   ps[n - i - 1] = t;  }  res = res.add(find(ps, n));  out.println(res);  }   BigInteger find(Pair[] ps, int n) {  BigInteger res = ZERO;  int i = 0;  FenwickTree ft = new FenwickTree(n + 1);  boolean[] added = new boolean[n + 1];  for (int j = 0; j < n; j++) {   if (abs(ps[j].x - ps[i].x) <= 1) continue;   while (abs(ps[j].x - ps[i].x) > 1) {   if (!added[ps[i].i]) ft.add(ps[i].i, 1);   added[ps[i].i] = true;   i++;   }   i--;   long total = ft.sum(n);   long left = ft.sum(ps[j].i - 1);   long right = total - left;   res = res.add(valueOf(ps[j].x).multiply(valueOf(left)));   res = res.add(valueOf(-ps[j].x).multiply(valueOf(right)));  }  return res;  }   class Pair implements Comparable<Pair> {  int x, i;    Pair(int x, int i) {   this.x = x;   this.i = i;  }    public int compareTo(Pair p) {   return x - p.x;  }    public String toString() {   return "(" + x + ", " + i + ")";  }  }   class FenwickTree {  int n;  int[] tree;     public FenwickTree(int n) {   this.n = n;   tree = new int[n];  }     public int sum(int id) {   int res = 0;   while (id > 0) {   res += tree[id];   id -= id & -id;   }   return res;  }     public void add(int id, int v) {   while (id < n) {   tree[id] += v;   id += id & -id;   }  }   int findkth(int k) {   int low = 1, high = n;   while (low < high) {   int mid = (low + high) / 2;   int val = sum(mid);   if(val < k) low = mid + 1;   else high = mid;   }   return low;  }  }    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());  }   long nextLong() throws IOException {   return Long.parseLong(next());  }   double nextDouble() throws IOException {   return Double.parseDouble(next());  }   void debug(Object... o) {   System.out.println(deepToString(o));  }   void gcj(Object o) {   String s = String.valueOf(o);   out.println("Case #" + test + ": " + s);   System.out.println("Case #" + test + ": " + s);  }   BufferedReader input;  PrintWriter out;  StringTokenizer st;  int test;   void init() throws IOException {   if (TEST) input = new BufferedReader(new FileReader("input.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 Main(), "", 1 << 20).start();  }   public void run() {   try {    init();    if (TEST) {     int runs = nextInt();     for(int i = 0; i < runs; i++) solve();    } else solve();    out.close();     } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  } }
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;  }  public String readLine() {   try {    return super.readLine();   } catch (IOException e) {    return null;   }  }  } class FastPrinter extends PrintWriter {  public FastPrinter(OutputStream out) {   super(out);  }  public FastPrinter(Writer out) {   super(out);  }  }
1	public class Solution{  public static void main(String[] args)throws IOException{   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int t = Integer.parseInt(br.readLine());   StringTokenizer st;   for(int z=0;z<t;z++){    st = new StringTokenizer(br.readLine());    int n = Integer.parseInt(st.nextToken());    st = new StringTokenizer(br.readLine());    int min=1;    int max=1;    for(int i=0;i<n;i++){     int k = Integer.parseInt(st.nextToken());     if(max<k){      min = max;      max = k;     }else if(min<k){      min = k;     }    }    int res = Math.min(n-2,min-1);    System.out.println(res);   }  } }
5	public class main {   static Scanner in; static int next() throws Exception {return in.nextInt();};     static PrintWriter out;  public static void main(String[] args) throws Exception {   in = new Scanner(System.in);    out = new PrintWriter(System.out);   int n = next();   int a = next();   int b = next();   int k = 0;   int i;   int[] ar = new int[n];   for(i=0;i<n;i++)    ar[i]=next();   Arrays.sort(ar);   k = ar[n-a]-ar[b-1];   if(k<0)    out.print(0);   else out.print(k);   out.close();  } }
0	public class D5 {  static int a, v, l, d; static double w;  static double afterMark( int s, double w) {  if (2 * s * a > v * v - w * w) {   return (v - w) * 1.0 / a + (s - (v * v - w * w) * 1.0 / (2 * a)) / v;  } else {   double megav = Math.sqrt((2 * a * s + w * w) * 1.0);  return (megav - w) / a;  } }  public static void main(String args[]) throws IOException {  boolean online = System.getProperty("ONLINE_JUDGE") != null;  Scanner in = online ? new Scanner(System.in) : new Scanner(new FileReader("input.txt"));  PrintWriter out = online ? new PrintWriter(System.out) : new PrintWriter(new FileWriter("output.txt"));    a = in.nextInt();  v = in.nextInt();  l = in.nextInt();  d = in.nextInt();  w = (double) in.nextInt();   double t,t1,t2;  if (v > w) {         if (2 * d * a > 2 * v * v - w * w) {   t1 = (2 * v - w) * 1.0 / a + (d - (2 * v * v - w * w) * 1.0 / (2 * a)) / v;   } else if (2 * d * a > w * w) {   double topv = Math.sqrt(d * a + w * w * 1.0 / 2);   t1 = (2 * topv - w) * 1.0 / a;  } else {   t1 = Math.sqrt(2 * d * 1.0 / a);   w = Math.sqrt(2 * a * d * 1.0);   }    t2 = afterMark(l - d, w);    t = t1 + t2;    } else {  t = afterMark(l, 0.0);   }   out.println(t);  out.flush();  return; } }
1	public class B1 {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int testCount = in.nextInt();   for (int test = 0; test < testCount; test++) {    String src = in.next();    if (src.matches("^R\\d+C\\d+$")) {     Pattern p = Pattern.compile("\\d+");     Matcher m = p.matcher(src);     m.find();     int r = Integer.parseInt(m.group(0));     m.find();     int c = Integer.parseInt(m.group(0));     System.out.println(toBase26(c) + r);    } else {     Pattern p = Pattern.compile("[A-Z]+");     Matcher m = p.matcher(src);     m.find();     String c = m.group(0);     p = Pattern.compile("\\d+");     m = p.matcher(src);     m.find();     int r = Integer.parseInt(m.group(0));     System.out.println("R" + r + "C" + toBase10(c));    }   }  }  private static String toBase26(int n) {   String res = "";   do {    n -= 1;    res = (char)('A' + (n % 26)) + res;    n /= 26;      } while (n > 0);   return res;  }  private static int toBase10(String x) {   int n = 0;   char[] digits = x.toCharArray();   for (int i = 0; i < digits.length; i++) {    n *= 26;    n += digits[i] - 'A' + 1;   }   return n;  } }
1	public class Main { public static void main(String args[]) throws IOException {  Scanner sc = new Scanner(System.in);     int n = sc.nextInt(), k = sc.nextInt(), kol = 0, prev;     boolean ok;     ArrayList<Integer> al = new ArrayList<Integer>();     al.add(2);     prev = 2;     for(int i=3;i<=n;i+=2)     {     ok = true;     for(Integer x: al)      if (i%x == 0)     {      ok = false;      break;     }     if (ok)      {      for(Integer x: al)      if (ok)      {      prev = x;       ok = false;      } else      {      if (x + prev + 1 == i)       {       kol++;       break;      }      if (x + prev + 1 > i) break;      prev = x;      }      al.add(i);     }     }     if (kol >= k) System.out.print("YES"); else System.out.print("NO"); } }
1	public class A {  public static void main(String[] args) {  new A().run(); }  private void run() {  Scanner sc =new Scanner(System.in);  int n = sc.nextInt();  int k = sc.nextInt();  sc.close();  boolean[] isp = new boolean[n + 1];  Arrays.fill(isp, true);  isp[1] = false;  int[] primes = new int[n];  int pc = 0;  for (int i = 2; i <= n; i++) {  if (isp[i]) {   primes[pc++] = i;   for (int j = i * i; j <= n; j+= i) {   isp[j] = false;   }  }  }  int res = 0;  for (int i = 0; i < pc; i++) {  for (int j = 1; j < i; j++)     if (primes[i] == primes[j] + primes[j - 1] + 1)    res++;  }  System.out.println(res >= k ? "YES" : "NO"); } }
3	public class Main { PrintWriter out = new PrintWriter(System.out); BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer tok = new StringTokenizer("");  String next() throws IOException {   if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }   return tok.nextToken();  }  int ni() throws IOException { return Integer.parseInt(next()); }  long nl() throws IOException { return Long.parseLong(next()); }   void solve() throws IOException {   int n=ni();   int[]A=new int[n];   for (int x=0;x<n;x++) A[x]=ni();   Arrays.sort(A);   ArrayList<Integer>B=new ArrayList();   B.add(A[0]);   int ans=1;     Outer:   for (int x=1;x<n;x++) {    for (int y=0;y<B.size();y++) {     if (A[x]%B.get(y)==0) continue Outer;    }    ans++;    B.add(A[x]);   }   System.out.println(ans);     }   public static void main(String[] args) throws IOException {   new Main().solve();  } }
5	public class A {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  void solve() throws IOException {   int n = nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = nextInt();     Arrays.sort(a);     int sum = 0;   for (int i = 0; i < n; i++)    sum += a[i];     int cur = 0;   for (int i = n - 1; i >= 0; i--) {    cur += a[i];    if (cur > sum - cur) {     out.println(n - i);     return;    }   }  }  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 A().inp();  }  String nextToken() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return "0";    }   }   return st.nextToken();  }  String nextString() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return "0";    }   }   return st.nextToken("\n");  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
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+" ");  }     } }
1	public class C {  public static void main(String[] arg) throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.valueOf(in.readLine());  char[] s = in.readLine().toCharArray();  int i = 0, j = 0;  int[] ct = new int[256];  Set<Character> all = new HashSet<>();  for (char c : s) {  all.add(c);  }  int total = 0, res = Integer.MAX_VALUE;  while (j < s.length) {  while (total < all.size() && j < s.length) {   if (ct[s[j]] == 0) {   total++;   }   ct[s[j]]++;   j++;  }  res = Math.min(res, j - i);  while (total == all.size() && i < s.length) {   ct[s[i]]--;   if (ct[s[i]] == 0) {   total--;   }   i++;   if (total == all.size()) {   res = Math.min(res, j - i);   }  }  }  System.out.println(res); } }
3	public class ProblemC { static long MOD = 1_000_000_007;  public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int n = input.nextInt();  boolean[] isFor = new boolean[n];  for (int a = 0; a < n; a++) {  isFor[a] = input.next().charAt(0) == 'f';  }  long[][] array = new long[n + 1][n + 1];  array[0][0] = 1;  boolean isPreviousFor = false;  for (int idx = 0; idx < n; idx++) {  long heightCache = 0;  for (int height = n-1; height >= 0; height--) {   if (isPreviousFor) {   array[idx + 1][height + 1] += array[idx][height];   array[idx + 1][height + 1] %= MOD;   } else {   heightCache += array[idx][height];   heightCache %= MOD;   array[idx + 1][height] += heightCache;   array[idx + 1][height] %= MOD;   }  }  isPreviousFor = isFor[idx];  }  long sum = 0;  for (int height = 0; height <= n; height++) {  sum += array[n][height];  }  System.out.println(sum % MOD); } }
4	public class Problem {  public static Pair solve(Forest f, List<Pair> queue){  Pair current = null, next = null;  int index = 0;  while(queue.size() > 0){  current = queue.remove(0);  index = f.desk[current.x][current.y];   if(current.x>0){   next = new Pair(current.x-1,current.y);   if(f.desk[next.x][next.y]==0){    f.desk[next.x][next.y] = index+1;    queue.add(next);   }   }   if(current.x<f.N-1){   next = new Pair(current.x+1,current.y);   if(f.desk[next.x][next.y]==0){    f.desk[next.x][next.y] = index+1;    queue.add(next);   }   }   if(current.y>0){   next = new Pair(current.x,current.y-1);   if(f.desk[next.x][next.y]==0){    f.desk[next.x][next.y] = index+1;    queue.add(next);   }   }   if(current.y<f.M-1){   next = new Pair(current.x,current.y+1);   if(f.desk[next.x][next.y]==0){    f.desk[next.x][next.y] = index+1;    queue.add(next);   }   }  }  return f.findMax(); }  public static void main(String[] args){  String buffer = null;  StringTokenizer st = null;  Forest f = null;  List<Pair> pairs = new LinkedList<Pair>();  Integer N,M,K,x,y;  try {  BufferedReader in = new BufferedReader(    new FileReader("input.txt")    );  FileWriter out = new FileWriter("output.txt");  buffer = in.readLine();  st = new StringTokenizer(buffer);  N = new Integer(st.nextToken());  M = new Integer(st.nextToken());  f = new Forest(N,M);  buffer = in.readLine();  st = new StringTokenizer(buffer);  K = new Integer(st.nextToken());  buffer = in.readLine();  st = new StringTokenizer(buffer);  for(int i = 0; i<K; i++){   x = new Integer(st.nextToken());   y = new Integer(st.nextToken());   f.desk[x-1][y-1] = 1;   pairs.add(new Pair(x-1,y-1));  }  Pair res = solve(f,pairs);    out.write(res.toString());  out.flush();  } catch (Exception e) {  } } } class Pair { public Pair(int i, int j){  x = i;  y = j; } public String toString(){  return (x+1) + " " + (y+1); } public int x; public int y; } class Forest { public Forest(int n, int m){  N = n;  M = m;  desk = new int[N][M]; }  public Pair findMax(){  Pair max = new Pair(0,0);  for(int i = 0; i<N; i++){  for(int j = 0; j<M; j++){   if(desk[i][j]>desk[max.x][max.y]){   max.x = i;   max.y = j;   }  }  }  return max; }  public int N; public int M; public int[][] desk; }
5	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("");  private void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  int n = nextInt();  int m[] = new int[n];  for(int i = 0; i < n; i++)  m[i] = nextInt();  sort(m);  m[n - 1] = m[n - 1] != 1 ? 1 : 2;  sort(m);  for(int i = 0; i < n; i++){  if(i != 0) out.print(" ");  out.print(m[i]);  }  out.println();  in.close();  out.close(); }  void chk(boolean b) {  if (b)  return;  System.out.println(new Error().getStackTrace()[1]);  exit(999); } void deb(String fmt, Object... args) {  System.out.printf(Locale.US, fmt + "%n", args); } 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()); } String nextLine() throws IOException {  st = new StringTokenizer("");  return in.readLine(); } boolean EOF() throws IOException {  while (!st.hasMoreTokens()) {  String s = in.readLine();  if (s == null)   return true;  st = new StringTokenizer(s);  }  return false; } }
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); } }
6	public class Order implements Runnable { private Scanner in = new Scanner(System.in); private PrintWriter out = new PrintWriter(System.out); private int xs, ys, n; private int[] x, y;  public static void main(String[] args) {  new Thread(new Order()).start(); }  private void read() {  xs = in.nextInt();  ys = in.nextInt();  n = in.nextInt();  x = new int[n];  y = new int[n];  for (int i = 0; i < n; i++) {  x[i] = in.nextInt();  y[i] = in.nextInt();  } }  private void solve() {  int[] res = new int[1 << n];  int[] last = new int[1 << n];  Arrays.fill(res, Integer.MAX_VALUE);  int[] ds = new int[n];  for (int i = 0; i < n; i++) {  ds[i] = (x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys);  }  int[][] d = new int[n][n];  for (int i = 0; i < n; i++) {  for (int j = 0; j < n; j++)   d[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);  }  res[0] = 0;  for (int i = 1; i < (1 << n); i++) {  for (int j = 0; j < n; j++) {   if (((i >> j) & 1) != 0) {   if (res[i - (1 << j)] + 2 * ds[j] < res[i]) {    res[i] = res[i - (1 << j)] + 2 * ds[j];    last[i] = i - (1 << j);   }   for (int k = j + 1; k < n; k++) {    if (((i >> k) & 1) != 0) {    if (res[i - (1 << j) - (1 << k)] + ds[j] + ds[k] + d[j][k] < res[i]) {     res[i] = res[i - (1 << j) - (1 << k)] + ds[j] + ds[k] + d[j][k];     last[i] = i - (1 << j) - (1 << k);    }    }   }   break;   }  }  }  int cur = (1 << n) - 1;  out.println(res[cur]);  while (cur != 0) {  out.print("0 ");  int dif = cur - last[cur];  for (int i = 0; i < n && dif != 0; i++) {   if (((dif >> i) & 1) != 0) {   out.print((i + 1) + " ");   dif -= (1 << i);   }  }  cur = last[cur];  }  out.println("0"); }  private void write() { }  public void run() {  read();  solve();  write();  out.close(); } }
1	public class B { static Vector<Integer> primes;  public static void main(String[] args) throws IOException {  InputReader myScanner = new InputReader();  int n = myScanner.nextInt(), k = myScanner.nextInt();  myScanner.hasNext();  int all[] = new int[n];  boolean numbers[] = new boolean[100100];  int diff[] = new int[n];  all[0] = myScanner.nextInt();  diff[0] = 1;  numbers[all[0]] = true;  int r = -1;  if (k == 1)  r = 1;  for (int i = 1; i < all.length; i++) {  all[i] = myScanner.nextInt();  diff[i] = diff[i - 1];  if (!numbers[all[i]]) {   if (r == -1 && diff[i] + 1 == k)   r = i + 1;   numbers[all[i]] = true;   diff[i]++;  }  }  if (r == -1)  System.out.println(-1 + " " + -1);  else {  numbers = new boolean[100010];  int l = 0, cnt = 1;  numbers[all[r - 1]] = true;  if (k == 1)   System.out.println(1 + " " + 1);  else {   for (int i = r - 2; i >= 0; i--) {   if (!numbers[all[i]]) {    numbers[all[i]] = true;    cnt++;   }   if (cnt == k) {    l = i + 1;    break;   }   }   System.out.println(l + " " + r);  }  } }  static class InputReader {  BufferedReader buff;  StringTokenizer tok;  String cur;  public InputReader() throws IOException {  buff = new BufferedReader(new InputStreamReader(System.in));  tok = new StringTokenizer(cur = buff.readLine());  }  public boolean hasNext() throws IOException {  if (!tok.hasMoreElements()) {   cur = buff.readLine();   if (cur == null)   return false;   tok = new StringTokenizer(cur);  }  return true;  }  public String next() throws IOException {  while (!tok.hasMoreElements())   tok = new StringTokenizer(cur = buff.readLine());   return tok.nextToken();  }  public int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(next());  }  public long nextLong() throws NumberFormatException, IOException {  while (!tok.hasMoreElements())   tok = new StringTokenizer(cur = buff.readLine());   return Long.parseLong(next());  } } }
6	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int V = in.nextInt();   int E = in.nextInt();   boolean [][] G = new boolean [V][V];   for (int i = 0; i < E; i++) {    int u = in.nextInt()-1;    int v = in.nextInt()-1;    G[u][v] = true;    G[v][u] = true;   }     int pset = 1 << V;     long [][] dp = new long [pset][V];   long cycles = 0;     for (int set = 1; set < pset; set++) {    int bit = Integer.bitCount(set);    int src = first(set);       if (bit == 1) {     dp[set][src] = 1;    }    else if(bit > 1) {     for (int i = 0; i < V; i++) {      if(i == src) continue;           if ((set & (1 << i)) != 0) {       int S_1 = set ^ (1 << i);       for (int v = 0; v < V; v++) {        if (G[v][i] == true) {         dp[set][i] += dp[S_1][v];        }       }      }           if (bit >= 3 && G[src][i]) {       cycles += dp[set][i];      }      }        }              }   System.out.println(cycles/2);  }   public static int first(int n) {   int cnt = 0;   while ((n & 1) != 1) {    cnt++;    n >>= 1;   }   return cnt;  } }
2	public class B {  public static void main(String[] args) {  InputReader in = new InputReader();  int n = in.nextInt();  int k = in.nextInt();   long numCandies = 1;  int turns = 1, add = 2;  while (numCandies < k) {  ++turns;  numCandies += add++;  }  int res = 0;  if (numCandies > k) {  turns += (numCandies-k);  res += (numCandies-k);  numCandies = k;  }   if (turns == n) {  System.out.println(res);  }  else {  while (turns != n) {   res += add;   turns += add++ + 1;  }  System.out.println(res);  }   }  static class InputReader {  public BufferedReader br;  public StringTokenizer st;   public InputReader() {  br = new BufferedReader(new InputStreamReader(System.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());  } } }
3	public class Round584_a {   public static void main(String[] args) throws Exception {     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));     StringTokenizer st;     int n = Integer.parseInt(br.readLine());     st = new StringTokenizer(br.readLine());     int a[] = new int[n];     for(int i=0 ; i<n ; i++) {       a[i] = Integer.parseInt(st.nextToken());     }     Arrays.sort(a);     boolean vis[] = new boolean[n];     int count = 0;     for(int i=0 ; i<n ; i++) {       if(!vis[i]) {         for(int j=i ; j<n ; j++) {           if(!vis[j]) {             if(a[j]%a[i] == 0) {               vis[j] = true;             }           }         }         count++;       }     }     System.out.println(count);   } }
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 A {  static int[] UPPER = new int[64], LOWER = new int[64]; static long[][][] memo;  static long dp(int bit, int lims, int digs) {  if(bit == -1)  return digs == 0 ? 1 : 0;  if(memo[lims][bit][digs] != -1)  return memo[lims][bit][digs];  long ret = 0;  for(int d = 0, end = digs < 10 ? digs + 1 : 10; d < end; ++d)  if(((lims & 1) == 1 || d >= LOWER[bit]) && ((lims & 2) == 2 || d <= UPPER[bit]))   ret += dp(bit - 1, lims | (d > LOWER[bit] ? 1 : 0) | (d < UPPER[bit] ? 2 : 0), digs - d);  return memo[lims][bit][digs] = ret; }  static void create(int[] x, long n) {  for(int i = 0; i < 64; ++i)  {  x[i] = (int) (n % 10);  n /= 10;  } }  static void prepMemo(int sod) {  memo = new long[4][64][sod + 1];  for(long[][] x: memo)  for(long[] y: x)   Arrays.fill(y, -1); }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  long n = sc.nextLong(), s = sc.nextLong();  create(UPPER, n);  long ans = 0;  for(int sod = 1; sod <= 162; ++sod)  {  create(LOWER, s + sod);  prepMemo(sod);  ans += dp(63, 0, sod);  }     out.println(ans);  out.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(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 String nextLine() throws IOException {return br.readLine();}  public double nextDouble() throws IOException { return Double.parseDouble(next()); }  public boolean ready() throws IOException {return br.ready();}  } }
1	public class Main {  long b = 31;  String fileName = "";    int INF = Integer.MAX_VALUE / 10;  long MODULO = 1000*1000*100;  void solve() throws IOException {   int n = readInt();   int d = readInt();   int[] arr = readIntArray(n);   Arrays.sort(arr);   int ans = 2;   for (int i=0; i < n - 1; ++i){    int cur = arr[i] + d;    if (arr[i+1] - d == cur) ans++;    if (arr[i+1] - d > cur) ans +=2;   }   out.println(ans);  }  class Number implements Comparable<Number>{   int x, cost;   Number(int x, int cost){    this.x = x;    this.cost = cost;   }   @Override   public int compareTo(Number o) {    return Integer.compare(this.cost, o.cost);   }  }  class Point{   int x, y;   Point(int x, int y){    this.x = x;    this.y = y;   }  }  class Vertex implements Comparable<Vertex>{   int num, depth, e, c;   Vertex(int num, int depth, int e, int c){    this.num = num;    this.e = e;    this.depth = depth;    this.c = c;   }   @Override   public int compareTo(Vertex o) {    return Integer.compare(this.e, o.e);   }  }    class Edge{   int from, to, num;   Edge(int to, int num){    this.to = to;    this.num = num;   }  }  class SparseTable{   int[][] rmq;   int[] logTable;   int n;   SparseTable(int[] a){    n = a.length;    logTable = new int[n+1];    for(int i = 2; i <= n; ++i){     logTable[i] = logTable[i >> 1] + 1;    }    rmq = new int[logTable[n] + 1][n];    for(int i=0; i<n; ++i){     rmq[0][i] = a[i];    }    for(int k=1; (1 << k) < n; ++k){     for(int i=0; i + (1 << k) <= n; ++i){      int max1 = rmq[k - 1][i];      int max2 = rmq[k-1][i + (1 << (k-1))];      rmq[k][i] = Math.max(max1, max2);     }    }   }   int max(int l, int r){    int k = logTable[r - l];    int max1 = rmq[k][l];    int max2 = rmq[k][r - (1 << k) + 1];    return Math.max(max1, max2);   }  }  long checkBit(long mask, int bit){   return (mask >> bit) & 1;  }  class Dsu{   int[] parent;   int countSets;   Dsu(int n){    countSets = n;    parent = new int[n];    for(int i=0; i<n; ++i){     parent[i] = i;    }   }   int findSet(int a){    if(parent[a] == a) return a;    parent[a] = findSet(parent[a]);    return parent[a];   }   void unionSets(int a, int b){    a = findSet(a);    b = findSet(b);    if(a!=b){     countSets--;     parent[a] = b;    }   }  }  static int checkBit(int mask, int bit) {   return (mask >> bit) & 1;  }  boolean isLower(char c){   return c >= 'a' && c <= 'z';  }    class SegmentTree{   int[] t;   int n;   SegmentTree(int n){    t = new int[4*n];    build(new int[n+1], 1, 1, n);   }   void build (int a[], int v, int tl, int tr) {    if (tl == tr)     t[v] = a[tl];    else {     int tm = (tl + tr) / 2;     build (a, v*2, tl, tm);     build (a, v*2+1, tm+1, tr);    }   }   void update (int v, int tl, int tr, int l, int r, int add) {    if (l > r)     return;    if (l == tl && tr == r)     t[v] += add;    else {     int tm = (tl + tr) / 2;     update (v*2, tl, tm, l, Math.min(r,tm), add);     update (v*2+1, tm+1, tr, Math.max(l,tm+1), r, add);    }   }   int get (int v, int tl, int tr, int pos) {    if (tl == tr)     return t[v];    int tm = (tl + tr) / 2;    if (pos <= tm)     return t[v] + get (v*2, tl, tm, pos);    else     return t[v] + get (v*2+1, tm+1, tr, pos);   }  }  class Fenwik {   long[] t;   int length;   Fenwik(int[] a) {    length = a.length + 100;    t = new long[length];    for (int i = 0; i < a.length; ++i) {     inc(i, a[i]);    }   }   void inc(int ind, int delta) {    for (; ind < length; ind = ind | (ind + 1)) {     t[ind] = Math.max(delta, t[ind]);    }   }   long getMax(int r) {    long sum = 0;    for (; r >= 0; r = (r & (r + 1)) - 1) {     sum = Math.max(sum, t[r]);    }    return sum;   }  }  int gcd(int a, int b){   return b == 0 ? a : gcd(b, a%b);  }  long gcd(long a, long b){   return b == 0 ? a : gcd(b, a%b);  }  long binPow(long a, long b, long m) {   if (b == 0) {    return 1;   }   if (b % 2 == 1) {    return ((a % m) * (binPow(a, b - 1, m) % m)) % m;   } else {    long c = binPow(a, b / 2, m);    return (c * c) % m;   }  }  int minInt(int... values) {   int min = Integer.MAX_VALUE;   for (int value : values) min = Math.min(min, value);   return min;  }  int maxInt(int... values) {   int max = Integer.MIN_VALUE;   for (int value : values) max = Math.max(max, value);   return max;  }  public static void main(String[] args) throws NumberFormatException, IOException {     new Main().run();  }  void run() throws NumberFormatException, IOException {   solve();   out.close();  };  BufferedReader in;  PrintWriter out;  StringTokenizer tok;  String delim = " ";  Random rnd = new Random();  Main() throws FileNotFoundException {   try {    in = new BufferedReader(new FileReader("input.txt"));    out = new PrintWriter("output.txt");   } catch (Exception e) {    if (fileName.isEmpty()) {     in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);    } else {     in = new BufferedReader(new FileReader(fileName + ".in"));     out = new PrintWriter(fileName + ".out");    }   }   tok = new StringTokenizer("");  }  String readLine() throws IOException {   return in.readLine();  }  String readString() throws IOException {   while (!tok.hasMoreTokens()) {    String nextLine = readLine();    if (null == nextLine) {     return null;    }    tok = new StringTokenizer(nextLine);   }   return tok.nextToken();  }  int readInt() throws NumberFormatException, IOException {   return Integer.parseInt(readString());  }  byte readByte() throws NumberFormatException, IOException {   return Byte.parseByte(readString());  }  int[] readIntArray (int n) throws NumberFormatException, IOException {   int[] a = new int[n];   for(int i=0; i<n; ++i){    a[i] = readInt();   }   return a;  }  Integer[] readIntegerArray (int n) throws NumberFormatException, IOException {   Integer[] a = new Integer[n];   for(int i=0; i<n; ++i){    a[i] = readInt();   }   return a;  }  long readLong() throws NumberFormatException, IOException {   return Long.parseLong(readString());  }  double readDouble() throws NumberFormatException, IOException {   return Double.parseDouble(readString());  } }
3	public class code5 { InputStream is; PrintWriter out; static long mod=pow(10,9)+7; static int dx[]={0,0,1,-1},dy[]={1,-1,0,0}; String arr[]; long dp[][]; void solve() throws IOException {  int n=ni();  arr=new String[n];  for(int i=0;i<n;i++)  arr[i]=ns();  dp=new long[n+1][n+1];  dp[0][0]=1;  for(int i=0;i<n;i++)  {  long next[]=new long[n+1];  for(int j=0;j<=i;j++)  {   if(arr[i].charAt(0)=='s')   {   next[0]+=dp[i][j];   next[j+1]-=dp[i][j];   }else {   next[j+1]+=dp[i][j];   next[j+2]-=dp[i][j];   }  }  long count=0;  for(int j=0;j<n;j++)  {   count+=next[j];   count=(count+mod)%mod;   dp[i+1][j]=count;  }  }  long ans=0;  for(int i=0;i<n;i++)  {  ans+=dp[n-1][i];  ans%=mod;  }  out.print(ans); } long rec(int index,int level) {  if(index>=arr.length-1)  return 1;  if(dp[index][level]!=-1)  return dp[index][level];  dp[index][level]=0;  if(arr[index].charAt(0)=='s')  {  dp[index][level]+=rec(index+1,level);  dp[index][level]%=mod;  if(level>0)  {   dp[index][level]+=rec(index+1,0);   dp[index][level]%=mod;  }  }  else {  dp[index][level]+=rec(index+1,level+1);  dp[index][level]%=mod;  }  return dp[index][level]; } double a[],b[],p; int sum(int i) {  int sum=0;  while(i!=0)  {  if((i%10)%2==1)   sum+=i%10;  i/=10;  }  return sum; } ArrayList<Integer> al[];  void take(int n,int m)  {  al=new ArrayList[n];  for(int i=0;i<n;i++)   al[i]=new ArrayList<Integer>();  for(int i=0;i<m;i++)  {   int x=ni()-1;   int y=ni()-1;   al[x].add(y);   al[y].add(x);  }  }  int check(long n)  {  int count=0;  while(n!=0)  {   if(n%10!=0)   break;   n/=10;   count++;  }  return count;  } public static int count(int x) {  int num=0;  while(x!=0)  {  x=x&(x-1);  num++;  }  return num; } static long d, x, y; void extendedEuclid(long A, long B) {  if(B == 0) {   d = A;   x = 1;   y = 0;  }  else {   extendedEuclid(B, A%B);   long temp = x;   x = y;   y = temp - (A/B)*y;  } } long modInverse(long A,long M)  {  extendedEuclid(A,M);  return (x%M+M)%M;  } public static void mergeSort(int[] arr, int l ,int r){  if((r-l)>=1){  int mid = (l+r)/2;  mergeSort(arr,l,mid);  mergeSort(arr,mid+1,r);  merge(arr,l,r,mid);  } } public static void merge(int arr[], int l, int r, int mid){  int n1 = (mid-l+1), n2 = (r-mid);  int left[] = new int[n1];  int right[] = new int[n2];  for(int i =0 ;i<n1;i++) left[i] = arr[l+i];  for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];  int i =0, j =0, k = l;  while(i<n1 && j<n2){  if(left[i]>right[j]){   arr[k++] = right[j++];  }  else{   arr[k++] = left[i++];  }  }  while(i<n1) arr[k++] = left[i++];  while(j<n2) arr[k++] = right[j++]; } public static void mergeSort(long[] arr, int l ,int r){  if((r-l)>=1){  int mid = (l+r)/2;  mergeSort(arr,l,mid);  mergeSort(arr,mid+1,r);  merge(arr,l,r,mid);  } } public static void merge(long arr[], int l, int r, int mid){  int n1 = (mid-l+1), n2 = (r-mid);  long left[] = new long[n1];  long right[] = new long[n2];  for(int i =0 ;i<n1;i++) left[i] = arr[l+i];  for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];  int i =0, j =0, k = l;  while(i<n1 && j<n2){  if(left[i]>right[j]){   arr[k++] = right[j++];  }  else{   arr[k++] = left[i++];  }  }  while(i<n1) arr[k++] = left[i++];  while(j<n2) arr[k++] = right[j++]; }  static class Pair implements Comparable<Pair>{     int x,y,k;   int i,dir;   long val;  Pair (int x,int y){  this.x=x;  this.y=y;  }   public int compareTo(Pair o) {  if(this.x!=o.x)   return this.x-o.x;  return this.y-o.y;  }   public String toString(){  return x+" "+y+" "+k+" "+i;}  public boolean equals(Object o) {  if (o instanceof Pair) {   Pair p = (Pair)o;   return p.x == x && p.y == y;  }  return false;  }  public int hashCode() {  return new Long(x).hashCode()*31 + new Long(y).hashCode() ;  } }     public static boolean isPal(String s){   for(int i=0, j=s.length()-1;i<=j;i++,j--){     if(s.charAt(i)!=s.charAt(j)) return false;   }   return true;  }  public static String rev(String s){  StringBuilder sb=new StringBuilder(s);  sb.reverse();  return sb.toString();  }    public static long gcd(long x,long y){  if(y==0)  return x;  else  return gcd(y,x%y);  }    public static int gcd(int x,int y){   if(y==0)    return x;   return gcd(y,x%y);  }    public static long gcdExtended(long a,long b,long[] x){      if(a==0){    x[0]=0;    x[1]=1;    return b;   }   long[] y=new long[2];   long gcd=gcdExtended(b%a, a, y);      x[0]=y[1]-(b/a)*y[0];   x[1]=y[0];      return gcd;  }    public static int abs(int a,int b){  return (int)Math.abs(a-b);  }    public static long abs(long a,long b){  return (long)Math.abs(a-b);  }    public static int max(int a,int b){  if(a>b)  return a;  else  return b;  }    public static int min(int a,int b){  if(a>b)  return b;  else   return a;  }    public static long max(long a,long b){  if(a>b)  return a;  else  return b;  }    public static long min(long a,long b){  if(a>b)  return b;  else   return a;  }    public static long pow(long n,long p,long m){  long result = 1;  if(p==0)   return 1;  if (p==1)   return n;  while(p!=0)  {   if(p%2==1)    result *= n;   if(result>=m)   result%=m;   p >>=1;   n*=n;   if(n>=m)   n%=m;  }  return result;  }    public static long pow(long n,long p){  long result = 1;  if(p==0)   return 1;  if (p==1)   return n;  while(p!=0)  {   if(p%2==1)    result *= n;    p >>=1;   n*=n;   }  return result;  }  public static void debug(Object... o) {  System.out.println(Arrays.deepToString(o));  }  void run() throws Exception {  is = System.in;  out = new PrintWriter(System.out);  solve();  out.flush();  }    public static void main(String[] args) throws Exception {  new Thread(null, new Runnable() {   public void run() {   try {    new code5().run();   } catch (Exception e) {    e.printStackTrace();   }   }  }, "1", 1 << 26).start();      }  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 double nd() {  return Double.parseDouble(ns());  }   private char nc() {  return (char) skip();  }   private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(isSpaceChar(b))) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }   private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while (p < n && !(isSpaceChar(b))) {   buf[p++] = (char) b;   b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p);  }   private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)   map[i] = ns(m);  return map;  }   private int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = ni();  return a;  }  private long[] nl(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nl();  return a;  }   private int ni() {  int num = 0, b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))   ;  if (b == '-') {   minus = true;   b = readByte();  }    while (true) {   if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }   private long nl() {  long num = 0;  int b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))   ;  if (b == '-') {   minus = true;   b = readByte();  }    while (true) {   if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }  }
0	public class A { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  BigInteger l = sc.nextBigInteger();  BigInteger r = sc.nextBigInteger();  BigInteger a = l.add(BigInteger.ZERO);  while (a.compareTo(r) < 0) {  BigInteger b = a.add(BigInteger.ONE);  while (b.compareTo(r) < 0) {   try {   a.modInverse(b);   } catch (ArithmeticException e) {   b = b.add(BigInteger.ONE);   continue;   }   BigInteger c = b.add(BigInteger.ONE);   while (c.compareTo(r) <= 0) {   try {    b.modInverse(c);    try {    a.modInverse(c);    } catch (ArithmeticException e) {    System.out.printf("%s %s %s\n", a.toString(), b.toString(), c.toString());    return;    }   } catch (ArithmeticException e) {       }   c = c.add(BigInteger.ONE);   }   b = b.add(BigInteger.ONE);  }  a = a.add(BigInteger.ONE);  }  System.out.println("-1"); } }
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;  }  public String readLine() {   try {    return super.readLine();   } catch (IOException e) {    return null;   }  } } class FastPrinter extends PrintWriter {  public FastPrinter(OutputStream out) {   super(out);  }  public FastPrinter(Writer out) {   super(out);  }  }
5	public class A {  public static void main(String[] args)  {  new A(new Scanner(System.in));  }  public A(Scanner in)  {  int n = in.nextInt();  int t = in.nextInt();  int tt = 2*t;   rect[] rs = new rect[n];  for (int i=0; i<n; i++)   rs[i] = new rect(in.nextInt(), in.nextInt());    Arrays.sort(rs);   int res = 2;  for (int i=1; i<n; i++)  {   rect a = rs[i-1];   rect b = rs[i];   int d = b.p-a.p;   int dd = a.t+b.t;   int tv = 2*d-dd;   if (tt == tv)    res++;   if (tv > tt)    res+=2;  }  System.out.printf("%d%n", res);  } } class rect implements Comparable<rect> {  int p;  int t;  public rect(int pp, int tt)  {  p = pp;  t = tt;  }  public int compareTo(rect rhs)  {  return p-rhs.p;  } }
4	public class Main{   static class Run implements Runnable{       final boolean consoleIO = false;    final String inFile = "input.txt";    final String outFile = "output.txt";       int n,m,k;    int[][] field;    boolean[][] visited;       LinkedList<Point> queue;    int[][] steps = {{0,1},{1,0},{0,-1},{-1,0}};       void wave() {     for(Point p:queue)      visited[p.y][p.x] = true;         while(!queue.isEmpty()) {      Point cur = queue.removeFirst();      for(int i = 0; i < steps.length; ++i) {       Point tmp = new Point(cur.x+steps[i][0],cur.y+steps[i][1]);             if(ok(tmp)&&!visited[tmp.y][tmp.x]) {        queue.add(tmp);        visited[tmp.y][tmp.x] = true;        field[tmp.y][tmp.x] = field[cur.y][cur.x]+1;       }      }     }    }       boolean ok(Point p) {     return p.x>=0 && p.y>=0 && p.x<n && p.y<m;    }       @Override    public void run() {     n = nextInt();     m = nextInt();     k = nextInt();         queue = new LinkedList<Point>();     for(int i = 0; i < k; ++i)      queue.add(new Point(nextInt()-1,nextInt()-1));         field = new int[m][n];     visited = new boolean[m][n];     wave();         Point maxP = new Point(0,0);     int maxV = Integer.MIN_VALUE;         for(int i = 0; i < m; ++i)      for(int j = 0; j < n; ++j)       if(field[i][j] > maxV) {        maxV = field[i][j];        maxP = new Point(j,i);       }         print((maxP.x+1)+" "+(maxP.y+1));     close();    }      BufferedReader in;    PrintWriter out;    StringTokenizer strTok;       Run() {     if (consoleIO) {      initConsoleIO();     }     else {      initFileIO();     }    }       void initConsoleIO() {     in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(new OutputStreamWriter(System.out));    }       void initFileIO() {     try {      in = new BufferedReader(new FileReader(inFile));      out = new PrintWriter(new FileWriter(outFile));     } catch (FileNotFoundException e) {      e.printStackTrace();     } catch (IOException e) {      e.printStackTrace();     }    }       void close() {     try {      in.close();      out.close();     } catch (IOException e) {      e.printStackTrace();     }    }       int nextInt() {     return Integer.parseInt(nextToken());    }       double nextDouble() {     return Double.parseDouble(nextToken());    }       float nextFloat() {     return Float.parseFloat(nextToken());    }       long nextLong() {     return Long.parseLong(nextToken());    }       String nextLine() {     try {      return in.readLine();     } catch (IOException e) {      return "__NULL";     }    }       boolean hasMoreTokens() {     return (strTok == null) || (strTok.hasMoreTokens());    }       String nextToken() {     while (strTok == null || !strTok.hasMoreTokens()) {      String line;      try {       line = in.readLine();       strTok = new StringTokenizer(line);      } catch (IOException e) {       e.printStackTrace();      }     }         return strTok.nextToken();    }       void cout(Object o){     System.out.println(o);    }       void print(Object o) {     out.write(o.toString());    }       void println(Object o) {     out.write(o.toString() + '\n');    }       void printf(String format, Object... args) {     out.printf(format, args);    }       String sprintf(String format, Object... args) {    return MessageFormat.format(format, args);   }   }     static class Pair<A, B> {    A a;    B b;       A f() {     return a;    }       B s() {     return b;    }       Pair(A a, B b) {     this.a = a;     this.b = b;    }       Pair(Pair<A, B> p) {     a = p.f();     b = p.s();    }   }     public static void main(String[] args) throws IOException {    Run run = new Run();    Thread thread = new Thread(run);    thread.run();   }  }
5	public class Solution {  static class Cottage implements Comparable<Cottage> {   public int x;   public double a;   public Cottage(int x, int a) {    this.x = x;    this.a = a;   }   public int compareTo(Cottage c) {    return x - c.x;   }  }  static final double e = 1e-9;  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int n = in.nextInt();   int t = in.nextInt();   Cottage[] cottages = new Cottage[n];   for (int i = 0; i < n; i++)    cottages[i] = new Cottage(in.nextInt(), in.nextInt());   Arrays.sort(cottages);   int ans = 2;   for (int i = 1; i < cottages.length; i++) {    double diff = cottages[i].x - cottages[i - 1].x - cottages[i - 1].a / 2 - cottages[i].a / 2;    ans = Math.abs(diff - t) < e ? ans + 1 : diff - t < -e ? ans : ans + 2;   }   out.print(ans);   out.close();  } }
6	public class Solution {  BufferedReader in;  PrintWriter out;  StringTokenizer st;  int[] x;  int[] y;  int n;  int X, Y;  int[] d;  int[][] dist;  int sqr(int a) {   return a * a;  }  int dist(int X, int Y, int i) {   return sqr(X - x[i]) + sqr(Y - y[i]);  }  int[] dp;  byte[][] pred;  int rec(int mask) {   if (dp[mask] == -1) {    int res = 1 << 29;    boolean ok = false;    for (int i = 0; i < n; ++i)     if ((mask & (1 << i)) > 0) {      ok = true;      int mm = mask & ~(1 << i);      for (int j = i; j < n; j++)       if ((mask & (1 << j)) > 0) {        int nmask = mm & ~(1 << j);        int a = rec(nmask) + d[i] + d[j] + dist[i][j];        if (a < res) {         res = a;         pred[0][mask] = (byte) (i);         pred[1][mask] = (byte) (j);        }       }      break;     }    if (!ok)     res = 0;    dp[mask] = res;   }   return dp[mask];  }  void solve() throws IOException {   X = ni();   Y = ni();   n = ni();   x = new int[n];   y = new int[n];   for (int i = 0; i < n; i++) {    x[i] = ni();    y[i] = ni();   }   d = new int[n];   dist = new int[n][n];   for (int i = 0; i < n; ++i)    d[i] = dist(X, Y, i);   for (int i = 0; i < n; ++i)    for (int j = 0; j < n; j++) {     dist[i][j] = dist(x[i], y[i], j);    }   pred = new byte[2][1 << n];   dp = new int[1 << n];   Arrays.fill(dp, -1);   out.println(rec((1 << n) - 1));   int a = (1 << n) - 1;   while (a > 0) {    if (pred[0][a] != pred[1][a])     out.print(0 + " " + (pred[0][a] + 1) + " " + (pred[1][a] + 1)       + " ");    else     out.print(0 + " " + (pred[0][a] + 1) + " ");    int na = a & ~(1 << pred[0][a]);    na &= ~(1 << pred[1][a]);    a = na;   }   out.println(0);  }  public Solution() throws IOException {   Locale.setDefault(Locale.US);   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   solve();   in.close();   out.close();  }  String ns() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int ni() throws IOException {   return Integer.valueOf(ns());  }  long nl() throws IOException {   return Long.valueOf(ns());  }  double nd() throws IOException {   return Double.valueOf(ns());  }  public static void main(String[] args) throws IOException {   new Solution();  } }
5	public class BetaRound15_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()); }  @Override public void run() {  try {  long t1 = System.currentTimeMillis();  init();  solve();  out.close();  long t2 = System.currentTimeMillis();  System.err.println("Time = " + (t2 - t1));  } catch (Exception e) {  e.printStackTrace(System.err);  System.exit(-1);  } }  public static void main(String[] args) {  new Thread(new BetaRound15_A()).start(); }  class House implements Comparable<House> {  int left, right;  House(int left, int right) {  this.left = left;  this.right = right;  }  @Override  public int compareTo(House h) {  return this.left - h.left;  } }  int getAns(House h1, House h2, int t) {  int d = h2.left - h1.right;  if (d < t) return 0;  if (d == t) return 1;  return 2; }  void solve() throws IOException {  int n = readInt();  int t = readInt() * 2;  House[] h = new House[n];  for (int i = 0; i < n; i++) {  int c = readInt() * 2;  int b = readInt();  h[i] = new House(c - b, c + b);  }  Arrays.sort(h);  int ans = 2;  for (int i = 1; i < n; i++) {  ans += getAns(h[i - 1], h[i], t);  }  out.print(ans); } }
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 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 int nextInt() {   return Integer.parseInt(next());  }  public long nextLong() {   return Long.parseLong(next());  }  public double nextDouble() {   return Double.parseDouble(next());  } }
6	public class BetaRound8_C implements Runnable {  BufferedReader in;  PrintWriter out;  StringTokenizer tok;  @Override  public void run() {   try {    long startTime = System.currentTimeMillis();    if (System.getProperty("ONLINE_JUDGE") != 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");    }    tok = new StringTokenizer("");    Locale.setDefault(Locale.US);    solve();    in.close();    out.close();    long endTime = System.currentTimeMillis();    long totalMemory = Runtime.getRuntime().totalMemory();    long freeMemory = Runtime.getRuntime().freeMemory();    System.err.println("Time = " + (endTime - startTime) + " ms");    System.err.println("Memory = " + ((totalMemory - freeMemory) / 1024) + " KB");   } catch (Throwable e) {    e.printStackTrace(System.err);    System.exit(-1);   }  }  String readString() throws IOException {   while (!tok.hasMoreTokens()) {    tok = new StringTokenizer(in.readLine());   }   return tok.nextToken();  }  int readInt() throws IOException {   return Integer.parseInt(readString());  }  long readLong() throws IOException {   return Long.parseLong(readString());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  void debug(Object... o) {   System.err.println(Arrays.deepToString(o));  }  public static void main(String[] args) {   new Thread(null, new BetaRound8_C(), "", 256 * 1024 * 1024).start();  }    final int INF = 1000 * 1000 * 1000;  int x0, y0;  int n;  int[] x, y;  int t(int i, int j) {   int dx = x[i] - x[j];   int dy = y[i] - y[j];   return dx * dx + dy * dy;  }  int t0(int i) {   int dx = x[i] - x0;   int dy = y[i] - y0;   return dx * dx + dy * dy;  }  int[] dp;  int[] p;  void solve() throws IOException {   x0 = readInt();   y0 = readInt();   n = readInt();   x = new int[n];   y = new int[n];   for (int i = 0; i < n; i++) {    x[i] = readInt();    y[i] = readInt();   }   dp = new int[1 << n];   p = new int[1 << n];   Arrays.fill(dp, INF);   dp[(1 << n) - 1] = 0;   get(0);   out.println(dp[0]);   printPath();  }  int get(int mask) {   if (dp[mask] != INF) {    return dp[mask];   }   int res = INF;   for (int i = 0; i < n; i++) {    if (((1 << i) & mask) == 0) {     int test = get(mask ^ (1 << i)) + 2 * t0(i);     if (res > test) {      res = test;      p[mask] = mask ^ (1 << i);     }     for (int j = i + 1; j < n; j++) {      if (((1 << j) & mask) == 0) {       test = get(mask ^ (1 << i) ^ (1 << j)) + t0(i)         + t(i, j) + t0(j);       if (res > test) {        res = test;        p[mask] = mask ^ (1 << i) ^ (1 << j);       }      }     }     break;    }   }   return dp[mask] = res;  }  void printPath() {   ArrayList<Integer> ans = new ArrayList<Integer>();   ans.add(0);   int mask = 0;   while (mask != (1 << n) - 1) {    for (int i = 0; i < n; i++) {     if (((mask ^ p[mask]) & (1 << i)) != 0) {      ans.add(i + 1);     }    }    mask = p[mask];    ans.add(0);   }   for (int x : ans) {    out.print(x + " ");   }  } }
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 int nextInt() throws IOException {    return Integer.parseInt(next());   }     public long nextLong() throws IOException {    return Long.parseLong(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 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};  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); }  void debug(Object... os){  System.err.println(Arrays.deepToString(os)); }  public static void main(String[] args){  Locale.setDefault(Locale.US);  new P111C().run(); } }
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 M = sc.nextInt();  int K = sc.nextInt();   Integer [] S = sc.nextInts();  sort(S, reverseOrder());    int cnt = K, res;  for (res = 0; res < N && cnt < M; ++res)  cnt += S[res] - 1;   exit(cnt < M ? -1 : res); }    static MyScanner sc;  static class MyScanner {  public String next() {  newLine();  return line[index++];  }   public char nextChar() {  return next().charAt(0);  }    public int nextInt() {  return Integer.parseInt(next());  }   public long nextLong() {  return Long.parseLong(next());  }   public double nextDouble() {  return Double.parseDouble(next());  }   public String nextLine() {  line = null;  return readLine();  }   public String [] nextStrings() {  line = null;  return readLine().split(" ");  }   public char [] nextChars() {  return next().toCharArray();  }  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;  }     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) {  pw.println(build(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); }  void NO() {  throw new Error("NO!"); }    static String build(Object... a) {  StringBuilder b = new StringBuilder();  for (Object o : a)  append(b, o);  return b.toString().trim();  }  static void append(StringBuilder b, Object o) {  if (o.getClass().isArray()) {  int L = Array.getLength(o);  for (int i = 0; i < L; ++i)   append(b, Array.get(o, i));  } else if (o instanceof Iterable<?>) {  for (Object p : (Iterable<?>)o)   append(b, p);  } else  b.append(" ").append(o);  }    public static void main(String[] args) {  sc = new MyScanner ();  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 Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   System.out.println(n + n / 2);  } }
6	public class E {  static void solve() throws Exception {  int tests = scanInt();  for (int test = 0; test < tests; test++) {  int n = scanInt(), m = scanInt(), a[][] = new int[n][m];   for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   a[i][j] = scanInt();   }  }  int bestCols[] = new int[min(m, n)];  for (int i = 0; i < bestCols.length; i++) {   bestCols[i] = i;  }  if (m > n) {   int bestColMax[] = new int[n];   for (int i = 0; i < n; i++) {   int cmax = 0;   for (int j = 0; j < n; j++) {    cmax = max(cmax, a[j][i]);   }   bestColMax[i] = cmax;   }   for (int i = n; i < m; i++) {   int cmax = 0;   for (int j = 0; j < n; j++) {    cmax = max(cmax, a[j][i]);   }   int minBC = 0, minBCM = Integer.MAX_VALUE;   for (int j = 0; j < n; j++) {    if (bestColMax[j] < minBCM) {    minBC = j;    minBCM = bestColMax[j];    }   }   if (cmax > minBCM) {    bestCols[minBC] = i;    bestColMax[minBC] = cmax;   }   }  }  int dyn[] = new int[1 << n], dynNext[] = new int[1 << n], sums[] = new int[1 << n], csums[] = new int[1 << n];  for (int i: bestCols) {   fill(dynNext, 0);   fill(sums, 0);   for (int j = 0; j < n; j++) {   for (int k = 1, bit = 0; k < 1 << n; k++) {    if (k == 1 << (bit + 1)) {    ++bit;    }    sums[k] = max(sums[k], csums[k] = csums[k ^ (1 << bit)] + a[(bit + j) % n][i]);   }   }   for (int mask1 = 0; mask1 < 1 << n; mask1++) {   int cdyn = dynNext[mask1];   for (int mask2 = mask1;; mask2 = (mask2 - 1) & mask1) {    cdyn = max(cdyn, dyn[mask2] + sums[mask1 ^ mask2]);    if (mask2 == 0) {    break;    }   }   dynNext[mask1] = cdyn;   }   int t[] = dyn;   dyn = dynNext;   dynNext = t;  }  out.println(dyn[(1 << n) - 1]);  } }  static int scanInt() throws IOException {  return parseInt(scanString()); }  static long scanLong() throws IOException {  return parseLong(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);  } } }
2	public class C { static final int M = 1000000007;   public static void main(String[] args) throws IOException{  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(in.readLine());   long x = Long.parseLong(st.nextToken());  if(x == 0){  System.out.println(0);  System.exit(0);  }  final long k = Long.parseLong(st.nextToken());  x = x%M;   long ans = (exp(2, k+1)*x - (exp(2, k) - 1))%M;  if(ans < 0) ans += M;  System.out.println(ans);   }  public static long exp(long a, long n){  if(n == 0) return 1;  if(n == 1) return a%M;  if(n%2 == 0) return exp((a*a)%M, n/2);  else return (a*exp((a*a)%M, (n-1)/2))%M; } }
5	public class VK2A {  public static void main(String args[])  {   Scanner S = new Scanner(System.in);   int n = S.nextInt();   int a = S.nextInt();   int b = S.nextInt();   int[] A = new int[n];   for(int i = 0; i < n; i++)    A[i] = S.nextInt();   for(int i = 0; i < n; i++)    for(int j = 0; j < n - i - 1; j++)    {     if(A[j] < A[j + 1])     {      int temp = A[j];      A[j] = A[j + 1];      A[j + 1] = temp;     }    }      System.out.println(A[a - 1] - A[a]);   }  }
0	public class A {  public static void main(String[] args) {     Scanner in = new Scanner(System.in);     long l = in.nextLong();   long r = in.nextLong();     if(r-l < 2 ){    System.out.println("-1");   }     else if(r-l == 2 && l %2 ==1){    System.out.println("-1");   }   else{           if(l%2 == 0){     System.out.println(l+ " "+(l+1)+" "+(l+2));        }    else{     System.out.println((l+1)+ " "+(l+2)+" "+(l+3));    }   }      }  }
0	public class StrangeAddition {  public static void main(String[] args) throws IOException {  PrintWriter out = new PrintWriter(System.out);  sc = new StringTokenizer(br.readLine());  int tc = nxtInt();  while (tc-- > 0) {  int a = nxtInt();  int b = nxtInt();  int ans = 0;  while (a != b) {   if (a == 0 || b == 0)   break;   if (a > b) {   int div = a / b;   a -= b * div;   ans += div;   } else {   int div = b / a;   b -= a * div;   ans += div;   }  }  out.println(ans + (a == b ? 1 : 0));  }  br.close();  out.close(); }  static BufferedReader br = new BufferedReader(new InputStreamReader(  System.in));  static StringTokenizer sc;  static String nxtTok() throws IOException {  while (!sc.hasMoreTokens()) {  String s = br.readLine();  if (s == null)   return null;  sc = new StringTokenizer(s.trim());  }  return sc.nextToken(); }  static int nxtInt() throws IOException {  return Integer.parseInt(nxtTok()); }  static long nxtLng() throws IOException {  return Long.parseLong(nxtTok()); } }
1	public class ProblemA {  public void solve() {   boolean oj = true;   try {    Reader reader = oj ? new InputStreamReader(System.in) : new FileReader("A.in");    Writer writer = oj ? new OutputStreamWriter(System.out) : new FileWriter("A.out");    BufferedReader br = new BufferedReader(reader);    StreamTokenizer st = new StreamTokenizer(reader);    PrintWriter out = new PrintWriter(writer);    int n = Integer.valueOf(br.readLine());    String s = br.readLine();    MyTokenizer tok = new MyTokenizer(s);    int[] a = new int[2];    int[] ind = new int[2];    int[] c = new int[2];    for(int i=0;i<n;i++) {     int p = (int)tok.getNum();     c[p%2]++;     a[p%2] = p;     ind[p%2] = i;    }    int b = ind[0];    if (c[0] > c[1])     b = ind[1];    out.printf("%d", b + 1);    br.close();    out.close();    reader.close();    writer.close();   }   catch (Exception ex) {    ex.printStackTrace();   }   finally {   }  }   public static void main(String[] args) {   ProblemA f = new ProblemA();   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) == '.' || s.charAt(cur) == '-')) {     snum += s.charAt(cur);     cur++;    }    return Double.valueOf(snum);   }   public String getString() {    skip();    String s2 = "";    while (cur < s.length() && (((s.charAt(cur) >= 'a' && s.charAt(cur) <= 'z')) || ((s.charAt(cur) >= 'A' && s.charAt(cur) <= 'Z')))) {     s2 += s.charAt(cur);     cur++;    }    return s2;   }   public char getCurrentChar() throws Exception {    if (cur < s.length())     return s.charAt(cur);    else     throw new Exception("Current character out of string length");   }   public void moveNextChar() {    if (cur < s.length())     cur++;   }   public boolean isFinished() {    return cur >= s.length();   }  } }
1	public class Main {  private static StringTokenizer st;  private static BufferedReader br;  public static long MOD = 1000000007;  public static long tenFive = 100000;  public static int INF = 100000;  public static void print(Object x) {   System.out.println(x + "");  }  public static void printArr(long[] x) {   StringBuilder s = new StringBuilder();   for (int i = 0; i < x.length; i++) {    s.append(x[i] + " ");   }   print(s);  }  public static void printArr(int[] x) {   StringBuilder s = new StringBuilder();   for (int i = 0; i < x.length; i++) {    s.append(x[i] + " ");   }   print(s);  }  public static String join(Collection<?> x, String space) {   if (x.size() == 0) return "";   StringBuilder sb = new StringBuilder();   boolean first = true;   for (Object elt : x) {    if (first) first = false;    else sb.append(space);    sb.append(elt);   }   return sb.toString();  }  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 List<Integer> nextInts(int N) throws IOException {   List<Integer> ret = new ArrayList<Integer>();   for (int i = 0; i < N; i++) {    ret.add(nextInt());   }   return ret;  }  public static void solve(int a, int b, List<Integer> orig) {   boolean swap = false;   if (a > b) {    swap = true;    int tmp = a;    a = b;    b = tmp;   }   List<Integer> nums = new ArrayList<Integer>(orig);   Collections.sort(nums);   Collections.reverse(nums);   Set<Integer> all = new HashSet<Integer>(nums);   Set<Integer> done = new HashSet<Integer>();   Set<Integer> inB = new HashSet<Integer>();   for (int x : nums) {    if (done.contains(x)) continue;    if (all.contains(a - x) && !done.contains(a - x)) {     done.add(x);     done.add(a - x);        } else if (all.contains(b - x) && !done.contains(b - x)) {     done.add(x);     done.add(b - x);     inB.add(x);     inB.add(b - x);    } else {     print("NO");     return;    }   }   print("YES");   List<Integer> out = new ArrayList<Integer>();   for (int x : orig) {    if (inB.contains(x) ^ swap) out.add(1);    else out.add(0);   }   print(join(out, " "));  }  public static void main(String[] args) throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));   int n = nextInt();   int a = nextInt();   int b = nextInt();   List<Integer> nums = nextInts(n);   solve(a, b, nums);  } }
2	public class B176 {  public static void main(String[] args) {   Scanner in = new Scanner(new BufferedInputStream(System.in));   PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));   long n = in.nextLong() - 1;   long k = in.nextLong() - 1;   if (k * (k + 1) / 2 < n) out.println(-1);   else if (n == 0) out.println(0);   else if (n < k) out.println(1);   else {    long t = binSearch(n, k, 1, k);    long ans = k - t + 1;    if (k * (k + 1) / 2 - t * (t - 1) / 2 != n) ans++;    out.println(ans);   }   out.close();  }  private static long binSearch(long n, long k, long from, long to) {   if (from == to) return from;   long mid = (from + to) / 2;   if (k * (k + 1) / 2 - mid * (mid - 1) / 2 > n) return binSearch(n, k, mid + 1, to);   else return binSearch(n, k, from, mid);  } }
1	public class Main {  static BufferedReader reader; static StringTokenizer tokenizer; static PrintWriter writer;  static int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(nextToken()); }  static long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(nextToken()); }  static double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(nextToken()); }  static String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  tokenizer = new StringTokenizer(reader.readLine());  }  return tokenizer.nextToken(); }  public static void main(String[] args) throws IOException {  reader = new BufferedReader(new InputStreamReader(System.in));  writer = new PrintWriter(System.out);  pineapple();  reader.close();  writer.close(); }  static void pineapple() throws NumberFormatException, IOException {  int n = nextInt();  int a = nextInt();  int b = nextInt();  TreeSet<Integer> al = new TreeSet<Integer>();  TreeMap<Integer, Integer> mp = new TreeMap<Integer, Integer>();  int[] ans = new int[n];  Arrays.fill(ans, -1);  TreeSet<Integer> used = new TreeSet<Integer>();  int[] mas = new int[n];  for (int i = 0; i < n; i++) {  int t = nextInt();  al.add(t);  mas[i] = t;  mp.put(t, i);  }  for (int st : al) {  if (used.contains(st))   continue;   {   int pr = st;   int cc = -1;   TreeSet<Integer> u2 = new TreeSet<Integer>();   u2.add(pr);   if (al.contains(a - pr) && !u2.contains(a - pr))   cc = a - pr;   else if (al.contains(b - pr) && !u2.contains(a - pr))   cc = b - pr;   if (cc != -1) {   u2.add(cc);   boolean bGo = true;   while (bGo) {    bGo = false;    int nxt = -1;    if (al.contains(a - cc) && !u2.contains(a - cc))    nxt = a - cc;    else if (al.contains(b - cc) && !u2.contains(b - cc))    nxt = b - cc;    if (nxt != -1) {    bGo = true;    u2.add(nxt);    cc = nxt;    pr = cc;    }   }   st = cc;   }  }   int x = st;  while (x != -1) {   int curr = x;   used.add(curr);   x = -1;   int next1 = a - curr;   if (al.contains(next1)) {   if (!used.contains(next1)) {    x = next1;    int ci = mp.get(curr);    int ni = mp.get(next1);    if (ans[ci] == -1 && ans[ni] == -1) {    ans[ni] = 0;    ans[ci] = 0;    }   }   }   int next2 = b - curr;   if (al.contains(next2)) {   if (!used.contains(next2)) {    x = next2;    int ci = mp.get(curr);    int ni = mp.get(next2);    if (ans[ci] == -1 && ans[ni] == -1) {    ans[ni] = 1;    ans[ci] = 1;    }   }   }  }  }  for (int i = 0; i < n; i++) {  if (ans[i] == -1) {   if (2 * mas[i] == a) {   ans[i] = 0;   continue;   }   if (2 * mas[i] == b) {   ans[i] = 1;   continue;   }   writer.println("NO");   return;  }  }  writer.println("YES");  for (int i = 0; i < n; i++) {  writer.print(ans[i] + " ");  } } }
5	public class A {  public A () throws IOException {  int N = sc.nextInt();  int [] A = new int [N];  for (int n = 0; n < N; ++n)  A[n] = sc.nextInt();  solve(N, A); }  public void solve (int N, int [] A) {   Arrays.sort(A);  int S1 = 0;  for (int n = 0; n < N; ++n)  S1 += A[n];   int S2 = 0;  for (int n = N - 1; n >= 0; --n) {  S2 += A[n];  if (S2 > S1 - S2)   exit(N - n);  } }    static MyScanner sc; static long t;  static void print (Object o) {  System.out.println(o); }  static void exit (Object o) {  print(o);   System.exit(0); }  static void run () throws IOException {  sc = new MyScanner ();  new A(); }  public static void main(String[] args) throws IOException {  run(); }  static long millis() {  return System.currentTimeMillis(); }  static void start() {  t = millis(); }  static class MyScanner {  String next() throws IOException {  newLine();  return line[index++];  }   int nextInt() throws IOException {  return Integer.parseInt(next());  }   String nextLine() throws IOException {  line = null;  return r.readLine();  }     private final BufferedReader r;  MyScanner () throws IOException {  this(new BufferedReader(new InputStreamReader(System.in)));  }   MyScanner(BufferedReader r) throws IOException {   this.r = r;  newLine();  }   private String [] line;  private int index;  private void newLine() throws IOException {  if (line == null || index == line.length) {   line = r.readLine().split(" ");   index = 0;  }  }  } }
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; }  private static 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();  }  String nextLine() throws IOException {  return br.readLine();  }  int nextInt() throws IOException {  return Integer.parseInt(next());  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(next());  }  boolean ready() throws IOException {  return br.ready();  }  } }
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();  } }
5	public class Twins {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[] val = new int[n];   for (int i=0; i<n; i++)    val[i] = in.nextInt();   Arrays.sort(val);   int sum = 0, count = 0;   for (int i=n-1; i>=0; i--) {    count++;    sum += val[i];    int his = 0;    for (int j=0; j<i; j++) his += val[j];    if (his < sum) break;   }   System.out.println(count);  } }
0	public class A implements Runnable {  private void Solution() throws IOException {  int n = nextInt();  if (n % 7 == 0 || n % 4 == 0 || n % 47 == 0 || n % 74 == 0 || n % 747 == 0 || n % 474 == 0 || n % 777 == 0 || n % 444 == 0 || n % 774 == 0 || n % 447 == 0 || n % 744 == 0 || n % 477 == 0)  System.out.println("YES"); else   System.out.println("NO"); }  public static void main(String args[]) {  new A().run(); }  BufferedReader in; StringTokenizer tokenizer;  public void run() {  try {    in = new BufferedReader(new InputStreamReader(System.in));    tokenizer = null;    Solution();    in.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   } }  int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(nextToken()); }  String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens())  tokenizer = new StringTokenizer(in.readLine());  return tokenizer.nextToken(); } }
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();  }  static class TaskD {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    final int[] dr = {-1, 0, 1, 0};    final int[] dc = {0, -1, 0, 1};    int height = in.nextInt();    int width = in.nextInt();    int k = in.nextInt();    int[][][] cost = new int[4][height][width];    for (int r = 0; r < height; r++) {     for (int c = 0; c + 1 < width; c++) {      int x = in.nextInt();      cost[3][r][c] = x;      cost[1][r][c + 1] = x;     }    }    for (int r = 0; r + 1 < height; r++) {     for (int c = 0; c < width; c++) {      int x = in.nextInt();      cost[2][r][c] = x;      cost[0][r + 1][c] = x;     }    }    boolean odd = (k % 2 != 0);    k /= 2;    int[][][] d = new int[k + 1][height][width];    for (int len = 1; len <= k; len++) {     for (int r = 0; r < height; r++) {      for (int c = 0; c < width; c++) {       d[len][r][c] = Integer.MAX_VALUE;       for (int dir = 0; dir < 4; dir++) {        int nr = r + dr[dir];        int nc = c + dc[dir];        if (nr < 0 || nr >= height || nc < 0 || nc >= width) {         continue;        }        d[len][r][c] = Math.min(d[len][r][c], d[len - 1][nr][nc] + cost[dir][r][c]);       }      }     }    }    for (int r = 0; r < height; r++) {     for (int c = 0; c < width; c++) {      if (c > 0) {       out.print(" ");      }      out.print(odd ? -1 : 2 * d[k][r][c]);     }     out.println();    }   }  }  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 _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)); }  void debug(Object... objects){  if (ONLINE_JUDGE){  for (Object o: objects){   System.err.println(o.toString());  }  } }    public void run(){  try{  timeBegin = System.currentTimeMillis();  Locale.setDefault(Locale.US);    init();  solve();    out.close();  time();  }catch (Exception e){  e.printStackTrace(System.err);  System.exit(-1);  } }    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';  char readChar() throws IOException{  int intValue = in.read();   if (intValue == -1){  return NOT_A_SYMBOL;  }   return (char) intValue; }  char[] readCharArray() throws IOException{  return readLine().toCharArray(); }    int readInt() throws IOException{  return Integer.parseInt(readString()); }  int[] readIntArray(int size) throws IOException{  int[] array = new int[size];   for (int index = 0; index < size; ++index){  array[index] = readInt();  }   return array; }    long readLong() throws IOException{  return Long.parseLong(readString()); }  long[] readLongArray(int size) throws IOException{  long[] array = new long[size];   for (int index = 0; index < size; ++index){  array[index] = readLong();  }   return array; }    double readDouble() throws IOException{  return Double.parseDouble(readString()); }  double[] readDoubleArray(int size) throws IOException{  double[] array = new double[size];   for (int index = 0; index < size; ++index){  array[index] = readDouble();  }   return array; }    Point readPoint() throws IOException{  return new Point(readInt(), readInt()); }  Point[] readPointArray(int size) throws IOException{  Point[] array = new Point[size];   for (int index = 0; index < size; ++index){  array[index] = readPoint();  }   return array; }    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);  }   public int getPrecision() {  return precision;  }  public void setPrecision(int precision) {  this.precision = precision;    format = createFormat(precision);  formatWithSpace = format + " ";  }   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}};   boolean check(int index, int lim){  return (0 <= index && index < lim); }    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); } }
2	public class CF {  long mod = (long) 1e9 + 9;  class Pair {  long a, b;  public Pair(long a, long b) {  super();  this.a = a % mod;  this.b = b % mod;  }  }  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 st(int n, int m, int k) {  int parts = n / k;  int used = n - m;  if (parts > n - m) {  long cur = 0;  int counter = 0;  int need = parts - (n - m);  for (int i = 1; i <= n; i++) {   if (counter + 1 == k && need <= 0) {   counter = 0;   used--;   } else {   counter++;   cur++;   if (counter == k) {    counter = 0;    cur = (cur * 2) % mod;    need--;   }   }  }  if (used < 0)   throw new AssertionError();  return cur;  } else {  return m;  } }  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());  }  double nextDouble() {  return Double.parseDouble(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();  }  long nextLong() {  return Long.parseLong(next());  } }  InputReader in; PrintWriter out;  void solveIO() throws IOException {  in = new InputReader(System.in);  out = new PrintWriter(System.out);  realSolve();  out.close();  }  void solve() throws IOException {  in = new InputReader(new File("input.txt"));  out = new PrintWriter(new File("output.txt"));  realSolve();  out.close();  }  public static void main(String[] args) throws IOException {  new CF().solveIO(); } }
4	public class A{  Scanner sc=new Scanner(System.in);  void run(){   String s=sc.nextLine();   int n=s.length();   int ans=0;   for(int len=1; len<n; len++){    for(int i=0; i+len<=n; i++){     String t=s.substring(i, i+len);     if(s.indexOf(t,i+1)!=-1){      ans=len;      break;     }    }   }   println(ans+"");  }  void println(String s){   System.out.println(s);  }  void print(String s){   System.out.print(s);  }  public static void main(String[] args){   new A().run();  } }
6	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   String[] parsedString;   int objectNum = 0;   int xStart=0;   int yStart=0;   parsedString = in.readLine().split(" ");   xStart = Integer.parseInt(parsedString[0]);   yStart = Integer.parseInt(parsedString[1]);   objectNum = Integer.parseInt(in.readLine());   int[] xLocs = new int[objectNum+1];   int[] yLocs = new int[objectNum+1];   int[] bitMasks = new int[1<<objectNum];   Arrays.fill(bitMasks, -1);   int[] previous = new int[1<<objectNum];   xLocs[objectNum]=xStart;   yLocs[objectNum]=yStart;   for(int i=0; i<objectNum; i++){    parsedString = in.readLine().split(" ");    xLocs[i] = Integer.parseInt(parsedString[0]);    yLocs[i] = Integer.parseInt(parsedString[1]);   }        int[][] times = new int[objectNum+1][objectNum+1];   for(int i=0;i<=objectNum;i++){    for(int j=0; j<=objectNum;j++){     times[i][j] = times[j][i] = (xLocs[i]-xLocs[j])*(xLocs[i]-xLocs[j])+(yLocs[i]-yLocs[j])*(yLocs[i]-yLocs[j]);    }   }             bitMasks[0] = 0;        for (int i=0; i<(1<<objectNum); i++){    if(bitMasks[i]==-1) {    }else{     for(int j=0; j<objectNum; j++){      if(((1<<j)&i) == 0){       int curState = (1<<j) | i;       int curTime = bitMasks[i] + 2*times[objectNum][j];        if(bitMasks[curState] == -1 || curTime < bitMasks[curState]){        bitMasks[curState] = curTime;        previous[curState] = i;       }        for(int k=0; k<objectNum; k++){        if(((1<<k) & curState) == 0){         int kState = ((1<<k) | curState);                  int kTime = bitMasks[i] + times[objectNum][j] + times[j][k] + times[k][objectNum];         if(bitMasks[kState] == -1 || kTime < bitMasks[kState]){          bitMasks[kState] = kTime;          previous[kState] = i;         }        }       }       break;      }     }    }   }   int finalState = (1<<objectNum)-1;   System.out.println(bitMasks[finalState]);   Deque<Integer> outputQ = new ArrayDeque<Integer>();   outputQ.add(0);   int curState = finalState;   while(curState>0){           int difference = curState ^ previous[curState];    int firstItem = -1;    int secondItem = -1;    for(int i=0; i<objectNum; i++){     if(((1<<i)&difference)>0){      secondItem=firstItem;      firstItem=i;     }    }    if(secondItem!=-1){          outputQ.add(firstItem+1);     outputQ.add(secondItem+1);     outputQ.add(0);    }    else{     outputQ.add(firstItem + 1);     outputQ.add(0);    }    curState = previous[curState];   }   System.out.print(outputQ.removeLast());   while(!outputQ.isEmpty()){    System.out.print(" ");    System.out.print(outputQ.removeLast());   }  } }
4	public class C {  public static void main(String[] args) throws Exception  {  new C(new Scanner(new File("input.txt")), new PrintWriter("output.txt"));  }  int oo = 987654321;  int W, H;  public C(Scanner in, PrintWriter out)  {  W = in.nextInt();  H = in.nextInt();   int[][] grid = new int[W][H];  for (int[] gri : grid)   Arrays.fill(gri, oo);    ArrayDeque<Node> q = new ArrayDeque<Node>();  int K = in.nextInt();  for (int u=0; u<K; u++)  {   q.add(new Node(in.nextInt()-1, in.nextInt()-1, 0));   while (q.size() > 0)   {    Node cur = q.poll();    if (grid[cur.x][cur.y] <= cur.d)     continue;    grid[cur.x][cur.y] = cur.d;    if (cur.x+1<W)     q.add(new Node(cur.x+1, cur.y, cur.d+1));    if (cur.x>0)     q.add(new Node(cur.x-1, cur.y, cur.d+1));    if (cur.y+1<H)     q.add(new Node(cur.x, cur.y+1, cur.d+1));    if (cur.y>0)     q.add(new Node(cur.x, cur.y-1, cur.d+1));   }  }   int res = 0;  for (int j=0; j<H; j++)   for (int i=0; i<W; i++)    res = Math.max(res, grid[i][j]);   for (int j=0; j<H; j++)   for (int i=0; i<W; i++)    if (res == grid[i][j])    {     out.printf("%d %d%n", i+1, j+1);     out.close();     return;    }  } } class Node {  int x, y, d;  public Node(int xx, int yy, int dd)  {  x=xx; y=yy; d=dd;  } }
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);  }  private static 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();  }  static public int nextInt() {   return Integer.parseInt(nextToken());  }  static public long nextLong() {   return Long.parseLong(nextToken());  }  static public String next() {   return nextToken();  }  static public String nextLine() {   try {    return reader.readLine();   } catch (IOException e) {    e.printStackTrace();   }   return null;  } }
1	public class Solution {  public static void main(String[] args) {   FastScanner sc = new FastScanner();   PrintWriter pw = new PrintWriter(System.out);     int tc = sc.ni();   for (int rep = 0; rep < tc; rep++) {    pw.println(solve(sc,pw));      }        pw.close();  }       public static String solve(FastScanner sc, PrintWriter pw) {   int n = sc.ni();   long cur1 = 2;   long cur2 = 4;   long block = 2;   long block2 = 4;   int tmp = 3;   while(cur1<=n||cur2<=n){    if(cur1==n||cur2==n){     return "YES";    }    if(cur1<n){     cur1+=block*tmp;    }    if(cur2<n){     cur2+=block2*tmp;    }    tmp+=2;   }   return "NO";      }                                   public static void printArr(PrintWriter pw,int[] a){   for(int i = 0;i<a.length;i++){    pw.print(a[i]);    if(i!=a.length-1){     pw.print(" ");    }   }   pw.println();  }  public static void print2d(PrintWriter pw,int[][] a){   for(int j=0;j<a.length;j++){    for(int i = 0;i<a[j].length;i++){     pw.print(a[j][i]);     if(i!=a[j].length-1){      pw.print(" ");     }    }    pw.println(" ");   }   pw.println();  }  static int gcd(int a, int b)  {   if (a == 0)    return b;   return gcd(b % a, a);  }  static long gcd(long a, long b) {   if (a == 0) return b;   return gcd(b % a, a);  }  public static int stoi(String s){   return Integer.parseInt(s);  } } 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());  }   int[] intArray(int N) {   int[] ret = new int[N];   for (int i = 0; i < N; i++)    ret[i] = ni();   return ret;  }  int[][] to2di(int m, int n){   int[][] ans = new int[m][n];   for(int i = 0;i<m;i++){    String[] r = nextLine().split("[ ]");    for(int j = 0;j<n;j++){     ans[i][j] = Integer.parseInt(r[j]);    }   }   return ans;  }  long[][] to2dl(int m, int n){   long[][] ans = new long[m][n];   for(int i = 0;i<m;i++){    String[] r = nextLine().split("[ ]");    for(int j = 0;j<n;j++){     ans[i][j] = Long.parseLong(r[j]);    }   }   return ans;  }   long nl() {   return Long.parseLong(next());  }   long[] longArray(int N) {   long[] ret = new long[N];   for (int i = 0; i < N; i++)    ret[i] = nl();   return ret;  }   double nd() {   return Double.parseDouble(next());  }   String nextLine() {   String str = "";   try {    str = br.readLine();   } catch (IOException e) {    e.printStackTrace();   }   return str;  } }
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());   }  } }
5	public class A {   public static void main(String[] args) {  Scanner s = new Scanner(new InputStreamReader(System.in));  int n = s.nextInt();  int [] ar = new int[n];  for (int i = 0; i < n ; i++) {  ar[i] = s.nextInt();  }  if(ar.length == 1){  System.out.println("NO");  }else{  Arrays.sort(ar);  int num = ar[0];  boolean flag = false;  for (int i = 1; i < ar.length; i++) {   if(ar[i]!= num){   System.out.println(ar[i]);   flag = true;   break;   }  }  if(!flag)   System.out.println("NO");  }  } }
5	public class Main {  public static void main(String[] args) throws Exception {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int testCases = 1;   Task solver = new Task();   for (int i = 1; i <= testCases; ++i)    solver.solve(in, out);   out.close();  } } class Task {  public void solve(Scanner in, PrintWriter out) {   int n = in.nextInt();   int a = in.nextInt();   int b = in.nextInt();   int[] complexity = new int[n];   for (int i = 0; i < n; ++i)    complexity[i] = in.nextInt();   Arrays.sort(complexity);   out.println(complexity[b] - complexity[b - 1]);  } }
0	public class Main {  public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String [] line = br.readLine().split(" ");  long l = Long.parseLong(line[0]);  long r = Long.parseLong(line[1]);  if(r-l < 2 || ((r-l == 2) && (l % 2 == 1)))  System.out.println("-1");  else  {  Long start = l + (l%2);   System.out.println(start + " " + (start + 1) + " " + (start + 2));  } } }
0	public class Test{  public static void main(String[] args) {   Scanner in= new Scanner(System.in);   int n=in.nextInt();   if(n%7==0 || n%4==0 || n%47==0 || n%74==0 || n%447==0 || n%474==0 || n%477==0 || n%747==0 || n%774==0){    System.out.println("YES");   }else    System.out.println("NO");    } }
0	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 n = Integer.parseInt(str);  int ans = 0;  if(n>=0) {   ans = n;  } else {   if ( str.length()==2) {   if(str.charAt(0)!='-') {    int a =Integer.parseInt(str.substring(0,1));    int b = Integer.parseInt(str.substring(1,2));    ans = Math.max(a, b);   } else {    ans = Integer.parseInt(str.substring(1,2));   }   } else {   String s1 = str.substring(0,str.length()-2).concat(str.substring(str.length()-2,str.length()-1));   String s2 = str.substring(0,str.length()-2).concat(str.substring(str.length()-1,str.length()));   int a = Integer.parseInt(s1);   int b = Integer.parseInt(s2);   ans = Math.max(a, b);   }  }  bos.write(new Integer(ans).toString().getBytes());  bos.write(eolb);  bos.flush();  } catch(IOException ioe) {  ioe.printStackTrace();  } } }
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 m=in.nextInt();   int k=in.nextInt();   Integer []cap=new Integer[n];   for(int i=0;i<n;i++) {    cap[i]=in.nextInt();   }   Arrays.sort(cap, Collections.reverseOrder());   int count=0;   while(k<m && count<cap.length) {    k+=(cap[count]-1);    ++count;   }   if(k>=m) {    out.println(count);   } else {    out.println(-1);   }  } } class InputReader {  StringTokenizer st;  BufferedReader in;  public InputReader(InputStream ins)  {   in = new BufferedReader(new InputStreamReader(ins));  }  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());  }  }
4	public class Main{  private static Parser in;  private static PrintWriter out;   public static void main(String[] args){   in = new Parser(System.in);   out = new PrintWriter(System.out);          String s = in.nextString(100);   int len = 0;   String ss = "";        l:for (int i = 1; i<=s.length(); i++){    for(int j = 0; j+i<=s.length();j++){     char[] c = new char[i];     char[] cc = new char[i];     s.getChars(j, j+i, c, 0);     String sss = new String(c);         for(int k = j+1; k+i<=s.length();k++){            s.getChars(k, k+i, cc, 0);      String ssss = new String(cc);      if(sss.equals(ssss)) {len = i; continue l;}     }    }   }        System.out.println(len);    } }  class Parser {  final private int BUFFER_SIZE = 1 << 16;  private DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;   public Parser(InputStream in) {    din = new DataInputStream(in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;  }  public String nextString(int size) {   byte[] ch = new byte[size];   int point = 0;   try {    byte c = read();    while (c == ' ' || c == '\n' || c=='\r')     c = read();    while (c != ' ' && c != '\n' && c!='\r') {     ch[point++] = c;     c = read();    }   } catch (Exception e) {}   return new String(ch,0,point);   }  public int nextInt() {  int ret = 0;  boolean neg;  try {   byte c = read();   while (c <= ' ')    c = read();   neg = c == '-';   if (neg)    c = read();   do {    ret = ret * 10 + c - '0';    c = read();   } while (c > ' ');   if (neg) return -ret;  } catch (Exception e) {}  return ret;  }  public long nextLong() {   long ret = 0;   boolean neg;   try {    byte c = read();    while (c <= ' ')     c = read();    neg = c == '-';    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';     c = read();    } while (c > ' ');     if (neg) return -ret;   } catch (Exception e) {}   return ret;   }  private void fillBuffer() {   try {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);   } catch (Exception e) {}   if (bytesRead == -1) buffer[0] = -1;  }   private byte read() {   if (bufferPointer == bytesRead) fillBuffer();   return buffer[bufferPointer++];  } }
3	public class Tt {  public static void main(String[] args) throws IOException {  FastScanner fs=new FastScanner(System.in);  int j = fs.nextInt();  ArrayList<Integer> a =new ArrayList<Integer>();  for(int i=0;i<j;i++) {  a.add(fs.nextInt());  }  Collections.sort(a);  Collections.reverse(a);  int c=0;  while(a.size()!=0) {  int f=a.get(a.size()-1);  c+=1;  for(int q=a.size()-1;q>-1;q--)  if(a.get(q)%f==0) {   a.remove(q);  }  }  System.out.println(c);  } 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 long nextLong() throws IOException{ return Long.parseLong(next()); }  public int nextInt() throws IOException { return Integer.parseInt(next()); }  public double nextDouble() throws IOException { return Double.parseDouble(next()); }  public String nextLine() throws IOException {   if(!st.hasMoreTokens())     return br.readLine();   String ret = st.nextToken();   while(st.hasMoreTokens())     ret += " " + st.nextToken();   return ret;  } }}
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();  } } class TaskC {  public void solve(int testNumber, InputReader in, OutputWriter out) {   int xs = in.readInt();   int ys = in.readInt();   int n = in.readInt();   int[] x = new int[n];   int[] y = new int[n];   IOUtils.readIntArrays(in, x, y);   int[] res = new int[1 << n];   int[] last = new int[1 << n];   Arrays.fill(res, Integer.MAX_VALUE);   int[] ds = new int[n];   for (int i = 0; i < n; i++) {    ds[i] = (x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys);   }   int[][] d = new int[n][n];   for (int i = 0; i < n; i++) {    for (int j = 0; j < n; j++)     d[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);   }   res[0] = 0;   for (int i = 1; i < (1 << n); i++) {    for (int j = 0; j < n; j++) {     if (((i >> j) & 1) != 0) {      if (res[i - (1 << j)] + 2 * ds[j] < res[i]) {       res[i] = res[i - (1 << j)] + 2 * ds[j];       last[i] = i - (1 << j);      }      for (int k = j + 1; k < n; k++) {       if (((i >> k) & 1) != 0) {        if (res[i - (1 << j) - (1 << k)] + ds[j] + ds[k] + d[j][k] < res[i]) {         res[i] = res[i - (1 << j) - (1 << k)] + ds[j] + ds[k] + d[j][k];         last[i] = i - (1 << j) - (1 << k);        }       }      }      break;     }    }   }   int cur = (1 << n) - 1;   out.printLine(res[cur]);   while (cur != 0) {    out.print("0 ");    int dif = cur - last[cur];    for (int i = 0; i < n && dif != 0; i++) {     if (((dif >> i) & 1) != 0) {      out.print((i + 1) + " ");      dif -= (1 << i);     }    }    cur = last[cur];   }   out.printLine("0");  } } 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 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 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 IOUtils {  public static void readIntArrays(InputReader in, int[]... arrays) {   for (int i = 0; i < arrays[0].length; i++) {    for (int j = 0; j < arrays.length; j++)     arrays[j][i] = in.readInt();   }  }  }
3	public class Main { private static BufferedReader br; private static StringTokenizer st; private 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 qq = Integer.MAX_VALUE;   for(int casenum = 1; casenum <= qq; casenum++) {  int n = readInt();  int[] l = new int[n];  for(int i = 0; i < n; i++) {   l[i] = readInt();  }  int ret = 0;  for(int i = 0; i < n; i++) {   for(int j = i+1; j < n; j++) {   if(l[i] > l[j]) {    ret++;   }   }  }  int qqq = readInt();  while(qqq-- > 0) {   int a = readInt();   int b = readInt();   int d = b-a;   ret ^= d*(d+1)/2;   pw.println(ret%2 == 0 ? "even" : "odd");  }  }  exitImmediately(); }  private static void exitImmediately() {  pw.close();  System.exit(0); }  private static long readLong() throws IOException {  return Long.parseLong(nextToken()); }  private static double readDouble() throws IOException {  return Double.parseDouble(nextToken()); }  private static int readInt() throws IOException {  return Integer.parseInt(nextToken()); }  private static String nextLine() throws IOException {  String s = br.readLine();  if(s == null) {  exitImmediately();  }  st = null;  return s; }  private static String nextToken() throws IOException {  while(st == null || !st.hasMoreTokens()) {  st = new StringTokenizer(nextLine().trim());  }  return st.nextToken(); } }
5	public class P015A {  public static void main(String[] args) {   Scanner inScanner = new Scanner(System.in);   int n = inScanner.nextInt();   int t = inScanner.nextInt();   House[] houses = new House[n];   for (int i = 0; i < n; i++)    houses[i] = new House(inScanner.nextInt(), inScanner.nextInt());   Arrays.sort(houses);   int sum = 2;   for (int i = 1; i < n; i++) {    double space = houses[i].leftX - houses[i - 1].rightX;    if (space >= t)     sum++;    if (space > t)     sum++;   }   System.out.println(sum);  }  private static class House implements Comparable<House> {   int x;   double leftX;   double rightX;   public House(int x, int size) {    super();    this.x = x;    leftX = x - (double) size / 2;    rightX = x + (double) size / 2;   }   @Override   public int compareTo(House o) {    return x - o.x;   }  } }
0	public class A199 { static int n[][] = new int[][] { { -1, 0 }, { 1, 0 }, { 0, -1 }, { 0, 1 } };  public static void main(String[] args) throws IOException {  new A199().solve(); }  public void solve() throws IOException {  Scanner scan = new Scanner(System.in);  int N = scan.nextInt();        System.out.println("0 0 " + N ); } }
4	public class Main{ public static void main(String args[]){  Scanner cin = new Scanner(System.in);  String str;  int i,j,k;  int cnt = 0;  char [] strArray;   str = cin.next();  strArray = str.toCharArray();   for(i = 0; i < strArray.length; i ++)  for(j = i + 1; j < strArray.length; j ++)  {   for(k = 0; (((i + k) < strArray.length && (j + k) < strArray.length) && (strArray[i + k] == strArray[j + k])); k ++)   if(k + 1> cnt) cnt = k + 1;  }   System.out.println(cnt); } }
1	public class A { FastScanner in; PrintWriter out; boolean systemIO = true;  public static void quickSort(int[] a, int from, int to) {  if (to - from <= 1) {  return;  }  int i = from;  int j = to - 1;  int x = a[from + (new Random()).nextInt(to - from)];  while (i <= j) {  while (a[i] < x) {   i++;  }  while (a[j] > x) {   j--;  }  if (i <= j) {   int t = a[i];   a[i] = a[j];   a[j] = t;   i++;   j--;  }  }  quickSort(a, from, j + 1);  quickSort(a, j + 1, to); }   public void solve() {  int n = in.nextInt();  HashSet<Long> ans = new HashSet<>();  Long d = in.nextLong();  long[] a = new long[n];  for (int i = 0; i < a.length; i++) {  a[i] = in.nextInt();  }  for (int i = 0; i < a.length; i++) {  long x = a[i] - d;  boolean flag = true;  for (int j = 0; j < a.length; j++) {   if (Math.abs(a[j] - x) < d) {   flag = false;   break;   }  }  if (flag) {   ans.add(x);  }  x = a[i] + d;  flag = true;  for (int j = 0; j < a.length; j++) {   if (Math.abs(a[j] - x) < d) {   flag = false;   break;   }  }  if (flag) {   ans.add(x);  }  }  out.println(ans.size()); }  public void run() {  try {  if (systemIO) {   in = new FastScanner(System.in);   out = new PrintWriter(System.out);  } else {   in = new FastScanner(new File("input.txt"));   out = new PrintWriter(new File("output.txt"));  }  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 nextLine() {  try {   return br.readLine();  } catch (IOException e) {   return null;  }  }  String next() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  }   public static void main(String[] args) {  new A().run(); } }
2	public class icpc {  public static void main(String[] args) throws IOException  {   Reader in = new Reader();   long n = in.nextLong();   long k = in.nextLong();   long val = 2 * n + 2 * k;   long D = 9 + 4 * val;   long sqrtD = (long)Math.sqrt((double)D);   double r1 = (-3 + sqrtD) / 2;   long r1DAsh = (long)r1;   System.out.println(n - r1DAsh);  } } class NumberTheory {  public boolean isPrime(long n)  {   if(n < 2)    return false;   for(long x = 2;x * x <= n;x++)   {    if(n % x == 0)     return false;   }   return true;  }  public ArrayList<Integer> primeFactorisation(int n)  {   ArrayList<Integer> f = new ArrayList<>();   for(int x=2;x * x <= n;x++)   {    while(n % x == 0)    {     f.add(x);     n /= x;    }   }   if(n > 1)    f.add(n);   return f;  }  public int[] sieveOfEratosthenes(int n)  {   int[] sieve = new int[n + 1];   for(int x=2;x<=n;x++)   {    if(sieve[x] != 0)     continue;    sieve[x] = x;    for(int u=2*x;u<=n;u+=x)     if(sieve[u] == 0)      sieve[u] = x;   }   return sieve;  }  public long gcd(long a, long b)  {   if(b == 0)    return a;   return gcd(b, a % b);  }  public long phi(long n)  {   double result = n;   for(long p=2;p*p<=n;p++)   {    if(n % p == 0)    {     while (n % p == 0)      n /= p;     result *= (1.0 - (1.0 / (double)p));    }   }   if(n > 1)    result *= (1.0 - (1.0 / (double)n));   return (long)result;  }  public Name extendedEuclid(long a, long b)  {   if(b == 0)    return new Name(a, 1, 0);   Name n1 = extendedEuclid(b, a % b);   Name n2 = new Name(n1.d, n1.y, n1.x - (long)Math.floor((double)a / b) * n1.y);   return n2;  }  public long modularExponentiation(long a, long b, long n)  {   long d = 1L;   String bString = Long.toBinaryString(b);   for(int i=0;i<bString.length();i++)   {    d = (d * d) % n;    if(bString.charAt(i) == '1')     d = (d * a) % n;   }   return d;  } } class Name {  long d;  long x;  long y;  public Name(long d, long x, long y)  {   this.d = d;   this.x = x;   this.y = y;  } } class SuffixArray {  int ALPHABET_SZ = 256, N;  int[] T, lcp, sa, sa2, rank, tmp, c;  public SuffixArray(String str)  {   this(toIntArray(str));  }  private static int[] toIntArray(String s)  {   int[] text = new int[s.length()];   for (int i = 0; i < s.length(); i++) text[i] = s.charAt(i);   return text;  }  public SuffixArray(int[] text)  {   T = text;   N = text.length;   sa = new int[N];   sa2 = new int[N];   rank = new int[N];   c = new int[Math.max(ALPHABET_SZ, N)];   construct();   kasai();  }  private void construct()  {   int i, p, r;   for (i = 0; i < N; ++i) c[rank[i] = T[i]]++;   for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];   for (i = N - 1; i >= 0; --i) sa[--c[T[i]]] = i;   for (p = 1; p < N; p <<= 1)   {    for (r = 0, i = N - p; i < N; ++i) sa2[r++] = i;    for (i = 0; i < N; ++i) if (sa[i] >= p) sa2[r++] = sa[i] - p;    Arrays.fill(c, 0, ALPHABET_SZ, 0);    for (i = 0; i < N; ++i) c[rank[i]]++;    for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];    for (i = N - 1; i >= 0; --i) sa[--c[rank[sa2[i]]]] = sa2[i];    for (sa2[sa[0]] = r = 0, i = 1; i < N; ++i)    {     if (!(rank[sa[i - 1]] == rank[sa[i]]       && sa[i - 1] + p < N       && sa[i] + p < N       && rank[sa[i - 1] + p] == rank[sa[i] + p])) r++;     sa2[sa[i]] = r;    }    tmp = rank;    rank = sa2;    sa2 = tmp;    if (r == N - 1) break;    ALPHABET_SZ = r + 1;   }  }  private void kasai()  {   lcp = new int[N];   int[] inv = new int[N];   for (int i = 0; i < N; i++) inv[sa[i]] = i;   for (int i = 0, len = 0; i < N; i++)   {    if (inv[i] > 0)    {     int k = sa[inv[i] - 1];     while ((i + len < N) && (k + len < N) && T[i + len] == T[k + len]) len++;     lcp[inv[i] - 1] = len;     if (len > 0) len--;    }   }  } } class ZAlgorithm {  public int[] calculateZ(char input[])  {   int Z[] = new int[input.length];   int left = 0;   int right = 0;   for(int k = 1; k < input.length; k++) {    if(k > right) {     left = right = k;     while(right < input.length && input[right] == input[right - left]) {      right++;     }     Z[k] = right - left;     right--;    } else {         int k1 = k - left;         if(Z[k1] < right - k + 1) {      Z[k] = Z[k1];     } else {      left = k;      while(right < input.length && input[right] == input[right - left]) {       right++;      }      Z[k] = right - left;      right--;     }    }   }   return Z;  }  public ArrayList<Integer> matchPattern(char text[], char pattern[])  {   char newString[] = new char[text.length + pattern.length + 1];   int i = 0;   for(char ch : pattern) {    newString[i] = ch;    i++;   }   newString[i] = '$';   i++;   for(char ch : text) {    newString[i] = ch;    i++;   }   ArrayList<Integer> result = new ArrayList<>();   int Z[] = calculateZ(newString);   for(i = 0; i < Z.length ; i++) {    if(Z[i] == pattern.length) {     result.add(i - pattern.length - 1);    }   }   return result;  } } class KMPAlgorithm {  public int[] computeTemporalArray(char[] pattern)  {   int[] lps = new int[pattern.length];   int index = 0;   for(int i=1;i<pattern.length;)   {    if(pattern[i] == pattern[index])    {     lps[i] = index + 1;     index++;     i++;    }    else    {     if(index != 0)     {      index = lps[index - 1];     }     else     {      lps[i] = 0;      i++;     }    }   }   return lps;  }  public ArrayList<Integer> KMPMatcher(char[] text, char[] pattern)  {   int[] lps = computeTemporalArray(pattern);   int j = 0;   int i = 0;   int n = text.length;   int m = pattern.length;   ArrayList<Integer> indices = new ArrayList<>();   while(i < n)   {    if(pattern[j] == text[i])    {     i++;     j++;    }    if(j == m)    {     indices.add(i - j);     j = lps[j - 1];    }    else if(i < n && pattern[j] != text[i])    {     if(j != 0)      j = lps[j - 1];     else      i = i + 1;    }   }   return indices;  } } class Hashing {  public long[] computePowers(long p, int n, long m)  {   long[] powers = new long[n];   powers[0] = 1;   for(int i=1;i<n;i++)   {    powers[i] = (powers[i - 1] * p) % m;   }   return powers;  }  public long computeHash(String s)  {   long p = 31;   long m = 1_000_000_009;   long hashValue = 0L;   long[] powers = computePowers(p, s.length(), m);   for(int i=0;i<s.length();i++)   {    char ch = s.charAt(i);    hashValue = (hashValue + (ch - 'a' + 1) * powers[i]) % m;   }   return hashValue;  } } class BasicFunctions {  public long min(long[] A)  {   long min = Long.MAX_VALUE;   for(int i=0;i<A.length;i++)   {    min = Math.min(min, A[i]);   }   return min;  }  public long max(long[] A)  {   long max = Long.MAX_VALUE;   for(int i=0;i<A.length;i++)   {    max = Math.max(max, A[i]);   }   return max;  } } class Matrix {  long a;  long b;  long c;  long d;  public Matrix(long a, long b, long c, long d)  {   this.a = a;   this.b = b;   this.c = c;   this.d = d;  } } class MergeSortInt {      void merge(int arr[], int l, int m, int r) {     int n1 = m - l + 1;   int n2 = r - m;      int L[] = new int[n1];   int R[] = new int[n2];      for (int i = 0; i < n1; ++i)    L[i] = arr[l + i];   for (int j = 0; j < n2; ++j)    R[j] = arr[m + 1 + j];         int i = 0, j = 0;      int k = l;   while (i < n1 && j < n2) {    if (L[i] <= R[j]) {     arr[k] = L[i];     i++;    } else {     arr[k] = R[j];     j++;    }    k++;   }      while (i < n1) {    arr[k] = L[i];    i++;    k++;   }      while (j < n2) {    arr[k] = R[j];    j++;    k++;   }  }     void sort(int arr[], int l, int r) {   if (l < r) {       int m = (l + r) / 2;        sort(arr, l, m);    sort(arr, m + 1, r);        merge(arr, l, m, r);   }  } } class MergeSortLong {      void merge(long arr[], int l, int m, int r) {     int n1 = m - l + 1;   int n2 = r - m;      long L[] = new long[n1];   long R[] = new long[n2];      for (int i = 0; i < n1; ++i)    L[i] = arr[l + i];   for (int j = 0; j < n2; ++j)    R[j] = arr[m + 1 + j];         int i = 0, j = 0;      int k = l;   while (i < n1 && j < n2) {    if (L[i] <= R[j]) {     arr[k] = L[i];     i++;    } else {     arr[k] = R[j];     j++;    }    k++;   }      while (i < n1) {    arr[k] = L[i];    i++;    k++;   }      while (j < n2) {    arr[k] = R[j];    j++;    k++;   }  }     void sort(long arr[], int l, int r) {   if (l < r) {       int m = (l + r) / 2;        sort(arr, l, m);    sort(arr, m + 1, r);        merge(arr, l, m, r);   }  } } class Node {  String a;  String b;  Node(String s1,String s2)  {   this.a = s1;   this.b = s2;  }  @Override  public boolean equals(Object ob)  {   if(ob == null)    return false;   if(!(ob instanceof Node))    return false;   if(ob == this)    return true;   Node obj = (Node)ob;   if(this.a.equals(obj.a) && this.b.equals(obj.b))    return true;   return false;  }  @Override  public int hashCode()  {   return (int)this.a.length();  } } class Reader {  final private int BUFFER_SIZE = 1 << 16;  private DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;  public Reader()  {   din = new DataInputStream(System.in);   buffer = new byte[BUFFER_SIZE];   bufferPointer = bytesRead = 0;  }  public Reader(String file_name) throws IOException  {   din = new DataInputStream(new FileInputStream(file_name));   buffer = new byte[BUFFER_SIZE];   bufferPointer = bytesRead = 0;  }  public String readLine() throws IOException  {   byte[] buf = new byte[64];   int cnt = 0, c;   while ((c = read()) != -1)   {    if (c == '\n')     break;    buf[cnt++] = (byte) c;   }   return new String(buf, 0, cnt);  }  public int nextInt() throws IOException  {   int ret = 0;   byte c = read();   while (c <= ' ')    c = read();   boolean neg = (c == '-');   if (neg)    c = read();   do   {    ret = ret * 10 + c - '0';   } while ((c = read()) >= '0' && c <= '9');   if (neg)    return -ret;   return ret;  }  public long nextLong() throws IOException  {   long ret = 0;   byte c = read();   while (c <= ' ')    c = read();   boolean neg = (c == '-');   if (neg)    c = read();   do {    ret = ret * 10 + c - '0';   }   while ((c = read()) >= '0' && c <= '9');   if (neg)    return -ret;   return ret;  }  public double nextDouble() throws IOException  {   double ret = 0, div = 1;   byte c = read();   while (c <= ' ')    c = read();   boolean neg = (c == '-');   if (neg)    c = read();   do {    ret = ret * 10 + c - '0';   }   while ((c = read()) >= '0' && c <= '9');   if (c == '.')   {    while ((c = read()) >= '0' && c <= '9')    {     ret += (c - '0') / (div *= 10);    }   }   if (neg)    return -ret;   return ret;  }  private void fillBuffer() throws IOException  {   bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);   if (bytesRead == -1)    buffer[0] = -1;  }  private byte read() throws IOException  {   if (bufferPointer == bytesRead)    fillBuffer();   return buffer[bufferPointer++];  }  public void close() throws IOException  {   if (din == null)    return;   din.close();  } } class FenwickTree {  public void update(long[] fenwickTree,long delta,int index)  {   index += 1;   while(index < fenwickTree.length)   {    fenwickTree[index] += delta;    index = index + (index & (-index));   }  }  public long prefixSum(long[] fenwickTree,int index)  {   long sum = 0L;   index += 1;   while(index > 0)   {    sum += fenwickTree[index];    index -= (index & (-index));   }   return sum;  } } class SegmentTree {  public int nextPowerOfTwo(int num)  {   if(num == 0)    return 1;   if(num > 0 && (num & (num - 1)) == 0)    return num;   while((num &(num - 1)) > 0)   {    num = num & (num - 1);   }   return num << 1;  }  public int[] createSegmentTree(int[] input)  {   int np2 = nextPowerOfTwo(input.length);   int[] segmentTree = new int[np2 * 2 - 1];   for(int i=0;i<segmentTree.length;i++)    segmentTree[i] = Integer.MIN_VALUE;   constructSegmentTree(segmentTree,input,0,input.length-1,0);   return segmentTree;  }  private void constructSegmentTree(int[] segmentTree,int[] input,int low,int high,int pos)  {   if(low == high)   {    segmentTree[pos] = input[low];    return;   }   int mid = (low + high)/ 2;   constructSegmentTree(segmentTree,input,low,mid,2*pos + 1);   constructSegmentTree(segmentTree,input,mid+1,high,2*pos + 2);   segmentTree[pos] = Math.max(segmentTree[2*pos + 1],segmentTree[2*pos + 2]);  }  public int rangeMinimumQuery(int []segmentTree,int qlow,int qhigh,int len)  {   return rangeMinimumQuery(segmentTree,0,len-1,qlow,qhigh,0);  }  private int rangeMinimumQuery(int segmentTree[],int low,int high,int qlow,int qhigh,int pos)  {   if(qlow <= low && qhigh >= high){    return segmentTree[pos];   }   if(qlow > high || qhigh < low){    return Integer.MIN_VALUE;   }   int mid = (low+high)/2;   return Math.max(rangeMinimumQuery(segmentTree, low, mid, qlow, qhigh, 2 * pos + 1),     rangeMinimumQuery(segmentTree, mid + 1, high, qlow, qhigh, 2 * pos + 2));  } }
1	public class B_14 {  @SuppressWarnings("resource") public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int t = input.nextInt();  for(int test = 0; test < t; test++){  int n = input.nextInt();  if(n % 2 == 0){   if(Math.sqrt(n / 2) == (int)(Math.sqrt(n / 2))){   System.out.println("YES");   }else if(n % 4 == 0 && Math.sqrt(n / 4) == (int)(Math.sqrt(n / 4))){   System.out.println("YES");   }else{   System.out.println("NO");   }  }else{   System.out.println("NO");  }  } }  }
3	public class Main {   static int mod = (int) (1e9+7);   static int MAX = (int)2e5+5;   static void solve()   {     int n = i();     String[] s = new String[n];     for(int i = 0 ; i<n ; i++)     {      s[i] = s();     }     int[][] dp = new int[n][n];     dp[0][0] = 1;     for(int i = 1; i<n; i++)     {      if(s[i-1].equals("f"))      {       for (int j = i-1 ; j>=0 ; j--)       {        dp[i][j+1] = dp[i-1][j];       }      }      else      {       int suff = 0;       for(int j = i-1; j>=0 ; j--)       {        suff += dp[i-1][j];        if(suff>=mod) suff-= mod;        dp[i][j] = suff;       }      }     }     int sum = 0;     for (int i=0 ; i<n; i++)     {      sum = sum+dp[n-1][i];      if(sum>=mod)       sum-=mod;     }     out.println(sum);     out.close();   }      static InputReader sc = new InputReader(System.in);   static PrintWriter out = new PrintWriter(System.out);   public static void main(String[] args)   {     new Thread(null,new Runnable() {     @Override     public void run() {      try{       solve();      }      catch(Exception e){       e.printStackTrace();      }     }     },"1",1<<26).start();   }   static class Pair implements Comparable<Pair>{     int x,y,i;     Pair (int x,int y,int i)     {       this.x = x;       this.y = y;       this.i = i;     }          Pair (int x,int y)     {       this.x = x;       this.y = y;     }       public int compareTo(Pair o)     {       return -(this.y-o.y);     }         public boolean equals(Object o)     {       if (o instanceof Pair) {        Pair p = (Pair)o;        return p.x == x && p.y==y;       }       return false;     }     @Override     public String toString()     {       return x + " "+ y + " "+i;     }       public int hashCode()     {       return new Long(x).hashCode() * 31 + new Long(y).hashCode();     }   }    static class Merge   {     public static void sort(int inputArr[])     {       int length = inputArr.length;       doMergeSort(inputArr,0, length - 1);     }     private static void doMergeSort(int[] arr,int lowerIndex, int higherIndex) {         if (lowerIndex < higherIndex) {        int middle = lowerIndex + (higherIndex - lowerIndex) / 2;        doMergeSort(arr,lowerIndex, middle);        doMergeSort(arr,middle + 1, higherIndex);        mergeParts(arr,lowerIndex, middle, higherIndex);       }     }     private static void mergeParts(int[]array,int lowerIndex, int middle, int higherIndex)     {       int[] temp=new int[higherIndex-lowerIndex+1];       for (int i = lowerIndex; i <= higherIndex; i++) {         temp[i-lowerIndex] = array[i];       }       int i = lowerIndex;       int j = middle + 1;       int k = lowerIndex;       while (i <= middle && j <= higherIndex) {         if (temp[i-lowerIndex] < temp[j-lowerIndex])         {           array[k] = temp[i-lowerIndex];           i++;         }         else         {           array[k] = temp[j-lowerIndex];           j++;         }         k++;       }       while (i <= middle) {         array[k] = temp[i-lowerIndex];         k++;         i++;       }       while(j<=higherIndex){         array[k]=temp[j-lowerIndex];         k++;         j++;       }     }   }   static long add(long a,long b){     long x=(a+b);     while(x>=mod) x-=mod;     return x;   }   static long sub(long a,long b){     long x=(a-b);     while(x<0) x+=mod;     return x;   }   static long mul(long a,long b){     a%=mod;     b%=mod;     long x=(a*b);     return x%mod;   }    static boolean isPal(String s){     for(int i=0, j=s.length()-1;i<=j;i++,j--){       if(s.charAt(i)!=s.charAt(j)) return false;     }     return true;   }   static String rev(String s){     StringBuilder sb=new StringBuilder(s);     sb.reverse();     return sb.toString();   }   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 long gcdExtended(long a,long b,long[] x){     if(a==0){       x[0]=0;       x[1]=1;       return b;     }     long[] y=new long[2];     long gcd=gcdExtended(b%a, a, y);     x[0]=y[1]-(b/a)*y[0];     x[1]=y[0];     return gcd;   }    static long mulmod(long a,long b,long m) {     if (m <= 1000000009) return a * b % m;     long res = 0;     while (a > 0)     {       if ((a&1)!=0)       {         res += b;         if (res >= m) res -= m;       }       a >>= 1;       b <<= 1;       if (b >= m) b -= m;     }     return res;   }   static int abs(int a,int b){     return (int)Math.abs(a-b);   }   public static long abs(long a,long b){     return (long)Math.abs(a-b);   }   static long pow(long n,long p){     long result = 1;     if(p==0)       return 1;     while(p!=0)     {       if(p%2==1)         result *= n;         p >>=1;       n*=n;       }     return result;   }   static void debug(Object... o) {     System.out.println(Arrays.deepToString(o));   }   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 int[] nextIntArray(int n) {     int a[] = new int[n];     for (int i = 0; i < n; i++) {       a[i] = nextInt();     }     return a;   }   public long[] nextLongArray(int n) {     long a[] = new long[n];     for (int i = 0; i < n; i++) {       a[i] = nextLong();     }     return a;   }      public String nextLine() {     int c = snext();     while (isSpaceChar(c))       c = snext();     StringBuilder res = new StringBuilder();     do {       res.appendCodePoint(c);       c = snext();     } while (!isEndOfLine(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;   }   private boolean isEndOfLine(int c) {     return c == '\n' || c == '\r' || c == -1;   }   public interface SpaceCharFilter {     public boolean isSpaceChar(int ch);   }  }  static int i()  {   return sc.nextInt();  }  static long l(){   return sc.nextLong();  }  static int[] iarr(int n)  {   return sc.nextIntArray(n);  }  static long[] larr(int n)  {   return sc.nextLongArray(n);  }  static String s(){   return sc.nextLine();  } }
0	public class Main implements Runnable {  public void _main() throws IOException {  long a = nextLong();  long b = nextLong();  long res = 0;  while (b > 0) {  res += a / b;  long t = a % b;  a = b;  b = t;  }  out.println(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 int nextInt() throws IOException {  return Integer.parseInt(next()); }  private long nextLong() throws IOException {  return Long.parseLong(next()); }  private double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static void main(String[] args) {  Locale.setDefault(Locale.UK);  new Thread(new Main()).start(); }  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);       _main();   out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(202);  } } }
3	public class utkarsh{ BufferedReader br; PrintWriter out;  int game(int s, int mid, int e, int[] a){  int i, j, n, m;  n = mid - s + 1;  m = e - mid;  int b[] = new int[n];  int c[] = new int[m];  for(i = 0; i < n; i++) b[i] = a[s + i];  for(j = 0; j < m; j++) c[j] = a[mid + 1 + j];  i = j = 0;  int ans = 0;  for(int k = s; k <= e; k++){  if(i == n){   a[k] = c[j++];  }else if(j == m){   a[k] = b[i++];  }else{   if(b[i] < c[j]){   a[k] = b[i++];   }else{   a[k] = c[j++];   ans += n - i;   }  }  }  return ans; }  int play(int s, int e, int[] a){  if(s >= e) return 0;  int m = (s + e) >> 1;  return play(s, m, a) + play(m+1, e, a) + game(s, m, e, a); }  void solve(){  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   int i, j, k, l, r, n;  n = ni();  int a[] = new int[n];  int d[] = new int[n];  for(i = 0; i < n; i++) {  a[i] = ni();  d[i] = a[i];  }  int ans = (play(0, n-1, d) & 1);  int q = ni();  while(q-- > 0){  l = ni(); r = ni();  ans ^= ((r - l + 1) * (r - l) / 2);    if((ans & 1) > 0) out.println("odd");  else  out.println("even");  }  out.flush(); }  int ni(){  return Integer.parseInt(ns()); }  String ip[]; int len, sz;  String ns(){  if(len >= sz){  try{   ip = br.readLine().split(" ");   len = 0;   sz = ip.length;  }catch(IOException e){   throw new InputMismatchException();  }  if(sz <= 0) return "-1";  }  return ip[len++]; }  public static void main(String[] args){ new utkarsh().solve(); } }
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);    }   }  } }
5	public class TaskD {  public static void main (String[] args) throws IOException {   FastScanner fs = new FastScanner(System.in);   PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));   int n = fs.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = fs.nextInt();   }     HashMap<Integer,Integer> h = new HashMap<Integer,Integer>(n);   BigInteger s = new BigInteger(""+a[0]);   BigInteger x = new BigInteger("0");   h.put(a[0], 1);   for (int i = 1; i < n; i++) {          x = x.add(new BigInteger(""+(((long)i)*((long)a[i]))));    x = x.subtract(s);    s = s.add(new BigInteger(""+a[i]));    Integer q = null;    q = h.get(a[i]-1);       if (q != null) {     x = x.subtract(new BigInteger(""+q));    }    q = h.get(a[i]+1);       if (q != null) {     x = x.add(new BigInteger(""+q));    }    q = h.get(a[i]);       if (q != null) {     h.put(a[i], q + 1);    } else {     h.put(a[i], 1);    }   }   pw.println(x);   pw.close();  }  static class FastScanner {   BufferedReader reader;   StringTokenizer tokenizer;   FastScanner(InputStream i) {    reader = new BufferedReader(new InputStreamReader(i));    tokenizer = new StringTokenizer("");   }   String next() throws IOException {    while(!tokenizer.hasMoreTokens()) tokenizer = new StringTokenizer(reader.readLine());    return tokenizer.nextToken();   }   int nextInt() throws IOException {    return Integer.parseInt(next());   }   long nextLong() throws IOException {    return Long.parseLong(next());   }  } }
5	public class Solver {  StringTokenizer st;  BufferedReader in;  PrintWriter out;  public static void main(String[] args) throws NumberFormatException, IOException {   Solver solver = new Solver();   solver.open();   solver.solve();   solver.close();  }  public void open() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);  }  public String nextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  public int nextInt() throws NumberFormatException, IOException {   return Integer.parseInt(nextToken());  }  public long nextLong() throws NumberFormatException, IOException {   return Long.parseLong(nextToken());  }  public double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextToken());  }  public void solve() throws NumberFormatException, IOException {   int n = nextInt();     int[] ar = new int[n];   int sum = 0;     for (int i=0;i<n;i++){    ar[i]=nextInt();    sum+=ar[i];      }     Arrays.sort(ar);     int me = 0;   int k = 0;   while (me<=sum){    k++;    int coin = ar[ar.length-k];    me += coin;    sum -= coin;   }     out.println(k);  }  public void close() {   out.flush();   out.close();  } }
5	public class P166A {  public static void main(String[] args) throws Exception {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int k = in.nextInt();   Point[] P = new Point[n];   for(int i=0; i<n; i++)    P[i] = new Point(in.nextInt(), in.nextInt());   Arrays.sort(P, new Comparator<Point>() {    public int compare(Point A, Point B) {     if(A.x != B.x) return B.x-A.x;     return A.y - B.y;    }   });   int cnt = 0;   Point ans = P[k-1];   for(int i=0; i<n; i++) {    if(P[i].x == ans.x && P[i].y==ans.y)     cnt++;   }   System.out.println(cnt);  } }
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();   }   String nextLine() {    if (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      return reader.readLine();     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken("\n");   }   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;   }   long[] nextLongArray(int n) {    long[] a = new long[n];    for (int i = 0; i < n; i++)     a[i] = nextLong();    return a;   }  }  static <A> void writeLines(A[] as, Function<A, String> f) {   PrintWriter pw = new PrintWriter(System.out);   for (A a : as) {    pw.println(f.apply(a));   }   pw.flush();  }  static void writeLines(int[] as) {   PrintWriter pw = new PrintWriter(System.out);   for (int a : as) pw.println(a);   pw.flush();  }  static void writeLines(long[] as) {   PrintWriter pw = new PrintWriter(System.out);   for (long a : as) pw.println(a);   pw.flush();  }  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;  }  static void debug(Object... args) {   StringJoiner j = new StringJoiner(" ");   for (Object arg : args) {    if (arg instanceof int[]) j.add(Arrays.toString((int[]) arg));    else if (arg instanceof long[]) j.add(Arrays.toString((long[]) arg));    else if (arg instanceof double[]) j.add(Arrays.toString((double[]) arg));    else if (arg instanceof Object[]) j.add(Arrays.toString((Object[]) arg));    else j.add(arg.toString());   }   System.err.println(j.toString());  } }
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] + " ");   }  } }
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)); } }
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 CFD {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  final long MOD = 1000L * 1000L * 1000L + 7;  int[] dx = {0, -1, 0, 1};  int[] dy = {1, 0, -1, 0};   void solve() throws IOException {   int n = nextInt();   long[] arr = nextLongArr(n);   long[] diff = new long[n];   long presum = 0;   for (int i = n - 1; i >= 0; i--) {    diff[i] = presum - (n - i - 1) * arr[i];    presum += arr[i];   }   BigInteger pairs = new BigInteger("0");   for (long s : diff) {    pairs = pairs.add(new BigInteger(Long.toString(s)));   }   BigInteger need = new BigInteger("0");   Map<Long, Long> hm = new HashMap<>();   for (int i = n - 1; i >= 0; i--) {    long v1 = hm.getOrDefault(arr[i] - 1, 0L) * (-1);    need = need.add(new BigInteger(Long.toString(v1)));    long v2 = hm.getOrDefault(arr[i] + 1, 0L);    need = need.add(new BigInteger(Long.toString(v2)));    hm.put(arr[i], hm.getOrDefault(arr[i], 0L) + 1);   }   BigInteger res = pairs.subtract(need);   out(res.toString());  }  void shuffle(long[] a) {   int n = a.length;   for(int i = 0; i < n; i++) {    int r = i + (int) (Math.random() * (n - i));    long tmp = a[i];    a[i] = a[r];    a[r] = tmp;   }  }  private void outln(Object o) {   out.println(o);  }  private void out(Object o) {   out.print(o);  }  public CFD() 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 CFD();  }  public long[] nextLongArr(int n) throws IOException{   long[] res = new long[n];   for(int i = 0; i < n; i++)    res[i] = nextLong();   return res;  }  public int[] nextIntArr(int n) throws IOException {   int[] res = new int[n];   for(int i = 0; i < n; i++)    res[i] = nextInt();   return res;  }  public String nextToken() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return null;    }   }   return st.nextToken();  }  public String nextString() {   try {    return br.readLine();   } catch (IOException e) {    eof = true;    return null;   }  }  public int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  public long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  public double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
5	public class a {  void solve() throws Exception {  int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();  int a[] = new int[n];  for (int i = 0; i<n; i++){  a[i] = in.nextInt();  }  Arrays.sort(a);  int sum = 0;  if (k >= m){  out.println(0);  return;  }  sum = a[n-1] + k - 1;  int j = 1;  for (int i = n-2; i >=0 && sum < m; i--, j++){  sum += a[i] - 1;  }  if (sum < m){  out.println(-1);  }else{  out.println(j);  } }  FastScanner in; PrintWriter out;  String input = ""; String output = "";  void run() {  try {  if (input.length() > 0) {   in = new FastScanner(new BufferedReader(new FileReader(input)));  } else   in = new FastScanner(new BufferedReader(new InputStreamReader(    System.in)));  if (output.length() > 0)   out = new PrintWriter(new FileWriter(output));  else   out = new PrintWriter(System.out);   solve();   out.flush();  out.close();  } catch (Exception ex) {  ex.printStackTrace();  out.flush();  out.close();  } finally {  out.close();  } }  public static void main(String[] args) {  new a().run(); }  class FastScanner {  BufferedReader bf;  StringTokenizer st;  public FastScanner(BufferedReader bf) {  this.bf = bf;  }  public String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(bf.readLine());  return st.nextToken();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  return bf.readLine();  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public double nextDouble() throws IOException {  return Double.parseDouble(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;   }    double nextDouble() {    boolean neg = false;    if (c == NC) c = getChar();    for (; (c < '0' || c > '9'); c = getChar()) {     if (c == '-') neg = true;    }    double cur = nextLong();    if (c != '.') {     return neg ? -cur : cur;    } else {     double frac = nextLong() / cnt;     return neg ? -cur - frac : cur + frac;    }   }    String next() {    StringBuilder res = new StringBuilder();    while (c <= 32) c = getChar();    while (c > 32) {     res.append(c);     c = getChar();    }    return res.toString();   }    String nextLine() {    StringBuilder res = new StringBuilder();    while (c <= 32) c = getChar();    while (c != '\n') {     res.append(c);     c = getChar();    }    return res.toString();   }    boolean hasNext() {    if (c > 32) return true;    while (true) {     c = getChar();     if (c == NC) return false;     else if (c > 32) return true;    }   }  }   static void ASSERT(boolean assertion, String message) {   if (!assertion) throw new AssertionError(message);  }   static void ASSERT(boolean assertion) {   if (!assertion) throw new AssertionError();  } }
0	public class Main {  public static void main(String[] args) {   Scanner sc =new Scanner(System.in);   long r,l;   r = sc.nextLong();   l = sc.nextLong();     if ((r+2)>l) { System.out.print("-1"); return;}    if ((r % 2) == 0) {    System.out.print(r);     System.out.print(" ");     System.out.print(r+1);     System.out.print(" ");     System.out.print(r+2);return; }     if((r+3)<=l )     { System.out.print(r+1);     System.out.print(" ");     System.out.print(r+2);     System.out.print(" ");     System.out.print(r+3);return; }    System.out.print("-1");   } }
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));   } }
1	public class Main implements Runnable { BufferedReader in; PrintStream out;  StringTokenizer st = new StringTokenizer(""); static boolean local = false;  public static void main(String [] args) throws Exception {  if (args.length > 0) local = true;  new Thread(new Main()).start(); }  void printExit(String s) {  out.println(s);  System.exit(0); }  public void run() {  try {  Locale.setDefault(Locale.US);  in = local ? new BufferedReader(new FileReader("input.txt")) : new BufferedReader(new InputStreamReader(System.in));  out = local ? new PrintStream(new File("output.txt")) : new PrintStream(System.out);  int n = nextInt();  char [] c = in.readLine().toCharArray();  int t = 0;  for (int i = 0; i < n; i++)   if (c[i] == 'T') t++;   int ans = n;  for (int i = 0; i < n; i++) {   int cnt = 0;   for (int j = 0; j < t; j++)   if (c[(i + j) % n] == 'H')    cnt++;   ans = min(ans, cnt);  }   out.println(ans);  }  catch (Exception e) {  e.printStackTrace();  } }  boolean seekForToken() {  try {  while (!st.hasMoreTokens()) {   String s = in.readLine();   if (s == null) {    return false;   }   st = new StringTokenizer(s);  }  return true;  }  catch (IOException e) {   e.printStackTrace();   return false;  }  }  int nextInt() {  return Integer.parseInt(nextToken());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  }  BigInteger nextBigInteger() {   return new BigInteger(nextToken());  }  String nextToken() {   seekForToken();   return st.nextToken();  } }
2	public class B  {  public static void main(String args[]) throws Exception  {   BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));    StringTokenizer st = new StringTokenizer(infile.readLine());   int N = Integer.parseInt(st.nextToken());   int K = Integer.parseInt(st.nextToken());         long x = (long)N;   long low = 0L;   long high = N;   while(low != high)   {    x = (low+high+1)/2;    long add = (x*(x+1))/2;    long y = N-x;    if(add-y > K)     high = x;    else if(add-y == K)    {     System.out.println(y);     break;    }    else     low = x;   }     }  public static void sort(int[] arr)  {   PriorityQueue<Integer> pq = new PriorityQueue<Integer>();   for(int a: arr)    pq.add(a);   for(int i=0; i < arr.length; i++)    arr[i] = pq.poll();  }  }
5	public class A {  final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  BufferedReader in;  PrintWriter out;  StringTokenizer tok = new StringTokenizer("");  class Pointd implements Comparable<Pointd>{   int x, in;   @Override   public int compareTo(Pointd o) {    if(x > o.x) return 1;    if(x < o.x) return -1;    if(in < o.in) return -1;    if(in > o.in) return 1;    return 0;   }   public Pointd(int x, int in) {    super();    this.x = x;    this.in = in;   }  }   void solve() throws IOException {   int n = readInt();   Pointd[] a = new Pointd[n];   for(int i = 0; i < n; i++){    a[i] = new Pointd(readInt(), i);   }   Arrays.sort(a);     int count = 0;   for(int i = 0; i < n; i++){    if(a[i].x != a[a[i].in].x) count++;   }   if(count == 0 || count == 2) out.println("YES");   else out.println("NO");  }    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());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  int[] readArr(int n) throws IOException {   int[] res = new int[n];   for (int i = 0; i < n; i++) {    res[i] = readInt();   }   return res;  }  long[] readArrL(int n) throws IOException {   long[] res = new long[n];   for (int i = 0; i < n; i++) {    res[i] = readLong();   }   return res;  }  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);   }  } }
1	public class Solution {  static class FastReader {   BufferedReader br;   StringTokenizer st;   public FastReader(String s) {    try {     br = new BufferedReader(new FileReader(s));    } catch (FileNotFoundException e) {         e.printStackTrace();    }   }   public FastReader() {    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());   }   String nextLine() throws IOException {    return br.readLine();   }   long nextLong() {    return Long.parseLong(nextToken());   }   double nextDouble() {    return Double.parseDouble(nextToken());   }   float nextFloat() {    return Float.parseFloat(nextToken());   }  }   static FastReader f = new FastReader();  static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  static StringTokenizer st;  static StringBuilder sb = new StringBuilder();  static long[] fact;  static int[] inputArray(int n) throws IOException {   int[] a = new int[n];   for(int i = 0 ; i < n ; i++) {    a[i] = f.nextInt();   }   return a;  }  static long[] inputLongArray(int n) throws IOException {   long[] a = new long[n];   for(int i = 0 ; i < n ; i++) {    a[i] = f.nextLong();   }   return a;  }  static long gcd(long a , long b) {   if(a == 0 || b == 0) {    return Math.max(a , b);   }     if(a % b == 0) {    return b;   }   return gcd(b , a % b);  }  static void initializeFact() {   fact = new long[MAX_N];   for(int i = 0 ; i < fact.length ; i++) {    if(i == 0) {     fact[i] = 1;    }    else {     fact[i] = fact[i-1] * i % mod;    }   }  }  static long longModulus(long x , long m) {   if(x < m) {    return x;   }   long d = x / m;   return x - d * m;  }   static BitSet sieveOfEratosthenes(int n)  {   BitSet isPrime = new BitSet(n+1);   isPrime.set(0, n + 1);   isPrime.set(0);   isPrime.set(1);   for(int i = 2; i * i <= n ; i++)   {    if(isPrime.get(i))     for(int j = i * i ; j <= n; j += i)      isPrime.clear(j);   }   return isPrime;  }  static long moduloInversePrime(long a) {     return modPow(a , mod - 2);  }  static long mult(long a, long b)  {   return (a * b % mod);  }  static long modPow(long a, int step)  {   long ans = 1;   while(step != 0)   {    if((step & 1) != 0)     ans = mult(ans , a);    a = mult(a , a);    step >>= 1;   }   return ans;  }  static int query(int l , int r) {   System.out.println("? " + l + " " + r);   System.out.flush();   return f.nextInt();  }  static int sum(int n) {   return n * (n + 1) / 2;  }  private static final int mod = (int) (1e9 + 7);  static int MAX_N = (int) Math.sqrt(1e9);   public static void main(String[] args) throws IOException {   int test = f.nextInt();    TreeSet<Integer> set = new TreeSet<>();   for(int i = 1 ; i <= MAX_N ; i++) {    set.add(i*i*2);    set.add(i*i*4);   }    for(int t = 1 ; t <= test ; t++) {    int n = f.nextInt();    if(set.contains(n)) {     sb.append("YES").append("\n");    }    else {     sb.append("NO").append("\n");    }   }   System.out.println(sb);  }  }
6	public class ELR {  static double solveUnweighted (int nodes, long curr, long pool, long excl) {  if (pool == 0 && excl == 0) {  int cnt = 0;  for (int i = 0; i < nodes; i++)   if ((curr & 1L << i) > 0)   cnt++;    double cont = (k / (cnt*1.0));  double edges = (cnt) * (cnt - 1) / 2.0;  return cont * cont * edges;  }  double res = 0;  int j = 0;  for (int i = 0; i < nodes; i++)  if ((pool & 1L << i) > 0 || (excl & 1L << i) > 0)   j = i;  for (int i = 0; i < nodes; i++) {  if ((pool & 1L << i) == 0 || adj[i][j])   continue;  long ncurr = curr, npool = 0, nexcl = 0;  ncurr |= 1L << i;   for (int k = 0; k < nodes; k++) {   if (adj[i][k]) {   npool |= pool & 1L << k;   nexcl |= excl & 1L << k;   }  }  res = Math.max(res, solveUnweighted(nodes, ncurr, npool, nexcl));   pool &= ~(1L << i);  excl |= 1L >> i;  }  return res; } public static void main(String[] args) {new Thread(null, new Runnable() { public void run() {try {  sol(); } catch (Throwable e) {   e.printStackTrace(); }}}, "2",1<<26).start();}  static int n,k; static boolean adj[][]; public static void sol() throws Throwable {  Scanner sc = new Scanner(System.in);  n = sc.nextInt();  k = sc.nextInt();  adj = new boolean[n][n];  for (int i = 0 ; i < n ; ++i) {  for (int j = 0 ; j < n ; ++j) {   adj[i][j] = sc.nextInt() == 1;  }  }  double ans = solveUnweighted(n, 0, (1L << n) - 1, 0);  System.out.println(ans); }  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 String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public boolean ready() throws IOException {  return br.ready();  } } }
2	public class main {  static long d,x,y; public static void main(String[] args) {  FastScanner in = new FastScanner();    long x = in.nextLong(), k = in.nextLong();   long mod = 1000000007;   long one = pow(2,k,mod);   one %= mod;   long two = (2*x)%mod-1;   two %= mod;   long ans = (one*two)%mod+1;   ans %= mod;   if(ans<0)  ans += mod;   if(x==0)  System.out.println("0");  else  System.out.println(ans);    } private static long pow(long a, long b, long mod) {  if(b==0) return 1;   if(b==1)  return a;   if(b%2==0)  return pow((a*a)%mod,b/2,mod);  else  return (a*pow((a*a)%mod,(b-1)/2,mod))%mod;   }     }      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(); }  int nextInt() {  return Integer.parseInt(next()); }  long nextLong() {  return Long.parseLong(next()); } }
0	public class A {  BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof;  void solve() throws IOException {  String s = nextToken();  int res = Integer.parseInt(s);   String s1 = s.substring(0, s.length() - 1);  res = Math.max(res, Integer.parseInt(s1));   String s2 = s.substring(0, s.length() - 2) + s.charAt(s.length() - 1);  res = Math.max(res, Integer.parseInt(s2));   out.println(res); }  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(); }  String nextString() {  try {  return br.readLine();  } catch (IOException e) {  eof = true;  return null;  } }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
4	public class Main { public static void main(String[] args) throws IOException {  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) {}   new Main().run();   } catch (IOException e) {   e.printStackTrace();   }  }  }, "1", 1L << 24).start();  }  BufferedReader in; PrintWriter out; StringTokenizer st = new StringTokenizer("");  int N; int M; boolean[][] used; Queue<Integer> queue;  int[] dx = { -1, 0, 1, 0 }; int[] dy = { 0, -1, 0, 1 }; int ans = -1;  void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter("output.txt");   N = nextInt();  M = nextInt();  used = new boolean [N][M];  queue = new ArrayDeque<Integer> (N * M);  for (int K = nextInt(); K --> 0; )  addState(nextInt() - 1, nextInt() - 1);  while (!queue.isEmpty()) {  int cv = queue.poll();  int cx = cv / M;  int cy = cv % M;  for (int d = 0; d < dx.length; d++) {   int nx = cx + dx[d];   int ny = cy + dy[d];   if (0 <= nx && nx < N && 0 <= ny && ny < M && !used[nx][ny])   addState(nx, ny);  }  }  out.println((1 + ans / M) + " " + (1 + ans % M));  out.close(); }  void addState(int x, int y) {  used[x][y] = true;  queue.add(ans = code(x, y)); }  int code(int x, int y) {  return x * M + y; }  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()); }  String nextLine() throws IOException {  st = new StringTokenizer("");  return in.readLine(); }  boolean EOF() throws IOException {  while (!st.hasMoreTokens()) {  String s = in.readLine();    if (s == null) {   return true;  }    st = new StringTokenizer(s);  }   return false; } }
3	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }   int min;   int count = 0;   int c = 0;   while (count != n) {    min = 1000;    for (int i = 0; i < n; i++) {     if (a[i] < min) {      min = a[i];     }    }    for (int i = 0; i < n; i++) {     if (a[i] != 1000 && a[i] % min == 0) {      count++;      a[i] = 1000;     }    }    c++;   }   System.out.println(c);  } }
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];  static {   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();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }  } }
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);  } } }
4	public class Main {  private static StreamTokenizer in;  private static PrintWriter out;  private static BufferedReader inB;   private static int nextInt() throws Exception{   in.nextToken();   return (int)in.nval;  }   private static String nextString() throws Exception{   in.nextToken();   return in.sval;  }   static{          try {   inB = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));   out = new PrintWriter(new FileOutputStream("output.txt"));   } catch(Exception e) {}     in = new StreamTokenizer(inB);  }   private static int[][] mind;  private static boolean[][] used;   private static int n,m;   public static void main(String[] args)throws Exception {   n = nextInt();   m = nextInt();   int k = nextInt();   int[][] mas = new int[k][2];     for(int i = 0; i<k; i++) {    mas[i][0] = nextInt()-1;    mas[i][1] = nextInt()-1;   }     mind = new int[n][m];   used = new boolean[n][m];   for(int i = 0; i<n; i++) {    Arrays.fill(mind[i], Integer.MAX_VALUE);   }     ArrayDeque<int[]> ad = new ArrayDeque<int[]>();     for(int i = 0; i<k; i++) {    ad.add(new int[] {mas[i][0], mas[i][1], 0});   }     while(!ad.isEmpty()) {    int[] cur = ad.remove();       if(used[cur[0]][cur[1]])continue;    int x = cur[0]; int y = cur[1]; int d = cur[2];    mind[x][y] = ++d;    used[x][y] = true;       if(isValid(x+1,y) && !used[x+1][y]) ad.add(new int[] {x+1, y, d});       if(isValid(x,y+1) && !used[x][y+1]) ad.add(new int[] {x, y+1, d});    if(isValid(x,y-1) && !used[x][y-1]) ad.add(new int[] {x, y-1, d});       if(isValid(x-1,y) && !used[x-1][y]) ad.add(new int[] {x-1, y, d});      }     int max = Integer.MIN_VALUE;   int maxx = 0, maxy = 0;     for(int i = 0; i<n; i++) {    for(int j = 0; j<m; j++) {     if(mind[i][j] > max) {      max = mind[i][j];      maxx = i+1;      maxy = j+1;     }    }   }     out.println(maxx + " " + maxy);   out.flush();  }   private static boolean isValid(int x, int y) {   return x>=0 && x<n && y>=0 && y<m;  }        private static void println(Object o) throws Exception {   System.out.println(o);  }  private static void exit(Object o) throws Exception {   println(o);   exit();  }  private static void exit() {   System.exit(0);  }  }
5	public class A {  private class Pair {  public final int prob;  public final int time;   public Pair(int prob, int time) {  this.prob = prob;  this.time = time;  } }  private void solve() throws IOException {  int n = nextInt();  int k = nextInt();   Pair[] p = new Pair[n];  for (int i = 0; i < n; i++) {  p[i] = new Pair(nextInt(), nextInt());  }   Arrays.sort(p, new Comparator<Pair>() {  @Override  public int compare(Pair o1, Pair o2) {   if (o1.prob == o2.prob) {   return o1.time - o2.time;   }   return o2.prob - o1.prob;  }  });   int time = p[k - 1].time;  int prob = p[k - 1].prob;  int res = 0;  for (int i = 0; i < n; i++) {  if (p[i].time == time && p[i].prob == prob) {   res++;  }  }  println(res); }  private String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  tokenizer = new StringTokenizer(reader.readLine());  }  return tokenizer.nextToken(); }  private int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(nextToken()); }  private double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(nextToken()); }  private long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  private void print(Object o) {  writer.print(o); }  private void println(Object o) {  writer.println(o); }  private void printf(String format, Object... o) {  writer.printf(format, o); }  public static void main(String[] args) {  long time = System.currentTimeMillis();  Locale.setDefault(Locale.US);  new A().run();  System.err.printf("%.3f\n", 1e-3 * (System.currentTimeMillis() - time)); }  BufferedReader reader; StringTokenizer tokenizer; PrintWriter writer;  private void run() {  try {  reader = new BufferedReader(new InputStreamReader(System.in));  writer = new PrintWriter(System.out);  solve();  reader.close();  writer.close();  } catch (IOException e) {  e.printStackTrace();  System.exit(13);  } } }
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();  } }  class FastScanner {  BufferedReader br;  StringTokenizer st;  FastScanner(File f) {  try {   br = new BufferedReader(new FileReader(f));  } catch (FileNotFoundException e) {   e.printStackTrace();  }  }  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 solve().run(); } }
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; }  long[] nextLongArray(int size) throws IOException {  long[] ret = new long [size];  for (int i = 0; i < size; i++)  ret[i] = nextLong();  return ret; }  double[] nextDoubleArray(int size) throws IOException {  double[] ret = new double [size];  for (int i = 0; i < size; i++)  ret[i] = nextDouble();  return ret; }  String nextLine() throws IOException {  st = new StringTokenizer("");  return in.readLine(); }  boolean EOF() throws IOException {  while (!st.hasMoreTokens()) {  String s = in.readLine();  if (s == null)   return true;  st = new StringTokenizer(s);  }  return false; }   void printRepeat(String s, int count) {  for (int i = 0; i < count; i++)  out.print(s); }  void printArray(int[] array) {  if (array == null || array.length == 0)  return;  for (int i = 0; i < array.length; i++) {  if (i > 0) out.print(' ');  out.print(array[i]);  }  out.println(); }  void printArray(long[] array) {  if (array == null || array.length == 0)  return;  for (int i = 0; i < array.length; i++) {  if (i > 0) out.print(' ');  out.print(array[i]);  }  out.println(); }  void printArray(double[] array) {  if (array == null || array.length == 0)  return;  for (int i = 0; i < array.length; i++) {  if (i > 0) out.print(' ');  out.print(array[i]);  }  out.println(); }  void printArray(double[] array, String spec) {  if (array == null || array.length == 0)  return;  for (int i = 0; i < array.length; i++) {  if (i > 0) out.print(' ');  out.printf(Locale.US, spec, array[i]);  }  out.println(); }  void printArray(Object[] array) {  if (array == null || array.length == 0)  return;  boolean blank = false;  for (Object x : array) {  if (blank) out.print(' '); else blank = true;  out.print(x);  }  out.println(); }  @SuppressWarnings("rawtypes") void printCollection(Collection collection) {  if (collection == null || collection.isEmpty())  return;  boolean blank = false;  for (Object x : collection) {  if (blank) out.print(' '); else blank = true;  out.print(x);  }  out.println(); }   static String memoryStatus() {  return (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory() >> 20) + "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB"; }  static void checkMemory() {  System.err.println(memoryStatus()); }  static long prevTimeStamp = Long.MIN_VALUE;  static void updateTimer() {  prevTimeStamp = System.currentTimeMillis(); }  static long elapsedTime() {  return (System.currentTimeMillis() - prevTimeStamp); }  static void checkTimer() {  System.err.println(elapsedTime() + " ms"); }  static void chk(boolean f) {  if (!f) throw new RuntimeException("Assert failed"); }  static void chk(boolean f, String format, Object ... args) {  if (!f) throw new RuntimeException(String.format(format, args)); }  static void log(String format, Object ... args) {  if (writeLog) System.err.println(String.format(Locale.US, format, args)); } }
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();   Team[] t = new Team[N];   for (int i=0; i<N; i++) t[i] = new Team(in.nextInt(), in.nextInt());   Arrays.sort(t);   int p_k = t[k-1].p, t_k = t[k-1].t;   int count = 0;   for (int i=0; i<N; i++) if (t[i].p==p_k && t[i].t ==t_k) count++;   out.println(count); } } class Team implements Comparable<Team>{  int p, t;  Team(int a, int b) { p=a; t=b;}  public int compareTo(Team g) {   if (p < g.p) return 1;   if (p > g.p) return -1;   if (t < g.t) return -1;   if (t > g.t) return 1;   return 0;  }  }
5	public class Solution {  public static void main(String[] args) throws IOException  {   new Solution().run();  }  StreamTokenizer in;  Scanner ins;  PrintWriter out;   int nextInt() throws IOException  {   in.nextToken();    return (int)in.nval;  }    void run() throws IOException  {   if(System.getProperty("ONLINE_JUDGE")!=null)   {    in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));    ins = new Scanner(System.in);    out = new PrintWriter(System.out);   }   else   {       in = new StreamTokenizer(new BufferedReader(new FileReader("input.txt")));       ins = new Scanner(new FileReader("input.txt"));    out = new PrintWriter(new FileWriter("output.txt"));   }   int n = nextInt(),k = nextInt();   Team[] A = new Team[n];   for(int i = 0; i < n; i++)   {    A[i] = new Team();    A[i].p = nextInt(); A[i].t = nextInt();   }   Arrays.sort(A);        k--;   int sum = 0;   for(int i = 0; i < n; i++)    if(A[k].compareTo(A[i])==0)     sum++;     out.print(sum);   out.close();  }     class Team implements Comparable  {   public int p,t;   public int compareTo(Object obj)   {    Team a = (Team) obj;    if(p>a.p || p==a.p && t<a.t)           return -1;    else         if(p==a.p && t==a.t)      return 0;     else      return 1;   }    } }
3	public class PaintColor {  public static void main(String[] args) throws Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(br.readLine());   String input[] = br.readLine().split(" ");   int c = 0;   Set<Integer> s = new HashSet<>();   int arr[] = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = Integer.parseInt(input[i]);   }   Arrays.sort(arr);   for (int i = 0; i < n; i++) {    if (!s.contains(arr[i])) {     c++;     for (int j = i; j < n; j++) {      if (arr[j] % arr[i] == 0) {       s.add(arr[j]);      }     }    }   }   System.out.println(c);  } }
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 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.nextInt();    int ar[] = in.nextIntArray(n);    long dp[][] = new long[n][n];    long ct = 0;    for (int i = 0; i < n; i++) {     for (int j = i + 1; j < n; j++) {      if (ar[i] > ar[j]) {       dp[i][j]++;       ct++;      }     }    }    for (int i = n - 2; i >= 0; i--) {     for (int j = i + 1; j < n; j++) {      dp[i][j] += dp[i + 1][j];     }    }    int m = in.nextInt();    for (int i = 0; i < m; i++) {     int l = in.nextInt() - 1;     int r = in.nextInt() - 1;     long val = (r - l + 1);     long estimated = (val * (val - 1)) / 2;     long change = estimated - dp[l][r];         ct = ct - dp[l][r];     dp[l][r] = change;     ct += dp[l][r];     if (ct % 2 == 0) {      out.println("even");     } else {      out.println("odd");     }         }    }  }  static class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar;   private int snumChars;   public InputReader(InputStream st) {    this.stream = st;   }   public int read() {        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 = read();    while (isSpaceChar(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public int[] nextIntArray(int n) {    int a[] = new int[n];    for (int i = 0; i < n; i++) {     a[i] = nextInt();    }    return a;   }   public boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
6	public class G1 { public static void main(String[] args) throws Exception {  new G1().run();  }  int MOD = 1_000_000_007; public void run() throws Exception {  FastScanner f = new FastScanner();   PrintWriter out = new PrintWriter(System.out);   int n = f.nextInt(), t = f.nextInt();   int[][] dp = new int[1 << n][3];   int[] tarr = new int[n];   int[] garr = new int[n];   for(int i = 0; i < n; i++) {    tarr[i] = f.nextInt();    garr[i] = f.nextInt()-1;    if(tarr[i] <= t) dp[1 << i][garr[i]] = 1;   }   int[] time = new int[1 << n];   for(int i = 0; i < dp.length; i++) {    for(int bi = 0; bi < n; bi++)     if((i & 1 << bi) != 0) time[i] += tarr[bi];   }   for(int i = 0; i < dp.length; i++) {    int j = time[i];     for(int k = 0; k < 3; k++) {      if(dp[i][k] == 0) continue;      for(int bi = 0; bi < n; bi++)       if(tarr[bi] + j <= t && (i & 1 << bi) == 0 && garr[bi] != k) {          dp[i | 1 << bi][garr[bi]] =           (dp[i | 1 << bi][garr[bi]] + dp[i][k]) % MOD;       }     }   }   long ans = 0;   for(int i = 0; i < dp.length; i++)    for(int j = 0; j < 3; j++)    if(time[i] == t) ans = (ans + dp[i][j]) % 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());   }   public long nextLong() {   return Long.parseLong(next());   }   public double nextDouble() {   return Double.parseDouble(next());   }   public String nextLine() {   try {    return reader.readLine();   } catch(IOException e) {    throw new RuntimeException(e);   }   }  } }
4	public class D7182 {  public static void main(String[] args) throws IOException {   init_io();   int N = nint(), M = nint(), K = nint();   if (K % 2 == 0) {    int[][][] grid = new int[K+1][N][M];    int[][][] edges = new int[4][N][M];    for (int i = 0; i < N; i++) {     for (int j = 0; j < M-1; j++) {      edges[0][i][j] = edges[2][i][j+1] = nint();     }    }    for (int i = 0; i < N-1; i++) {     for (int j = 0; j < M; j++) {      edges[1][i][j] = edges[3][i+1][j] = nint();     }    }    for (int k = 1; k <= K/2; k++) {     for (int i = 0; i < N; i++) {      for (int j = 0; j < M; j++) {       int min = Integer.MAX_VALUE;       if (i != N-1) {        min = Math.min(min, grid[k-1][i+1][j] + edges[1][i][j]);       }       if (j != M-1) {        min = Math.min(min, grid[k-1][i][j+1] + edges[0][i][j]);       }       if (i != 0) {        min = Math.min(min, grid[k-1][i-1][j] + edges[3][i][j]);       }       if (j != 0) {        min = Math.min(min, grid[k-1][i][j-1] + edges[2][i][j]);       }       grid[k][i][j] = min;      }     }    }    for (int i = 0; i < N; i++) {     for (int j = 0; j < M; j++) {      out.print(grid[K/2][i][j]*2 + " ");     }     out.println();    }   }   else {    for (int i = 0; i < N; i++) {     for (int j = 0; j < M; j++) {      out.print(-1 + " ");     }     out.println();    }   }   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)));  } }
4	public class C_CF {  public static void main(String[] args) {   FastScanner57 fs = new FastScanner57();   PrintWriter pw = new PrintWriter(System.out);   int t = fs.ni();     for (int tc = 0; tc < t; tc++) {    int n = fs.ni();    int[] q = new int[n+5];    int ind = 0;    q[0] = 1;    for (int i = 0; i < n; i++) {     int a = fs.ni();     while (q[ind]!=a) ind--;     StringBuilder sb = new StringBuilder();     for (int j = 0; j < ind; j++) {      sb.append(q[j]-1);      sb.append(".");     }      sb.append(a);      q[ind]++;      q[ind+1] = 1;      ind++;      pw.println(sb);    }   }   pw.close();  }  static class BIT18 {   int[] bit;   public BIT18(int size) {    bit = new int[size];   }   public void update(int ind, int delta) {    while (ind < bit.length) {     bit[ind] += delta;     ind = ind + (ind & (-1 * ind));    }   }   public int sum(int ind) {    int s = 0;    while (ind > 0) {     s += bit[ind];     ind = ind - (ind & (-1 * ind));    }    return s;   }   public int query(int l, int r) {    return sum(r) - sum(l);   }  }     public static long recur(int ind, int p, int prev, long[] v, Long[][] dp, long[][] lr, List<List<Integer>> list) {   long last = v[0];   long ls = 0L;   long rs = 0L;   if (p == 1) {    last = v[1];   }   if (ind != 0) {    ls += (long) Math.abs(last - lr[ind][0]);   }   if (ind != 0) {    rs += (long) Math.abs(last - lr[ind][1]);   }   if (dp[ind][p] != null) {    return dp[ind][p];   }   long[] cur = lr[ind];   List<Integer> temp = list.get(ind);   for (int val : temp) {    if (prev == val) {     continue;    }    ls += recur(val, 0, ind, cur, dp, lr, list);    rs += recur(val, 1, ind, cur, dp, lr, list);   }   return dp[ind][p] = Math.max(ls, rs);  }  public static void sort(long[] a) {   List<Long> list = new ArrayList();   for (int i = 0; i < a.length; i++) {    list.add(a[i]);   }   Collections.sort(list);   for (int i = 0; i < a.length; i++) {    a[i] = list.get(i);   }  }  public static long gcd(long n1, long n2) {   if (n2 == 0) {    return n1;   }   return gcd(n2, n1 % n2);  } } class UnionFind16 {  int[] id;  public UnionFind16(int size) {   id = new int[size];   for (int i = 0; i < size; i++) {    id[i] = i;   }  }  public int find(int p) {   int root = p;   while (root != id[root]) {    root = id[root];   }   while (p != root) {    int next = id[p];    id[p] = root;    p = next;   }   return root;  }  public void union(int p, int q) {   int a = find(p), b = find(q);   if (a == b) {    return;   }   id[b] = a;  } } class FastScanner57 {  BufferedReader br;  StringTokenizer st;  public FastScanner57() {   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());  }  int[] intArray(int N) {   int[] ret = new int[N];   for (int i = 0; i < N; i++) {    ret[i] = ni();   }   return ret;  }  long nl() {   return Long.parseLong(next());  }  long[] longArray(int N) {   long[] ret = new long[N];   for (int i = 0; i < N; i++) {    ret[i] = nl();   }   return ret;  }  double nd() {   return Double.parseDouble(next());  }  String nextLine() {   String str = "";   try {    str = br.readLine();   } catch (IOException e) {    e.printStackTrace();   }   return str;  } }
5	public class Main{  public static void main(String[] args) throws Exception {   Parserdoubt12 s = new Parserdoubt12(System.in);     int n = s.nextInt();     int a[] = new int[n];   for (int i = 0; i < n; i++) {    a[i] = s.nextInt();   }     int copy[] = a.clone();   Arrays.sort(a);   int count = 0;   for (int i = 0; i < copy.length; i++) {    if(a[i] != copy[i]) count++;   }   if(count <= 2) System.out.println("YES");   else System.out.println("NO");  }    }  class Parserdoubt12 {  final private int BUFFER_SIZE = 1 << 17;   private DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;   public Parserdoubt12(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 char nextChar() throws Exception  {   byte c=read();   while(c<=' ') c= read();   return (char)c;  }  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 Main {  StreamTokenizer in; int n, k;  public void run() {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  read();  print(solve()); }  void read() {  n = nextInt();  }  int solve() {  int result = n;  if (result < 0) {  int res1 = n / 10;  int mod = n % 10;    int res2 = res1 / 10 * 10 + mod;  if (res1 > res2)   result = res1;  else   result = res2;  }   return result; }  void print(int result) {  System.out.println(result); }   public static void main(String[] Args) {  new Main().run(); }  public int nextInt() {  try {  in.nextToken();  }  catch (Exception e) {}  return (int)in.nval; }  public String nextString() {  try {  in.nextToken();  }  catch (Exception e) {}  return in.sval; } }
5	public class a{  static int a;  static Scanner sc = new Scanner(System.in);  public static void main(String[] args) throws IOException{   int n = sc.nextInt();   int p = n;   int m = sc.nextInt();   int k = sc.nextInt();   int a[] = new int[n];   for (int i = 0; i < n; i++)   {    a[i] = sc.nextInt() - 1;   }   Arrays.sort(a);   int j =0;   for(int i=0; i<n; i++){    if(m > k){     k = k + a[n-i-1];     j++;    }   }   if(m > k)    System.out.println(-1);   else    System.out.println(j);  }  }
2	public class C {  String fileName = "<name>";  public static final int MOD = (int) (1e9 + 7);  public void solve() throws IOException {   long x = nextLong();   if (x == 0) {    out.print(0);    return;   }   long k = nextLong();   BigInteger power = BigInteger.valueOf(2)     .modPow(BigInteger.valueOf(k), BigInteger.valueOf(MOD));   BigInteger r = BigInteger.valueOf(x).multiply(power);   BigInteger l = r.subtract(power).add(BigInteger.ONE);   out.print(l.add(r).mod(BigInteger.valueOf(MOD)));  }  public void run() {   try {    br = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();    out.close();   } catch (IOException e) {    e.printStackTrace();    System.exit(1);   }  }  BufferedReader br;  StringTokenizer in;  PrintWriter 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());  }  public double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  public long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);   new C().run();  } }
4	public class C {  static BufferedReader br;  static StringTokenizer st;  static PrintWriter pw;  static String nextToken() {   try {    while (st == null || !st.hasMoreTokens()) {     st = new StringTokenizer(br.readLine());    }   } catch (IOException e) {    e.printStackTrace();   }   return st.nextToken();  }  static int nextInt() {   return Integer.parseInt(nextToken());  }  static long nextLong() {   return Long.parseLong(nextToken());  }  static double nextDouble() {   return Double.parseDouble(nextToken());  }  static String nextLine() {   try {    return br.readLine();   } catch (IOException e) {    e.printStackTrace();   }   return null;  }  public static void main(String[] args) {   br = new BufferedReader(new InputStreamReader(System.in));   pw = new PrintWriter(System.out);   solve();   pw.close();  }  private static void solve() {   int t = nextInt();   int[] stack = new int[1000000];   for (int i = 0; i < t; i++) {    int n = nextInt();    stack[0] = nextInt();    int id = 1;    pp(stack, id);    for (int j = 1; j < n; j++) {     int x = nextInt();     if (x == 1) {      stack[id++] = x;     } else {      while (true) {       int p = stack[--id];       if (p + 1 == x) {        stack[id++] = x;        break;       }      }     }     pp(stack, id);    }   }  }  private static void pp(int[] stack, int size) {   for (int i = 0; i < size - 1; i++) {    pw.print(stack[i] + ".");   }   pw.println(stack[size - 1]);  }  }
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());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  BigInteger nextBigInteger() throws IOException {   return new BigInteger(nextToken());  } }
1	public class Main {  BufferedReader in; StringTokenizer str = null; PrintWriter out;  private String next() throws Exception{  while (str == null || !str.hasMoreElements())  str = new StringTokenizer(in.readLine());  return str.nextToken(); }  private int nextInt() throws Exception{  return Integer.parseInt(next()); }  private long nextLong() throws Exception{  return Long.parseLong(next()); }  private double nextDouble() throws Exception{  return Double.parseDouble(next()); }  final int oo = Integer.MAX_VALUE;  int [][]s; int n, ALL; public void run() throws Exception{  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  n = nextInt();  char []a = next().toCharArray();  s = new int[n][52];  boolean []set = new boolean[52];  for(int i = 0; i < n; ++i) {  int pos = get(a[i]);  if (!set[pos]) {   ++ALL;   set[pos] = true;  }  for(int j = 0; j < 52; ++j) {   if (i > 0) {   s[i][j] += s[i-1][j];   }   if (j == pos) {   s[i][j]++;   }  }  }  int ret = oo;  for(int i = 0; i < n; ++i) {  ret = Math.min(ret, get(i));  }  out.println(ret);  out.close(); }  private int get(int i) {  int lo = i - 1, hi = n;  while(hi - lo > 1) {  int m = lo + (hi - lo) / 2;  int c = 0;  for(int j = 0; j < 52; ++j) {   if (sum(j, i, m) > 0) {   ++c;   }  }  if (c < ALL) {   lo = m;  } else {   hi = m;  }  }  if (hi != n) {  return hi - i + 1;  }  return oo; }  private int sum(int pos, int l, int r) {  int ret = s[r][pos];  if (l > 0) ret -= s[l - 1][pos];  return ret; }  private int get(char x) {  if ('a' <= x && x <= 'z') return (int)(x - 'a');  return (int)(x - 'A' + 26); }  public static void main(String[] args) throws Exception{  new Main().run(); } }
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);     }   int nextInt() {  try {   in.nextToken();   return Integer.parseInt(in.sval);  } catch (IOException e) {   throw new Error();  }  }   String next() {  try {   in.nextToken();   return in.sval;  } catch (IOException e) {   throw new Error();  }  } }    static class Value implements Comparable <Value> {  int x;  int pos;   Value(int x, int pos) {  this.x = x;  this.pos = pos;  }   public int compareTo(Value second) {  if (this.x == second.x) {   return this.pos - second.pos;  } else {   return this.x - second.x;  }  } }  void solve() {  int n = in.nextInt();   Value ar[] = new Value[n];  for (int i = 0; i < n; i++) {  ar[i] = new Value(in.nextInt(), i);  }  Arrays.sort(ar);  int cnt = 0;   for (int i = 0; i < n; i++) {  if (ar[i].pos != i && ar[ar[i].pos].x != ar[i].x) {   cnt++;     }  }  if (cnt > 2) {  out.println("NO");  } else {  out.println("YES");  } }  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(); } }
3	public class C { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni();  int mod = 1000000007;  long[] dp = new long[5005];  dp[0] = 1;  for(int i = 0;i < n;i++){  char c = nc();  if(c == 's'){   if(i < n-1){   for(int j = 5003;j >= 0;j--){    dp[j] += dp[j+1];    if(dp[j] >= mod)dp[j] -= mod;   }   }  }else{   for(int j = 5003;j >= 0;j--){   dp[j+1] = dp[j];   }   dp[0] = 0;  }  }  long ans = 0;  for(int i = 0;i < 5005;i++)ans += dp[i];  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 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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
5	public class TaskA {  class Contest implements Comparable<Contest>  {   int problems;   int penalty;   Contest (int problems, int penalty) {    this.problems = problems;    this.penalty = penalty;   }   public int compareTo(Contest contest) {    if(problems != contest.problems) return contest.problems - problems;    return penalty - contest.penalty;    }  }  void run(){   int n = nextInt(), k = nextInt();   Contest[] c = new Contest[n];   for(int i = 0; i < n; i++) {    c[i] = new Contest(nextInt(), nextInt());   }   Arrays.sort(c);   int cproblem = c[k - 1].problems, cpenalty = c[k - 1].penalty;   int ans = 0;   for(int i = 0; i < n; i++) {    if(c[i].problems == cproblem && c[i].penalty == cpenalty) ans++;   }   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;   }  }  double nextDouble(){   return Double.parseDouble(next());  }  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;   }  }  String nextLine(){   try{    StringBuilder res = new StringBuilder("");    int c = System.in.read();    while(c == '\r' || c == '\n')     c = System.in.read();    do{     res.append((char)c);     c = System.in.read();    }while(c != '\r' && c != '\n');    return res.toString();   }catch(Exception e){    return null;   }  }  public static void main(String[] args){   new TaskA().run();  } }
1	public class Polycarp{  public static void main(String args[]){  Scanner s = new Scanner(System.in);   int rem[] = new int[3];   Arrays.fill(rem,-1);  rem[0] = 0;   char ch[] = s.next().toCharArray();  int n = ch.length;  long dp[] = new long[n];   int sum = 0;    for(int i=0;i<ch.length;i++){   sum = sum + (ch[i]-48);   if(rem[sum%3] != -1)   if(i>0){   dp[i] = Math.max(dp[i-1],dp[rem[sum%3]]+1);}   else   dp[i] = 1;   else   if(i>0)    dp[i] = dp[i-1];        rem[sum%3] = i;   sum = sum%3;    }       System.out.println(dp[n-1]);      } }
0	public class Counterexample {  public static void main(String[] args) {   Scanner sc= new Scanner(System.in);  long l=sc.nextLong(),r=sc.nextLong();  if (l%2==0&&r-l>=2) System.out.print(l+" "+(l+1)+" "+(l+2));  else if (l%2==1&&r-l>=3) System.out.print((l+1)+" "+(l+2)+" "+(l+3));  else System.out.print("-1"); } }
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() {   long x = io.readLong(), k = io.readLong();   if(x==0){    io.writeLine("0");    return;   }   long res = ((pow(2, k+1, MOD) * (x % MOD)) % MOD - pow(2, k, MOD) % MOD + 1 + MOD) % MOD;   io.writeLine(res+"");  }  long pow(long a, long p, long mod) {   long res = 1;   while (p > 0) {    if (p % 2 == 1) res = (res * a) % mod;    a = (a * a) % mod;    p /= 2;   }   return res;  } }  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 void writeInt(int a) {this.out.print(a);this.out.print(' ');}  public void writeWord(String s){   this.out.print(s);  }  public void writeIntArray(int[] a, int k, String separator) {   StringBuilder sb = new StringBuilder();   for (int i = 0; i < k; i++) {    if (i > 0) sb.append(separator);    sb.append(a[i]);   }   this.writeLine(sb.toString());  }  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 long[] readLongArray() {   String[]n=this.readLine().trim().split("\\s+");long[]r=new long[n.length];   for(int i=0;i<n.length;i++)r[i]=Long.parseLong(n[i]);   return r;  }  public int[] readIntArray() {   String[]n=this.readLine().trim().split("\\s+");int[]r=new int[n.length];   for(int i=0;i<n.length;i++)r[i]=Integer.parseInt(n[i]);   return r;  }  public int[] readIntArray(int n) {   int[] res = new int[n];   char[] all = this.readLine().toCharArray();   int cur = 0;boolean have = false;   int k = 0;   boolean neg = false;   for(int i = 0;i<all.length;i++){    if(all[i]>='0' && all[i]<='9'){     cur = cur*10+all[i]-'0';     have = true;    }else if(all[i]=='-') {     neg = true;    }    else if(have){     res[k++] = neg?-cur:cur;     cur = 0;     have = false;     neg = false;    }   }   if(have)res[k++] = neg?-cur:cur;   return res;  }  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;   }  }  public String readWord() {   try {    boolean start = false;    StringBuilder sb = new StringBuilder();    while (true) {     int c = br.read();     if (c!= ' ' && c!= '\r' && c!='\n' && c!='\t') {      sb.append((char)c);      start = true;     } else if (start || c == -1) return sb.toString();    }   } catch (Exception ex) {    return "";   }  }  public char readSymbol() {   try {    while (true) {     int c = br.read();     if (c != ' ' && c != '\r' && c != '\n' && c != '\t') {      return (char) c;     }    }   } catch (Exception ex) {    return 0;   }  } } class Pair {  public Pair(int a, int b) {this.a = a;this.b = b;}  public int a;  public int b; } class PairLL {  public PairLL(long a, long b) {this.a = a;this.b = b;}  public long a;  public long b; } class Triple {  public Triple(int a, int b, int c) {this.a = a;this.b = b;this.c = c;}  public int a;  public int b;  public int c; }
6	public class Main { public static void main(String[] args) throws IOException {      new Main().run();   }  BufferedReader in; PrintWriter out; StringTokenizer st = new StringTokenizer("");  int vNum; int eNum; boolean[][] g;  void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  vNum = nextInt();  eNum = nextInt();  g = new boolean [vNum][vNum];  for (int e = 0; e < eNum; e++) {  int u = nextInt() - 1;  int v = nextInt() - 1;  g[u][v] = g[v][u] = true;  }       out.println(optimizedDP());   out.close(); }   long naiveDP() {  long[] count = new long [vNum + 1];  int size = 1 << vNum;  long[][] dp = new long [size][vNum];  for (int begin = 0; begin < vNum; begin++) {  for (long[] row : dp) fill(row, 0L);  dp[1 << begin][begin] = 1L;  for (int mask = 0; mask < size; mask++) {   int len = Integer.bitCount(mask);   for (int v = 0; v < vNum; v++) {   long cval = dp[mask][v];   if (cval == 0L) continue;   if (g[v][begin]) count[len] += cval;   for (int nv = 0; nv < vNum; nv++) {    if (g[v][nv]) {    int nmask = mask | (1 << nv);    if (nmask != mask)     dp[nmask][nv] += cval;    }   }   }  }  }  long ret = 0L;  for (int len = 3; len <= vNum; len++) {  if (count[len] % (len * 2) != 0) System.err.println("ERROR!");  ret += count[len] / len / 2;  }  return ret; }  long optimizedDP() {  long[] count = new long [vNum + 1];  long[][] dp = new long [1 << vNum][vNum];  for (int last = vNum - 1; last >= 0; last--) {  int size = 1 << last;  for (int mask = 0; mask < size; mask++)   fill(dp[mask], 0, last, 0L);  for (int nv = 0; nv < last; nv++)   if (g[last][nv]) dp[1 << nv][nv] = 1L;  for (int mask = 0; mask < size; mask++) {   int len = Integer.bitCount(mask) + 1;   for (int v = 0; v < last; v++) {   long cval = dp[mask][v];   if (cval == 0L) continue;   if (g[v][last]) count[len] += cval;   for (int nv = 0; nv < last; nv++) {    if (g[v][nv]) {    int nmask = mask | (1 << nv);    if (nmask != mask)     dp[nmask][nv] += cval;    }   }   }  }  }  long ret = 0L;  for (int len = 3; len <= vNum; len++) {  if (count[len] % 2 != 0) System.err.println("ERROR!");  ret += count[len] >> 1;  }  return ret; }  void genFullGraph(int vNum) {  this.vNum = vNum;  this.eNum = vNum * (vNum - 1) / 2;  g = new boolean [vNum][vNum];  for (int i = 0; i < vNum; i++)  for (int j = i + 1; j < vNum; j++)   g[i][j] = g[j][i] = true;    }   static long b2mb(long b) {  return b >> 20; }  static void checkMemory() {  System.err.println(b2mb(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) + "/" + b2mb(Runtime.getRuntime().totalMemory()) + " MB"); }   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()); }  String nextLine() throws IOException {  st = new StringTokenizer("");  return in.readLine(); }  boolean EOF() throws IOException {  while (!st.hasMoreTokens()) {  String s = in.readLine();  if (s == null)   return true;  st = new StringTokenizer(s);  }  return false; } }
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 templ implements Runnable{  static class pair implements Comparable  {   int f;   int s;   pair(int fi,int se)   {    f=fi;    s=se;   }   public int compareTo(Object o)   {    pair pr=(pair)o;    if(s>pr.s)     return 1;    if(s==pr.s)    {     if(f>pr.f)      return 1;     else      return -1;    }    else     return -1;   }   public boolean equals(Object o)   {    pair ob=(pair)o;    int ff;    int ss;    if(o!=null)    {     ff=ob.f;     ss=ob.s;     if((ff==this.f)&&(ss==this.s))      return true;    }    return false;   }   public int hashCode()   {    return (this.f+" "+this.s).hashCode();   }  }  public class triplet implements Comparable  {   int f,t;   int s;   triplet(int f,int s,int t)   {    this.f=f;    this.s=s;    this.t=t;   }   public boolean equals(Object o)   {    triplet ob=(triplet)o;    int ff;    int ss;    int tt;    if(o!=null)    {     ff=ob.f;     ss=ob.s;     tt=ob.t;     if((ff==this.f)&&(ss==this.s)&&(tt==this.t))      return true;    }    return false;   }   public int hashCode()   {    return (this.f+" "+this.s+" "+this.t).hashCode();   }   public int compareTo(Object o)   {    triplet tr=(triplet)o;    if(t>tr.t)     return 1;    else     return -1;   }  }  void merge1(int arr[], int l, int m, int r)  {   int n1 = m - l + 1;   int n2 = r - m;   int L[] = new int [n1];   int R[] = new int [n2];   for (int i=0; i<n1; ++i)    L[i] = arr[l + i];   for (int j=0; j<n2; ++j)    R[j] = arr[m + 1+ j];   int i = 0, j = 0;   int k = l;   while (i < n1 && j < n2)   {    if (L[i]<=R[j])    {     arr[k] = L[i];     i++;    }    else    {     arr[k] = R[j];     j++;    }    k++;   }   while (i < n1)   {    arr[k] = L[i];    i++;    k++;   }   while (j < n2)   {    arr[k] = R[j];    j++;    k++;   }  }  void sort1(int arr[], int l, int r)  {   if (l < r)   {    int m = (l+r)/2;    sort1(arr, l, m);    sort1(arr , m+1, r);    merge1(arr, l, m, r);   }  }  public static void main(String args[])throws Exception  {   new Thread(null,new templ(),"templ",1<<27).start();  }  public void run()  {   try   {    InputReader in = new InputReader(System.in);    PrintWriter out = new PrintWriter(System.out);    int n=in.ni();    int x=in.ni();    long l=1,r=n;    while(l<=r)    {     long mid=(l+r)/2;     long k=(mid*(mid+1))/2-(n-mid);     if(k==x)     {      out.println((n-mid));      break;     }     else if(k<x)      l=mid+1;     else      r=mid-1;    }    out.close();   }   catch(Exception e){    return;   }  }  static class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar, snumChars;   public InputReader(InputStream stream) {    this.stream = stream;   }   public int read() {    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 ni() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public long nl() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;    do {     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public int[] nextIntArray(int n) {    int a[] = new int[n];    for (int i = 0; i < n; i++) {     a[i] = ni();    }    return a;   }   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 String nextLine() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isEndOfLine(c));    return res.toString();   }   public 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 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);   TaskE1 solver = new TaskE1();   solver.solve(1, in, out);   out.close();  }  static class TaskE1 {   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[] 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) {        for (int shift = 0; shift < n; shift++) {         int sum = 0;         for (int i = 0; i < n; i++) {          if ((submask & (1 << i)) > 0) {           sum += a[(i + shift) % n][j];          }         }         nd[mask] = Math.max(nd[mask], d[mask ^ submask] + sum);        }       }      }      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());   }  } }
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);  }  }
3	public class D_Edu_Round_35 {  public static long MOD = 1000000007;  public static void main(String[] args) throws FileNotFoundException {        PrintWriter out = new PrintWriter(System.out);   Scanner in = new Scanner();   int n = in.nextInt();   int[] data = new int[n];   for (int i = 0; i < n; i++) {    data[i] = in.nextInt();   }   FT tree = new FT(n + 1);   int result = 0;   for (int i = n - 1; i >= 0; i--) {    tree.update(data[i], 1);    result += tree.get(data[i] - 1);    result %= 2;   }   int q = in.nextInt();   int[] tmp = new int[n];   for (int i = 0; i < q; i++) {    int l = in.nextInt() - 1;    int r = in.nextInt() - 1;    int total = r - l + 1;    total = total * (total - 1) / 2;    total %= 2;    result += total;    result %= 2;    if (result % 2 == 0) {     out.println("even");    } else {     out.println("odd");    }   }   out.close();  }  public static int[] KMP(String val) {   int i = 0;   int j = -1;   int[] result = new int[val.length() + 1];   result[0] = -1;   while (i < val.length()) {    while (j >= 0 && val.charAt(j) != val.charAt(i)) {     j = result[j];    }    j++;    i++;    result[i] = j;   }   return result;  }  public static boolean nextPer(int[] data) {   int i = data.length - 1;   while (i > 0 && data[i] < data[i - 1]) {    i--;   }   if (i == 0) {    return false;   }   int j = data.length - 1;   while (data[j] < data[i - 1]) {    j--;   }   int temp = data[i - 1];   data[i - 1] = data[j];   data[j] = temp;   Arrays.sort(data, i, data.length);   return true;  }  public static int digit(long n) {   int result = 0;   while (n > 0) {    n /= 10;    result++;   }   return result;  }  public static double dist(long a, long b, long x, long y) {   double val = (b - a) * (b - a) + (x - y) * (x - y);   val = Math.sqrt(val);   double other = x * x + a * a;   other = Math.sqrt(other);   return val + other;  }  public static class Point implements Comparable<Point> {   int x, y;   public Point(int start, int end) {    this.x = start;    this.y = end;   }   @Override   public int hashCode() {    int hash = 5;    hash = 47 * hash + this.x;    hash = 47 * hash + this.y;    return hash;   }   @Override   public boolean equals(Object obj) {    if (obj == null) {     return false;    }    if (getClass() != obj.getClass()) {     return false;    }    final Point other = (Point) obj;    if (this.x != other.x) {     return false;    }    if (this.y != other.y) {     return false;    }    return true;   }   @Override   public int compareTo(Point o) {    return Integer.compare(x, o.x);   }  }  public static class FT {   int[] data;   FT(int n) {    data = new int[n];   }   public void update(int index, int value) {    while (index < data.length) {     data[index] += value;     data[index] %= 2;     index += (index & (-index));    }   }   public int get(int index) {    int result = 0;    while (index > 0) {     result += data[index];     result %= 2;     index -= (index & (-index));    }    return result;   }  }  public static long gcd(long a, long b) {   if (b == 0) {    return a;   }   return gcd(b, a % b);  }  public static long pow(long a, long b, 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 long nextLong() {    return Long.parseLong(next());   }   public int nextInt() {    return Integer.parseInt(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    st = null;    try {     return br.readLine();    } catch (Exception e) {     throw new RuntimeException();    }   }   public boolean endLine() {    try {     String next = br.readLine();     while (next != null && next.trim().isEmpty()) {      next = br.readLine();     }     if (next == null) {      return true;     }     st = new StringTokenizer(next);     return st.hasMoreTokens();    } catch (Exception e) {     throw new RuntimeException();    }   }  } }
5	public class Main {  static int N;  static int[] U, V;  static int[] A;  public static void main(String[] args) {   FastScanner sc = new FastScanner(System.in);   N = sc.nextInt();   U = new int[N-1];   V = new int[N-1];   for (int i = 0; i < N - 1; i++) {    U[i] = sc.nextInt()-1;    V[i] = sc.nextInt()-1;   }   A = sc.nextIntArray(N, -1);   System.out.println(solve() ? "Yes" : "No");  }  static boolean solve() {   if( A[0] != 0 ) return false;   int[][] G = adjB(N, U, V);   Map<Integer, Integer> parents = new HashMap<>();   for (Node node : orderFromRoot(N, G, 0)) {    parents.put(node.a, node.parent);   }   ArrayDeque<Integer> q = new ArrayDeque<>();   for (int next : G[0]) {    q.add(0);   }   int idx = 1;   while(!q.isEmpty()) {    int p = q.poll();    int a = A[idx++];    if( parents.get(a) != p ) {     return false;    }    for (int next : G[a]) {     if( next == p ) continue;     q.add(a);    }   }   return true;  }  static int[][] adjB(int n, int[] from, int[] to) {   int[][] adj = new int[n][];   int[] cnt = new int[n];   for (int f : from) {    cnt[f]++;   }   for (int t : to) {    cnt[t]++;   }   for (int i = 0; i < n; i++) {    adj[i] = new int[cnt[i]];   }   for (int i = 0; i < from.length; i++) {    adj[from[i]][--cnt[from[i]]] = to[i];    adj[to[i]][--cnt[to[i]]] = from[i];   }   return adj;  }  static Node[] orderFromRoot(int N, int[][] G, int root) {   ArrayDeque<Node> q = new ArrayDeque<>();   Node[] ret = new Node[N];   int idx = 0;   q.add(new Node(-1, root));   while(!q.isEmpty()) {    Node n = q.poll();    ret[idx++] = n;    for (int next : G[n.a]) {     if( next == n.parent ) continue;     q.add(new Node(n.a, next));    }   }   return ret;  }  static class Node {   int parent, a;   public Node(int parent, int a) {    this.parent = parent;    this.a = a;   }  }  @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();   }   String nextLine() {    if (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      return reader.readLine();     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken("\n");   }   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;   }   long[] nextLongArray(int n) {    long[] a = new long[n];    for (int i = 0; i < n; i++)     a[i] = nextLong();    return a;   }  }  static <A> void writeLines(A[] as, Function<A, String> f) {   PrintWriter pw = new PrintWriter(System.out);   for (A a : as) {    pw.println(f.apply(a));   }   pw.flush();  }  static void writeLines(int[] as) {   PrintWriter pw = new PrintWriter(System.out);   for (int a : as) pw.println(a);   pw.flush();  }  static void writeLines(long[] as) {   PrintWriter pw = new PrintWriter(System.out);   for (long a : as) pw.println(a);   pw.flush();  }  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;  }  static void debug(Object... args) {   StringJoiner j = new StringJoiner(" ");   for (Object arg : args) {    if (arg instanceof int[]) j.add(Arrays.toString((int[]) arg));    else if (arg instanceof long[]) j.add(Arrays.toString((long[]) arg));    else if (arg instanceof double[]) j.add(Arrays.toString((double[]) arg));    else if (arg instanceof Object[]) j.add(Arrays.toString((Object[]) arg));    else j.add(arg.toString());   }   System.err.println(j.toString());  } }
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();    long MOD = 1000000007;    long[] current = new long[n + 3];       current[0] = 1;    for (int i = 0; i < n - 1; i++) {     String s = in.next();     if (s.equals("f")) {      for (int j = i + 1; j > 0; j--) {       current[j] = current[j - 1];       current[j] %= MOD;      }      current[0] = 0;     } else {      for (int j = i + 1; j >= 0; j--) {             current[j] = current[j + 1] + current[j];       current[j] %= MOD;      }                     }    }    long result = 0;    for (int i = 0; i <= n; i++) {     result += current[i];     result %= MOD;    }    out.println(result);   }  }  static class InputReader {   private static BufferedReader in;   private static 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 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();  } }
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 cf1517d {  public static void main(String[] args) throws IOException {   int n = rni(), m = ni(), k = ni(), ans[][] = new int[n][m];   WGraph g = wgraph(n * m);   for (int i = 0; i < n; ++i) {    r();    for (int j = 0; j < m - 1; ++j) {     g.c(i * m + j, i * m + j + 1, ni());    }   }   for (int i = 0; i < n - 1; ++i) {    r();    for (int j = 0; j < m; ++j) {     g.c(i * m + j, (i + 1) * m + j, ni());    }   }   if (k % 2 == 1) {    for (int[] row : ans) {     fill(row, -1);     prln(row);    }    close();    return;   }   k >>= 1;   for (int l = 0; l < k; ++l) {    int nans[][] = new int[n][m];    for (int[] row : nans) {     fill(row, IBIG);    }    for (int i = 0; i < n * m; ++i) {     for (int ed[] : g.get(i)) {      int j = ed[0], d = ed[1];      if (ans[i / m][i % m] + d < nans[j / m][j % m]) {       nans[j / m][j % m] = ans[i / m][i % m] + d;      }     }    }    ans = nans;   }   for (int i = 0; i < n; ++i) {    for (int j = 0; j < m; ++j) {     ans[i][j] *= 2;    }   }   for (int[] row : ans) {    prln(row);   }   close();  }  static int solve(WGraph g, int i, int k) {   List<Map<Integer, Integer>> cost = new ArrayList<>();   for (int j = 0; j <= k; ++j) {    cost.add(new HashMap<>());   }   PriorityQueue<int[]> dijk = new PriorityQueue<>((a, b) -> a[2] - b[2]);   dijk.offer(new int[] {i, 0, 0});   cost.get(0).put(i, 0);   while (!dijk.isEmpty()) {    int e[] = dijk.poll(), node = e[0], dist = e[1], co = e[2];    if (co > cost.get(dist).get(node)) {     continue;    }    if (dist == k) {     return 2 * co;    }    if (dist < k) {     for (int ed[] : g.get(node)) {      int j = ed[0], c = ed[1];      if (co + c < cost.get(dist + 1).getOrDefault(j, IBIG)) {       cost.get(dist + 1).put(j, co + c);       dijk.offer(new int[] {j, dist + 1, co + c});      }     }    }   }   return -1;  }  static WGraph wgraph(int n) {   WGraph g = new WGraph();   for (int i = 0; i < n; ++i) {    g.add(new ArrayList<>());   }   return g;  }  static WGraph wgraph(int n, int m) throws IOException {   WGraph g = wgraph(n);   for (int i = 0; i < m; ++i) {    g.c(rni() - 1, ni() - 1, ni());   }   return g;  }  static WGraph wdigraph(int n, int m) throws IOException {   WGraph g = wgraph(n);   for (int i = 0; i < m; ++i) {    g.cto(rni() - 1, ni() - 1, ni());   }   return g;  }  static class WGraph extends ArrayList<List<int[]>> {   void cto(int u, int v, int w) {    get(u).add(new int[] {v, w});   }   void c(int u, int v, int w) {    cto(u, v, w);    cto(v, u, w);   }  }  static BufferedReader __i = new BufferedReader(new InputStreamReader(System.in));  static PrintWriter __o = new PrintWriter(new OutputStreamWriter(System.out));  static StringTokenizer input;  static Random __r = new Random();          static final int IBIG = 1000000007;  static final int IMAX = 2147483647;  static final long LMAX = 9223372036854775807L;   static int minof(int a, int b, int c) {return min(a, min(b, c));}  static int minof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); int min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static long minof(long a, long b, long c) {return min(a, min(b, c));}  static long minof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); long min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static int maxof(int a, int b, int c) {return max(a, max(b, c));}  static int maxof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); int max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static long maxof(long a, long b, long c) {return max(a, max(b, c));}  static long maxof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); long max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static int powi(int a, int b) {if (a == 0) return 0; int ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static long powl(long a, int b) {if (a == 0) return 0; long ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static int fli(double d) {return (int) d;}  static int cei(double d) {return (int) ceil(d);}  static long fll(double d) {return (long) d;}  static long cel(double d) {return (long) ceil(d);}  static int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}  static long gcd(long a, long b) {return b == 0 ? a : gcd(b, a % b);}  static int[] exgcd(int a, int b) {if (b == 0) return new int[] {1, 0}; int[] y = exgcd(b, a % b); return new int[] {y[1], y[0] - y[1] * (a / b)};}  static long[] exgcd(long a, long b) {if (b == 0) return new long[] {1, 0}; long[] y = exgcd(b, a % b); return new long[] {y[1], y[0] - y[1] * (a / b)};}  static int randInt(int min, int max) {return __r.nextInt(max - min + 1) + min;}  static long mix(long x) {x += 0x9e3779b97f4a7c15L; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9L; x = (x ^ (x >> 27)) * 0x94d049bb133111ebL; return x ^ (x >> 31);}   static void reverse(int[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {int swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(long[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {long swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(double[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {double swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(char[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {char swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  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 void rsort(int[] a) {shuffle(a); sort(a);}  static void rsort(long[] a) {shuffle(a); sort(a);}  static void rsort(double[] a) {shuffle(a); sort(a);}  static int[] copy(int[] a) {int[] ans = new int[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static long[] copy(long[] a) {long[] ans = new long[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static double[] copy(double[] a) {double[] ans = new double[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static char[] copy(char[] a) {char[] ans = new char[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}   static void r() throws IOException {input = new StringTokenizer(rline());}  static int ri() throws IOException {return Integer.parseInt(rline());}  static long rl() throws IOException {return Long.parseLong(rline());}  static double rd() throws IOException {return Double.parseDouble(rline());}  static int[] ria(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni(); return a;}  static int[] riam1(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni() - 1; return a;}  static long[] rla(int n) throws IOException {long[] a = new long[n]; r(); for (int i = 0; i < n; ++i) a[i] = nl(); return a;}  static double[] rda(int n) throws IOException {double[] a = new double[n]; r(); for (int i = 0; i < n; ++i) a[i] = nd(); return a;}  static char[] rcha() throws IOException {return rline().toCharArray();}  static String rline() throws IOException {return __i.readLine();}  static String n() {return input.nextToken();}  static int rni() throws IOException {r(); return ni();}  static int ni() {return Integer.parseInt(n());}  static long rnl() throws IOException {r(); return nl();}  static long nl() {return Long.parseLong(n());}  static double rnd() throws IOException {r(); return nd();}  static double nd() {return Double.parseDouble(n());}   static void pr(int i) {__o.print(i);}  static void prln(int i) {__o.println(i);}  static void pr(long l) {__o.print(l);}  static void prln(long l) {__o.println(l);}  static void pr(double d) {__o.print(d);}  static void prln(double d) {__o.println(d);}  static void pr(char c) {__o.print(c);}  static void prln(char c) {__o.println(c);}  static void pr(char[] s) {__o.print(new String(s));}  static void prln(char[] s) {__o.println(new String(s));}  static void pr(String s) {__o.print(s);}  static void prln(String s) {__o.println(s);}  static void pr(Object o) {__o.print(o);}  static void prln(Object o) {__o.println(o);}  static void prln() {__o.println();}  static void pryes() {prln("yes");}  static void pry() {prln("Yes");}  static void prY() {prln("YES");}  static void prno() {prln("no");}  static void prn() {prln("No");}  static void prN() {prln("NO");}  static boolean pryesno(boolean b) {prln(b ? "yes" : "no"); return b;};  static boolean pryn(boolean b) {prln(b ? "Yes" : "No"); return b;}  static boolean prYN(boolean b) {prln(b ? "YES" : "NO"); return b;}  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 h() {prln("hlfd"); flush();}  static void flush() {__o.flush();}  static void close() {__o.close();} }
2	public class D { InputStream is; PrintWriter out; String INPUT = "";  long I = 4000000000000000007L;  void solve() {   outer:  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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
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 String nextLine();  public int nextInt();  public long nextLong();  public double nextDouble(); } static class StdIn implements Input {  final private 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 String nextLine() {  int c;  while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));  StringBuilder s = new StringBuilder();  while (c != -1)  {   if (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 int[] readIntArray(int n) {  int[] ar = new int[n];  for(int i=0; i<n; ++i)   ar[i]=nextInt();  return ar;  }  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;  }  public long[] readLongArray(int n) {  long[] ar = new long[n];  for(int i=0; i<n; ++i)   ar[i]=nextLong();  return ar;  }  public double nextDouble() {  double ret = 0, div = 1;  byte c = read();  while (c <= ' ')   c = read();  boolean neg = (c == '-');  if (neg)   c = read();  do   ret = ret * 10 + c - '0';  while ((c = read()) >= '0' && c <= '9');  if (c == '.')   while ((c = read()) >= '0' && c <= '9')   ret += (c - '0') / (div *= 10);  if (neg)   return -ret;  return ret;  }  private void fillBuffer() throws IOException {  bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);  if (bytesRead == -1)   buffer[0] = -1;  }  private byte read() {  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 A {  static class Sort implements Comparable<Sort> {   int x,a;   public int compareTo(Sort o) {    if (this.x==o.x)     return this.a-o.a;    return this.x-o.x;   }  }  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int t = sc.nextInt();   Sort[]a = new Sort[n];   for (int i = 0; i < n; i++) {    a[i] = new Sort();    a[i].x = sc.nextInt();    a[i].a = sc.nextInt();   }   Arrays.sort(a);   int ans = 2;   for (int i = 1; i < n; i++) {    double d = a[i].x-a[i].a / 2.0-a[i-1].x-a[i-1].a / 2.0;    if (d==t)     ans++;    else if (d > t)     ans += 2;   }   System.out.println(ans);  } }
6	public class MaeDosDragoes { public static PrintWriter saida = new PrintWriter(System.out, false); public static class Escanear {   BufferedReader reader;   StringTokenizer tokenizer;  public Escanear() {    this(new InputStreamReader(System.in));   }  public Escanear(Reader in) {    reader = new BufferedReader(in);   }   String proximo() {    if (tokenizer == null || !tokenizer.hasMoreElements()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return tokenizer.nextToken();   }     int proximoNum() {    return Integer.parseInt(proximo());   }  }  public static void main(String[] args) {  Escanear escanear = new Escanear();  int proximoInt = escanear.proximoNum();   long[] aux = new long[proximoInt];   double proximoDouble = escanear.proximoNum();   for(Integer i = 0; i < proximoInt; i++) {    for(Integer j =0; j < proximoInt; j++) {     Integer val = escanear.proximoNum();     if (val.equals(1) || i.equals(j)) {   aux[i] |= 1L << j;   }    }   }   int esquerda = proximoInt/2;   int direita = proximoInt - esquerda;  int maiorMascara = 1 << esquerda;  int[] depois = new int[1 << esquerda];  Integer mascara = 1;  while (mascara < maiorMascara) {  int mascaraAtual = mascara;    for(int j = 0; j < esquerda; j++) {     if (((1 << j) & mascara) > 0) {      mascaraAtual &= aux[j + direita] >> direita;      depois[mascara] = Math.max(depois[mascara], depois[mascara ^ (1 << j)]);     }    }    if (mascara.equals(mascaraAtual)) {     depois[mascara] = Math.max(depois[mascara],Integer.bitCount(mascara));  }  mascara++;  }   int auxiliar = 0;   int mascaraMaxima = 1 << direita;   for(int i = 0; i < mascaraMaxima; i++) {    int mascaraCorrente = i;    int mascaraValor = maiorMascara -1;    for(int j = 0; j < direita; j++) {     if (((1 << j) & i) > 0) {      mascaraCorrente &= (aux[j] & (mascaraMaxima-1));      mascaraValor &= aux[j] >> direita;     }    }    if (mascaraCorrente != i) continue;    auxiliar = Math.max(auxiliar, Integer.bitCount(i) + depois[mascaraValor]);   }   proximoDouble/=auxiliar;   saida.println(proximoDouble * proximoDouble * (auxiliar * (auxiliar-1))/2);   saida.flush();  } }
4	public class prob1 { public static void main(String[] args) {  Scanner input = new Scanner(System.in);  String s = input.next();  int n = s.length();  int i = n-1;  CharSequence temp;  for(i = n-1; i > 0; i--)  for(int j = 0 ; j <= n-i; j++)  {   temp = s.subSequence(j, i+j);   if( s.substring(j+1, n).contains(temp) || s.substring(0, j+i-1).contains(temp))   {   System.out.println(i);   return;   }  }  System.out.println(0); } }
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);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); } } class TaskA{  static boolean twofind(String s, String t){   int index = s.indexOf(t);   int index2 = s.indexOf(t, index + 1);   if(index2 != -1)return true;   return false;  } public void solve(int testNumber, FastScanner scan, FastPrinter out) {      String s = scan.next();   String ans = "";   boolean ok = false;   for(int i = s.length(); i >= 0; i--){   for(int j = 0; j <= s.length() - 1; j++){    try{    if(twofind(s, s.substring(j, j + i))){     ans = s.substring(j, j + i); break;    }    }catch(Exception e){    break;    }   }   if(!ans.equals(""))break;   }     out.println(ans.length());    } } class FastScanner extends BufferedReader { public FastScanner(InputStream is) {  super(new InputStreamReader(is)); }  public int read() {  try{  int ret = super.read();  return ret;  }catch(Exception e){  throw new InputMismatchException();  } }  public String next() {   StringBuilder sb = new StringBuilder();   int c = read();   while (isWhiteSpace(c)) {    c = read();   }   if (c < 0) {    return null;   }   while (c >= 0 && !isWhiteSpace(c)) {    sb.appendCodePoint(c);    c = read();   }   return sb.toString();  }  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;  }  public long nextLong() {  return Long.parseLong(next()); }  public BigInteger nextBigInteger() {  return new BigInteger(next()); }  public BigDecimal nextBigDecimal(){  return new BigDecimal(next()); }  public String readLine(){  try{  return super.readLine();  }catch(IOException e){  return null;  } } } class FastPrinter extends PrintWriter {  public FastPrinter(OutputStream out) {  super(out); } public FastPrinter(Writer out) {  super(out); } }
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 {   int mod = 1000000007;   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.readInt();    int[][] dp = new int[n + 1][5002];    char[] a = new char[n];    for (int i = 0; i < n; i++) a[i] = in.readCharacter();    for (int i = 0; i < dp[n].length; i++) dp[n][i] = 1;    for (int i = n - 1; i >= 0; i--) {     for (int j = 0; j < n; j++) {      if (a[i] == 's') {       if (j > 0) dp[i][j] = dp[i][j - 1];       dp[i][j] = (int) ((dp[i][j] + (long) dp[i + 1][j]) % mod);      } else {       if (j > 0) dp[i][j] = dp[i][j - 1];       dp[i][j] = (int) ((dp[i][j] + (long) dp[i + 1][j + 1] - (long) dp[i + 1][j] + mod) % mod);      }     }    }    out.println(dp[0][0]);   }  }  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 char readCharacter() {    int c = read();    while (isSpaceChar(c))     c = read();    return (char) c;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
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());  iLoop:  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; } }
1	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)));  int n = nextInt();  String[]a = new String[n], b = new String[n];  Map<String, Integer> map = new HashMap<String, Integer>();  for (int i = 0; i < n; i++) {  a[i] = next();  if (!map.containsKey(a[i]))   map.put(a[i], 0);  map.put(a[i], map.get(a[i])+1);  }  int ans = 0;  for (int i = 0; i < n; i++) {  b[i] = next();  if (!map.containsKey(b[i]))   ans++;  else {   map.put(b[i], map.get(b[i])-1);   if (map.get(b[i])==0)   map.remove(b[i]);  }  }  System.out.println(ans);  pw.close(); } private static int nextInt() throws IOException {  return Integer.parseInt(next()); } private static long nextLong() throws IOException {  return Long.parseLong(next()); } private static double nextDouble() throws IOException {  return Double.parseDouble(next()); } private static String next() throws IOException {  while (st==null || !st.hasMoreTokens())  st = new StringTokenizer(br.readLine());  return st.nextToken(); } }
5	public class Main {   public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String[]parts = br.readLine().split("\\s+");  int n = Integer.parseInt(parts[0]);  int a = Integer.parseInt(parts[1]);  int b = Integer.parseInt(parts[2]);  parts = br.readLine().split("\\s+");  int[]hard = new int[n];  for(int i = 0; i < n; i++){  hard[i] = Integer.parseInt(parts[i]);  }  Arrays.sort(hard);  System.out.println(hard[b]-hard[b-1]); } }
0	public class three {  static boolean check;  public static void main(String[] args) {   check = true;   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   String s = n + "";   recurse(n, s.length(), "4");   if (!check)    System.out.println("YES");   else {    recurse(n, s.length(), "7");    if (!check)     System.out.println("YES");    else     System.out.println("NO");   }  }  private static void recurse(int n, int length, String string) {   int k = Integer.parseInt(string);   if (n % k == 0) {    check = false;   } else if (string.length() <= length && check) {    recurse(n, length, string + "4");    recurse(n, length, string + "7");   }  } }
1	public class A implements Runnable {  public void run() {   long startTime = System.nanoTime();   int n = nextInt();   String[] all = new String[9];   all[0] = "M";   for (int i = 0; i < 4; i++) {    String s = "";    for (int j = 0; j < i; j++) {     s += "X";    }    all[2 * i + 1] = s + "S";    all[2 * i + 2] = s + "L";   }   Map<String, Integer> map1 = new HashMap<>();   Map<String, Integer> map2 = new HashMap<>();   for (String s : all) {    map1.put(s, 0);    map2.put(s, 0);   }   for (int i = 0; i < n; i++) {    String s = nextToken();    map1.put(s, map1.get(s) + 1);   }   for (int i = 0; i < n; i++) {    String s = nextToken();    map2.put(s, map2.get(s) + 1);   }   int res = 0;   for (String s : all) {    int a = map1.get(s);    int b = map2.get(s);    if (a > b) {     res += a - b;    }   }   println(res);   if (fileIOMode) {    System.out.println((System.nanoTime() - startTime) / 1e9);   }   out.close();  }    private static boolean fileIOMode;  private static BufferedReader in;  private static PrintWriter out;  private static StringTokenizer tokenizer;  public static void main(String[] args) throws Exception {   fileIOMode = args.length > 0 && args[0].equals("!");   if (fileIOMode) {    in = new BufferedReader(new FileReader("a.in"));    out = new PrintWriter("a.out");   } else {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);   }   tokenizer = new StringTokenizer("");   new Thread(new A()).start();  }  private static String nextLine() {   try {    return in.readLine();   } catch (IOException e) {    return null;   }  }  private static String nextToken() {   while (!tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(nextLine());   }   return tokenizer.nextToken();  }  private static int nextInt() {   return Integer.parseInt(nextToken());  }  private static long nextLong() {   return Long.parseLong(nextToken());  }  private static double nextDouble() {   return Double.parseDouble(nextToken());  }  private static BigInteger nextBigInteger() {   return new BigInteger(nextToken());  }  private static void print(Object o) {   if (fileIOMode) {    System.out.print(o);   }   out.print(o);  }  private static void println(Object o) {   if (fileIOMode) {    System.out.println(o);   }   out.println(o);  }  private static void printf(String s, Object... o) {   if (fileIOMode) {    System.out.printf(s, o);   }   out.printf(s, o);  } }
2	public class Main{ public static void main(String[] args) {  long n,k;  Scanner s= new Scanner(System.in); n=s.nextInt(); k=s.nextInt(); System.out.println((int)(n-((-3+Math.sqrt(9+8*(n+k)))/2)));  } }
0	public class TaskA extends Thread {  public TaskA(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 n = nextLong();   output.println("0 0 " + n);  }  public void run() {   try {    solve();   } catch (Throwable e) {    System.err.println(e.getMessage());    e.printStackTrace();    System.exit(666);   } finally {    output.close();   }  }  public static void main(String... args) {   new TaskA(null, null).start();  }  private int nextInt() throws IOException {   return Integer.parseInt(next());  }  private double nextDouble() throws IOException {   return Double.parseDouble(next());  }  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; }
1	public class Main implements Runnable {  public InputReader in;  public PrintWriter out;  public void solve() throws Exception {     int N = in.nextInt();   int[] houses = new int[N];   boolean[] exist = new boolean[52];   for (int i = 0; i < N; i++) {    char c = in.nextChar();    if ('a' <= c && c <= 'z') {     houses[i] = 26 + (c - 'a');    } else {     houses[i] = (c - 'A');    }    exist[houses[i]] = true;   }   int[][] pokemons = new int[N][52];   pokemons[0][houses[0]] = 1;   for (int i = 1; i < N; i++) {    System.arraycopy(pokemons[i-1], 0, pokemons[i], 0, pokemons[i].length);    pokemons[i][houses[i]]++;   }   int uniques = 0;   for(boolean bool : exist)    if (bool)     uniques++;   if (uniques == 1) {    out.print(1);    return;   }    int last_variant = -1;   for (int i = 0; i < N-1; i++) {    if (pokemons[i][houses[i]] == pokemons[N-1][houses[i]]) {     last_variant = i;     break;    }   }   int minimum = N;   for (int i = 0; i <= last_variant; i++) {    if (houses[i] == houses[i+1])     continue;        int low = i+1;    int high = N-1;    while (low < high) {     int mid = (low + high) / 2;     boolean allPresent = true;     for (int j = 0; j < 52; j++) {      if (j != houses[i] && exist[j] && pokemons[mid][j] == pokemons[i][j]) {       allPresent = false;       break;      }     }     if (allPresent) {      high = mid;     } else {      low = mid + 1;     }    }    minimum = min(minimum, low - i + 1);   }   out.print(minimum);  }  public void run() {   try {    in = new InputReader(System.in);    out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));    Locale.setDefault(Locale.US);    int tests = 1;    while (tests-- > 0) {     solve();    }    out.close();   } catch (Throwable e) {    e.printStackTrace();    System.exit(7);   }  }  static int abs(int x) {   return x < 0 ? -x : x;  }  static int max(int a, int b) {   return a > b ? a : b;  }  static int min(int a, int b) {   return a < b ? a : b;  }  static long abs(long x) {   return x < 0 ? -x : x;  }  static long max(long a, long b) {   return a > b ? a : b;  }  static long min(long a, long b) {   return a < b ? a : b;  }  public static void main(String args[]) {   new Thread(null, new Main(), "Main", 1 << 28).start();  }  static boolean OJ = System.getProperty("ONLINE_JUDGE") != null;  public void console(Object... objects) {   if (!OJ) {    out.println(Arrays.deepToString(objects));    out.flush();   }  }  @SuppressWarnings({"Duplicates", "unused"})  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[2048];   private int curChar;   private int numChars;   private SpaceCharFilter filter;   public InputReader() {    this.stream = System.in;   }   public InputReader(InputStream stream) {    this.stream = stream;   }   public InputReader(SpaceCharFilter filter) {    this.stream = System.in;    this.filter = filter;   }   public InputReader(InputStream stream, SpaceCharFilter filter) {    this.stream = stream;    this.filter = filter;   }   public int read() {    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 char nextChar() {    int c = read();    while (isSpaceChar(c))     c = read();    return (char) c;   }   public int nextDigit() {    int c = read();    while (isSpaceChar(c))     c = read();    return c - '0';   }   public int nextInt() {    int c = read();    while (isSpaceChar(c))     c = read();    boolean negative = false;    if (c == '-') {     negative = true;     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 negative ? -res : res;   }   public int[] nextInts(int N) {    int[] nums = new int[N];    for (int i = 0; i < N; i++)     nums[i] = nextInt();    return nums;   }   public long[] nextLongs(int N) {    long[] nums = new long[N];    for (int i = 0; i < N; i++)     nums[i] = nextLong();    return nums;   }   public int nextUnsignedInt() {    int c = read();    while (isSpaceChar(c))     c = read();    int res = 0;    do {     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res;   }   public final long nextLong() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    boolean negative = false;    if (c == '-') {     negative = true;     c = read();    }    long res = 0;    do {     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return negative ? -res : res;   }   public final long nextUnsignedLong() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    long res = 0;    do {     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res;   }   public double nextDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    long 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 (!(c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1 || c == '.'));    if (c != '.') {     return res * sgn;    }    c = read();    long aft = 0;    int len = 1;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     aft *= 10;     len *= 10;     aft += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn + aft / (1.0 * len);   }   public String nextLine() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isEndChar(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 boolean isEndChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == '\n' || c == '\r' || c == '\t' || c == -1;   }   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 char[] nextChars() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    char[] chars = new char[res.length()];    res.getChars(0, chars.length, chars, 0);    return chars;   }   public int[][] nextIntMatrix(int rows, int cols) {    int[][] matrix = new int[rows][cols];    for (int i = 0; i < rows; i++)     for (int j = 0; j < cols; j++)      matrix[i][j] = nextInt();    return matrix;   }   public long[][] nextLongMatrix(int rows, int cols) {    long[][] matrix = new long[rows][cols];    for (int i = 0; i < rows; i++)     for (int j = 0; j < cols; j++)      matrix[i][j] = nextLong();    return matrix;   }   public char[][] nextCharMap(int rows, int cols) {    char[][] matrix = new char[rows][cols];    for (int i = 0; i < rows; i++)     for (int j = 0; j < cols; j++)      matrix[i][j] = nextChar();    return matrix;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
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();   int[] a = new int[n];   int sum = 0;   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();    sum += a[i];   }   Arrays.sort(a);   int res = 0;   int mySum = 0;   int hisSum = sum;   for (int i = n - 1; i >= 0; i--) {    mySum += a[i];    hisSum -= a[i];    res++;    if (mySum > hisSum) break;   }   out.println(res);  } } 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());  }   } 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++) {    writer.print(objects[i]);   }  }  public void println(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 a = in.nextLong();   long b = in.nextLong();   long ans = 0;   while (a > 0 && b > 0){    if (a < b){     long t = a;     a = b;     b = t;    }    ans += a/b;    a %= b;   }   out.print(ans);  } } 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 (Exception e){     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }  public long nextLong(){   return Long.parseLong(next());  }  }
3	public class code_1 {  public static void main(String[] args) {   Scanner in=new Scanner(System.in);   int n=in.nextInt();   int a[]=new int[n];   for(int i=0;i<n;i++)  a[i]=in.nextInt();   Arrays.sort(a);   for(int i=0;i<n-1;i++) {    if(a[i]!=-1) {   for(int j=i+1;j<n;j++) {      if(a[j]%a[i]==0)    a[j]=-1;   }  }  }   int count=0;   for(int i=0;i<n;i++) {    if(a[i]!=-1)   count++;  }   System.out.println(count);  } }
6	public class Main implements Runnable {      private int n;  private int nn;  private int[][] D;  private int[] dp;  private int[] prev;  private void solve() throws Throwable {   int xs = nextInt(), ys = nextInt();   n = nextInt();   int[][] pts = new int[n][2];   for (int i = 0; i < n; i++) {    pts[i][0] = nextInt();    pts[i][1] = nextInt();   }   D = new int[n][n];   for (int i = 0; i < n; i++) {    for (int j = 0; j < n; j++) {     if (i == j) {      D[i][i] = 2 * (sqr(pts[i][0] - xs) + sqr(pts[i][1] - ys));     } else {      D[i][j] = sqr(pts[i][0] - xs) + sqr(pts[i][1] - ys)        + sqr(pts[i][0] - pts[j][0])        + sqr(pts[i][1] - pts[j][1]) + sqr(pts[j][0] - xs)        + sqr(pts[j][1] - ys);     }    }   }   nn = 1 << n;   dp = new int[nn];   prev = new int[nn];   Arrays.fill(dp, -1);   Arrays.fill(prev, -1);   dp[0] = 0;   Dp(nn - 1);   pw.println(dp[nn - 1]);   pw.print(0);   for (int p = nn - 1; p != -1 && prev[p] != -1; p = prev[p]) {    int vv = p ^ prev[p];    for (int j = 0; j < n; j++) {     int jj = 1 << j;     if ((vv & jj) == 0)      continue;     pw.print(' ');     pw.print(j + 1);    }    pw.print(" 0");   }   pw.println();  }  private int Dp(int i) {   if (dp[i] != -1)    return dp[i];   int ans = 107374182, p = -1;   int j1 = 1, pos1 = 0;   for (; pos1 < n && j1 < nn; j1 *= 2, pos1++) {    if ((i & j1) == 0)     continue;    int a = D[pos1][pos1] + Dp(i ^ j1);    if (a < ans) {     ans = a;     p = i ^ j1;    }    int j2 = j1 * 2, pos2 = pos1 + 1;    for (; pos2 < n && j2 < nn; j2 *= 2, pos2++) {     if ((i & j2) == 0)      continue;     a = D[pos1][pos2] + Dp(i ^ (j1 | j2));     if (a < ans) {      ans = a;      p = i ^ (j1 | j2);     }    }    break;   }   dp[i] = ans;   prev[i] = p;   return ans;  }  private int sqr(int i) {   return i * i;  }      private void initstreams() throws Throwable {     in = new BufferedReader(new InputStreamReader(System.in, "ISO-8859-1"));   pw = new PrintWriter(System.out);  }  BufferedReader in;  PrintWriter pw;  StringTokenizer st;  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());  }  long nextLong() throws NumberFormatException, IOException {   return Long.parseLong(nextString());  }  double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextString());  }  @Override  public void run() {   try {    initstreams();    solve();   } catch (Throwable e) {    sError = e;   } finally {    if (pw != null)     pw.close();   }  }  private 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;  } }
0	public class Main {   public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  while (n-- > 0) {  int a = in.nextInt();  int b = in.nextInt();  int k = 0;  while (a != 0 && b != 0) {   if (a > b) {   int t = a / b;   k += t;   a = a - b * t;   } else {   int t = b / a;   k += t;   b = b - a * t;   }  }  System.out.println(k);  }  } }
3	public class Main implements Runnable { static class InputReader {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  private SpaceCharFilter filter;  private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  public InputReader(InputStream stream)  {  this.stream = stream;  }   public int read()  {  if (numChars==-1)   throw new InputMismatchException();    if (curChar >= numChars)  {   curChar = 0;   try   {   numChars = stream.read(buf);   }   catch (IOException e)   {   throw new InputMismatchException();   }     if(numChars <= 0)     return -1;  }  return buf[curChar++];  }   public String nextLine()  {  String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;  }  public int nextInt()  {  int c = read();    while(isSpaceChar(c))   c = read();    int sgn = 1;    if (c == '-')   {   sgn = -1;   c = read();  }    int res = 0;  do   {   if(c<'0'||c>'9')    throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  while (!isSpaceChar(c));     return res * sgn;  }   public long nextLong()  {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-')   {   sgn = -1;   c = read();  }  long res = 0;    do   {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  while (!isSpaceChar(c));   return res * sgn;  }   public double nextDouble()  {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-')   {   sgn = -1;   c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.')   {   if (c == 'e' || c == 'E')   return res * Math.pow(10, nextInt());   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  if (c == '.')   {   c = read();   double m = 1;   while (!isSpaceChar(c))   {   if (c == 'e' || c == 'E')    return res * Math.pow(10, nextInt());   if (c < '0' || c > '9')    throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();   }  }  return res * sgn;  }   public String readString()  {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do   {   res.appendCodePoint(c);   c = read();  }   while (!isSpaceChar(c));    return res.toString();  }   public boolean isSpaceChar(int c)  {  if (filter != null)   return filter.isSpaceChar(c);  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }   public String next()  {  return readString();  }   public interface SpaceCharFilter  {  public boolean isSpaceChar(int ch);  } }   public static void main(String args[]) throws Exception {  new Thread(null, new Main(),"Main",1<<26).start(); }   public void run() {  InputReader sc = new InputReader(System.in);  PrintWriter w = new PrintWriter(System.out);      int n = sc.nextInt();    int a[] = new int[n];    for(int i = 0; i < n; ++i)    a[i] = sc.nextInt();    int cnt = 0;    for(int i = 0; i < n; ++i) {    for(int j = 0; j < i; ++j) {    if(a[i] < a[j])     cnt ^= 1;    }   }    int m = sc.nextInt();    for(int i = 0; i < m; ++i) {    int l = sc.nextInt();    int r = sc.nextInt();    long size = (long)(r - l + 1);    long subarr = size * (size - 1) / 2;    int type = (int)(subarr % 2);    if(type == 1) {    cnt ^= 1;    }    if(cnt == 0)    w.println("even");    else    w.println("odd");   }   w.close();  } }
6	public class E {  private static 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);  }  private static void fill(int[][] array, int val)  {   for(int [] fill : array)    Arrays.fill(fill, val);  } }
4	public class C2 {  String filename = null;  InputReader sc;  void solve() {   int n = sc.nextInt();   int[] a = sc.nextArray(n);   int[] ps = new int[n];   int[] q = new int[n];   int[] qs = new int[n];   int nq = 0;   for (int i = 1; i < n; i++) {    if (a[i] == 1) {     qs[nq] = i - 1;     q[nq++] = a[i - 1] + 1;     ps[i] = i - 1;    } else {     if (a[i] == a[i - 1] + 1) {      qs[nq] = i - 1;      q[nq++] = 1;      ps[i] = i - 1;     } else {      for (int j = nq - 1; j >= 0; j--) {       if (a[i] == q[j]) {        ps[i] = qs[j];        nq = j;        break;       }      }     }    }   }   int[] parents = ps;   String[] strs = new String[n];   strs[0] = "1";   System.out.println(strs[0]);   for (int i = 1; i < n; i++) {    String p = strs[parents[i]];    if (a[i] == 1) {     strs[i] = p + ".1";    } else {     int lastDot = p.lastIndexOf(".");     if (lastDot == -1) {      strs[i] = a[i] + "";     } else {      strs[i] = p.substring(0, lastDot) + "." + a[i];     }    }    System.out.println(strs[i]);   }  }  public void run() throws FileNotFoundException {   if (filename == null) {    sc = new InputReader(System.in);   } else {    sc = new InputReader(new FileInputStream(new File(filename)));   }   int nTests = sc.nextInt();   for (int test = 0; test < nTests; test++) {    solve();   }  }  public static void main(String[] args) {   C2 sol = new C2();   try {    sol.run();   } catch (FileNotFoundException e) {    e.printStackTrace();   }  }  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 float nextFloat() {    return Float.parseFloat(next());   }   public double nextDouble() {    return Float.parseFloat(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public int[] nextArray(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = nextInt();    }    return a;   }  } }
4	public class givenstring { public static void main(String[] args){  Scanner reader = new Scanner(System.in);  String in = reader.next();   int max = 0;   for(int i = 0; i < in.length(); i++){  for(int j = i+1; j < in.length(); j++){     String consider = in.substring(i, j);   for(int k = i+1; k < in.length(); k++){   if(k + consider.length() > in.length())    break;   else if(in.substring(k, k+consider.length()).equals(consider))    max = Math.max(max, consider.length());   }  }  }   System.out.println(max); } }
3	public class TaskF {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[] a = new int[n + 1];   for (int i = 1; i <= n; i++) {    a[i] = in.nextInt();   }   int[] prefixSum = new int[n + 1];   prefixSum[0] = 0;   for (int i = 1; i <= n; i++) {    prefixSum[i] = prefixSum[i - 1] + a[i];   }   Map<Integer, List<Segment>> sumToSegments = new HashMap<>();   for (int i = 1; i <= n; i++) {    for (int j = i; j <= n; j++) {     int sum = prefixSum[j] - prefixSum[i - 1];     sumToSegments       .computeIfAbsent(sum, $ -> new ArrayList<>())       .add(Segment.make(i, j));    }   }   List<Segment> bestSegments = null;   for (int sum : sumToSegments.keySet()) {    List<Segment> segments = sumToSegments.get(sum);    int size = segments.size();    int[] f = new int[size];    int[] next = new int[size];    boolean[] take = new boolean[size];    f[size - 1] = 1;    next[size - 1] = -1;    take[size - 1] = true;    int bestStartIndex = size - 1;    for (int i = size - 2; i >= 0; i--) {     int nextIndex;     if (segments.get(i).q >= segments.get(size - 1).p) {      nextIndex = -1;     } else {      int L = i + 1;      int R = size - 1;      while (L < R) {       int M = (L + R) / 2;       if (segments.get(i).q >= segments.get(M).p) {        L = M + 1;       } else {        R = M;       }      }      nextIndex = L;     }     f[i] = 1 + ((nextIndex == -1) ? 0 : f[nextIndex]);     next[i] = nextIndex;     take[i] = true;     if (f[i + 1] > f[i]) {      take[i] = false;      f[i] = f[i + 1];      next[i] = i + 1;     }     if (bestStartIndex == -1 || f[i] > f[bestStartIndex]) {      bestStartIndex = i;     }    }        List<Segment> maxForSum = new ArrayList<>();    int index = bestStartIndex;    do {     if (take[index]) {      maxForSum.add(segments.get(index));     }     index = next[index];    } while (index != -1);    if (bestSegments == null || maxForSum.size() > bestSegments.size()) {     bestSegments = maxForSum;    }   }   System.out.println(bestSegments.size());   for (Segment segment : bestSegments) {    System.out.printf("%s %s%n", segment.p, segment.q);   }   in.close();  }  private static class Segment {   public final int p;   public final int q;   private Segment(int p, int q) {    this.p = p;    this.q = q;   }   public static Segment make(int p, int q) {    return new Segment(p, q);   }  } }
6	public class ASimpleTask {  public static void main(String args[]) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[][] d = new int[n][n];   for (int i = 0, m = sc.nextInt(); i < m; i++) {    int a = sc.nextInt() - 1, b = sc.nextInt() - 1;    d[a][b] = 1;    d[b][a] = 1;   }   long[][] dp = new long[1 << n][n];      for (int mask = 1; mask < 1 << n; mask++) {    int start = numberOfTrailingZeros(mask);    if (bitCount(mask) == 1) {     dp[mask][start] = 1;     continue;    }    for (int i = 0; i < n; i++) {     if ((mask & (1 << i)) > 0 && i != start) {      int xmask = mask ^ (1 << i);      for (int j = 0; j < n; j++) {       if (d[j][i] > 0) {        dp[mask][i] += dp[xmask][j];       }      }     }    }   }      long sum = 0;   for (int mask = 1; mask < 1 << n; mask++) {    if (bitCount(mask) >= 3) {     for (int i = 0; i < n; i++) {      if (d[numberOfTrailingZeros(mask)][i] > 0) {       sum += dp[mask][i];      }     }    }   }   out.print(sum / 2);  } }
0	public class TaskA {  public static void main(String[] args) throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   PrintWriter writer = new PrintWriter(System.out);   String[] input = reader.readLine().split(" ");   long l = Long.parseLong(input[0]);   long r = Long.parseLong(input[1]);   if (l % 2 == 0) {    if (r >= l + 2) {     writer.println(l + " " + (l + 1) + " " + (l + 2));    } else {     writer.println(-1);    }   } else {    if (r >= l + 3) {     writer.println((l + 1) + " " + (l + 2) + " " + (l + 3));    } else {     writer.println(-1);    }   }   writer.close();  } }
4	public class Main { public static void main(String[] args)throws Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringBuilder sb = new StringBuilder();      StringTokenizer st = new StringTokenizer(br.readLine(), " ");  n = pint(st.nextToken());  m = pint(st.nextToken());  k = pint(st.nextToken());      map = new int[n][m][4];  for (int i = 0; i < n; i++) {  st = new StringTokenizer(br.readLine(), " ");  for (int j = 0; j < m-1; j++) {   int temp = pint(st.nextToken());   map[i][j][3]=temp;   map[i][j+1][2]=temp;  }  }  for (int i = 0; i < n-1; i++) {  st = new StringTokenizer(br.readLine(), " ");  for (int j = 0; j < m; j++) {   int temp = pint(st.nextToken());   map[i][j][1]=temp;   map[i+1][j][0]=temp;  }  }   ans = new int[n][m][k/2+1];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   if(k%2==1) {   sb.append("-1 ");   continue;   }     int min=rec(i,j,0,k/2);     sb.append(min*2).append(" ");     }sb.append("\n");  }   System.out.println(sb);   } static int n,m,k;  static int[]dx = {-1,1, 0, 0}; static int[]dy = {0, 0, -1,1}; static int[][][]map; static int[][][]ans;  static int rec(int x, int y, int cost, int cnt) {  if(cnt==0) {  return 0;  }  if(ans[x][y][cnt]!=0)return ans[x][y][cnt];   int temp=Integer.MAX_VALUE;  for (int i = 0; i < 4; i++) {  int tx=x+dx[i], ty=y+dy[i];    if(tx<0||tx>=n||ty<0||ty>=m)continue;    if(map[x][y][i]!=0) {   temp=Math.min(temp, rec(tx, ty, cost, cnt-1)+map[x][y][i]);  }  }  ans[x][y][cnt]=temp;   return ans[x][y][cnt]; }  static int pint(String s) {  return Integer.parseInt(s); } }
1	public class SpreadSheet {  public void run() {   try {    Scanner s = new Scanner(System.in);    int tests = s.nextInt();    for (int i = 0; i < tests; i++) {     String line = s.next();     String regex = "R[\\d]+C[\\d]+";     Pattern pattern = Pattern.compile(regex);     Matcher matcher = pattern.matcher(line);         if (matcher.matches()){      int r = Integer.parseInt(line.substring(1, line.indexOf("C")));      int c = Integer.parseInt(line.substring(line.indexOf("C") +1));      System.out.println(toFormula(r, c));     }     else {      int index = -1;      for (int j = 0; j < line.length(); j++) {       if (line.charAt(j) >= '0' && line.charAt(j) <= '9') {        index = j;        break;       }      }      String c = line.substring(0, index);      int r = Integer.parseInt(line.substring(index));      System.out.println(fromFormula(c, r));     }    }   } catch (Exception e) {    e.printStackTrace();   }  }   private String toFormula(int r, int c) {   StringBuffer buff = new StringBuffer();   char ch;   while (c != 0) {    int m = c%26;    if(m==0)    {     ch = 'Z';     c = c/26 - 1;    }    else    {     ch = (char)(m+'A'-1);     c /= 26;    }    buff.append(ch);      }   return buff.reverse().toString() + r;  }   private String fromFormula(String c, int r) {   int ret = 0;   int power = 1;   for (int i = c.length()-1; i >= 0; i--) {    ret += ((c.charAt(i) - 'A' + 1) * power);    power *= 26;   }   return "R" + r + "C" + ret;  }   public static void main(String[] args) {   new SpreadSheet().run();  } }
2	public class Main {    public static void main(String[] args) {     Scanner scan=new Scanner(System.in);   long n=scan.nextLong(),k=scan.nextLong();   if(n>((k-2)*(k-1))/2+k){    System.out.println("-1");   } else if(n==1){    System.out.println("0");  } else if(n<=k&&n>1){    System.out.println("1"); } else{    n-=k;    long start=k-2;    long x;    long left=1,right=k-2;       while(left<=right){    x=(left+right)/2;            if(n>cumSum(x, start)){    left=x+1;       } else if(n<cumSum(x-1, start)){ right=x-1;     } else{     System.out.println(1+x);     break; }    }  }  }  public static long cumSum(long x,long start){  return (x*(2*start+1-x))/2;  } }
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();  }  int nextInt() {   return Integer.parseInt(next());  }  long nextLong() {   return Long.parseLong(next());  }  double nextDouble() {   return Double.parseDouble(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 Main { public static void main(String[] args) {  Main main = new Main();  main.solveC(); }  private void solveA() {  Scanner sc = new Scanner(System.in);  String first = sc.next();  String last = sc.next();  String answer = first.substring(0, 1) + last.substring(0, 1);  for (int i = 2; i <= first.length(); i++) {  String current = first.substring(0, i) + last.substring(0, 1);  if (answer.compareTo(current) > 0) {   answer = current;  }  }  System.out.println(answer); }  private void solveB() {  Scanner sc = new Scanner(System.in);  int N = sc.nextInt();  int layer = 0;  for (int i = 1; i <= N; i++) {  int max = N - i + 1;  layer += i < max ? i : max;  }  System.out.println(layer); }  private void solveC() {  Scanner sc = new Scanner(System.in);  final long MOD_NUM = 1000000007L;  int N = sc.nextInt();  long[] level = new long[N + 2];  level[0] = 1;  sc.nextLine();  String pre = "s";  for (int i = 0; i < N; i++) {  String line = sc.nextLine();  long[] next_level = new long[N + 2];  if (pre.equals("f")) {   for (int j = 1; j < N + 1; j++) {   next_level[j] = level[j - 1];   }  }  if (pre.equals("s")) {   for (int j = N; j >= 0; j--) {   next_level[j] = (next_level[j + 1] + level[j]) % MOD_NUM;   }  }  pre = line;  level = next_level;  }  long answer = 0L;  for (int i = 0; i < N + 1; i++) {  answer = (answer + level[i]) % MOD_NUM;  }  System.out.println(answer); }  private void solveD() {  Scanner sc = new Scanner(System.in);  int N = sc.nextInt();  System.out.println(N); }  private void solveE() {  Scanner sc = new Scanner(System.in);  int N = sc.nextInt();  System.out.println(N); }  private void solveF() {  Scanner sc = new Scanner(System.in);  int N = sc.nextInt();  System.out.println(N); }  interface Graph {  void link(int from, int to, long cost);  Optional<Long> getCost(int from, int to);  int getVertexNum(); }  interface FlowResolver {  long maxFlow(int from, int to); }   class ArrayGraph implements Graph {  private Long[][] costArray;  private int vertexNum;  public ArrayGraph(int n) {  costArray = new Long[n][];  for (int i = 0; i < n; i++) {   costArray[i] = new Long[n];  }  vertexNum = n;  }  @Override  public void link(int from, int to, long cost) {  costArray[from][to] = new Long(cost);  }  @Override  public Optional<Long> getCost(int from, int to) {  return Optional.ofNullable(costArray[from][to]);  }  @Override  public int getVertexNum() {  return vertexNum;  } }   class DfsFlowResolver implements FlowResolver {  private Graph graph;  public DfsFlowResolver(Graph graph) {  this.graph = graph;  }    public long maxFlow(int from, int to) {  long sum = 0L;  long currentFlow;  do {   currentFlow = flow(from, to, Long.MAX_VALUE / 3, new boolean[graph.getVertexNum()]);   sum += currentFlow;  } while (currentFlow > 0);  return sum;  }    private long flow(int from, int to, long current_flow, boolean[] passed) {  passed[from] = true;  if (from == to) {   return current_flow;  }  for (int id = 0; id < graph.getVertexNum(); id++) {   if (passed[id]) {   continue;   }   Optional<Long> cost = graph.getCost(from, id);   if (cost.orElse(0L) > 0) {   long nextFlow = current_flow < cost.get() ? current_flow : cost.get();   long returnFlow = flow(id, to, nextFlow, passed);   if (returnFlow > 0) {    graph.link(from, id, cost.get() - returnFlow);    graph.link(id, from, graph.getCost(id, from).orElse(0L) + returnFlow);    return returnFlow;   }   }  }  return 0L;  } }   class BinaryIndexedTree {  private long[] array;  public BinaryIndexedTree(int size) {  this.array = new long[size + 1];  }    public void add(int index, long value) {  for (int i = index; i < array.length; i += (i & -i)) {   array[i] += value;  }  }    public long getSum(int index) {  long sum = 0L;  for (int i = index; i > 0; i -= (i & -i)) {   sum += array[i];  }  return sum;  } } }
5	public class A {  void run() throws IOException {   int n = ni();   int m = ni();   int k = ni();   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = ni() - 1;   Arrays.sort(a);   int ans = 0;   if (m > k) {    m -= k - 1;    for (int i = n - 1; i >= 0; i--) {     ans++;     m -= a[i];       if (m < 2)      break;    }    if (m > 1)     ans = -1;   }   pw.print(ans);  }  String next() throws IOException {   while (st == null || !st.hasMoreTokens())    st = new StringTokenizer(br.readLine());   return st.nextToken();  }  int ni() throws IOException {   return Integer.parseInt(next());  }  String nl() throws IOException {   return br.readLine();  }  PrintWriter pw;  BufferedReader br;  StringTokenizer st;  public static void main(String[] args) throws IOException {   long timeout = System.currentTimeMillis();   boolean CF = System.getProperty("ONLINE_JUDGE") != null;   PrintWriter _pw = new PrintWriter(System.out);   BufferedReader _br = new BufferedReader(CF ? new InputStreamReader(System.in) : new FileReader(new File("in.txt")));   new A(_br, _pw).run();   if (!CF) {    _pw.println();    _pw.println(System.currentTimeMillis() - timeout);   }   _br.close();   _pw.close();  }  public A(BufferedReader _br, PrintWriter _pw) {   br = _br;   pw = _pw;  } }
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 stupid(long l, long r) {  long ans = 0;  for (long i = l; i <= r; i++)  for (long j = l; j <= r; j++)   ans = Math.max(ans, i ^ j);  return ans; }  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 run() {  try {  in = new FastScanner(new File("test.in"));  out = new PrintWriter(new File("test.out"));   solve();   out.close();  } catch (FileNotFoundException e) {  e.printStackTrace();  } }  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;  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  } }  public static void main(String[] args) {  new CFDiv1().runIO(); } }
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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
6	public class Solution {  private static StringTokenizer st; private static int n; private static int k;  private static boolean[][] graph; private static int[] dp; private static int maxCliqueSize;  public static void main(String[] args) throws Exception {  BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  st = new StringTokenizer(reader.readLine());  n = Integer.parseInt(st.nextToken());  k = Integer.parseInt(st.nextToken());  graph = new boolean[n][n];  dp = new int[1 << (n / 2)];  for (int i = 0; i < n; ++i) {  st = new StringTokenizer(reader.readLine());   for (int j = 0; j < n; ++j)   graph[i][j] = st.nextToken().equals("1");  }  reader.close();    int size1 = n / 2;  int border = 1 << size1;  for (int mask = 1; mask < border; ++mask) {     boolean isComplete = true;  for (int i = 0; i < size1; ++i) {   if (((mask >> i) & 1) == 0)   continue;   for (int j = i + 1; j < size1; ++j) {   if (((mask >> j) & 1) == 0)    continue;    if (!graph[i][j]) {    isComplete = false;    break;   }   }   if (!isComplete)   break;  }   if (isComplete)   dp[mask] = Integer.bitCount(mask);  }  for (int mask = 1; mask < border; ++mask) {  for (int i = 0; i < size1; ++i) {   if (((mask >> i) & 1) == 0) {   dp[mask | (1 << i)] = Math.max(dp[mask | (1 << i)], dp[mask]);   }  }  }    maxCliqueSize = 1;  int size2 = n - n /2;  border = (1 << size2);  for (int mask = 0; mask < border; ++mask) {   boolean isComplete = true;  for (int i = 0; i < size2; ++i) {   if (((mask >> i) & 1) == 0)   continue;   for (int j = i + 1; j < size2; ++j) {   if (((mask >> j) & 1) != 0 && !graph[i + size1][j + size1]) {    isComplete = false;    break;   }   }   if (!isComplete)   break;  }   if (!isComplete)   continue;   int mask1 = (1 << size1) - 1;   for (int i = 0; i < size2; ++i) {   if (((mask >> i) & 1) == 0)   continue;   for (int j = 0; j < size1; ++j) {   if (!graph[j][i + size1] && ((mask1 >> j) & 1) != 0)    mask1 ^= (1 << j);   }  }   maxCliqueSize = Math.max(maxCliqueSize, dp[mask1] + Integer.bitCount(mask));  }    double answer = (1.0 * k * k * (maxCliqueSize - 1) / (2 * maxCliqueSize));  System.out.printf("%.15f", answer); } }
1	public class Main {  static final double eps=1e-10;  public static void main(String[] args) throws FileNotFoundException  {   new Main().solve();  }  public void solve() throws FileNotFoundException  {   Scanner cin=new Scanner(System.in);   int n;   n=cin.nextInt();   String s;   s=cin.next();   int ans=Integer.MAX_VALUE;   int h=0,t=0;   for(int i=0;i<s.length();i++)   {    if(s.charAt(i)=='H')     h++;    else if(s.charAt(i)=='T')     t++;   }   ans=Math.min(ans,fun(s,'H',h));   ans=Math.min(ans,fun(s,'T',t));   System.out.println(ans);  }  public int fun(String s,char c,int num)  {   int ans=Integer.MAX_VALUE;   int ret=num;   for(int i=0;i<num;i++)   {    if(s.charAt(i)==c)    {     ret--;    }   }   ans=ret;   for(int i=0;i+num<s.length();i++)   {    if(s.charAt(i)!=c)     ret--;    if(s.charAt(i+num)!=c)    {     ret++;    }    ans=Math.min(ans, ret);   }   return ans;  } }
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));   }  } }
1	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);   ACodehorsesTShirts solver = new ACodehorsesTShirts();   solver.solve(1, in, out);   out.close();  }  static class ACodehorsesTShirts {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.nextInt();    Map<String, Integer> map = new HashMap<>();    for (int i = 0; i < n; i++) {     String ch = in.next();     if (map.containsKey(ch)) {      map.put(ch, map.get(ch) + 1);     } else {      map.put(ch, 1);     }    }    int s = n;    for (int i = 0; i < n; i++) {     String ch = in.next();     if (map.containsKey(ch)) {      if (map.get(ch) == 1) {       map.remove(ch);      } else {       map.put(ch, map.get(ch) - 1);      }      s--;     }    }    out.println(s);   }  }  static class FastScanner {   private BufferedReader br;   private StringTokenizer st;   public FastScanner(InputStream inputStream) {    br = new BufferedReader(new InputStreamReader(inputStream));   }   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());   }  } }
4	public class Solution {  public static void main(String[] args) {   FastScanner sc = new FastScanner();   PrintWriter pw = new PrintWriter(System.out);        int tc = 1;   for (int rep = 0; rep < tc; rep++) {    solve(sc,pw);          }        pw.close();  }       public static void solve(FastScanner sc, PrintWriter pw) {   int n = sc.ni();   int m = sc.ni();   int k = sc.ni();   int[][] arr = sc.to2di(n,m-1);   int[][] arr2 = sc.to2di(n-1,m);      if(k%2==1){    String s ="";    for(int j = 0;j<m;j++){     s+="-1";     if(j!=m-1){      s+=" ";     }    }    for(int i = 0;i<n;i++){     pw.println(s);    }    return;   }      Integer[][][] dp = new Integer[n][m][k+1];                                                                              for(int i= 0;i<n;i++){    for(int j = 0;j<m;j++){         fill(dp,i,j,k,n,m,arr,arr2);        }   }   for(int i= 0;i<n;i++){    String s = "";    for(int j = 0;j<m;j++){         s+=dp[i][j][k];     if(j!=m-1){      s+=" ";     }        }    pw.println(s);   }      }  public static int fill(Integer[][][] dp, int x, int y, int k, int n,int m,int[][] arr, int[][] arr2){        if(dp[x][y][k]!=null){    return dp[x][y][k];   }   if(k==0){    dp[x][y][k]= 0;    return 0;   }   int min = Integer.MAX_VALUE;      if(x>0){        int curVal = 2*arr2[x-1][y]+fill(dp,x-1,y,k-2,n,m,arr,arr2);    min = Math.min(min,curVal);   }   if(y>0){       int curVal = 2*arr[x][y-1]+fill(dp,x,y-1,k-2,n,m,arr,arr2);    min = Math.min(min,curVal);   }   if(x<n-1){       int curVal = 2*arr2[x][y]+fill(dp,x+1,y,k-2,n,m,arr,arr2);    min = Math.min(min,curVal);   }   if(y<m-1){       int curVal = 2*arr[x][y]+fill(dp,x,y+1,k-2,n,m,arr,arr2);    min = Math.min(min,curVal);   }   dp[x][y][k]=min;   return min;   }                                     public static void printArr(PrintWriter pw,int[] a){   for(int i = 0;i<a.length;i++){    pw.print(a[i]);    if(i!=a.length-1){     pw.print(" ");    }   }   pw.println();  }  public static void print2d(PrintWriter pw,int[][] a){   for(int j=0;j<a.length;j++){    for(int i = 0;i<a[j].length;i++){     pw.print(a[j][i]);     if(i!=a[j].length-1){      pw.print(" ");     }    }    pw.println(" ");   }   pw.println();  }  public static int stoi(String s){   return Integer.parseInt(s);  } } 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());  }   int[] intArray(int N) {   int[] ret = new int[N];   for (int i = 0; i < N; i++)    ret[i] = ni();   return ret;  }  int[][] to2di(int m, int n){   int[][] ans = new int[m][n];   for(int i = 0;i<m;i++){    String[] r = nextLine().split("[ ]");    for(int j = 0;j<n;j++){     ans[i][j] = Integer.parseInt(r[j]);    }   }   return ans;  }  long[][] to2dl(int m, int n){   long[][] ans = new long[m][n];   for(int i = 0;i<m;i++){    String[] r = nextLine().split("[ ]");    for(int j = 0;j<n;j++){     ans[i][j] = Long.parseLong(r[j]);    }   }   return ans;  }   long nl() {   return Long.parseLong(next());  }   long[] longArray(int N) {   long[] ret = new long[N];   for (int i = 0; i < N; i++)    ret[i] = nl();   return ret;  }   double nd() {   return Double.parseDouble(next());  }   String nextLine() {   String str = "";   try {    str = br.readLine();   } catch (IOException e) {    e.printStackTrace();   }   return str;  } }
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()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(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); }  public void run() {  Locale.setDefault(Locale.UK);  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   solve();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } finally {  out.flush();  } } }
5	public class ProblemA {  private void solve() throws IOException {  Scanner stdin = new Scanner(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));     int n = Integer.valueOf(stdin.nextInt());   int[] p = new int[n];   for (int i = 0; i < n; i++) {   p[i] = stdin.nextInt();   }     Arrays.sort(p);   if (p[n-1] == 1) {   p[n-1] = 2;   } else {   p[n-1] = 1;   out.print(p[n-1] + " ");   n--;   }     for (int i = 0; i < n; i++) {   out.print(p[i] + " ");   }        out.flush();   out.close(); }  public static void main(String[] args) throws IOException {  ProblemA solver = new ProblemA();   solver.solve(); } }
3	public class F11141 { static class Solver {  ArrayList<int[]> ranges[];  HashMap<Long, Integer> hm = new HashMap<>();  int id(long s) {  if (!hm.containsKey(s))   hm.put(s, hm.size());  return hm.get(s);  }     int[] memo;  int go(int r) {  memo[N] = 0;  int last = N;  for(int[] a : ranges[r]) {   while(a[0] < last) {   memo[last - 1] = memo[last];   last--;   }   memo[a[0]] = Math.max(memo[a[0]], Math.max(memo[a[0]], 1 + memo[a[1] + 1]));   last = a[0];  }  while(0 < last) {   memo[last - 1] = memo[last];   last--;  }  return memo[0];  }  ArrayDeque<int[]> ans = new ArrayDeque<>();   void go2(int r) {  memo[N] = 0;  int last = N;  int minAt[] = new int[N], oo = 987654321;  Arrays.fill(minAt, oo);  for(int[] a : ranges[r]) {   minAt[a[0]] = Math.min(minAt[a[0]], a[1] - a[0]);   while(a[0] < last) {   memo[last - 1] = memo[last];   last--;   }   memo[a[0]] = Math.max(memo[a[0]], Math.max(memo[a[0]], 1 + memo[a[1] + 1]));   last = a[0];  }  while(0 < last) {   memo[last - 1] = memo[last];   last--;  }  int k = 0;  for(; k < N;) {   if(minAt[k] == oo || memo[k] != 1 + memo[k + minAt[k] + 1]) k++;   else {   ans.push(new int[] {k, k + minAt[k]});   k += minAt[k] + 1;   }  }  }   @SuppressWarnings("unchecked")  Solver() {  ranges = new ArrayList[2250001];  for (int i = 0; i < ranges.length; i++)   ranges[i] = new ArrayList<>();  }  int N, LID;  long[] a;  void solve(Scanner s, PrintWriter out) {  N = s.nextInt();  a = new long[N + 1];  for (int i = 1; i <= N; i++)   a[i] = s.nextLong() + a[i - 1];  for (int i = N; i >= 1; i--)   for (int j = i; j <= N; j++) {   int x = id(a[j] - a[i - 1]);   ranges[x].add(new int[] { i - 1, j - 1 });   }    int best = 0, bid = -1;  memo = new int[N + 1];  Arrays.sort(ranges, (a, b) -> b.size() - a.size());  for(int i = 0; i < ranges.length; i++, LID++) {   if(ranges[i].size() <= best) break;   int ans = go(i);   if(ans > best) {   best = ans;   bid = i;   }  }      out.println(best);  go2(bid);      while(!ans.isEmpty()) {   int[] c = ans.pop();   out.println(++c[0] + " " + ++c[1]);  }    }  }  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  Solver solver = new Solver();  solver.solve(s, out);  out.close();  } }
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();  } }
3	public class Kaudo {  static Reader in =new Reader();  static StringBuilder Sd=new StringBuilder();  static long ans,res,lot,max;  static List<Integer>gr[];  static ArrayList<Integer> A=new ArrayList();  static String ch[];  public static void main(String [] args) {   int n=in.nextInt(),a[]=new int [n],g=0;   for(int i=0;i<n;i++){   a[i]=in.nextInt();   if(a[i]==1){System.out.println("1");return;}   }   ans=0;   Arrays.sort(a);   for(int i=0;i<n;i++){    int x=a[i];    if(x>0){ans++;   for(int u=i;u<n;u++){   if(a[u]%x==0){a[u]=0;}     }}     }   System.out.println(ans);  }  static int gcd(int a,int b){  if(b==0)return a;  return gcd(b,a%b);  }  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 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; }  }  }
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 pr(Object o) {   out.print(o);  }  public static void ln(Object o) {   out.println(o);  }  public static void ln() {   out.println();  } }
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);  }                                                        }
6	public class EdC { static long[] mods = {1000000007, 998244353, 1000000009}; static long mod = mods[0]; public static MyScanner sc;  public static PrintWriter out;  static char[][] grid;  static int n;  static int t;  static int[][] dp;  static int[] times;  static int[] genre; public static void main(String[] omkar) throws Exception{    sc = new MyScanner();  out = new PrintWriter(System.out);  n = sc.nextInt();  t = sc.nextInt();  times = new int[n];  genre = new int[n];  for(int j =0 ;j<n;j++){   times[j] = sc.nextInt();   genre[j] = sc.nextInt();   }  dp = new int[1<<n][4];  for(int j = 0;j<1<<n;j++)   Arrays.fill(dp[j], -1);  for(int j=0;j<1<<n;j++){   letsgodp(j, 1);   letsgodp(j, 2);   letsgodp(j, 3);  }  int ans = 0;  for(int j=0;j<1<<n;j++){   int time = 0;   for(int k = 0;k<n;k++){   if (((1<<k) & j) != 0){    time+=times[k];   }   }   if (time == t){   ans+=dp[j][1];   ans%=mod;   ans+=dp[j][2];   ans%=mod;   ans+=dp[j][3];   ans%=mod;   }  }  out.println(ans);  out.close();  } public static void letsgodp(int mask, int dg){  if (dp[mask][dg] != -1)  return;  dp[mask][dg] = 0;  for(int j = 0;j<n;j++){  if (((1<<j) & mask) != 0 && genre[j] == dg){   int submask = mask - (1<<j);   int og1 = genre[j]+1 > 3 ? genre[j]-2 : genre[j]+1;   int og2 = genre[j]+2 > 3 ? genre[j]-1 : genre[j]+2;   if (submask != 0){   letsgodp(submask, og1);   letsgodp(submask, og2);   dp[mask][dg] +=(dp[submask][og1] + dp[submask][og2]);   dp[mask][dg] %=mod;   }   else{   dp[mask][dg] = 1;   }  }  } } 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 String[] readArrayString(int n){  String[] array = new String[n];  for(int j =0 ;j<n;j++)  array[j] = sc.next();  return array; } static int[] readArrayInt(int n){  int[] array = new int[n];  for(int j = 0;j<n;j++)   array[j] = sc.nextInt();  return array;  } static int[] readArrayInt1(int n){  int[] array = new int[n+1];  for(int j = 1;j<=n;j++){  array[j] = sc.nextInt();  }  return array; } static long[] readArrayLong(int n){  long[] array = new long[n];  for(int j =0 ;j<n;j++)  array[j] = sc.nextLong();  return array; } static double[] readArrayDouble(int n){  double[] array = new double[n];  for(int j =0 ;j<n;j++)  array[j] = sc.nextDouble();  return array; } static int minIndex(int[] array){  int minValue = Integer.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } static int minIndex(long[] array){  long minValue = Long.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } static int minIndex(double[] array){  double minValue = Double.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } 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; } static void verdict(boolean a){   out.println(a ? "YES" : "NO");  }  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());   }   String nextLine() {    String str = "";    try{     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }    } }
5	public class Main {    static int sum=0;    public static void main(String[] args)throws Exception{   Scanner sc =new Scanner(System.in);            while(sc.hasNext()){   int n=ni(sc),x[]=new int[n+1];  for(int i=1;i<=n;i++)x[i]=ni(sc);  sort(x);  if(x[n]==1){x[n]=2;for(int i=1;i<=n;i++)System.out.print(x[i]+" ");}  else{x[0]=1;  for(int i=0;i<n;i++)System.out.print(x[i]+" ");  }    }      }    static void db(Object... os){    System.err.println(Arrays.deepToString(os)); }   static int ni(Scanner in){  return in.nextInt();  }  }
1	public class TheyAreEverywhere {  static StringTokenizer st;  static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in), 325678);  static int[] id = new int[100000];  public static void main(String[] args) throws IOException {   int n = in();   String s = next();   int total = 0;   int[] seq = new int[n];   boolean[] c = new boolean[100000];   for (int i = 0; i < n; i++) {    seq[i] = s.charAt(i);    if (!c[seq[i]]) {     total++;     c[seq[i]] = true;    }   }   Arrays.fill(id, -1);   int best = Integer.MAX_VALUE;   TreeSet<Integer> q = new TreeSet<Integer>(new Comparator<Integer>() {    @Override    public int compare(Integer o1, Integer o2) {     return id[o1] - id[o2];    }   });   for (int i = 0; i < n; i++) {    q.remove(seq[i]);    id[seq[i]] = i;    q.add(seq[i]);    if (q.size() == total) {         best = Math.min(best, i - id[q.first()] + 1);    }      }   System.out.println(best);  }  public static int in() throws IOException {   return Integer.parseInt(next());  }  public static long inl() throws IOException {   return Long.parseLong(next());  }  public static String next() throws IOException {   if (st == null || !st.hasMoreTokens())    st = new StringTokenizer(bf.readLine());   return st.nextToken();  } }
2	public class B { static long sumN(long n) {  return n * (n + 1) / 2; }  static int binSearchPuts(int n, int k) {  int L = 1;  int U = n;  int M = (L + U) / 2;  while(L <= U)  {  long left = sumN(M) - (n - M);    if(left < k)  {   L = M + 1;  }  else if(left > k)  {   U = M;  }  else  {   break;  }   M = (L + U) / 2;  }  return M; }  public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int n = input.nextInt();  int k = input.nextInt();  long ate = n - binSearchPuts(n, k);  System.out.println(ate); } }
5	public class A {  public static void main(String[] args) {   new A().solve();  }   public void solve() {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int t = sc.nextInt();   float[] left = new float[n];   float[] right = new float[n];   for (int i=0; i<n; ++i) {    int c = sc.nextInt();    int w = sc.nextInt();    left[i] = (float) (c - (float) w * 1.0 / 2);    right[i] = (float) (c + (float) w * 1.0 / 2);   }   for (int i=0; i<n; ++i)    for (int j=i+1; j<n; ++j)     if (left[j] < left[i]) {      float tmp = left[i];      left[i] = left[j];      left[j] = tmp;      tmp = right[i];      right[i] = right[j];      right[j] = tmp;     }   int res = 2;   for (int i=1; i<n; ++i) {    float dis = left[i] - right[i-1];    if (Math.abs(dis - t) < 0.000001)     res ++;    if ((dis - t) > 0.000001)     res += 2;   }   System.out.println(res);  } }
5	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer split = new StringTokenizer(in.readLine());   int n = Integer.parseInt(split.nextToken());   double t = Double.parseDouble(split.nextToken());   House[] xaxis = new House[n];   for (int i = 0; i < n; i++) {    split = new StringTokenizer(in.readLine());    xaxis[i] = new House(Double.parseDouble(split.nextToken()), Double.parseDouble(split.nextToken()));   }   Arrays.sort(xaxis);   int count = 2;   for (int i = 0; i < xaxis.length - 1; i++) {    double free = (xaxis[i + 1].getX() - xaxis[i + 1].getSize() / 2.0) - (xaxis[i].getX() + xaxis[i].getSize() / 2.0);    if (free / t == 1.0) {     count++;    } else if (free / t > 1.0) {     count += 2;    }   }   System.out.println(count);  } } class House implements Comparable<House> {  private double x;  private double size;  public House(double x, double size) {   this.x = x;   this.size = size;  }  public double getX() {   return x;  }  public double getSize() {   return size;  }  public int compareTo(House o) {   if (this.x > o.getX()) {    return 1;   } else if (this.x == o.getX()) {    return 0;   }   return -1;  } }
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 solve(int n, int m) throws Exception {  ans = 0;  g = new int[n * m][];  for (int x = 0; x < m; x++) {  for (int y = 0; y < n; y++) {   int[] w = new int[5];   int cnt = 0;   for (int dir = 0; dir < 5; dir++) {   int nx = x + dx[dir];   int ny = y + dy[dir];   if (nx >= 0 && nx < m && ny >= 0 && ny < n) {    w[cnt++] = ny * m + nx;   }   }   g[y * m + x] = copyOf(w, cnt);  }  }  go(n, m, 0, (1L << (n * m)) - 1);  return ans; }  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 void debug(Object... o) {  System.err.println(deepToString(o)); }  static void setTime() {  launchTimer = System.currentTimeMillis(); }  static void printTime() {  System.err.println(System.currentTimeMillis() - launchTimer); }  static void printMemory() {  System.err.println((Runtime.getRuntime().totalMemory() - Runtime   .getRuntime().freeMemory()) / 1000 + "kb"); }  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()); }  static long nextLong() throws IOException {  return Long.parseLong(next()); }  static double nextDouble() throws IOException {  return Double.parseDouble(next()); }  static BigInteger nextBig() throws IOException {  return new BigInteger(next()); } }
3	public class maestro{  public static void main(String[] args){   Scanner sc = new Scanner(System.in);   int N = sc.nextInt();   long mod = (long)Math.pow(10,9)+7;   long[][] arr = new long[N][N];   arr[0][0]=1;   for (int i=1;i<N;i++){    char c = sc.next().charAt(0);    if (c=='f'){     for (int j=1;j<N;j++) arr[i][j] = arr[i - 1][j - 1];    }    else {     long sum=0;     for (int j=N-1;j>=0;j--){      sum=(sum+arr[i-1][j])%mod;      arr[i][j] = sum;     }    }   }   long ans=0;   for (int i=0;i<N;i++) ans=(ans+arr[N-1][i])%mod;   System.out.println(ans);  } }
0	public class Main {  FastScanner in;  PrintWriter out;  public void solve() throws IOException {   double a = in.nextInt();   double v = in.nextInt();   double l = in.nextInt();   double d = in.nextInt();   double w = in.nextInt();   if (w * w / (a * 2) > d || v < w) {    if (v * v / (a * 2) > l) {     out.println(Math.sqrt(l * 2 / a));    }    else {     double t = v / a;     double s = l - t * v / 2;     t = t + s / v;     out.println(t);    }    return;   }   double t = solveD(a, v, w, d);   if ((v + w) * (v - w) / (a * 2) > l - d) {    double dis = w * w + a * (l - d) * 2;    double t1 = (Math.sqrt(dis) - w) / a;    System.out.println(t + t1);   }   else {    double t1 = (v - w) / a;    double s = l - d - (v + w) * t1 / 2;    double t2 = s / v;    System.out.println(t + t1 + t2);   }  }  public double solveD(double a, double vMax, double wBound, double s) {   double v = Math.sqrt(a * s + wBound * wBound / 2);   if (v > vMax) {    v = vMax;   }   double t1 = v / a;   double t2 = (v - wBound) / a;   double s1 = v * t1 / 2;   double s2 = (v + wBound) * t2 / 2;   double sr = s - s1 - s2;   double tr = sr / v;   return t1 + t2 + tr;  }  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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }  }  public static void main(String[] arg) {   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()); }  long nextLong() {  return Long.parseLong(nextToken()); }  double nextFloat() {  return Float.parseFloat(nextToken()); }  double nextDouble() {  return Double.parseDouble(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(); }  }  class Tarif { public int abPlata; public int tMin; public int price; public long res; }
4	public class codeforces {  static final long MOD2 = 998_244_353;  public static void main(String[] args) {   FastScanner sc = new FastScanner();   PrintWriter pw = new PrintWriter(System.out);     int tc = sc.ni();   for (int rep = 0; rep < tc; rep++) {    int N = sc.ni();    int[] arr = sc.intArray(N);    pw.println(solve(arr));   }     pw.close();  }    static String solve(int[] arr) {   StringBuilder sb = new StringBuilder();   List<Integer> list = new ArrayList();   list.add(0);   for (int i = 0; i < arr.length; i++) {    int x = arr[i];    for (int j = list.size() - 1; j >= 0; j--) {     if (x - 1 == list.get(j)) {      list.set(j, x);      while (list.size() > j+1) {       list.remove(list.size() - 1);      }      list.add(0);                 for (int idx = 0; idx < list.size() - 1; idx++) {       sb.append(list.get(idx) + ".");      }      sb.setLength(sb.length() - 1);      sb.append("\n");      break;     }    }   }   sb.setLength(sb.length() - 1);   return sb.toString();  }   static int summation(int x) {   return x * (x+1) / 2;  }  static long pow(long num, long exp, long mod){   long ans=1;   for(int i=1;i<=exp;i++){    ans=(ans*num)%mod;   }   return ans;  }  static boolean isPrime(int n)  {    if (n <= 1)    return false;   else if (n == 2)    return true;   else if (n % 2 == 0)    return false;   for (int i = 3; i <= Math.sqrt(n); i += 2) {    if (n % i == 0)     return false;   }   return true;  }  static int gcd(int a, int b)  {   if (a == 0)    return b;   return gcd(b % a, a);  }  static long gcd(long a, long b) {   if (a == 0) return b;   return gcd(b % a, a);  }  static int lcm(int a, int b)  {   return (a / gcd(a, b)) * b;  }  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);  }  static int charint(char c) {   return Integer.parseInt(String.valueOf(c));  }           public static void printArr(PrintWriter pw, int[] arr) {   StringBuilder sb = new StringBuilder();   for (int x : arr) {    sb.append(x + "");   }   sb.setLength(sb.length() - 1);   pw.println(sb.toString());  }  public static void printArr2d(PrintWriter pw, int[][] arr) {   StringBuilder sb = new StringBuilder();   for (int[] row : arr) {    for (int x : row) {     sb.append(x + " ");    }    sb.setLength(sb.length() - 1);    sb.append("\n");   }   pw.println(sb.toString());  } } 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());  }  int[] intArray(int N) {   int[] ret = new int[N];   for (int i = 0; i < N; i++)    ret[i] = ni();   return ret;  }  long nl() {   return Long.parseLong(next());  }  long[] longArray(int N) {   long[] ret = new long[N];   for (int i = 0; i < N; i++)    ret[i] = nl();   return ret;  }  double nd() {   return Double.parseDouble(next());  }  String nextLine() {   String str = "";   try {    str = br.readLine();   } catch (IOException e) {    e.printStackTrace();   }   return str;  } } class MultiSet {  TreeMap<Long, Integer> map = new TreeMap<>();  private int size = 0;  public MultiSet() {  }  public void add(Long val) {   map.put(val, map.getOrDefault(val, 0) + 1);   size++;  }  public void remove(Long val) {   map.put(val, map.get(val) - 1);   if (map.get(val) == 0) {    map.remove(val);   }   size--;  }  public int size() {   return size;  }  public Long higher(Long val) {   return map.higherKey(val);  }  public Long lower(Long val) {   return map.lowerKey(val);  }  public Long ceiling(Long val) {   return map.ceilingKey(val);  }  public Long floor(Long val) {   return map.floorKey(val);  }  public Long first() {   return map.firstKey();  }  public Long last() {   return map.lastKey();  }  public boolean isEmpty() {   return map.isEmpty();  } }
5	public class l {               static long mod = (int) (1e9 + 7);  static int n;  static StringBuilder sol;  static class pair implements Comparable<pair> {   int L,R;   public pair( int x,int y) {    L=x;R=y;   }    public int compareTo(pair o) {    if (L!=o.L)return L-o.L;    return o.R-R;   }   public String toString(){    return L+" "+R;   }  }  static boolean is;  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);     PrintWriter pw = new PrintWriter(System.out);   int m = sc.nextInt();   int n = sc.nextInt();   int q = sc.nextInt();   TreeSet<Integer>length= new TreeSet<>();   length.add(0);   length.add(n);   TreeSet<Integer>width= new TreeSet<>();   width.add(0);   width.add(m);   TreeMap<Integer,Integer>len= new TreeMap<>();   len.put(n,1);   TreeMap<Integer,Integer>wid= new TreeMap<>();   wid.put(m,1);   while (q-->0){    String t= sc.next();    if (t.equals("H")) {     int x = sc.nextInt();     int k1 = length.ceiling(x);     int k2 = length.floor(x);     if (x != k1) {      int s = k1 - k2;      int con = len.get(s);      if (con == 1) len.remove(s);      else len.put(s, con - 1);      len.put((k1 - x), len.getOrDefault((k1 - x), 0) + 1);      len.put((x - k2), len.getOrDefault((x - k2), 0) + 1);      length.add(x);     }    }    else {     int x = sc.nextInt();     int k1 = width.ceiling(x);     int k2 = width.floor(x);     if (x != k1) {      int s = k1 - k2;           int con = wid.get(s);      if (con == 1) wid.remove(s);      else wid.put(s, con - 1);      wid.put((k1 - x), wid.getOrDefault((k1 - x), 0) + 1);      wid.put((x - k2), wid.getOrDefault((x - k2), 0) + 1);      width.add(x);     }    }    pw.println(1l*len.lastKey()*wid.lastKey());   }   pw.flush();  }  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() 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 String nextLine() throws IOException {    return br.readLine();   }   public double nextDouble() throws IOException {    String x = next();    StringBuilder sb = new StringBuilder("0");    double res = 0, f = 1;    boolean dec = false, neg = false;    int start = 0;    if (x.charAt(0) == '-') {     neg = true;     start++;    }    for (int i = start; i < x.length(); i++)     if (x.charAt(i) == '.') {      res = Long.parseLong(sb.toString());      sb = new StringBuilder("0");      dec = true;     } else {      sb.append(x.charAt(i));      if (dec)       f *= 10;     }    res += Long.parseLong(sb.toString()) / f;    return res * (neg ? -1 : 1);   }   public boolean ready() throws IOException {    return br.ready();   }   } }
5	public class A {   public static void main(String Args[]) throws IOException{   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st;   st = new StringTokenizer(br.readLine());   int n=Integer.valueOf(st.nextToken());   int m=Integer.valueOf(st.nextToken());   int k=Integer.valueOf(st.nextToken());   st = new StringTokenizer(br.readLine());   int sock[] = new int[n];     for (int i=0;i<n;i++){    sock[i]= Integer.valueOf(st.nextToken());   }   Arrays.sort(sock);   m-=k;   int count=0;   int index=sock.length-1;   while(m>0){    if(index<0){     System.out.println("-1");     return;    }    m++;    m-=sock[index];    index--;    count++;   }   System.out.println(count);  }  }
4	public class Main implements Runnable {   public void solve() throws IOException {  int N = nextInt();     int M = nextInt();         int B = nextInt();     int[][] burn = new int[B][2];     for(int i = 0; i < B; i++){       burn[i][0] = nextInt();       burn[i][1] = nextInt();     }         int ansx = -1;     int ansy = -1;     int ans = -1;         for(int i = 1; i <= N; i++){       for(int j = 1; j <= M; j++){         int burnAt = Integer.MAX_VALUE;         for(int k = 0; k < B; k++){           int now = distance(i, j, burn[k][0], burn[k][1]);           burnAt = Math.min(burnAt, now);         }                 if(burnAt >= ans){                     ans = burnAt;           ansx = i;           ansy = j;                   }       }     }              out.println(ansx + " " + ansy); }     private int distance(int x, int y, int xx, int yy){         return Math.abs(xx - x) + Math.abs(yy - y);   }                     public static void main(String[] args) {  new Main().run(); }  public void run() {  try {    in = new BufferedReader(new FileReader(new File("input.txt")));       out = new PrintWriter(new FileWriter(new File("output.txt")));       tok = null;  solve();  in.close();       out.close();  } catch (IOException e) {  System.exit(0);  } }  public String nextToken() throws IOException {  while (tok == null || !tok.hasMoreTokens()) {  tok = new StringTokenizer(in.readLine());  }  return tok.nextToken(); }  public int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  public long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  public double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }   PrintWriter out; BufferedReader in; StringTokenizer tok; }
4	public class A {  public static void main(String[] args) {  new A().run(); }  private void run() {  Scanner sc = new Scanner(System.in);  String s = sc.next();  sc.close();   int res = 0;  for (int i = 0; i < s.length(); i++)  for (int j = i + 1; j <= s.length(); j++) {   String sub = s.substring(i, j);   int c = count(s, sub);   if (c >= 2)   res = Math.max(res, sub.length());  }  System.out.println(res); }  private int count(String s, String sub) {  int res = 0;  while (s.length() > 0) {  if (s.startsWith(sub))   res++;  s = s.substring(1);  }  return res; } }
5	public class A {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int k = in.nextInt();   team[] t = new team[n];   for (int i = 0; i < n; i++)    t[i] = new team(in.nextInt(), in.nextInt());   Arrays.sort(t);   int cnt = 0;   team tm = t[t.length - k];   for (int i = t.length - 1; i >= 0; i--)    if (tm.equal(t[i]))     cnt++;   System.out.println(cnt);  }  static class team implements Comparable<team> {   int p, t;   public team(int pp, int tt) {    p = pp;    t = tt;   }   @Override   public int compareTo(team o) {    if (p == o.p)     return o.t - t;    return p - o.p;   }   public boolean equal(team a) {    return a.p == p && a.t == t;   }  } }
3	public class B{  static long []sum;  static int n;  public static void main(String[] args) throws IOException {  Scanner sc=new Scanner();  PrintWriter out=new PrintWriter(System.out);  n=sc.nextInt();  sum=new long [n+1];  for(int i=1;i<=n;i++)  sum[i]=sc.nextInt()+sum[i-1];  HashMap<Long,Integer> map=new HashMap();  ArrayList<int []>[]adj=new ArrayList[n*n+10];  for(int i=0;i<adj.length;i++)  adj[i]=new ArrayList();  for(int r=1;r<=n;r++)   for(int l=1;l<=n;l++) {   if(r<l)   continue;   long x=sum[r]-sum[l-1];   map.put(x, map.getOrDefault(x, map.size()));   adj[map.get(x)].add(new int [] {l,r});  }  int ans=0;  int bestIdx=0;  for(int idx=0;idx<adj.length;idx++)  {  ArrayList<int[]>list=adj[idx];  if(list.isEmpty())   continue;  int curr=1;  int R=list.get(0)[1];  for(int i=1;i<list.size();i++)  {   int []tmp=list.get(i);   if(tmp[0]>R)   {   R=tmp[1];   curr++;   }  }  if(curr>=ans) {   ans=curr;   bestIdx=idx;  }  }  out.println(ans);  ArrayList<int[]>list=adj[bestIdx];  int R=list.get(0)[1];  out.println(list.get(0)[0]+" "+R);  for(int i=1;i<list.size();i++)  {  int []tmp=list.get(i);  if(tmp[0]>R)  {   R=tmp[1];   out.println(tmp[0]+" "+tmp[1]);  }  }  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();  }  String nextLine() throws IOException {  return br.readLine();  }  int nextInt() throws IOException{  return Integer.parseInt(next());  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(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 long getNextLong()throws IOException  {  checkStringTokenizer();  return Long.parseLong( strtoken.nextToken());  }  public double getNextDouble()throws IOException  {  checkStringTokenizer();  return Double.parseDouble( strtoken.nextToken());  }  public float getNextFloat()throws IOException  {  checkStringTokenizer();  return Float.parseFloat( strtoken.nextToken());  }  public String getNextString()throws IOException  {  checkStringTokenizer();  return strtoken.nextToken();  }  public String getNextLine()throws IOException  {  checkStringTokenizer();  return bufferReader.readLine();  }  public void skipCurrentLine()throws IOException  {  checkStringTokenizer();  strtoken = null;  }  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(); } }
0	@SuppressWarnings("unused") public class A { public static void main(String[] args) throws Exception {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  TreeSet<Integer> set = new TreeSet<Integer>();  set.add(n);  try {  String s = Integer.toString(n);  s = s.substring(0, s.length() - 1);  set.add(Integer.parseInt(s));  } catch (Exception e) {  }  try {  String s = Integer.toString(n);  s = s.substring(0, s.length() - 2) + s.charAt(s.length() - 1);  set.add(Integer.parseInt(s));  } catch (Exception e) {  }  System.out.println(max(set)); } }
6	public class ElongatedMatrix { public static void main(String[] args) {  InputStream input;  OutputStream output;  try {  input = new FileInputStream("input.txt");  output = new FileOutputStream("output.txt");  } catch (FileNotFoundException e) {  input = System.in;  output = System.out;  }  Kattio io = new Kattio(input, output);  (new Solve(io)).main();  io.close();  if (input instanceof FileInputStream)  try {   input.close();  } catch (IOException e) {   }  if (output instanceof FileOutputStream)  try {   output.close();  } catch (IOException e) {   } } } class Solve { static final int oo = (int) 1e9; Kattio io; int n, m; int[][] a; int[][][] dp; int[][] diff; int[][] slant;  Solve(Kattio io) {  this.io = io; }  int getbit(int x, int n) {  n--;  return (x >> n) & 1; }  int setbit(int x, int n) {  n--;  return x | (1 << n); }  int caldp(int currentRow, int firstRow, int mask) {  if (dp[currentRow][firstRow][mask] != -1)  return dp[currentRow][firstRow][mask];  dp[currentRow][firstRow][mask] = 0;  if (mask == (1 << n) - 1)  dp[currentRow][firstRow][mask] = slant[currentRow][firstRow];  else {  for (int i = 1; i <= n; i++)   if (getbit(mask, i) == 0) {   dp[currentRow][firstRow][mask] = Math.max(    Math.min(caldp(i, firstRow, setbit(mask, i)), diff[currentRow][i]),    dp[currentRow][firstRow][mask]);   }  }  return dp[currentRow][firstRow][mask];  }  void main() {  n = io.getInt();  m = io.getInt();  a = new int[n+1][m+1];  dp = new int[n+1][n+1][1<<n];   for (int i=1; i<=n; i++)  for (int j=1; j<=m; j++)   a[i][j] = io.getInt();   diff = new int[n+1][n+1];  for (int i=1; i<=n; i++)  for (int j=1; j<=n; j++)  {   diff[i][j]=oo;   for (int x=1; x<=m; x++)   diff[i][j]=Math.min(diff[i][j], Math.abs(a[i][x]-a[j][x]));  }   slant = new int[n+1][n+1];  for (int i=1; i<=n; i++)  for (int j=1; j<=n; j++)  {   slant[i][j] = oo;   for (int x=1; x+1<=m; x++)   slant[i][j] = Math.min(slant[i][j], Math.abs(a[i][x]-a[j][x+1]));  }   for (int i=1; i<=n; i++)  for (int j=1; j<=n; j++)   Arrays.fill(dp[i][j], -1);   int res = 0;  for (int i=1; i<=n; i++)  res = Math.max(res, caldp(i,i,setbit(0,i)));   io.print(res); } } 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()); }  public double getDouble() {  return Double.parseDouble(nextToken()); }  public long getLong() {  return Long.parseLong(nextToken()); }  public String getWord() {  return 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; } }
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();    }   }  } }
1	public class Main {  public static void main(String[] args) throws IOException {   Scan scan = new Scan();   int n = scan.scanInt();   long d = scan.scanLong();   long a[]=new long[n];   for(int i=0;i<n;i++){    a[i]=scan.scanLong();   }   Arrays.sort(a);   int count=0;   for(int i=0;i<n-1;i++){    if((a[i+1]-d)>(a[i]+d)){     count+=2;    }else if((a[i+1]-d)==(a[i]+d)){     count++;    }   }   count+=2;   System.out.println(count);  }   static class Scan  {   private byte[] buf=new byte[1024];   private int index;   private InputStream in;   private int total;   public Scan()   {    in=System.in;   }   public int scan()throws IOException   {    if(total<0)     throw new InputMismatchException();    if(index>=total)    {     index=0;     total=in.read(buf);     if(total<=0)      return -1;    }    return buf[index++];   }   public int scanInt()throws IOException   {    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();     }     else throw new InputMismatchException();    }    return neg*integer;   }    public char scanchar()throws IOException   {    int n=scan();    while(isWhiteSpace(n))     n=scan();    return (char)n;         }   public long scanLong()throws IOException   {    long lng=0;    int n=scan();    while(isWhiteSpace(n))     n=scan();    int neg=1;    if(n=='-')    {     neg=-1;     n=scan();    }    while(!isWhiteSpace(n) && n!='.')    {     if(n>='0'&&n<='9')     {      lng*=10;      lng+=n-'0';      n=scan();     }     else throw new InputMismatchException();    }    if(n=='.')    {     n=scan();     long temp=1;     while(!isWhiteSpace(n))     {      if(n>='0'&&n<='9')      {       temp/=10;       lng+=(n-'0')*temp;       n=scan();      }      else throw new InputMismatchException();     }    }    return neg*lng;   }   public double scanDouble()throws IOException   {    double doub=0;    int n=scan();    while(isWhiteSpace(n))     n=scan();    int neg=1;    if(n=='-')    {     neg=-1;     n=scan();    }    while(!isWhiteSpace(n)&&n!='.')    {     if(n>='0'&&n<='9')     {      doub*=10;      doub+=n-'0';      n=scan();     }     else throw new InputMismatchException();    }    if(n=='.')    {     n=scan();     double temp=1;     while(!isWhiteSpace(n))     {      if(n>='0'&&n<='9')      {       temp/=10;       doub+=(n-'0')*temp;       n=scan();      }      else throw new InputMismatchException();     }    }    return doub*neg;   }   public String scanString()throws IOException   {    StringBuilder sb=new StringBuilder();    int n=scan();    while(isWhiteSpace(n))     n=scan();    while(!isWhiteSpace(n))    {     sb.append((char)n);     n=scan();    }    return sb.toString();   }   private boolean isWhiteSpace(int n)   {    if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)     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);   PrintWriter out = new PrintWriter(outputStream);   G1PlaylistForPolycarpEasyVersion solver = new G1PlaylistForPolycarpEasyVersion();   solver.solve(1, in, out);   out.close();  }  static class G1PlaylistForPolycarpEasyVersion {   long mod = (int) 1e9 + 7;   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int T = in.nextInt();    int[] t = new int[n];    int[] g = new int[n];    for (int i = 0; i < n; i++) {     t[i] = in.nextInt();     g[i] = in.nextInt();    }    long[] fact = new long[n + 1];    fact[0] = 1;    for (int i = 1; i <= n; i++) {     fact[i] = (fact[i - 1] * i) % mod;    }    ArrayList<Integer> masks = new ArrayList<>();    long val = 0;    for (int i = 1; i < (1 << n); i++) {     int time = 0;     int[] count = new int[3];     for (int j = 0; j < n; j++) {      if ((i & (1 << j)) != 0) {       time += t[j];       count[g[j] - 1]++;      }     }     if (time == T) {      masks.add(i);      Arrays.sort(count);      long v = ((fact[count[0]] * fact[count[1]]) % mod * fact[count[2]]) % mod;      val += ((countUtil(count[0], count[1], count[2])) * v) % mod;     }    }    out.println(val%mod);   }   long countWays(int p, int q, int r, int last) {              if (p < 0 || q < 0 || r < 0)     return 0;                         if (p == 1 && q == 0 && r == 0 && last == 0)     return 1;        if (p == 0 && q == 1 && r == 0 && last == 1)     return 1;    if (p == 0 && q == 0 && r == 1 && last == 2)     return 1;                         if (last == 0)     return (countWays(p - 1, q, r, 1) +       countWays(p - 1, q, r, 2)) % mod;        if (last == 1)     return (countWays(p, q - 1, r, 0) +       countWays(p, q - 1, r, 2)) % mod;    if (last == 2)     return (countWays(p, q, r - 1, 0) +       countWays(p, q, r - 1, 1)) % mod;    return 0;   }   long countUtil(int p, int q, int r) {       return ((countWays(p, q, r, 0) +      countWays(p, q, r, 1)) % mod +      countWays(p, q, r, 2)) % mod;   }  }  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 - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
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 String nextLine();  public int nextInt();  public long nextLong();  public double nextDouble(); } static class StdIn implements Input {  final private 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 String nextLine() {  int c;  while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));  StringBuilder s = new StringBuilder();  while (c != -1)  {   if (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 int[] readIntArray(int n) {  int[] ar = new int[n];  for(int i=0; i<n; ++i)   ar[i]=nextInt();  return ar;  }  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;  }  public long[] readLongArray(int n) {  long[] ar = new long[n];  for(int i=0; i<n; ++i)   ar[i]=nextLong();  return ar;  }  public double nextDouble() {  double ret = 0, div = 1;  byte c = read();  while (c <= ' ')   c = read();  boolean neg = (c == '-');  if (neg)   c = read();  do   ret = ret * 10 + c - '0';  while ((c = read()) >= '0' && c <= '9');  if (c == '.')   while ((c = read()) >= '0' && c <= '9')   ret += (c - '0') / (div *= 10);  if (neg)   return -ret;  return ret;  }  private void fillBuffer() throws IOException {  bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);  if (bytesRead == -1)   buffer[0] = -1;  }  private byte read() {  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();  } } }
0	public class A{ public static void main(String[] args){  Scanner s = new Scanner(System.in);  int n = s.nextInt();  int prev2=0;  int prev1=1;  int prev=1;  int curr = 2;  if(n == 0) {System.out.println("0 0 0"); return;}  else if(n == 1) {System.out.println("0 0 1");return;}  while(true){  if(curr == n) break;  prev2 = prev1;  prev1 = prev;  int temp = prev + curr;  prev = curr;  curr = temp;  }  System.out.println(prev2 + " " + prev1 + " " + prev1); } }
3	public class Main1 {  static class Reader  {  final private int BUFFER_SIZE = 1 << 16;  private DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;   public Reader()  {   din = new DataInputStream(System.in);   buffer = new byte[BUFFER_SIZE];   bufferPointer = bytesRead = 0;  }   public Reader(String file_name) throws IOException  {   din = new DataInputStream(new FileInputStream(file_name));   buffer = new byte[BUFFER_SIZE];   bufferPointer = bytesRead = 0;  }   public String readLine() throws IOException  {   byte[] buf = new byte[64];   int cnt = 0, c;   while ((c = read()) != -1)   {   if (c == '\n')    break;   buf[cnt++] = (byte) c;   }   return new String(buf, 0, cnt);  }   public int nextInt() throws IOException  {   int ret = 0;   byte c = read();   while (c <= ' ')   c = read();   boolean neg = (c == '-');   if (neg)   c = read();   do  {   ret = ret * 10 + c - '0';   } while ((c = read()) >= '0' && c <= '9');   if (neg)   return -ret;   return ret;  }   public long nextLong() throws IOException  {   long ret = 0;   byte c = read();   while (c <= ' ')   c = read();   boolean neg = (c == '-');   if (neg)   c = read();   do {   ret = ret * 10 + c - '0';   }   while ((c = read()) >= '0' && c <= '9');   if (neg)   return -ret;   return ret;  }   public double nextDouble() throws IOException  {   double ret = 0, div = 1;   byte c = read();   while (c <= ' ')   c = read();   boolean neg = (c == '-');   if (neg)   c = read();   do {   ret = ret * 10 + c - '0';   }   while ((c = read()) >= '0' && c <= '9');   if (c == '.')   {   while ((c = read()) >= '0' && c <= '9')   {    ret += (c - '0') / (div *= 10);   }   }   if (neg)   return -ret;   return ret;  }   private void fillBuffer() throws IOException  {   bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);   if (bytesRead == -1)   buffer[0] = -1;  }   private byte read() throws IOException  {   if (bufferPointer == bytesRead)   fillBuffer();   return buffer[bufferPointer++];  }   public void close() throws IOException  {   if (din == null)   return;   din.close();  }  }  public static void main(String[] args) throws IOException  {  Reader s=new Reader();  int n = s.nextInt(), i, j, ans=0;  int[] a = new int[101];  for(i=0;i<n;i++){  a[s.nextInt()]++;  }  for(i=1;i<=100;i++){  if(a[i]>0){   ans++;   for(j=i;j<=100;j++){   if(j%i==0){    a[j]=0;   }   }  }  }  System.out.println(ans); } }
5	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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, FastReader in, PrintWriter out) {    int n = in.nextInt();    int[] a = in.nextIntArray(n);    int[] b = a.clone();    b = Arrays.copyOf(b, a.length + 2);    b[a.length] = 0;    b[a.length + 1] = (int) 2e9;    ArrayUtils.sort(b);    b = ArrayUtils.uniqueArray(b);    SegmentTreeSumL segmentTreeSumL = new SegmentTreeSumL(b.length + 1);    SegmentTreeSumL size = new SegmentTreeSumL(b.length + 1);    for (int i = 0; i < n; ++i) {     segmentTreeSumL.update(Arrays.binarySearch(b, a[i]), a[i]);     size.update(Arrays.binarySearch(b, a[i]), 1);    }    Debug debug = new Debug(out);    BigInteger sum = new BigInteger("0");    for (int i = 0; i < n; ++i) {     segmentTreeSumL.update(Arrays.binarySearch(b, a[i]), -a[i]);     size.update(Arrays.binarySearch(b, a[i]), -1);     int indG = ArrayUtils.LowerBound(b, a[i] + 2);     indG = Math.min(indG, b.length);     long s1 = size.getRangeSum(indG, b.length);     long sum1 = segmentTreeSumL.getRangeSum(indG, b.length);         sum = sum.add(BigInteger.valueOf(sum1 - s1 * a[i]));     int indL = ArrayUtils.LowerBound(b, a[i] - 1) - 1;     indL = Math.max(0, indL);     long s2 = size.getRangeSum(0, indL);     long sum2 = segmentTreeSumL.getRangeSum(0, indL);         sum = sum.add(BigInteger.valueOf(sum2 - s2 * a[i]));    }    out.println(sum.toString());   }  }  static class ArrayUtils {   public static int LowerBound(int[] a, int v) {    int high = a.length;    int low = -1;    while (high - low > 1) {     int mid = (high + low) >>> 1;     if (a[mid] >= v) {      high = mid;     } else {      low = mid;     }    }    return high;   }   public static int[] sort(int[] a) {    a = shuffle(a, new SplittableRandom());    Arrays.sort(a);    return a;   }   public static int[] shuffle(int[] a, SplittableRandom gen) {    for (int i = 0, n = a.length; i < n; i++) {     int ind = gen.nextInt(n - i) + i;     int d = a[i];     a[i] = a[ind];     a[ind] = d;    }    return a;   }   public static int[] uniqueArray(int[] a) {    int n = a.length;    int p = 0;    for (int i = 0; i < n; i++) {     if (i == 0 || a[i] != a[i - 1]) a[p++] = a[i];    }    return Arrays.copyOf(a, p);   }  }  static class FastReader {   private InputStream stream;   private byte[] buf = new byte[8192];   private int curChar;   private int pnumChars;   private FastReader.SpaceCharFilter filter;   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;   }   public int[] nextIntArray(int n) {    int[] array = new int[n];    for (int i = 0; i < n; i++) {     array[i] = nextInt();    }    return array;   }   private boolean isSpaceChar(int c) {    if (filter != null) {     return filter.isSpaceChar(c);    }    return isWhitespace(c);   }   private static boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   private interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  static class SegmentTreeSumL {   long[] lazy;   long[] seg;   long[] a;   int size;   int N;   public SegmentTreeSumL(long[] a) {    this.N = a.length;    size = 4 * N;    seg = new long[size];    lazy = new long[size];    this.a = a;    build(0, N - 1, 0);   }   public SegmentTreeSumL(int n) {    this.N = n;    size = 4 * N;    seg = new long[size];    lazy = new long[size];   }   private void build(int s, int e, int c) {    if (s == e) {     seg[c] = a[s];     return;    }    int m = (s + e) >>> 1;    build(s, m, 2 * c + 1);    build(m + 1, e, 2 * c + 2);    seg[c] = seg[2 * c + 1] + seg[2 * c + 2];   }   public void update(int index, int value) {    update(0, N - 1, 0, index, value);   }   private void update(int s, int e, int c, int index, int value) {    if (s == e) {     seg[c] += value;     return;    }    int m = (s + e) >>> 1;    if (index <= m) {     update(s, m, 2 * c + 1, index, value);    } else {     update(m + 1, e, 2 * c + 2, index, value);    }    seg[c] = seg[2 * c + 1] + seg[2 * c + 2];   }   public long getRangeSum(int l, int r) {    return getRangeSum(0, N - 1, 0, l, r);   }   private long getRangeSum(int s, int e, int c, int l, int r) {    if (s > e || l > r || l > e || r < s) return 0;    if (lazy[c] != 0) {     if (s != e) {      lazy[2 * c + 1] += lazy[c];      lazy[2 * c + 2] += lazy[c];     }     seg[c] += (e - s + 1) * (1L) * lazy[c];     lazy[c] = 0;    }    if (s == e) {     return seg[c];    }    if (s >= l && e <= r) {     return seg[c];    }    int m = (s + e) >>> 1;    return getRangeSum(s, m, 2 * c + 1, l, r)      + getRangeSum(m + 1, e, 2 * c + 2, l, r);   }  }  static class Debug {   PrintWriter out;   boolean oj;   public Debug(PrintWriter out) {    oj = System.getProperty("ONLINE_JUDGE") != null;    this.out = out;   }  } }
6	public class C {  public static void main(String[] args)  {   new C();  }   final int oo = (int)1e9;   int Hx,Hy;   int N;  int[][] P;   int[] memo;  int[][] soln;   int[] dist1;  int[][] dist2;   C()  {   Scanner in = new Scanner(System.in);   Hx=in.nextInt();   Hy=in.nextInt();     N=in.nextInt();   P=new int[N][2];   for (int i=0; i<N; ++i)   {    P[i][0]=in.nextInt();    P[i][1]=in.nextInt();   }     memo=new int[1<<N];   Arrays.fill(memo, -1);   soln=new int[2][1<<N];     dist1=new int[N];   Arrays.fill(dist1, -1);   dist2=new int[N][N];   for (int[] d : dist2) Arrays.fill(d, -1);     int res=go((1<<N)-1);   System.out.println(res);     int set=(1<<N)-1;   while (set>0)   {    System.out.print("0 ");    System.out.print((soln[0][set]+1)+" ");    if (soln[1][set]>-1) System.out.print((soln[1][set]+1)+" ");       if (soln[1][set]>-1)    {     set-=((1<<soln[0][set])+(1<<soln[1][set]));    }    else    {     set-=(1<<soln[0][set]);    }   }   System.out.println("0");  }   int go(int set)  {   if (set==0)    return 0;   if (memo[set]>-1)    return memo[set];       int res=oo;   int i=0;   while (!on(set,i)) ++i;   res=dist(i)+go(set-(1<<i));   soln[0][set]=i;   soln[1][set]=-1;     for (int j=i+1; j<N; ++j)   {    if (on(set,j))    {     int tmp=dist(i,j)+go(set-(1<<i)-(1<<j));     if (tmp<res)     {      res=tmp;      soln[0][set]=i;      soln[1][set]=j;     }    }   }     return memo[set]=res;  }     int dist(int i)  {   if (dist1[i]>-1) return dist1[i];     int dx=P[i][0]-Hx;   int dy=P[i][1]-Hy;   return dist1[i]=2*(dx*dx+dy*dy);  }     int dist(int i, int j)  {   if (dist2[i][j]>-1) return dist2[i][j];     int res=0,dx,dy;     dx=P[i][0]-Hx;   dy=P[i][1]-Hy;   res+=dx*dx+dy*dy;     dx=P[i][0]-P[j][0];   dy=P[i][1]-P[j][1];   res+=dx*dx+dy*dy;     dx=P[j][0]-Hx;   dy=P[j][1]-Hy;   res+=dx*dx+dy*dy;     return dist2[i][j]=res;  }   boolean on(int set, int loc)  {   return (set&(1<<loc))>0;  } }
5	public class A { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni();  int[] a = new int[n];  int[] b = new int[n];  for(int i = 0;i < n;i++)b[i] = a[i] = ni();   Arrays.sort(b);  int ct = 0;  for(int i = 0;i < n;i++){  if(a[i] != b[i])ct++;  }  if(ct <= 2){  out.println("YES");  }else{  out.println("NO");  } }  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(); }  public int ni() {  try {  int num = 0;  boolean minus = false;  while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));  if(num == '-'){   num = 0;   minus = true;  }else{   num -= '0';  }    while(true){   int b = is.read();   if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');   }else{   return minus ? -num : num;   }  }  } catch (IOException e) {  }  return -1; }  public long nl() {  try {  long num = 0;  boolean minus = false;  while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));  if(num == '-'){   num = 0;   minus = true;  }else{   num -= '0';  }    while(true){   int b = is.read();   if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');   }else{   return minus ? -num : num;   }  }  } catch (IOException e) {  }  return -1; }  public String ns() {  try{  int b = 0;  StringBuilder sb = new StringBuilder();  while((b = is.read()) != -1 && (b == '\r' || b == '\n' || b == ' '));  if(b == -1)return "";  sb.append((char)b);  while(true){   b = is.read();   if(b == -1)return sb.toString();   if(b == '\r' || b == '\n' || b == ' ')return sb.toString();   sb.append((char)b);  }  } catch (IOException e) {  }  return ""; }  public char[] ns(int n) {  char[] buf = new char[n];  try{  int b = 0, p = 0;  while((b = is.read()) != -1 && (b == ' ' || b == '\r' || b == '\n'));  if(b == -1)return null;  buf[p++] = (char)b;  while(p < n){   b = is.read();   if(b == -1 || b == ' ' || b == '\r' || b == '\n')break;   buf[p++] = (char)b;  }  return Arrays.copyOf(buf, p);  } catch (IOException e) {  }  return null; }   double nd() { return Double.parseDouble(ns()); } boolean oj = System.getProperty("ONLINE_JUDGE") != null; void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
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());   }     public long nextLong() {    return Long.parseLong(nextToken());   }     public double nextDouble() {    return Double.parseDouble(nextToken());   }  } }
1	public class D527A2 {  public static void main(String[] args) {  FastScanner in = new FastScanner(System.in);  int N = in.nextInt();  Stack<Integer> stack = new Stack<>();  for(int i = 0; i < N; i++) {  int num = in.nextInt() % 2;  if(stack.size() >= 1 && stack.lastElement() == num)   stack.pop();  else   stack.add(num);  }   System.out.println(stack.size() <= 1 ? "YES" : "NO"); }   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 long nextLong() {  return Long.parseLong(next());  }  public double nextDouble() {  return Double.parseDouble(next());  }  public String next() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  public String nextLine() {  int c = read();  while (isEndline(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isEndline(c));  return res.toString();  } } }
3	public class Main {  public static void main(String[] args) {   File file = new File("in.txt");   File fileOut = new File("out.txt");   InputStream inputStream = null;   OutputStream outputStream = null;      inputStream = System.in;   outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   Task solver = new Task();   solver.solve(1, in, out);   out.close();  }  } class Task {  private final int mod = 1000000007;  public void solve(int testNumber, InputReader in, PrintWriter out) {   Integer n = in.nextInt();   List<Character> comm = new ArrayList<>(n);   for(int i=0; i<n; i++){    comm.add(in.next().charAt(0));   }   long[][] dp = new long[n][n];   dp[0][0] = 1;   for(int i=1; i<n; i++){    Character lastComm = comm.get(i-1);    if(lastComm.equals('f')){     dp[i][0] = 0;     for(int j=1; j<n; j++){      dp[i][j] = dp[i-1][j-1];     }    }    else{     Long suffixSum = dp[i-1][n-1];     for(int j=n-1; j>=0; j--){      dp[i][j] = suffixSum;      if(j>0) {       suffixSum += dp[i - 1][j - 1] % mod;      }     }    }   }   Long finalSum = 0L;   for(int i=0; i<n; i++){    finalSum += dp[n-1][i] % mod;   }   out.println(finalSum % mod);  } }  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 String nextLine(){   try {    return reader.readLine();   } catch (IOException e){    throw new RuntimeException(e);   }  }  public int nextInt() {   return Integer.parseInt(next());  }  public long nextLong() { return Long.parseLong(next()); } }  class Pair<F, S> {  public final F first;  public final S second;    public Pair(F first, S second) {   this.first = first;   this.second = second;  }  @Override  public boolean equals(Object o) {   if (!(o instanceof Pair)) {    return false;   }   Pair<?, ?> p = (Pair<?, ?>) o;   return Objects.equals(p.first, first) && Objects.equals(p.second, second);  }  @Override  public int hashCode() {   return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode());  }  @Override  public String toString() {   return "(" + first + ", " + second + ')';  } } class IntPair extends Pair<Integer, Integer>{  public IntPair(Integer first, Integer second){   super(first, second);  } }
4	public class Main {  public static void main(String[] args) throws FileNotFoundException {   Scanner read = new Scanner(new FileInputStream(new File("input.txt")));  PrintWriter out = new PrintWriter(new File("output.txt"));  int n = read.nextInt(), m = read.nextInt(), k = read.nextInt(), tree[][] = new int[n][m], a[] = new int[k],   b[] = new int[k], x = 0, y = 0, max = -1, d = 0;  for (int i = 0; i < k; i++) {  a[i] = read.nextInt() - 1;  b[i] = read.nextInt() - 1;   tree[a[i]][b[i]] = 0;  }  for(int i = 0; i < n; i++){  Arrays.fill(tree[i], Integer.MAX_VALUE);  }  for (int o = 0; o < k; o++) {  for(int i = 0; i < n; i++){   for(int j = 0; j < m; j++){   d = Math.abs(a[o] - i) + Math.abs(b[o] - j);   if(d < tree[i][j])    tree[i][j] = d;   }  }  }  for(int i = 0; i<n; i++){  for(int j = 0; j < m ; j ++){   if(tree[i][j] > max){   max= tree[i][j];   x= i;   y = j;   }  }  }  out.println(x + 1 + " " + (y + 1));  out.close(); } }
4	public class BetaRound23_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()); }  @Override public void run() {  try {  long t1 = System.currentTimeMillis();  init();  solve();  out.close();  long t2 = System.currentTimeMillis();  System.err.println("Time = " + (t2 - t1));  } catch (Exception e) {  e.printStackTrace(System.err);  System.exit(-1);  } }  public static void main(String[] args) {  new Thread(new BetaRound23_A()).start(); }  void solve() throws IOException {  char[] s = in.readLine().toCharArray();  int n = s.length;  for (int ans = n - 1; ans >= 1; ans--) {  for (int i = 0; i < n - ans + 1; i++) {   for (int j = i + 1; j < n - ans + 1; j++) {   int count = 0;   for (int k = 0; k < ans; k++) {    if (s[i + k] == s[j + k]) count++;    else break;   }   if (count == ans) {    out.print(ans);    return;   }   }  }  }  out.print(0); }  }
4	public class R035CRetry {  public void debug(Object... objects) { System.err.println(Arrays.deepToString(objects)); }  public static final int INF = 987654321;  public static final long LINF = 987654321987654321L;  public static final double EPS = 1e-9;   Scanner scanner;  PrintWriter out;  boolean[][] bss;   public R035CRetry() {   try {    this.scanner = new Scanner(new File("input.txt"));    this.out = new PrintWriter("output.txt");   } catch(FileNotFoundException ex) { ex.printStackTrace(); }  }   class Point implements Comparable<Point> {   int x, y, count;   Point(int x, int y) { this.x = x; this.y = y; }   public int hashCode() { return x * 17 + y; }   public boolean equals(Object o) {    if(!(o instanceof Point)) return false;    Point that = (Point)o;    return this.x == that.x && this.y == that.y;   }   public int compareTo(Point that) { return this.count - that.count; }   public String toString() { return "(" + x + ", " + y + ":" + count + ")"; }  }    int[] dx = new int[] { 0, 0, -1, 1 };  int[] dy= new int[] { -1, 1, 0, 0 };  int n, m;   Queue<Point> q;   Point bfs() {   int max = -INF;   Point p = null;   while(!q.isEmpty()) {    Point cur = q.remove();    if(max < cur.count) { max = cur.count; p = cur; }    for(int i=0; i<dx.length; i++) {     int nx = cur.x + dx[i];     int ny = cur.y + dy[i];     if(nx < 0 || nx >= n) { continue; }     if(ny < 0 || ny >= m) { continue; }     Point np = new Point(nx, ny);     if(bss[nx][ny] ) { continue; }     np.count = cur.count+1;     bss[nx][ny] = true;     q.add(np);    }   }   return p;  }   private void solve() {   this.n = scanner.nextInt();   this.m = scanner.nextInt();   this.bss = new boolean[n][m];   int k = scanner.nextInt();   q = new PriorityQueue<Point>();   for(int i=0; i<k; i++) {    int x = scanner.nextInt() - 1;    int y = scanner.nextInt() - 1;    Point init = new Point(x, y);    init.count = 1;    q.add(init);    bss[x][y] = true;   }   Point p = bfs();   out.println((p.x+1) + " " + (p.y+1));  }   private void finish() { this.out.close(); }   public static void main(String[] args) {   R035CRetry obj = new R035CRetry();   obj.solve();   obj.finish();  } }
1	public class main {  public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);   br = new BufferedReader(new InputStreamReader(System.in));   PrintWriter pw = new PrintWriter(System.out);   int n = nextInt();   int d = nextInt();   int ans = 2;   int b[] = new int [n];   Arrays.sort(b);   for (int i = 0; i < n; i++) {    b[i] = nextInt();   }   for (int i = 1; i < n; i++) {    if (b[i] - b[i - 1] >= d * 2) {     ans++;    }    if (b[i] - b[i - 1] > d * 2) {     ans++;    }   }   pw.println(ans);   pw.close();  }  static BufferedReader br;  static StringTokenizer st = new StringTokenizer("");  public static int nextInt() throws IOException {   if (!st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return Integer.parseInt(st.nextToken());  }  public static String next() throws IOException {   if (!st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return st.nextToken();  }  public static double nextDouble() throws IOException {   if (!st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return Double.parseDouble(st.nextToken());  }  public static long nextLong() throws IOException {   if (!st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return Long.parseLong(st.nextToken());  } }
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);   String[] input = kek.readLine().split(" ");  int N = Integer.parseInt(input[0]), M = Integer.parseInt(input[1]);  boolean[][] connected = new boolean[N + 1][N];  long[][] walks = new long[1 << N][N];  long res = 0;   for(int i = 0; i < M; i++){  input = kek.readLine().split(" ");  int A = Integer.parseInt(input[0]) - 1, B = Integer.parseInt(input[1]) - 1;  connected[A][B] = connected[B][A] = true;  }   for(int i = 0; i < N; i++){  walks[1 << i][i] = 1;  }   for(int i = 1; i < 1 << N; i++){  int temp = (int) (Math.log(i & -(i)) / 0.6931471805599453);  for(int j = 0; j < N; j++){   if(((1 << j) & i) > 0 && j != temp){   for(int k = 0; k < N; k++){    if(connected[k][j]){    walks[i][j] += walks[i ^ (1 << j)][k];    }   }      int count = 0, track = i;   while(track > 0){    if(track % 2 == 1){    count++;    }    track /= 2;   }         if(count >= 3 && connected[temp][j]){    res += walks[i][j];   }   }  }  }   outkek.println(res / 2);  kek.close();  outkek.close(); }  }
2	public class B { 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 void debug(Object... os) {  out.println(Arrays.deepToString(os)); }  private static void solve() throws IOException {  String[] line = in.readLine().split(" ");  long n = Long.parseLong(line[0]) - 1;  long k = Long.parseLong(line[1]) - 1;  if (f(1, k) < n) {  out.println(-1);  return;  }  if (n == 0) {  out.println(0);  return;  }  long lo = 0l;  long hi = k;  while (lo + 1l < hi) {  long m = (lo + hi) / 2l;  long f = f(k - m + 1, k);  if (f < n) {   lo = m;  } else {   hi = m;  }  }  out.println(hi);  }  private static long f(long lo, long hi) {  return (lo + hi) * (hi - lo + 1l) / 2l; } }
6	public class Main {  static HashSet<Integer> adjList[];  public static void main(String[]args)throws IOException{   BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(System.in));   StringBuilder stringBuilder=new StringBuilder();   String temp[]=bufferedReader.readLine().split(" ");   int V=Integer.parseInt(temp[0]);   int E=Integer.parseInt(temp[1]);   adjList=new HashSet[V];   for(int i=0;i<V;i++)    adjList[i]=new HashSet<>();   for(int i=0;i<E;i++){    temp=bufferedReader.readLine().split(" ");    int x=Integer.parseInt(temp[0])-1;    int y=Integer.parseInt(temp[1])-1;    adjList[y].add(x);    adjList[x].add(y);   }   stringBuilder.append(solve(V)+"\n");   System.out.println(stringBuilder);  }  private static long solve(int V) {   long dp[][]=new long[(1<<V)][V];   long count=0;   for(int i=0;i<V;i++)    dp[(1<<i)][i]=1;   for(int mask=1;mask<(1<<V);mask++){       int first = Integer.numberOfTrailingZeros(mask);    for(int i=0;i<V;i++){     if((mask&(1<<i))==0 || first==i) continue;     for (int j = 0; j < V; j++)      if (adjList[i].contains(j) && (mask & (1<<j))!=0)       dp[mask][i] += dp[mask ^ (1 << i)][j];         if (Integer.bitCount(mask)>=3)      if(adjList[first].contains(i))       count+=dp[mask][i];    }   }   return count/2;  } }
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();   }  } }
6	public class MainC {  private FastScanner in;  private PrintWriter out;  private int N;  private Dist[] dists;  private int countDists;  private int[][] minLeft;  private int[] minOrder;  private int minOrderCount = 10000000;  public void solve() throws IOException {   int xb = in.nextInt();   int yb = in.nextInt();   N = in.nextInt();   int[] x, y;   boolean isOdd;   if (N % 2 == 0) {    x = new int[N];    y = new int[N];    isOdd = false;   }   else {    x = new int[N + 1];    y = new int[N + 1];    isOdd = true;   }   for (int i = 0; i < N; i++) {    x[i] = in.nextInt() - xb;    y[i] = in.nextInt() - yb;   }   if (N % 2 == 1) {    N++;    x[N - 1] = 0;    y[N - 1] = 0;   }   countDists = N * (N - 1) / 2;   dists = new Dist[countDists];   int c = 0;   int commonSum = 0;   for (int i = 0; i < N; i++) {    for (int j = i + 1; j < N; j++) {     dists[c] = new Dist();     dists[c].from = i;     dists[c].to = j;     dists[c].dist = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j])         * (y[i] - y[j]);     dists[c].dist = Math.min(dists[c].dist, x[i] * x[i] + y[i]         * y[i] + x[j] * x[j] + y[j] * y[j]);     c++;    }    commonSum += x[i] * x[i] + y[i] * y[i];   }   Arrays.sort(dists);   minLeft = new int[countDists][N + 1];   for (int i = 0; i < countDists; i++) {    int sum = 0;    for (int j = 1; j <= N; j++) {     if (i + j - 1 < countDists) {      sum = sum + dists[i + j - 1].dist;      minLeft[i][j] = sum;     }     else {      minLeft[i][j] = 100000000;     }    }   }   order(0, new int[N], 0, 0);   out.println(minOrderCount + commonSum);   for (int i = 1; i <= N / 2; i++) {    int first = -1;    int second = -1;    for (int j = 0; j < N; j++) {     if (minOrder[j] == i) {      if (first == -1) {       first = j;      }      else {       second = j;      }     }    }    if (isOdd && (first == N - 1 || second == N - 1)) {     first++;     second++;     out.print("0 " + (first + second - N) + " ");    }    else if (x[first] * x[first] + y[first] * y[first] + x[second]        * x[second] + y[second] * y[second] < (x[first] - x[second])        * (x[first] - x[second])        + (y[first] - y[second])        * (y[first] - y[second])) {     first++;     second++;     out.print("0 " + first + " 0 " + second + " ");    }    else {     first++;     second++;     out.print("0 " + first + " " + second + " ");    }   }   out.println("0");  }  private void order(int countOrdered, int[] order, int startsFrom, int sum) {   if (countOrdered == N) {    if (sum < minOrderCount) {     minOrder = Arrays.copyOf(order, N);     minOrderCount = sum;    }    return;   }   while (startsFrom < countDists) {    if (order[dists[startsFrom].from] == 0        && order[dists[startsFrom].to] == 0) {     if (minLeft[startsFrom][(N - countOrdered) / 2] + sum >= minOrderCount) {      break;     }     order[dists[startsFrom].from] = countOrdered / 2 + 1;     order[dists[startsFrom].to] = countOrdered / 2 + 1;     order(countOrdered + 2, order, startsFrom + 1, sum         + dists[startsFrom].dist);     order[dists[startsFrom].from] = 0;     order[dists[startsFrom].to] = 0;    }    startsFrom++;   }  }  private class Dist implements Comparable<Dist> {   int from;   int to;   int dist;   @Override   public int compareTo(Dist o) {    if (dist < o.dist) {     return -1;    }    if (dist == o.dist) {     return 0;    }    return 1;   }  }  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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }  }  public static void main(String[] arg) {   new MainC().run();  } }
5	public class Beta97B {  static Scanner in;  static StreamTokenizer st;  static int n;  static int[] a;  static int max = 1;  public static void main(String[] args) throws IOException {     st = new StreamTokenizer(new InputStreamReader(System.in));   n = nextInt();   a = new int[n];   int ind = 0;   for (int i = 0; i < n; ++i) {    a[i] = nextInt();    if (a[i] > max) {     max = a[i];     ind = i;    }   }   if (max == 1) {    a[0] = 2;   } else {    a[ind] = 1;   }   Arrays.sort(a);   for (int i = 0; i < n; ++i)    System.out.print(a[i] + " ");  }  private static int nextInt() throws IOException {   st.nextToken();   return (int) st.nval;  } }
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).modPow(      BigInteger.valueOf(x + 1), BigInteger.valueOf(1000000009))      .subtract(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;   }   public long readLong() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public String readString() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuffer res = new StringBuffer();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   private String readLine0() {    StringBuffer buf = new StringBuffer();    int c = read();    while (c != '\n' && c != -1) {     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 char readCharacter() {    int c = read();    while (isSpaceChar(c))     c = read();    return (char) c;   }   public double readDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, readInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, readInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }  } }
6	public class E {  void solve(BufferedReader in) throws Exception {   int[] xx = toInts(in.readLine());   int n = xx[0];   double k = xx[1];   int[][] board = new int[n][n];   for(int i = 0; i<n; i++) board[i] = toInts(in.readLine());   int fst = n/2;   int snd = n - fst;   int[] maxc = new int[1<<fst];   int max = 1;   for(int i = 0; i<(1<<fst); i++) {    for(int j = 0; j<fst; j++) {     if((i&(1<<j)) != 0) maxc[i] = Math.max(maxc[i], maxc[i^(1<<j)]);    }    boolean ok = true;    for(int a = 0; a<fst; a++) if(((1<<a)&i) != 0) {     for(int b = a+1; b<fst; b++) if(((1<<b)&i) != 0) {      if(board[a][b] == 0) ok = false;     }    }    if(ok) {     maxc[i] = Integer.bitCount(i);     max = Math.max(max, maxc[i]);    }   }   for(int i = 0; i<(1<<snd); i++) {    boolean ok = true;    for(int a = 0; a<snd; a++) if(((1<<a)&i) != 0) {     for(int b = a+1; b<snd; b++) if(((1<<b)&i) != 0) {      if(board[a+fst][b+fst] == 0) ok = false;     }    }    if(!ok) continue;    int mask = 0;    for(int a = 0; a<fst; a++) {     ok = true;     for(int b = 0; b<snd; b++) {      if(((1<<b)&i) != 0) {       if(board[a][b+fst] == 0) ok = false;      }     }     if(ok) mask |= (1<<a);    }    max = Math.max(Integer.bitCount(i) + maxc[mask], max);   }   System.out.println(k*k*(max-1.0)/(2*max));  }  int toInt(String s) {return Integer.parseInt(s);}  int[] toInts(String s) {   String[] a = s.split(" ");   int[] o = new int[a.length];   for(int i = 0; i<a.length; i++) o[i] = toInt(a[i]);   return o;  }  void e(Object o) {   System.err.println(o);  }  public static void main(String[] args) throws Exception{   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   (new E()).solve(in);  } }
1	public class Main {  InputStreamReader inp = new InputStreamReader(System.in); BufferedReader in = new BufferedReader(inp); boolean test = false;  String[] inData = { "9", "HTHTHTHHT",  };  static int id = -1; public String readLine() throws IOException {  id++;  if(test)  return inData[id];  else  return in.readLine(); }   public Main() throws Throwable {   int animalNr = Integer.valueOf(readLine());  String animals = readLine();   boolean[] state = new boolean[animalNr];  int tigerCount = 0;  for (int i = 0; i < animals.length(); i++) {  if('T' == animals.charAt(i)){   state[i] = true;   tigerCount++;  }  }  int best = Integer.MAX_VALUE;  for (int i = 0; i < state.length; i++) {  int swaps = 0;  for (int j = i; j < i+tigerCount; j++) {   if(state[j %animalNr] == false){   swaps ++;   }  }  if(swaps < best){   best = swaps;  }  }   System.out.println(best);   }   public static void main(String[] args) throws Throwable {  new Main(); } }
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();  } } }
5	public class A {  private void solve() throws IOException {  int n = nextInt();  Integer[] a = new Integer[n];  Integer[] b = new Integer[n];   for (int i = 0; i < n; i++) {  a[i] = b[i] = nextInt();  }   Arrays.sort(a);  int k = 0;  for (int i = 0; i < n; i++) {  if (!a[i].equals(b[i])) {   k++;  }  }   if (k <= 2) {  println("YES");  } else {  println("NO");  } }  private String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  tokenizer = new StringTokenizer(reader.readLine());  }  return tokenizer.nextToken(); }  private int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(nextToken()); }  private double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(nextToken()); }  private long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  private void print(Object o) {  writer.print(o); }  private void println(Object o) {  writer.println(o); }  private void printf(String format, Object... o) {  writer.printf(format, o); }  public static void main(String[] args) {  long time = System.currentTimeMillis();  Locale.setDefault(Locale.US);  new A().run();  System.err.printf("%.3f\n", 1e-3 * (System.currentTimeMillis() - time)); }  BufferedReader reader; StringTokenizer tokenizer; PrintWriter writer;  private void run() {  try {  reader = new BufferedReader(new InputStreamReader(System.in));  writer = new PrintWriter(System.out);  solve();  reader.close();  writer.close();  } catch (IOException e) {  e.printStackTrace();  System.exit(13);  } } }
5	public class A { BufferedReader br; StringTokenizer st; PrintWriter out;  void solve() throws IOException {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  int[] b = a.clone();  Arrays.sort(b);  int k = 0;  for (int i = 0; i < n; i++) {  if (a[i] != b[i]) {   k++;  }  }  if (k <= 2) {  out.println("YES");  } else {  out.println("NO");  } }  void run() {  try {       br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   solve();   out.close();  } catch (IOException e) {  e.printStackTrace();  } }  public static void main(String[] args) {  new A().run(); }  public String nextToken() throws IOException {  while ((st == null) || (!st.hasMoreTokens()))  st = new StringTokenizer(br.readLine());  return st.nextToken(); }  public int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  public double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  public long nextLong() throws IOException {  return Long.parseLong(nextToken()); } }
5	public class TaskA {  public static void main(String[] args) throws Exception {   Scanner scanner = new Scanner(System.in);   int n = scanner.nextInt();   scanner.nextLine();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = scanner.nextInt();   }   Arrays.sort(a);   int sum = 0;   for (int i = 0; i < n; i++) {    sum += a[i];   }   int take = 0, num = 0;   for (int i = n - 1; i > -1; i--) {    num++;    take += a[i];    sum -= a[i];    if (take > sum) {     break;    }   }   System.out.println(num);  } }
2	public class virtual1{  static InputReader in = new InputReader();  static PrintWriter out = new PrintWriter(System.out);   public static void main(String[] args) {    long x = in.nextLong();    long k = in.nextLong();    long mod = (long)1e9+7l;       long mul1 = 1;    long mul2 = 2*x-1;    mul2 = mul2%mod;    long pow = k;    long to = 2;    while(pow>0l){     if(pow%2l==1l){      mul1 = mul1*to;      mul1%=mod;     }     to=to*to;     to%=mod;     pow = pow/2l;    }    mul1 = mul1*mul2;    mul1%=mod;    mul1+=1;    if(x!=0)    out.println(mul1%mod);    else    out.println(0);     out.close();   }  static class InputReader  {   BufferedReader br;   StringTokenizer st;    public InputReader()   {    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());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  } }
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 void shuffle(int[] a) {   int n = a.length;   for(int i = 0; i < n; i++) {    int r = i + (int) (Math.random() * (n - i));    int tmp = a[i];    a[i] = a[r];    a[r] = tmp;   }  }  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());  }  public long nextLong() {   return Long.parseLong(next());  }  public double nextDouble() {   return Double.parseDouble(next());  } } class OutputWriter {  BufferedWriter writer;  public OutputWriter(OutputStream stream) {   writer = new BufferedWriter(new OutputStreamWriter(stream));  }  public void print(int i) throws IOException {   writer.write(i);  }  public void print(String s) throws IOException {   writer.write(s);  }  public void print(char[] c) throws IOException {   writer.write(c);  }  public void close() throws IOException {   writer.close();  } }
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));  }  private static int gcd(int i, int j) {   int a = Math.min(i,j);   int b = Math.max(i,j);   while(a != 0)   {    int temp = b % a;    b = a;    a = temp;   }   return b;  } }
4	public class OverlapedString { public static void main(String args[]) throws Exception {  OverlapedString os = new OverlapedString();  BufferedReader stdin =  new BufferedReader(new InputStreamReader(System.in));  String line;  while ((line = stdin.readLine()) != null) {  System.out.println(os.handleOverlap(line));  } } private int handleOverlap(String str) {  int len = str.length();  int count = 0;  for(int i=0;i<len;i++)  for(int j=i+1;j<len;j++) {   String _tmp = str.substring(i,j);   if(_tmp!=null&&_tmp.length()>0) {   if(getOverlapCount(str,_tmp)>1)   {    if(_tmp.length()>count)    count = _tmp.length();   }   }  }  return count; } private int getOverlapCount(String str,String sub) {  int start = 0;  int count = 0;  while(start<str.length()) {  start = str.indexOf(sub,start);  if(start==-1)   break;  else {   start++;   count++;  }  }  return count; } }
6	public class Main {  public void dfs(ArrayList<Integer>[] graph,int[] visited,int source) {    }  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(); } } class Reader {  static BufferedReader reader;  static StringTokenizer tokenizer;   static void init() throws IOException {   reader = new BufferedReader(     new FileReader("input.txt"));  tokenizer = new StringTokenizer("");  }  static void init(InputStream input) {   reader = new BufferedReader(      new InputStreamReader(input) );   tokenizer = new StringTokenizer("");  }   static String nextLine() throws IOException{   return reader.readLine();  }  static String next() throws IOException {   while ( ! tokenizer.hasMoreTokens() ) {       tokenizer = new StringTokenizer(      reader.readLine() );   }   return tokenizer.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt( next() );  }  static long nextLong() throws IOException {   return Long.parseLong( next() );  }  static double nextDouble() throws IOException {   return Double.parseDouble( 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[] intArr(int n) throws IOException {   int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();   return in;  }  public long[] longArr(int n) throws IOException {   long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();   return in;  }  public int[] intSortedArr(int n) throws IOException {   int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();   shuffle(in);   Arrays.sort(in);   return in;  }  public long[] longSortedArr(int n) throws IOException {   long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();   shuffle(in);   Arrays.sort(in);   return in;  }  public Integer[] IntegerArr(int n) throws IOException {   Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();   return in;  }  public Long[] LongArr(int n) throws IOException {   Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();   return in;  }  public String nextLine() throws IOException {  return br.readLine();  }   public int nextInt() throws IOException {  return Integer.parseInt(next());  }   public double nextDouble() throws IOException {  return Double.parseDouble(next());  }   public char nextChar() throws IOException {  return next().charAt(0);  }   public long nextLong() throws IOException {  return Long.parseLong(next());  }   public boolean ready() throws IOException {  return br.ready();  }   public void waitForInput() throws InterruptedException {  Thread.sleep(3000);  } } 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;  } } }
5	public class Main {  public static void main(String args[]) {  (new Main()).solve(); }  void solve() {  Scanner cin = new Scanner(System.in);  while( cin.hasNextInt() ) {   int n = cin.nextInt();  int arr[] = new int[n];  for(int i=0; i<n; ++i) {   arr[i] = cin.nextInt();  }   Arrays.sort(arr);   int ret[] = new int[n];  ret[0] = 1;  for(int i=0; i<n-1; ++i) { ret[i + 1] = arr[i]; }  if( arr[n - 1] == 1 ) { ret[n - 1] = 2; }   String glue = "";  for(int i=0; i<n; ++i) {   System.out.print(glue + ret[i]);   glue = " ";  }   System.out.println();  }  } }
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(); } private static int nextInt() throws IOException {  return Integer.parseInt(next()); } private static long nextLong() throws IOException {  return Long.parseLong(next()); } private static double nextDouble() throws IOException {  return Double.parseDouble(next()); } private static String next() throws IOException {  while (st==null || !st.hasMoreTokens())  st = new StringTokenizer(br.readLine());  return st.nextToken(); } }
1	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();  int k = in.nextInt();  boolean[] p = new boolean[n + 5];  int[] pp = new int[n + 5];  int ind = 0;  Arrays.fill(p, true);  p[0] = false;  p[1] = false;  for (int i = 2; i < n + 5; i++)  if (p[i]) {   pp[ind++] = i;   for (int j = 2*i; j < n + 5; j += i) p[j] = false;  }    boolean[] b = new boolean[n + 1];  for (int i = 0; i < ind - 1; i++)  if (pp[i] + pp[i + 1] + 1 <= n && p[pp[i] + pp[i + 1] + 1]) b[pp[i] + pp[i + 1] + 1] = true;   int kol = 0;  for (int i = 2; i <= n; i++)   if (b[i]) kol++;  if (kol >= k) out.println("YES");  else out.println("NO");  out.close(); } }
0	public class Main {   static final double EPS = 1E-6;  double a, v, l, d, w, u;   public void run() {   a = cin.nextDouble();   v = cin.nextDouble();   l = cin.nextDouble();   d = cin.nextDouble();   w = cin.nextDouble();   w = Math.min(w, v);   double s1 = v * v / (2 * a);   double s2 = w * w / (2 * a);   double s3 = s1 - s2;     double cost = 0;   if (d < s2) {    cost += Math.sqrt(2 * d / a);    w = cost * a;   } else if (d < s1 + s3) {    u = Math.sqrt(d / a + w * w / (2 * a * a)) * a;    cost = u / a + (u - w) / a;   } else {    cost += v / a;    cost += (v - w) / a;    cost += (d - s3 - s1) / v;   }   d = l - d;   s3 = (v * v - w * w) / (2 * a);   if (d < s3) {    cost += (-w + Math.sqrt(w * w + 2 * a * d)) / a;   } else {    cost += (v - w) / a;    cost += (d - s3) / v;   }   out.println(cost);  }  public static void main(String[] args) throws IOException {   Main sloved = new Main();   sloved.run();   sloved.out.close();  }  Scanner cin = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out); }
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());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
3	public class code5 { InputStream is; PrintWriter out; static long mod=pow(10,9)+7; static int dx[]={0,0,1,-1},dy[]={1,-1,0,0}; String arr[]; long dp[][]; void solve() throws IOException {  int n=ni();  int a[]=na(n);  int q=ni();  boolean flag=false;  for(int i=0;i<n;i++)  {  for(int j=0;j<i;j++)  {   if(a[j]>a[i])   flag^=true;  }  }  while(q--!=0)  {  int l=ni()-1;  int r=ni()-1;  int num=(r-l+1);  int tot=num*(num-1)/2;  if(tot%2==1)   flag^=true;  if(flag)   out.println("odd");  else   out.println("even");   } } int sum(int i) {  int sum=0;  while(i!=0)  {  if((i%10)%2==1)   sum+=i%10;  i/=10;  }  return sum; } ArrayList<Integer> al[];  void take(int n,int m)  {  al=new ArrayList[n];  for(int i=0;i<n;i++)   al[i]=new ArrayList<Integer>();  for(int i=0;i<m;i++)  {   int x=ni()-1;   int y=ni()-1;   al[x].add(y);   al[y].add(x);  }  }  int check(long n)  {  int count=0;  while(n!=0)  {   if(n%10!=0)   break;   n/=10;   count++;  }  return count;  } public static int count(int x) {  int num=0;  while(x!=0)  {  x=x&(x-1);  num++;  }  return num; } static long d, x, y; void extendedEuclid(long A, long B) {  if(B == 0) {   d = A;   x = 1;   y = 0;  }  else {   extendedEuclid(B, A%B);   long temp = x;   x = y;   y = temp - (A/B)*y;  } } long modInverse(long A,long M)  {  extendedEuclid(A,M);  return (x%M+M)%M;  } public static void mergeSort(int[] arr, int l ,int r){  if((r-l)>=1){  int mid = (l+r)/2;  mergeSort(arr,l,mid);  mergeSort(arr,mid+1,r);  merge(arr,l,r,mid);  } } public static void merge(int arr[], int l, int r, int mid){  int n1 = (mid-l+1), n2 = (r-mid);  int left[] = new int[n1];  int right[] = new int[n2];  for(int i =0 ;i<n1;i++) left[i] = arr[l+i];  for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];  int i =0, j =0, k = l;  while(i<n1 && j<n2){  if(left[i]>right[j]){   arr[k++] = right[j++];  }  else{   arr[k++] = left[i++];  }  }  while(i<n1) arr[k++] = left[i++];  while(j<n2) arr[k++] = right[j++]; } public static void mergeSort(long[] arr, int l ,int r){  if((r-l)>=1){  int mid = (l+r)/2;  mergeSort(arr,l,mid);  mergeSort(arr,mid+1,r);  merge(arr,l,r,mid);  } } public static void merge(long arr[], int l, int r, int mid){  int n1 = (mid-l+1), n2 = (r-mid);  long left[] = new long[n1];  long right[] = new long[n2];  for(int i =0 ;i<n1;i++) left[i] = arr[l+i];  for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];  int i =0, j =0, k = l;  while(i<n1 && j<n2){  if(left[i]>right[j]){   arr[k++] = right[j++];  }  else{   arr[k++] = left[i++];  }  }  while(i<n1) arr[k++] = left[i++];  while(j<n2) arr[k++] = right[j++]; }  static class Pair implements Comparable<Pair>{     int x,y,k;   int i,dir;   long val;  Pair (int x,int y){  this.x=x;  this.y=y;  }   public int compareTo(Pair o) {  if(this.x!=o.x)   return this.x-o.x;  return this.y-o.y;  }   public String toString(){  return x+" "+y+" "+k+" "+i;}  public boolean equals(Object o) {  if (o instanceof Pair) {   Pair p = (Pair)o;   return p.x == x && p.y == y;  }  return false;  }  public int hashCode() {  return new Long(x).hashCode()*31 + new Long(y).hashCode() ;  } }     public static boolean isPal(String s){   for(int i=0, j=s.length()-1;i<=j;i++,j--){     if(s.charAt(i)!=s.charAt(j)) return false;   }   return true;  }  public static String rev(String s){  StringBuilder sb=new StringBuilder(s);  sb.reverse();  return sb.toString();  }    public static long gcd(long x,long y){  if(y==0)  return x;  else  return gcd(y,x%y);  }    public static int gcd(int x,int y){   if(y==0)    return x;   return gcd(y,x%y);  }    public static long gcdExtended(long a,long b,long[] x){      if(a==0){    x[0]=0;    x[1]=1;    return b;   }   long[] y=new long[2];   long gcd=gcdExtended(b%a, a, y);      x[0]=y[1]-(b/a)*y[0];   x[1]=y[0];      return gcd;  }    public static int abs(int a,int b){  return (int)Math.abs(a-b);  }    public static long abs(long a,long b){  return (long)Math.abs(a-b);  }    public static int max(int a,int b){  if(a>b)  return a;  else  return b;  }    public static int min(int a,int b){  if(a>b)  return b;  else   return a;  }    public static long max(long a,long b){  if(a>b)  return a;  else  return b;  }    public static long min(long a,long b){  if(a>b)  return b;  else   return a;  }    public static long pow(long n,long p,long m){  long result = 1;  if(p==0)   return 1;  if (p==1)   return n;  while(p!=0)  {   if(p%2==1)    result *= n;   if(result>=m)   result%=m;   p >>=1;   n*=n;   if(n>=m)   n%=m;  }  return result;  }    public static long pow(long n,long p){  long result = 1;  if(p==0)   return 1;  if (p==1)   return n;  while(p!=0)  {   if(p%2==1)    result *= n;    p >>=1;   n*=n;   }  return result;  }  public static void debug(Object... o) {  System.out.println(Arrays.deepToString(o));  }  void run() throws Exception {  is = System.in;  out = new PrintWriter(System.out);  solve();  out.flush();  }    public static void main(String[] args) throws Exception {  new Thread(null, new Runnable() {   public void run() {   try {    new code5().run();   } catch (Exception e) {    e.printStackTrace();   }   }  }, "1", 1 << 26).start();      }  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 double nd() {  return Double.parseDouble(ns());  }   private char nc() {  return (char) skip();  }   private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(isSpaceChar(b))) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }   private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while (p < n && !(isSpaceChar(b))) {   buf[p++] = (char) b;   b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p);  }   private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)   map[i] = ns(m);  return map;  }   private int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = ni();  return a;  }  private long[] nl(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nl();  return a;  }   private int ni() {  int num = 0, b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))   ;  if (b == '-') {   minus = true;   b = readByte();  }    while (true) {   if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }   private long nl() {  long num = 0;  int b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))   ;  if (b == '-') {   minus = true;   b = readByte();  }    while (true) {   if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }  }
1	public class TaskB implements Runnable {  boolean prime[] = new boolean[(int)1e6+10];  InputReader c;  PrintWriter w;  public void run() {   c = new InputReader(System.in);   w = new PrintWriter(System.out);   char a[] = c.next().toCharArray(), b[] = c.next().toCharArray();   int n = a.length, m = b.length;   int[][] prefix = new int[m][2];   for(int i=0;i<m;i++){    if(i!=0) {     prefix[i][0] = prefix[i-1][0];     prefix[i][1] = prefix[i-1][1];    }    prefix[i][b[i] - '0']++;      }   long res = 0;   for(int i=0;i<n;i++){    int temp = a[i] - '0';    res += prefix[m - n + i][temp^1];    if(i!=0) res -= prefix[i-1][temp^1];   }   w.println(res);   w.close();  }  void sieveOfEratosthenes(int n) {   for(int i=0;i<n;i++)    prime[i] = true;   for(int p = 2; p*p <=n; p++)   {    if(prime[p] == true)    {     for(int i = p*p; i <= n; i += p)      prime[i] = false;    }   }  }  class pair implements Comparable<pair>{   char ch;   int ind;   @Override   public String toString() {    return "pair{" +      "ch=" + ch +      ", ind=" + ind +      '}';   }   public pair(char ch, int ind) {    this.ch = ch;    this.ind = ind;   }   public int compareTo(pair car) {    if(this.ch==car.ch)     return this.ind - car.ind;    return this.ch - car.ch;   }  }  public static void sortbyColumn(int arr[][], int col){   Arrays.sort(arr, new Comparator<int[]>()   {    public int compare(int[] o1, int[] o2){     return(Integer.valueOf(o1[col]).compareTo(o2[col]));    }   });  }  static long gcd(long a, long b){   if (b == 0)    return a;   return gcd(b, a % b);  }  public static class DJSet {   public int[] upper;   public DJSet(int n) {    upper = new int[n];    Arrays.fill(upper, -1);   }   public int root(int x) {    return upper[x] < 0 ? x : (upper[x] = root(upper[x]));   }   public boolean equiv(int x, int y) {    return root(x) == root(y);   }   public boolean union(int x, int y) {    x = root(x);    y = root(y);    if (x != y) {     if (upper[y] < upper[x]) {      int d = x;      x = y;      y = d;     }     upper[x] += upper[y];     upper[y] = x;    }    return x == y;   }  }  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;  }  public void printArray(int[] a){   for(int i=0;i<a.length;i++)    w.print(a[i]+" ");   w.println();  }  public int[] scanArrayI(int n){   int a[] = new int[n];   for(int i=0;i<n;i++)    a[i] = c.nextInt();   return a;  }  public long[] scanArrayL(int n){   long a[] = new long[n];   for(int i=0;i<n;i++)    a[i] = c.nextLong();   return a;  }  public void printArray(long[] a){   for(int i=0;i<a.length;i++)    w.print(a[i]+" ");   w.println();  }  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private SpaceCharFilter filter;   private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   public InputReader(InputStream stream) {    this.stream = stream;   }   public int read() {    if (numChars==-1)     throw new InputMismatchException();    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     }     catch (IOException e) {      throw new InputMismatchException();     }     if(numChars <= 0)      return -1;    }    return buf[curChar++];   }   public String nextLine() {    String str = "";    try {     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }   public int nextInt() {    int c = read();    while(isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     if(c<'0'||c>'9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));    return res * sgn;   }   public long nextLong() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));    return res * sgn;   }   public double nextDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, nextInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, nextInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }   public String readString() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    }    while (!isSpaceChar(c));    return res.toString();   }   public boolean isSpaceChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public String next() {    return readString();   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  public static void main(String args[]) throws Exception {   new Thread(null, new TaskB(),"TaskB",1<<26).start();  } }
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};  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); }  void debug(Object... os){  System.err.println(Arrays.deepToString(os)); }  public static void main(String[] args){  Locale.setDefault(Locale.US);  new P111C().run(); } }
5	public class codeforces  {   public static void main(String[] args)  {   InputReader in = new InputReader(System.in);   PrintWriter pw = new PrintWriter(System.out);   int n = in.nextInt();   long U = in.nextLong();   long[] E = new long[n];   double max = -1;     for(int i=0;i<n;i++)   E[i] = in.nextLong();     for(int k=1;k<n-1;k++)   {   int i = k + 1, j = n - 1, mid = 0;   double T = 0;      while(i < j)   {    mid = (int)Math.ceil((double)(i+j)/2);       if(E[mid] - E[k-1] <= U)    i = mid;    else    j = mid - 1;   }      j = k;   k = i;   i = j - 1;      T = E[k] - E[j];   T /= E[k] - E[i];      if(E[k] - E[i] <= U)    max = Math.max(max, T);      k = j;   }      pw.println(max);     pw.flush();   pw.close();  }        public static ArrayList Divisors(long n)  {   ArrayList<Long> div = new ArrayList<>();      for (long i=1; i<=Math.sqrt(n); i++)   {    if (n%i == 0)    {     div.add(i);           if(n/i != i)      div.add(n/i);    }   }   return div;  }    public static int BinarySearch(long[] a, long k)  {   int n = a.length;   int i = 0, j = n-1;   int mid = 0;     if(k < a[0])   return 0;   else if(k >= a[n-1])   return n;   else   {   while(j - i > 1)   {    mid = (i+j)/2;       if(k >= a[mid])    i = mid;    else    j = mid;   }   }     return i+1;  }  public static long GCD(long a,long b)  {   if(b==0)   return a;   else   return GCD(b,a%b);  }    static class pair implements Comparable<pair>  {   Integer x, y;   pair(int x,int y)   {   this.x=x;   this.y=y;   }     public int compareTo(pair o) {   int result = x.compareTo(o.x);   if(result==0)    result = y.compareTo(o.y);      return result;   }      public String toString()   {   return x+" "+y;   }     public boolean equals(Object o)   {   if (o instanceof pair)    {    pair p = (pair)o;    return p.x - x == 0 && p.y - y == 0 ;   }   return false;   }     public int hashCode()   {   return new Long(x).hashCode()*31 + new Long(y).hashCode();   }  }    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 int[] nextIntArray(int n)   {   int a[] = new int[n];   for (int i = 0; i < n; i++)    {    a[i] = nextInt();   }   return a;   }     public String readString()   {   int c = snext();   while (isSpaceChar(c))    {    c = snext();   }   StringBuilder res = new StringBuilder();   do    {    res.appendCodePoint(c);    c = snext();   } while (!isSpaceChar(c));   return res.toString();   }     public String nextLine()   {   int c = snext();   while (isSpaceChar(c))    c = snext();   StringBuilder res = new StringBuilder();   do    {    res.appendCodePoint(c);    c = snext();   } while (!isEndOfLine(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;   }     private boolean isEndOfLine(int c)   {   return c == '\n' || c == '\r' || c == -1;   }     public interface SpaceCharFilter   {   public boolean isSpaceChar(int ch);   }  }    static class CodeX {   public static void sort(long arr[]) {    merge_sort(arr, 0, arr.length - 1);   }    private static void merge_sort(long A[], long start, long end) {    if (start < end) {     long mid = (start + end) / 2;     merge_sort(A, start, mid);     merge_sort(A, mid + 1, end);     merge(A, start, mid, end);    }    }    private static void merge(long A[], long start,long mid, long end) {    long p = start, q = mid + 1;    long Arr[] = new long[(int)(end - start + 1)];    long k = 0;     for (int i = (int)start; i <= end; i++) {     if (p > mid)      Arr[(int)k++] = A[(int)q++];      else if (q > end)      Arr[(int)k++] = A[(int)p++];      else if (A[(int)p] < A[(int)q])      Arr[(int)k++] = A[(int)p++];      else      Arr[(int)k++] = A[(int)q++];    }    for (int i = 0; i < k; i++) {     A[(int)start++] = Arr[i];    }    }   }  }
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 <T> void shuffle(T[] arr) {  int n = arr.length;  for(int i=0;i<n;i++ ) {   int k = random.nextInt(n);   T temp = arr[k]; arr[k] = arr[i]; arr[i] = temp;  }  }     static void ruffleSort(int[] a) {  int n=a.length;  for (int i=0; i<n; i++) {   int oi=random.nextInt(n); int temp=a[oi];   a[oi]=a[i]; a[i]=temp;  }  Arrays.sort(a);  }   static void ruffleSort(long[] a) {  int n=a.length;  for (int i=0; i<n; i++) {   int oi=random.nextInt(n); long temp=a[oi];   a[oi]=a[i]; a[i]=temp;  }  Arrays.sort(a);  }      static void reverse(int[] arr, int l, int r) {  for(int i=l;i<l+(r-l)/2;i++){   int temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;  }  }   static void reverse(long[] arr, int l, int r) {  for(int i=l;i<l+(r-l)/2;i++){   long temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;  }  }     static <T> void reverse(T[] arr, int l, int r) {  for(int i=l;i<l+(r-l)/2;i++) {   T temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;  }  }      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 String nextLine() throws IOException {   return br.readLine();  }     public int nextInt(){   return Integer.parseInt(next());  }    public int[] readArray(int n){   int[] a = new int[n];   for(int i=0;i<n;i++)   a[i] = nextInt();   return a;  }     public long nextLong() {   return Long.parseLong(next());  }     public char nextChar() {   return next().toCharArray()[0];  }  }   }
4	public class Main{  public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));  static long MOD = (long) (1e9 + 7);   static long MOD2 = MOD * MOD;  static FastReader sc = new FastReader();  static int pInf = Integer.MAX_VALUE;  static int nInf = Integer.MIN_VALUE;  static long ded = (long)(1e17)+9;  public static void main(String[] args) throws Exception {   int test = 1;   for (int i = 1; i <= test; i++){    solve();   }   out.flush();   out.close();  }  static int n,m;  static int[][] hor,ver;  static Long[][][] dp;  static void solve(){   n = sc.nextInt();   m = sc.nextInt();   int k = sc.nextInt();   dp = new Long[n+1][m+1][k+1];   hor = new int[n][m-1];   ver = new int[n-1][m];   for(int i = 0; i < n; i++){    for(int j = 0; j < m-1; j++){     hor[i][j] = sc.nextInt();    }   }   for(int i = 0; i < n-1; i++){    for(int j = 0; j < m; j++){     ver[i][j] = sc.nextInt();    }   }   if(k%2==1){    for(int i = 0; i < n; i++){     for(int j = 0; j < m; j++){      out.print(-1+" ");     }     out.println();    }    return;   }   k = k/2;   for(int i = 0; i < n; i++){    for(int j = 0; j < m; j++){     long ans = cal(i,j,k);     out.print((2*ans)+" ");    }    out.println();   }  }  static long cal(int i, int j,int k){   if(k==0)return 0;   if(dp[i][j][k]!=null)return dp[i][j][k];   long ans = ded;   for(int h = 0; h < 4; h++){    int ni = i+di[h];    int nj = j+dj[h];    if(e(ni,nj)){     int cost = 0;     if(ni==i){      if(nj>j){       cost = hor[i][j];      }else{       cost = hor[i][nj];      }     }if(nj==j){      if(ni>i){       cost = ver[i][j];      }else{       cost = ver[ni][j];      }     }     ans = Math.min(ans,(cost)+cal(ni,nj,k-1));    }   }   return dp[i][j][k] = ans;  }  static int[] di = new int[]{0,-1,0,1};  static int[] dj = new int[]{-1,0,1,0};  static boolean e(int i, int j){   return i>=0&&j>=0&&i<n&&j<m;  }  static class Pair implements Comparable<Pair> {   int x;   int y;   public Pair(int x, int y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(Pair o){    return this.x-o.x;   }   @Override   public String toString() {    return "Pair{" + "x=" + x + ", y=" + y + '}';   }   public boolean equals(Pair o){    return this.x==o.x&&this.y==o.y;   }  }  public static long mul(long a, long b) {   return ((a % MOD) * (b % MOD)) % MOD;  }  public static long add(long a, long b) {   return ((a % MOD) + (b % MOD)) % MOD;  }  public static long c2(long n) {   if ((n & 1) == 0) {    return mul(n / 2, n - 1);   } else {    return mul(n, (n - 1) / 2);   }  }   static final Random random = new Random();  static void ruffleSort(int[] a) {   int n = a.length;   for (int i = 0; i < n; i++) {    int oi = random.nextInt(n); int temp= a[oi];    a[oi] = a[i];    a[i] = temp;   }   Arrays.sort(a);  }   static long countSetBits(long n) {   if (n == 0) return 0;   return 1 + countSetBits(n & (n - 1));  }   static long gcd(long A, long B) {   if (B == 0) return A;   return gcd(B, A % B);  }   static long fastExpo(long x, long n) {   if (n == 0) return 1;   if ((n & 1) == 0) return fastExpo((x * x) % MOD, n / 2) % MOD;   return ((x % MOD) * fastExpo((x * x) % MOD, (n - 1) / 2)) % MOD;  }   static boolean isPrime(long n) {   if (n <= 1) return false;   if (n <= 3) return true;   if (n % 2 == 0 || n % 3 == 0) return false;   for (int i = 5; i <= Math.sqrt(n); i += 6)    if (n % i == 0 || n % (i + 2) == 0) return false;   return true;  }  public static long modinv(long x) {   return modpow(x, MOD - 2);  }  public static long modpow(long a, long b) {   if (b == 0) {    return 1;   }   long x = modpow(a, b / 2);   x = (x * x) % MOD;   if (b % 2 == 1) {    return (x * a) % MOD;   }   return x;  }   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());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, InputReader in, PrintWriter out) {    long MOD = MathExtentions.DEFAULT_MOD;    long x = in.NextLong();    long k = in.NextLong();    if (x == 0) {     out.println(0);     return;    }    x %= MOD;    long res = x * MathExtentions.powerMod(2, k + 1, MOD);    res %= MOD;    res -= MathExtentions.powerMod(2, k, MOD) - 1;    res %= MOD;    while (res < 0) res += MOD;    while (res >= MOD) res -= MOD;    out.println(res);   }  }  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 long NextLong() {    return Long.parseLong(next());   }  }  static class MathExtentions {   public static final long DEFAULT_MOD = 1_000_000_007;   public static long powerMod(final long x, final long y, final long m) {    if (y == 0)     return 1;    long p = powerMod(x, y / 2, m) % m;    p = (p * p) % m;    if (y % 2 == 0)     return p;    else     return (x * p) % m;   }  } }
1	public class Main { static class MyReader{  private BufferedReader reader = null;  private StringTokenizer tokenizer = null;  MyReader(Reader r) throws IOException{   reader = new BufferedReader(r);  }  public int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  public String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  } } public static void main(String []args) throws IOException{  PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));  MyReader reader = new MyReader(new InputStreamReader(System.in));  int n = reader.nextInt();  int k = reader.nextInt();  int []a = new int[n];  for (int i = 0; i < n; ++i)  a[i] = reader.nextInt();  int j = 0;  HashMap<Integer,Integer> map = new HashMap<>();  for (int i = 0; i < n; ++i){  if (map.containsKey(a[i]))   map.put(a[i], map.get(a[i])+1);  else{   map.put(a[i], 1);   if (map.size()==k) { j = i+1; break; }  }  }  if (map.size()<k){  System.out.println("-1 -1");  return;  }  for (int i = 0; i < n; ++i){  if (map.get(a[i])==1){   System.out.println(i+1 + " " + j);   return;  }  map.put(a[i], map.get(a[i])-1);  } }  }
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 long getNextLong()throws IOException  {  checkStringTokenizer();  return Long.parseLong( strtoken.nextToken());  }  public double getNextDouble()throws IOException  {  checkStringTokenizer();  return Double.parseDouble( strtoken.nextToken());  }  public float getNextFloat()throws IOException  {  checkStringTokenizer();  return Float.parseFloat( strtoken.nextToken());  }  public String getNextString()throws IOException  {  checkStringTokenizer();  return strtoken.nextToken();  }  public String getNextLine()throws IOException  {  checkStringTokenizer();  return bufferReader.readLine();  }  public void skipCurrentLine()throws IOException  {  checkStringTokenizer();  strtoken = null;  }  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(); } }
3	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[] arr = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = in.nextInt();   }   Arrays.sort(arr);   int cnt = 0;   int pos = 0;   while (true) {    while (pos < n && arr[pos] == -1) pos++;    if (pos == n) break;    int min = arr[pos];    arr[pos] = -1;    cnt++;    for (int i = pos + 1; i < n; i++) {     if (arr[i] % min == 0) {      arr[i] = -1;     }    }   }   System.out.println(cnt);  } }
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 Skill implements Comparable<Skill> {  String name;  int v;  public Skill(String n,int val)  {   name=n;   v=val;  }  public int compareTo(Skill k)  {   return -k.name.compareTo(name);  } } class Parserdoubt  {   final private 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 char nextChar() throws Exception   {    byte c=read();    while(c<=' ') c= read();    return (char)c;   }   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++];   }  }
1	public class C {  private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); private static PrintStream out = System.out;  public static void main(String[] args) throws NumberFormatException, IOException {  int n = Integer.parseInt(in.readLine());  char[] s = in.readLine().toCharArray();  HashSet<Character> all = new HashSet<Character>();  for (char c : s)  all.add(c);  int totalCount = all.size();  HashMap<Character, Integer> cnts = new HashMap<Character, Integer>();  int ans = Integer.MAX_VALUE;  int x = 0;  for (int y = 0; y < n; ++y) {  if (!cnts.containsKey(s[y]))   cnts.put(s[y], 0);  cnts.put(s[y], cnts.get(s[y]) + 1);  if (cnts.size() < totalCount)   continue;  while (cnts.get(s[x]) > 1) {   cnts.put(s[x], cnts.get(s[x]) - 1);   ++x;  }  ans = Math.min(ans, y - x + 1);  }  out.println(ans); } }
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;   }  } }
5	public class CottageVillage {   class cl {   int x=0;   int a=0;     cl(int x, int a){    this.x=x;    this.a=a;   }  }   class cmp implements Comparator<cl> {   public int compare(cl d1, cl d2) {    return d1.x<d2.x ? -1 : 1;   }  }   public CottageVillage() {   Scanner sc = new Scanner(System.in);     int n = sc.nextInt();   int k = sc.nextInt();     cl[] w = new cl[n];   for(int i=0; i<n; i++)    w[i] = new cl(sc.nextInt(), sc.nextInt());   Arrays.sort(w, new cmp());     int cnt=2, diff=0;   for(int i=1; i<n; i++) {    diff = Math.abs(2*w[i].x-2*w[i-1].x-w[i].a-w[i-1].a)-2*k;    if (diff>0) cnt+=2;    else if (diff==0) cnt++;   }   System.out.println(cnt);  }   public static void main(String... args) {   new CottageVillage();  } }
0	public class A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   System.out.println("0 0 " + n);  } }
4	public class Main {  static Scanner cin = new Scanner(new BufferedReader(new InputStreamReader(System.in)));  static PrintWriter cout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  public static void main(String[] agrs) throws IOException{     String line = cin.nextLine();     HashMap<String, Integer> map = new HashMap<String, Integer>();   int ans = 0;   for (int i = 0; i < line.length(); ++i) {    StringBuffer str = new StringBuffer("");    for (int j = i; j < line.length(); ++j) {     str.append(line.charAt(j));         if (!map.containsKey(str.toString())) {           map.put(str.toString(), 1);     } else {      ans = str.length() > ans ? str.length() : ans;     }    }   }     cout.println(ans);     cin.close();   cout.close();  } }
1	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);  CBanhMi solver = new CBanhMi();  solver.solve(1, in, out);  out.close(); }  static class CBanhMi {  long mod = (long) (1e9 + 7);  public void solve(int testNumber, InputReader in, PrintWriter out) {  int n = in.nextInt();  int q = in.nextInt();  long[] two = new long[n + 1];  two[0] = 1;  for (int i = 1; i <= n; ++i) {   two[i] = (two[i - 1] * 2L);   two[i] %= mod;  }   char[] s = in.nextCharArray();  int[] acc = new int[n + 1];  for (int i = 1; i <= n; ++i) {   acc[i] = s[i - 1] == '0' ? 0 : 1;   acc[i] += acc[i - 1];  }            while (q-- > 0) {   int f = in.nextInt();   int t = in.nextInt();   int ones = acc[t] - acc[f - 1];   int zeros = (t - f + 1) - ones;   if (ones == 0) {   out.println(0);   } else {   long ans = two[t - f + 1] - (zeros > 0 ? two[zeros] : 0);   if (zeros == 0) {    --ans;   }   ans = (ans + mod) % mod;   out.println(ans);   }  }  }  }  static class InputReader implements FastIO {  private InputStream stream;  private static final int DEFAULT_BUFFER_SIZE = 1 << 16;  private static final int EOF = -1;  private byte[] buf = new byte[DEFAULT_BUFFER_SIZE];  private int curChar;  private int numChars;  public InputReader(InputStream stream) {  this.stream = stream;  }  public int read() {  if (this.numChars == EOF) {   throw new UnknownError();  } else {   if (this.curChar >= this.numChars) {   this.curChar = 0;    try {    this.numChars = this.stream.read(this.buf);   } catch (IOException ex) {    throw new InputMismatchException();   }    if (this.numChars <= 0) {    return EOF;   }   }   return this.buf[this.curChar++];  }  }  public int nextInt() {  int c;  for (c = this.read(); isSpaceChar(c); c = this.read()) {  }   byte sgn = 1;  if (c == 45) {   sgn = -1;   c = this.read();  }   int res = 0;   while (c >= 48 && c <= 57) {   res *= 10;   res += c - 48;   c = this.read();   if (isSpaceChar(c)) {   return res * sgn;   }  }   throw new InputMismatchException();  }  public String next() {  int c;  while (isSpaceChar(c = this.read())) {  }   StringBuilder result = new StringBuilder();  result.appendCodePoint(c);   while (!isSpaceChar(c = this.read())) {   result.appendCodePoint(c);  }   return result.toString();  }  public static boolean isSpaceChar(int c) {  return c == 32 || c == 10 || c == 13 || c == 9 || c == EOF;  }  public char[] nextCharArray() {  return next().toCharArray();  }  }  static interface FastIO {  } }
6	public class Main {  static HashSet<Integer> adjList[];  public static void main(String[]args)throws IOException{   BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(System.in));   StringBuilder stringBuilder=new StringBuilder();   String temp[]=bufferedReader.readLine().split(" ");   int V=Integer.parseInt(temp[0]);   int E=Integer.parseInt(temp[1]);   adjList=new HashSet[V];   for(int i=0;i<V;i++)    adjList[i]=new HashSet<>();   for(int i=0;i<E;i++){    temp=bufferedReader.readLine().split(" ");    int x=Integer.parseInt(temp[0])-1;    int y=Integer.parseInt(temp[1])-1;    adjList[y].add(x);    adjList[x].add(y);   }   stringBuilder.append(solve(V)+"\n");   System.out.println(stringBuilder);  }  private static long solve(int V) {   long dp[][]=new long[(1<<V)][V];   for(int i=0;i<V;i++)    dp[(1<<i)][i]=1;   for(int mask=1;mask<(1<<V);mask++){       int first = Integer.numberOfTrailingZeros(mask);    for(int i=0;i<V;i++){     if((mask&(1<<i))==0 || first==i) continue;     for (int j = 0; j < V; j++)      if (adjList[i].contains(j) && (mask & (1<<j))!=0)       dp[mask][i] += dp[mask ^ (1 << i)][j];    }   }     long count=0;   for(int mask=1;mask<(1<<V);mask++) {    int first = Integer.numberOfTrailingZeros(mask);    if (Integer.bitCount(mask)>=3)     for (int i = 0; i < V; i++) {      if(adjList[first].contains(i))       count+=dp[mask][i];     }   }   return count/2;   } }
1	public class C{ public static void main(String[] args) {  InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out);  Solver solver = new Solver();  solver.solve(in, out);  out.close(); }  static class Solver{  public void solve(InputReader in, PrintWriter out) {  int n = in.nextInt();  String s = in.next();  HashMap<Character, Integer> map = new HashMap<>();  for (int i = 0; i < n; ++ i) {   map.put(s.charAt(i), 0);  }  int l = 0, r = 0, cnt = 0, ans = n;  char c;  while (l < n) {   while (r < n && cnt < map.size()) {   c = s.charAt(r);   map.put(c, map.get(c) + 1);   if (map.get(c) == 1) ++cnt;   ++r;   }     if (cnt == map.size() && r-l < ans)   ans = r-l;     c = s.charAt(l);   map.put(c, map.get(c)-1);   if (map.get(c) == 0) --cnt;   ++l;  }  out.println(ans);  } }  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{   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 {  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 nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}   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 long l(){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 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 double d() throws IOException {return Double.parseDouble(s()) ;}   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 int[] arr(int n){int[] ret = new int[n];for (int i = 0; i < n; i++) {ret[i] = i();}return ret;}  }                        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();  } }
0	public class p343a {  public static void main(String args[])  {   Scanner sc = new Scanner(System.in);   System.out.println();   long a = sc.nextLong();   long b = sc.nextLong();   if(a==b) System.out.println("1");   else if(b==1) System.out.println(a);   else if(a==1) System.out.println(b);   else if(a>b) System.out.println(count(a,b));   else System.out.println(count(b,a));  }  public static long count(long a,long b)  {   long count = 0;   while(b!=1)   {    long c = a/b;    count += c;    long d = a-(c*b);    a = b;    b = d;    if(b==1)    {     count += a;     break;    }   }   return count;  } }
0	public class Main2 {   public static void main(String args[]){   Scanner input = new Scanner(System.in);   String st = input.nextLine();   System.out.println(bank(st));   }     public static int bank(String st){   StringBuilder sb = new StringBuilder(st);   int st1 = Integer.parseInt(sb.substring(0,st.length()-2)+sb.substring(st.length()-1,st.length()));   int st2 = Integer.parseInt(sb.substring(0,st.length()-1));   int st3 = Integer.parseInt(st);   return Math.max(st3,Math.max(st1, st2));   }  }
0	public class D {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   double a = in.nextDouble();   double v = in.nextDouble();   double l = in.nextDouble();   double d = in.nextDouble();   double w = in.nextDouble();   double ans = 0;   double maxSpeedBySign = Math.sqrt(2 * a * d);   double speedAtSign = -1;   if (v <= w) {    if (maxSpeedBySign <= v) {     ans += Math.sqrt(2 * d / a);     speedAtSign = maxSpeedBySign;    } else {     ans += v / a;     double distanceLeftTillSign = d - v * v / a / 2;     ans += distanceLeftTillSign / v;     speedAtSign = v;    }   } else {    if (maxSpeedBySign <= w) {     ans += Math.sqrt(2 * d / a);     speedAtSign = maxSpeedBySign;    } else {     double S = d / 2 - w * w / 4 / a;     double X = d - S;     double speed = Math.sqrt(2 * a * X);     if (speed <= v) {      ans += Math.sqrt(2 * X / a);      ans += (speed - w) / a;      speedAtSign = w;     } else {      double distanceToAc = v * v / a / 2;      double distanceToDe = (v * v - w * w) / a / 2;      ans += Math.sqrt(2 * distanceToAc / a);      ans += (d - distanceToAc - distanceToDe) / v;      ans += (v - w) / a;     }     speedAtSign = w;    }   }   l -= d;   double timeToGetMaxSpeed = (v - speedAtSign) / a;   double timeToReachEnd = (-2 * speedAtSign + Math.sqrt(4 * speedAtSign     * speedAtSign + 8 * a * l))     / 2 / a;   if (timeToGetMaxSpeed < timeToReachEnd) {    ans += timeToGetMaxSpeed;    double distanceCoveredToMaxSpeed = speedAtSign * timeToGetMaxSpeed      + 0.5 * a * timeToGetMaxSpeed * timeToGetMaxSpeed;    l -= distanceCoveredToMaxSpeed;    ans += l / v;   } else {    ans += timeToReachEnd;   }   System.out.println(ans);  } }
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);   ASubtractions solver = new ASubtractions();   solver.solve(1, in, out);   out.close();  }  static class ASubtractions {   int sub(int a, int b) {    if (a % b == 0)     return a / b;    else return a / b + sub(b, a % b);   }   public void solve(int testNumber, InputReader in, OutputWriter out) {    int t = in.nextInt();    int a, b;    while (t-- > 0) {     a = in.nextInt();     b = in.nextInt();     out.println(sub(a, b));    }   }  }  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 close() {    writer.close();   }   public void println(int i) {    writer.println(i);   }  } }
3	public class Main {  public static void main(String[] args) {   Scanner scan = new Scanner(System.in);   int n = scan.nextInt();   int[] nums = new int[n];   for(int i = 0; i < n; i++){    nums[i] = scan.nextInt();   }   Arrays.sort(nums);   boolean[] div = new boolean[n];   int count = 0;   for(int i = 0; i < n; i++) {    if (!div[i]) {     count++;     div[i] = true;     for(int j = i+1; j < n; j++) {      if (nums[j] % nums[i] == 0) {       div[j] = true;      }     }    }   }   System.out.println(count);  } }
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 IOException, InterruptedException {   int n = reader.nextInt();   int[] a = reader.nextIntArray(n);   boolean b = false;   for (int i = 0; i < n; i++) {    for (int j = i + 1; j < n; j++) {     if (a[i] > a[j]) {      b = !b;     }    }   }   int m = reader.nextInt();   for (int i = 0; i < m; i++) {    int l = reader.nextInt();    int r = reader.nextInt();    int d = r - l + 1;    if (d * (d - 1) / 2 % 2 == 1) {     b = !b;    }    writer.println(b ? "odd" : "even");   }  }   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;    }    int[][] nextIntMatrix(int n, int m) throws IOException {     int[][] a = new int[n][0];     for (int j = 0; j < n; j++) {      a[j] = nextIntArray(m);     }     return a;    }    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;    }    long[] nextLongArray(int n) throws IOException {     long[] m = new long[n];     for (int i = 0; i < n; i++) {      m[i] = nextLong();     }     return m;    }    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();    }    String nextLine() throws IOException {     if (end) {      return null;     }     str.setLength(0);     int c = nextChar();     while (c != '\n' && c != '\r' && c != -1) {      str.append((char) c);      c = nextChar();     }     if (c == -1) {      end = true;      if (str.length() == 0) {       return null;      }     }     if (c == '\r') {      nextChar();     }     return str.toString();    }    char[] nextCharArray() throws IOException {     return nextString().toCharArray();    }    char[][] nextCharMatrix(int n) throws IOException {     char[][] a = new char[n][0];     for (int i = 0; i < n; i++) {      a[i] = nextCharArray();     }     return a;    }   }   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();    }   }  }
3	public final class PythonIndentation { public static void main(String[] args) {  new PythonIndentation(System.in, System.out); }  static class Solver implements Runnable {  static final int MOD = (int) 1e9 + 7;  int n;  char[] arr;  long[][] dp;  BufferedReader in;  PrintWriter out;  void solve() throws IOException  {  n = Integer.parseInt(in.readLine());  arr = new char[n];  dp = new long[n + 1][n + 1];   for (int i = 0; i < n; i++)   arr[i] = in.readLine().charAt(0);   for (int i = 0; i <= n; i++)   Arrays.fill(dp[i], -1);   dp[0][0] = 1;   if (arr[0] == 's')   out.println(find(1, 0));  else   out.println(find(1, 1));   }  long find(int curr, int backIndents)  {   if (backIndents < 0)   return 0;   if (curr == n)   return dp[curr][backIndents] = 1;   if (dp[curr][backIndents] != -1)   return dp[curr][backIndents];   long ans;   if (arr[curr] == 's')  {   if (arr[curr - 1] == 'f')   ans = find(curr + 1, backIndents);   else   ans = CMath.mod(find(curr + 1, backIndents) + find(curr, backIndents - 1), MOD);  }  else  {   ans = find(curr + 1, backIndents + 1);   if (arr[curr - 1] != 'f')   {    ans = CMath.mod(ans + find(curr, backIndents - 1), MOD);   }  }   return dp[curr][backIndents] = ans;  }  public Solver(BufferedReader in, PrintWriter out)  {  this.in = in;  this.out = out;  }  @Override public void run()  {  try  {   solve();  }  catch (IOException e)  {   e.printStackTrace();  }  }  }  static class CMath {  static long mod(long number, long mod)  {  return number - (number / mod) * mod;  }  }  private PythonIndentation(InputStream inputStream, OutputStream outputStream) {  BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));  PrintWriter out = new PrintWriter(outputStream);  Thread thread = new Thread(null, new Solver(in, out), "PythonIndentation", 1 << 29);  try  {  thread.start();  thread.join();  }  catch (InterruptedException e)  {  e.printStackTrace();  }  finally  {  try  {   in.close();  }  catch (IOException e)  {   e.printStackTrace();  }   out.flush();  out.close();  } } }
6	public class MaeDosDragoes {   public static PrintWriter saida = new PrintWriter(System.out, false);            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());   }     String readNextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  }   public static void main(String[] args) {  FastScanner fastScanner = new FastScanner();   int proximoInt = fastScanner.nextInt();   double proximoDouble = fastScanner.nextInt();   long[] graph = new long[proximoInt];   for(Integer i = 0; i < proximoInt; i++) {    for(Integer j =0; j < proximoInt; j++) {     Integer val = fastScanner.nextInt();     if (val.equals(1) || i.equals(j)) {   graph[i] |= 1L << j;   }    }   }   int szLeft = proximoInt/2;   int szRight = proximoInt - szLeft;   int[] dp = new int[1 << szLeft];   int maxMask = 1 << szLeft;   for(int mask = 1; mask <maxMask; mask++) {    int curMask = mask;    for(int j = 0; j < szLeft; j++) {     if (((1 << j) & mask) > 0) {      curMask &= graph[j + szRight] >> szRight;      dp[mask] = Math.max(dp[mask], dp[mask ^ (1 << j)]);     }    }    if (mask == curMask) {     dp[mask] = Math.max(dp[mask],Integer.bitCount(mask));    }   }   int ans = 0;   int rmaxMask = 1 << szRight;   for(int mask = 0; mask < rmaxMask; mask++) {    int curMask = mask;    int oMask = maxMask -1;    for(int j = 0; j < szRight; j++) {     if (((1 << j) & mask) > 0) {      curMask &= (graph[j] & (rmaxMask-1));      oMask &= graph[j] >> szRight;     }    }    if (curMask != mask) continue;    ans = Math.max(ans, Integer.bitCount(mask) + dp[oMask]);   }   proximoDouble/=ans;   saida.println(proximoDouble * proximoDouble * (ans * (ans-1))/2);   saida.flush();  } }
1	public class A { public static void main(String[] args){  Scanner in = new Scanner(System.in);  int n = in.nextInt();  int a[] = new int[100];  for (int i = 0;i<n;i++) a[i] = in.nextInt()%2;  if (a[0]==a[1] || a[0]==a[2]){  for (int i = 1;i<n;i++)   if (a[i] != a[0]) {   System.out.println(i+1);   break;   }  } else{  System.out.println(1);  } } }
0	public final class subtractions {  static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static FastScanner sc=new FastScanner(br);  static PrintWriter out=new PrintWriter(System.out);  static long solve(long a,long b) {  if(a<=0 || b<=0)  {  return 0;  }  else  {  long max=Math.max(a,b),min=Math.min(a,b);  long low=1,high=(long)(1e9);  while(low<high)  {   long mid=(low+high)>>1,val=(min*mid),curr=max-val;   if(curr<min)   {   high=mid;   }   else   {   low=mid+1;   }  }  return low+solve(min,max-(low*min));  } }  public static void main(String args[]) throws Exception {  int t=sc.nextInt();  while(t>0)  {  long a=sc.nextLong(),b=sc.nextLong();  out.println(solve(a,b));  t--;  }  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 String next() throws Exception {  return nextToken().toString(); }   public int nextInt() throws Exception {   return Integer.parseInt(nextToken());  }  public long nextLong() throws Exception {   return Long.parseLong(nextToken());  }  public double nextDouble() throws Exception {   return Double.parseDouble(nextToken());  } }
4	public class Main{  static InputReader sc;  static PrintWriter pw;  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   sc = new InputReader(inputStream);   pw = new PrintWriter(outputStream);   solve();   pw.close();  }      public static void solve() {     int t=1;   u:while(t-->0){    int n=s(0);    int m=s(0);    int k=s(0);       long [][][]arr=new long [n][m][4];    for(int i=0;i<n;i++){     for(int j=0;j<m-1;j++){      long v=s(0l);      arr[i][j][0]=v;      arr[i][j+1][2]=v;     }    }    for(int i=0;i<n-1;i++){     for(int j=0;j<m;j++){      long v=s(0l);      arr[i][j][1]=v;      arr[i+1][j][3]=v;     }    }    Long [][][]dp=new Long [n][m][k+1];    for(int i=0;i<n;i++){     for(int j=0;j<m;j++)      for(int p=1;p<=k;p++)       helper(i,j,p,dp,arr,n,m);    }    for(int i=0;i<n;i++){     for(int j=0;j<m;j++)      p(dp[i][j][k]+" ");     pln("");    }   }     }    static int [][]dir=new int [][]{{0,1},{1,0},{0,-1},{-1,0}};  public static long helper(int i, int j, int k, Long [][][]dp, long [][][]arr, int n, int m){   if(k<0)    return -1;   if(k==0)    return 0;   if(dp[i][j][k]!=null)    return dp[i][j][k];   int x, y;   long ans=Long.MAX_VALUE,val;   for(int d=0;d<4;d++){    x=i+dir[d][0];    y=j+dir[d][1];    if(x<0||x>=n||y<0||y>=m)     continue;    val=helper(x,y,k-2,dp,arr,n,m);    if(val!=-1)     ans=Math.min(ans,val+2*arr[i][j][d]);   }   return dp[i][j][k]=(ans==Long.MAX_VALUE?-1:ans);    }  public static int find(List<Integer> list, int x){   int l=0,r=list.size()-1,m;   while(l<=r){    m=(r-l)/2+l;    if(list.get(m)<=x)     l=m+1;    else     r=m-1;   }   return r;  }  static class Node{   int val;   long cost;   Node next;   Node(int v,long c){    val=v;    next=null;    cost=c;   }  }   public static long sum(long n){   long val=0l;   while(n>0){    val+=n%10;    n/=10;   }   return val;  }                              public static int findDiameter(int r, List<List<Integer>>list){   return findFarthest(findFarthest(r,list)[0],list)[1];  }  public static int[] findFarthest(int u, List<List<Integer>>list){   int n=list.size();   boolean []vis=new boolean[n+1];   Queue<Integer>q=new LinkedList<>();   q.offer(u);   vis[u]=true;   int s,pr,cnt=0;   int []ar=new int[]{u,0};   while(q.size()>0){    s=q.size();    while(s-->0){     pr=q.poll();     if(ar[1]<cnt){      ar[1]=cnt;      ar[0]=pr;     }     for(int i:list.get(pr)){      if(!vis[i]){       vis[i]=true;       q.offer(i);      }     }    }    cnt++;   }   return ar;  }  public static long atMostK(char []chrr, int k){   if(k<0)    return 0;   int l=0,cnt=0;   long ans=0l;   for(int i=0;i<chrr.length;i++){    if(chrr[i]=='1')     cnt++;    while(cnt>k){     if(chrr[l++]=='1')      cnt--;    }    ans+=(long)(i-l)+1l;   }   return ans;  }  public static int ask(int l){   System.out.println(l);   System.out.flush();   return sc.nextInt();  }  public static void sort(long []arr){   ArrayList<Long> list=new ArrayList<>();   for(int i=0;i<arr.length;i++)    list.add(arr[i]);   Collections.sort(list);   for(int i=0;i<arr.length;i++)    arr[i]=list.get(i);  }  public static void swap(char []chrr, int i, int j){   char temp=chrr[i];   chrr[i]=chrr[j];   chrr[j]=temp;  }  public static int countSetBits(long n){   int a=0;   while(n>0){    a+=(n&1);    n>>=1;   }   return a;  }  static class Pair{   int v,w;   Pair(int V, int W){    v=V;    w=W;   }    }   static boolean isPrime(long n) {   if (n <= 1)    return false;   if (n <= 3)    return true;   if (n % 2 == 0 || n % 3 == 0)    return false;   for (int i = 5; i * i <= n; i = i + 6)    if (n % i == 0 || n % (i + 2) == 0)     return false;   return true;  }  static long gcd(long a, long b) {   if (b == 0)    return a;   return a>b?gcd(b, a % b):gcd(a, b % a);  }  static long fast_pow(long base,long n,long M){   if(n==0)    return 1;   if(n==1)   return base;   long halfn=fast_pow(base,n/2,M);   if(n%2==0)    return ( halfn * halfn ) % M;   else    return ( ( ( halfn * halfn ) % M ) * base ) % M;  }  static long modInverse(long n,long M){   return fast_pow(n,M-2,M);  }  public static int s(int n){   return sc.nextInt();  }  public static long s(long n){   return sc.nextLong();  }  public static String s(String n){   return sc.next();  }  public static double s(double n){   return sc.nextDouble();  }  public static void p(int n){   pw.print(n);  }  public static void p(long n){   pw.print(n);  }  public static void p(String n){   pw.print(n);  }  public static void p(double n){   pw.print(n);  }  public static void pln(int n){   pw.println(n);  }  public static void pln(long n){   pw.println(n);  }  public static void pln(String n){   pw.println(n);  }  public static void pln(double n){   pw.println(n);  }  public static void feedArr(long []arr){   for(int i=0;i<arr.length;i++)    arr[i]=sc.nextLong();  }  public static void feedArr(double []arr){   for(int i=0;i<arr.length;i++)    arr[i]=sc.nextDouble();  }  public static void feedArr(int []arr){   for(int i=0;i<arr.length;i++)    arr[i]=sc.nextInt();  }  public static void feedArr(String []arr){   for(int i=0;i<arr.length;i++)    arr[i]=sc.next();  }  public static String printArr(int []arr){   StringBuilder sbr=new StringBuilder();   for(int i:arr)    sbr.append(i+" ");   return sbr.toString();  }  public static String printArr(long []arr){   StringBuilder sbr=new StringBuilder();   for(long i:arr)    sbr.append(i+" ");   return sbr.toString();  }  public static String printArr(String []arr){   StringBuilder sbr=new StringBuilder();   for(String i:arr)    sbr.append(i+" ");   return sbr.toString();  }  public static String printArr(double []arr){   StringBuilder sbr=new StringBuilder();   for(double i:arr)    sbr.append(i+" ");   return sbr.toString();  }  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 double nextDouble() {    return Double.parseDouble(next());   }  } }
6	public class C {  public static void main(String[] args) {   new C().run();   }  private void run() {  Scanner sc = new Scanner(System.in);  int sx = sc.nextInt();  int sy = sc.nextInt();  int n = sc.nextInt();  int[] x = new int[n];  int[] y = new int[n];  for (int i = 0; i < n; i++) {  x[i] = sc.nextInt();  y[i] = sc.nextInt();  }  sc.close();  int[] w = new int[n * n];  int[] pMask = new int[n * n];  for (int i = 0; i < n; i++) {  for (int j = i; j < n; j++) {   int ind = i * n + j;   if (i == j) {   w[ind] = 2 * dist(sx, sy, x[i], y[i]);   pMask[ind] = 1 << i;   } else {   w[ind] = dist(sx, sy, x[i], y[i]) + dist(x[i], y[i], x[j], y[j]) + dist(x[j], y[j], sx, sy);   pMask[ind] = 1 << i | 1 << j;   }  }  }  int max = 1 << n;  int[] p = new int[max];  int[] dist = new int[max];  Arrays.fill(dist, Integer.MAX_VALUE / 2);  dist[0] = 0;  int[] available = new int[n * n];  for (int mask = 0; mask < max; mask++) {  int ac = 0;  for (int i = 0; i < n; i++) {   if (((mask >> i) & 1) == 0) {   available[ac++] = i;   }  }  int s = 0;     for (int j = s; j < ac; j++) {   int a = available[s];   int b = available[j];   int ind = a * n + b;   int nextMask = mask | pMask[ind];   int newD = dist[mask] + w[ind];   if (newD < dist[nextMask]) {    dist[nextMask] = newD;       p[nextMask] = ind;   }   }    }  System.out.println(dist[max - 1]);  ArrayList<Integer> steps = new ArrayList<Integer>();  int mask = max - 1;  while (mask > 0) {  int msk = p[mask];  steps.add(msk);  int a = msk / n;  int b = msk % n;  if (a == b) {   mask ^= 1 << a;  } else {   mask ^= 1 << a;   mask ^= 1 << b;  }  }  System.out.print(0);  for (int i = steps.size() - 1; i >= 0; i--) {  int msk = steps.get(i);  int a = msk / n;  int b = msk % n;  if (a == b) {   System.out.printf(" %d 0", a + 1);  } else {   System.out.printf(" %d %d 0", a + 1, b + 1);  }  }  System.out.println(); }  private int dist(int x1, int y1, int x2, int y2) {  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); } }
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)); }  }
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;  }  @Override  public int compareTo(Beacon o) {  return Integer.compare(this.position, o.position);  } }  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 long nl() {  return Long.parseLong(next());  }  public void close() throws IOException {  reader.close();  } }  public static void main(String[] args) throws IOException {  try (ChainReaction instance = new ChainReaction()) {  instance.solve();  } } }
6	public class newProgram9 {  public static void main(String[] args) throws IOException {     FastIO in = new FastIO();   int t = in.ni();     while (t-- > 0) {    int n = in.ni();    int m = in.ni();    int a[][] = new int[n][m];    int b[][] = new int[m][n];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      a[i][j] = in.ni();      b[j][i] = a[i][j];     }    }    for (int i = 0; i < m; i++) {     Arrays.sort(b[i]);    }    Data d[] = new Data[m];    for (int i = 0; i < m; i++) {     d[i] = new Data(-b[i][n - 1], i);    }    Arrays.sort(d);    int col = Math.min(n, m);    int c[][] = new int[n][col];    for (int i = 0; i < col; i++) {     for (int j = 0; j < n; j++) {      c[j][i] = a[j][d[i].b];     }    }                         System.out.println(ans(c, n, col, 0));   }   in.bw.flush();  }  private static int ans(int c[][], int n, int m, int col) {   if (col == m) {    int sum = 0;    for (int i = 0; i < n; i++) {     int max = 0;     for (int j = 0; j < m; j++) {           max = Math.max(c[i][j], max);     }     sum += max;        }       return sum;   } else {    int max = ans(c, n, m, col + 1);    int curr[] = new int[n];    for (int i = 0; i < n; i++) {     curr[i] = c[i][col];    }    for (int i = 1; i < n; i++) {     for (int j = 0; j < n; j++) {      c[j][col] = curr[(i + j) % n];     }     max = Math.max(max, ans(c, n, m, col + 1));    }    return max;   }  }  static class FastIO {   private final BufferedReader br;   private final BufferedWriter bw;   private String s[];   private int index;   private final StringBuilder sb;   public FastIO() throws IOException {    br = new BufferedReader(new InputStreamReader(System.in));    bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));    s = br.readLine().split(" ");    sb = new StringBuilder();    index = 0;   }   public int ni() throws IOException {    return Integer.parseInt(nextToken());   }   public double nd() throws IOException {    return Double.parseDouble(nextToken());   }   public long nl() throws IOException {    return Long.parseLong(nextToken());   }   public String next() throws IOException {    return nextToken();   }   public String nli() throws IOException {    try {     return br.readLine();    } catch (IOException ex) {    }    return null;   }   public int[] gia(int n) throws IOException {    int a[] = new int[n];    for (int i = 0; i < n; i++) {     a[i] = ni();    }    return a;   }   public int[] gia(int n, int start, int end) throws IOException {    validate(n, start, end);    int a[] = new int[n];    for (int i = start; i < end; i++) {     a[i] = ni();    }    return a;   }   public double[] gda(int n) throws IOException {    double a[] = new double[n];    for (int i = 0; i < n; i++) {     a[i] = nd();    }    return a;   }   public double[] gda(int n, int start, int end) throws IOException {    validate(n, start, end);    double a[] = new double[n];    for (int i = start; i < end; i++) {     a[i] = nd();    }    return a;   }   public long[] gla(int n) throws IOException {    long a[] = new long[n];    for (int i = 0; i < n; i++) {     a[i] = nl();    }    return a;   }   public long[] gla(int n, int start, int end) throws IOException {    validate(n, start, end);    long a[] = new long[n];    for (int i = start; i < end; i++) {     a[i] = nl();    }    return a;   }   public int[][][] gwtree(int n) throws IOException {    int m = n - 1;    int adja[][] = new int[n + 1][];    int weight[][] = new int[n + 1][];    int from[] = new int[m];    int to[] = new int[m];    int count[] = new int[n + 1];    int cost[] = new int[n + 1];    for (int i = 0; i < m; i++) {     from[i] = i + 1;     to[i] = ni();     cost[i] = ni();     count[from[i]]++;     count[to[i]]++;    }    for (int i = 0; i <= n; i++) {     adja[i] = new int[count[i]];     weight[i] = new int[count[i]];    }    for (int i = 0; i < m; i++) {     adja[from[i]][count[from[i]] - 1] = to[i];     adja[to[i]][count[to[i]] - 1] = from[i];     weight[from[i]][count[from[i]] - 1] = cost[i];     weight[to[i]][count[to[i]] - 1] = cost[i];     count[from[i]]--;     count[to[i]]--;    }    return new int[][][] { adja, weight };   }   public int[][][] gwg(int n, int m) throws IOException {    int adja[][] = new int[n + 1][];    int weight[][] = new int[n + 1][];    int from[] = new int[m];    int to[] = new int[m];    int count[] = new int[n + 1];    int cost[] = new int[n + 1];    for (int i = 0; i < m; i++) {     from[i] = ni();     to[i] = ni();     cost[i] = ni();     count[from[i]]++;     count[to[i]]++;    }    for (int i = 0; i <= n; i++) {     adja[i] = new int[count[i]];     weight[i] = new int[count[i]];    }    for (int i = 0; i < m; i++) {     adja[from[i]][count[from[i]] - 1] = to[i];     adja[to[i]][count[to[i]] - 1] = from[i];     weight[from[i]][count[from[i]] - 1] = cost[i];     weight[to[i]][count[to[i]] - 1] = cost[i];     count[from[i]]--;     count[to[i]]--;    }    return new int[][][] { adja, weight };   }   public int[][] gtree(int n) throws IOException {    int adja[][] = new int[n + 1][];    int from[] = new int[n - 1];    int to[] = new int[n - 1];    int count[] = new int[n + 1];    for (int i = 0; i < n - 1; i++) {     from[i] = i + 1;     to[i] = ni();     count[from[i]]++;     count[to[i]]++;    }    for (int i = 0; i <= n; i++) {     adja[i] = new int[count[i]];    }    for (int i = 0; i < n - 1; i++) {     adja[from[i]][--count[from[i]]] = to[i];     adja[to[i]][--count[to[i]]] = from[i];    }    return adja;   }   public int[][] gg(int n, int m) throws IOException {    int adja[][] = new int[n + 1][];    int from[] = new int[m];    int to[] = new int[m];    int count[] = new int[n + 1];    for (int i = 0; i < m; i++) {     from[i] = ni();     to[i] = ni();     count[from[i]]++;     count[to[i]]++;    }    for (int i = 0; i <= n; i++) {     adja[i] = new int[count[i]];    }    for (int i = 0; i < m; i++) {     adja[from[i]][--count[from[i]]] = to[i];     adja[to[i]][--count[to[i]]] = from[i];    }    return adja;   }   public void print(String s) throws IOException {    bw.write(s);   }   public void println(String s) throws IOException {    bw.write(s);    bw.newLine();   }   public void print(int s) throws IOException {    bw.write(s + "");   }   public void println(int s) throws IOException {    bw.write(s + "");    bw.newLine();   }   public void print(long s) throws IOException {    bw.write(s + "");   }   public void println(long s) throws IOException {    bw.write(s + "");    bw.newLine();   }   public void print(double s) throws IOException {    bw.write(s + "");   }   public void println(double s) throws IOException {    bw.write(s + "");    bw.newLine();   }   private String nextToken() throws IndexOutOfBoundsException, IOException {    if (index == s.length) {     s = br.readLine().split(" ");     index = 0;    }    return s[index++];   }   private void validate(int n, int start, int end) {    if (start < 0 || end >= n) {     throw new IllegalArgumentException();    }   }  }  static class Data implements Comparable<Data> {   int a, b;   public Data(int a, int b) {    this.a = a;    this.b = b;   }   @Override   public int compareTo(Data o) {    if (a == o.a) {     return Integer.compare(b, o.b);    }    return Integer.compare(a, o.a);   }   public static void sort(int a[]) {    Data d[] = new Data[a.length];    for (int i = 0; i < a.length; i++) {     d[i] = new Data(a[i], 0);    }    Arrays.sort(d);    for (int i = 0; i < a.length; i++) {     a[i] = d[i].a;    }   }  } }
4	public class R035C {  public void debug(Object... objects) { System.err.println(Arrays.deepToString(objects)); }  public static final int INF = 987654321;  public static final long LINF = 987654321987654321L;  public static final double EPS = 1e-9;   Scanner scanner;  PrintWriter out;  int[][] iss;   public R035C() {   try {    this.scanner = new Scanner(new File("input.txt"));    this.out = new PrintWriter("output.txt");   } catch(FileNotFoundException ex) { ex.printStackTrace(); }  }   class Point implements Comparable<Point> {   int x, y, count;   Point(int x, int y) { this.x = x; this.y = y; }   public int hashCode() { return x * 17 + y; }   public boolean equals(Object o) {    if(!(o instanceof Point)) return false;    Point that = (Point)o;    return this.x == that.x && this.y == that.y;   }   public int compareTo(Point that) { return this.count - that.count; }   public String toString() { return "(" + x + ", " + y + ":" + count + ")"; }  }    int[] dx = new int[] { 0, 0, -1, 1 };  int[] dy= new int[] { -1, 1, 0, 0 };  int n, m;   Queue<Point> q;   Point bfs() {   int max = -INF;   Point p = null;   while(!q.isEmpty()) {    Point cur = q.remove();    if(max < cur.count) { max = cur.count; p = cur; }    for(int i=0; i<dx.length; i++) {     int nx = cur.x + dx[i];     int ny = cur.y + dy[i];     if(nx < 0 || nx >= n) { continue; }     if(ny < 0 || ny >= m) { continue; }     Point np = new Point(nx, ny);     if(iss[nx][ny] != 0) { continue; }     np.count = cur.count+1;     iss[nx][ny] = np.count;     q.add(np);    }   }   return p;  }   private void solve() {   this.n = scanner.nextInt();   this.m = scanner.nextInt();   this.iss = new int[n][m];   int k = scanner.nextInt();   q = new PriorityQueue<Point>();   for(int i=0; i<k; i++) {    int x = scanner.nextInt() - 1;    int y = scanner.nextInt() - 1;    Point init = new Point(x, y);    init.count = 1;    q.add(init);    iss[x][y] = 1;   }   Point p = bfs();   out.println((p.x+1) + " " + (p.y+1));  }   private void finish() { this.out.close(); }   public static void main(String[] args) {   R035C obj = new R035C();   obj.solve();   obj.finish();  } }
0	public class ProblemB {    public static void main(String[] args) {   Scanner s = new Scanner(System.in);     int a = s.nextInt();     int f1 = a/10;     int b = a;   int last = a%10;     b/=10;   b/=10;   b*=10;   b+=last;     System.out.println(Math.max(a, Math.max(f1, b)));         } }
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();   }   finally {   }  }  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);   }   public String getString() {    skip();    String s2 = "";    while (cur < s.length() && (s.charAt(cur) >= 'a' && s.charAt(cur) <= 'z')) {     s2 += s.charAt(cur);     cur++;    }    return s2;   }   public char getCurrentChar() throws Exception {    if (cur < s.length())     return s.charAt(cur);    else     throw new Exception("Current character out of string length");   }   public void moveNextChar() {    if (cur < s.length())     cur++;   }   public boolean isFinished() {    return cur >= s.length();   }  } }
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 Sellerman();   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++];  }  @Override  public void close() {   try {    stream.close();   } catch (IOException ignored) {   }  } } abstract class InputReader {  private boolean finished = false;  public abstract int read();  public int nextInt() {   return Integer.parseInt(nextToken());  }   public String nextToken() {   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;  }  public void setFinished(boolean finished) {   this.finished = finished;  }  public abstract void close(); } interface Solver {  public void solve(int testNumber, InputReader in, PrintWriter out); } class Exit {  private Exit() {  }  public static void exit(InputReader in, PrintWriter out) {   in.setFinished(true);   in.close();   out.close();  } } class Sellerman implements Solver {  public void solve(int testNumber, InputReader in, PrintWriter out) {   int x0 = in.nextInt();   int y0 = in.nextInt();   int n = in.nextInt() + 1;   int[] x = new int[n];   int[] y = new int[n];   x[n - 1] = x0;   y[n - 1] = y0;   for (int i = 0; i < n - 1; ++i) {    x[i] = in.nextInt();    y[i] = in.nextInt();   }   int [][] g = new int[n][n];   for(int i = 0; i < n; ++i)    for (int j = 0; j < n; ++j) {     g[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);    }   -- n;   int[] dm = new int[1 << n];   int[] prev = new int[1 << n];   byte [] bit = new byte[1 << n];   byte [] item0 = new byte[1 << n];   byte [] item1 = new byte[1 << n];   for (int i = 0; i < n; ++i) {    bit[1 << i] = (byte) i;   }   Arrays.fill(dm, -1);   dm[0] = 0;   int tt[][] = new int[n][n];   for (int i = 0; i < n; ++i)    for (int j =0 ; j < n; ++j) {     tt[i][j] = Math.min(g[n][i] + g[i][j] + g[j][n],          g[n][j] + g[i][j] + g[i][n]);    }   for (int i = 0; i < (1 << n); ++i) {    if (dm[i] == -1)continue;    int t = (i ^ ((1 << n) - 1));    int left = bit[t - (t & (t - 1))];    for (int j = left; j < n; ++j) {     if ((i & (1 << j)) > 0) continue;     int nm = i | (1 << left) | (1 << j);     if (dm[nm] == -1 || dm[nm] > dm[i] + tt[left][j]) {      dm[nm] = dm[i] + tt[left][j];      prev[nm] = i;      item0[nm] = (byte)left;      item1[nm] = (byte)j;     }    }   }   out.println(dm[(1 << n) - 1]);   Vector<Vector<Integer>> path = new Vector<Vector<Integer>> () ;   int cmask = (1 << n) - 1;   while (cmask > 0) {    int p = prev[cmask];    Vector<Integer> tmp = new Vector<Integer> () ;    tmp.add(0);    tmp.add(item0[cmask] + 1);    tmp.add(item1[cmask] + 1);    cmask = prev[cmask];    path.add(tmp);   }   Collections.reverse(path);   int len = 0;   for (Vector<Integer> vec : path)    len += vec.size();   int ans[] = new int[len];   boolean[] valid = new boolean[len];   Arrays.fill(valid, true);   len = 0;   for (Vector<Integer> vec : path) {    for (int ttt : vec) {     ans[len ++] = ttt;    }   }   for (int i = 0; i < len - 1; ++i) {    if (ans[i] == ans[i + 1])     valid[i] = false;   }   for (int i = 0; i < len; ++i) {    if (valid[i]) {     out.print(ans[i] + " ");    }   }   out.print("0");  } }
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 <T> void shuffle(T[] arr) {  int n = arr.length;  for(int i=0;i<n;i++ ) {   int k = random.nextInt(n);   T temp = arr[k]; arr[k] = arr[i]; arr[i] = temp;  }  }     static void ruffleSort(int[] a) {  int n=a.length;  for (int i=0; i<n; i++) {   int oi=random.nextInt(n); int temp=a[oi];   a[oi]=a[i]; a[i]=temp;  }  Arrays.sort(a);  }   static void ruffleSort(long[] a) {  int n=a.length;  for (int i=0; i<n; i++) {   int oi=random.nextInt(n); long temp=a[oi];   a[oi]=a[i]; a[i]=temp;  }  Arrays.sort(a);  }      static void reverse(int[] arr, int l, int r) {  for(int i=l;i<l+(r-l)/2;i++){   int temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;  }  }   static void reverse(long[] arr, int l, int r) {  for(int i=l;i<l+(r-l)/2;i++){   long temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;  }  }     static <T> void reverse(T[] arr, int l, int r) {  for(int i=l;i<l+(r-l)/2;i++) {   T temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;  }  }      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 String nextLine() throws IOException {   return br.readLine();  }     public int nextInt(){   return Integer.parseInt(next());  }    public int[] readArray(int n){   int[] a = new int[n];   for(int i=0;i<n;i++)   a[i] = nextInt();   return a;  }     public long nextLong() {   return Long.parseLong(next());  }     public char nextChar() {   return next().toCharArray()[0];  }  }   }
3	public class ProblemF_2 {  public static InputStream inputStream = System.in;  public static OutputStream outputStream = System.out;  public static void main(String[] args) {   MyScanner scanner = new MyScanner(inputStream);   PrintWriter out = new PrintWriter(outputStream);   int n = scanner.nextInt();   List<Integer> list = new ArrayList<>();   for (int i = 0; i < n; i++) {    list.add(scanner.nextInt());   }   Map<Integer, List<Pair<Integer, Integer>>> map = new HashMap<>();   for (int i = n - 1; i >= 0; i--) {    int x = 0;    for (int j = i; j >= 0; j--) {     x = x + list.get(j);     if (!map.containsKey(x)) {      map.put(x, new ArrayList<>());     }     map.get(x).add(new Pair<>(j + 1, i + 1));    }   }   List<Pair<Integer, Integer>> ans = new ArrayList<>();   for (Map.Entry<Integer, List<Pair<Integer, Integer>>> entry : map.entrySet()) {    List<Pair<Integer, Integer>> segments = entry.getValue();    Collections.reverse(segments);    List<Pair<Integer, Integer>> result = new ArrayList<>();    result.add(segments.get(0));    for (int i = 1; i < segments.size(); i++) {     if (segments.get(i).first > result.get(result.size() - 1).second) {      result.add(segments.get(i));     }    }    if (result.size() > ans.size()) {     ans = result;    }   }   out.println(ans.size());   for (Pair<Integer, Integer> pair : ans) {    out.println(pair.first + " " + pair.second);   }    out.flush();  }  private static class MyScanner {   private BufferedReader bufferedReader;   private StringTokenizer stringTokenizer;   private MyScanner(InputStream inputStream) {    bufferedReader = new BufferedReader(new InputStreamReader(inputStream));   }   private String next() {    while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {     try {      stringTokenizer = new StringTokenizer(bufferedReader.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return stringTokenizer.nextToken();   }   private int nextInt() {    return Integer.parseInt(next());   }   private long nextLong() {    return Long.parseLong(next());   }   private double nextDouble() {    return Double.parseDouble(next());   }   private String nextLine() {    String str = "";    try {     str = bufferedReader.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  }  private static class Pair<F, S> {   private F first;   private S second;   public Pair() {}   public Pair(F first, S second) {    this.first = first;    this.second = second;   }  } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   int MOD = 1000000007;   public void solve(int testNumber, FastScanner in, PrintWriter out) {    long x = in.nextLong();    long k = in.nextLong();    if (x == 0) {     out.print(0);     return;    }    long b = fast_expo(2, k);    long a = (b * 2) % MOD;    long u = ((x % MOD) * a) % MOD;    long v = (b - 1 + MOD) % MOD;    out.print((u - v + MOD) % MOD);   }   private long fast_expo(long a, long b) {    long res = 1L;    a = a % MOD;    while (b > 0) {     if ((b & 1) != 0) {      res = (res * a) % MOD;     }     b = b >> 1;     a = (a * a) % MOD;    }    return res % MOD;   }  }  static class FastScanner {   private BufferedReader bufferedReader;   private StringTokenizer stringTokenizer;   public FastScanner(InputStream inputStream) {    bufferedReader = new BufferedReader(new InputStreamReader(inputStream));   }   public String next() {    while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {     try {      stringTokenizer = new StringTokenizer(bufferedReader.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return stringTokenizer.nextToken();   }   public long nextLong() {    return Long.parseLong(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(); } }
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; }  int count(int n, int m, int p, int step) {  int[] dr = {1, 0, -1, 0, 0};  int[] dc = {0, 1, 0, -1, 0};     int ct = 0;  boolean[][] f = new boolean[n][m];  for(int j = 0;j < n;j++){  for(int k = 0;k < m;k++){   if(k % 5 == p){   ct++;   for(int l = 0;l < 5;l++){    int nr = j+dr[l];    int nc = k+dc[l];    if(nr >= 0 && nr < n && nc >= 0 && nc < m){    f[nr][nc] = true;    }   }   }  }  p = (p+step)%5;  }   for(int j = 0;j < n;j++){  for(int k = 0;k < m;k++){   if(!f[j][k]){   ct++;   for(int l = 0;l < 5;l++){    int nr = j+dr[l];    int nc = k+dc[l];    if(nr >= 0 && nr < n && nc >= 0 && nc < m){    f[nr][nc] = true;    }   }   }  }  }  return ct; }  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()); } long nl() { return Long.parseLong(in.next()); } double nd() { return Double.parseDouble(in.next()); } boolean oj = System.getProperty("ONLINE_JUDGE") != null; void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
4	public class codeforces { public static void main(String[] args) throws Exception {  int t=sc.nextInt();  while(t-->0) {  int n=sc.nextInt();  int[]a=sc.nextIntArray(n);  LinkedList<Integer>ll=new LinkedList<Integer>();  for(int i=0;i<n;i++) {   if(a[i]==1) {   ll.addLast(a[i]);   }else if(ll.isEmpty()) {   ll.addLast(a[i]);      }else {   while(!(ll.getLast()==a[i]-1)) {    ll.removeLast();   }   ll.removeLast();   ll.addLast(a[i]);   }   int ii=0;   for(int j:ll) {   pw.print(j);   if(ii!=ll.size()-1){    pw.print('.');   }   ii++;   }   pw.println();  }    }        pw.close(); }  static class Scanner {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s));  }  public Scanner(FileReader r) {  br = new BufferedReader(r);  }  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 String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-') {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.') {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public long[] nextlongArray(int n) throws IOException {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  public Long[] nextLongArray(int n) throws IOException {  Long[] a = new Long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  public int[] nextIntArray(int n) throws IOException {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = nextInt();  return a;  }  public Integer[] nextIntegerArray(int n) throws IOException {  Integer[] a = new Integer[n];  for (int i = 0; i < n; i++)   a[i] = nextInt();  return a;  }  public boolean ready() throws IOException {  return br.ready();  }  }  static class pair implements Comparable<pair> {  long x;  long y;  public pair(long x, long y) {  this.x = x;  this.y = y;  }  public String toString() {  return x + " " + y;  }  public boolean equals(Object o) {  if (o instanceof pair) {   pair p = (pair) o;   return p.x == x && p.y == y;  }  return false;  }  public int hashCode() {  return new Long(x).hashCode() * 31 + new Long(y).hashCode();  }  public int compareTo(pair other) {  if (this.x == other.x) {   return Long.compare(this.y, other.y);  }  return Long.compare(this.x, other.x);  } }  static class tuble implements Comparable<tuble> {  int x;  int y;  int z;  public tuble(int x, int y, int z) {  this.x = x;  this.y = y;  this.z = z;  }  public String toString() {  return x + " " + y + " " + z;  }  public int compareTo(tuble other) {  if (this.x == other.x) {   if (this.y == other.y) {   return this.z - other.z;   }   return this.y - other.y;  } else {   return this.x - other.x;  }  } }  static long mod = 1000000007; static Random rn = new Random(); static Scanner sc = new Scanner(System.in); static PrintWriter pw = new PrintWriter(System.out); }
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 {   @Override   public void run() {    InputStream inputStream = System.in;    OutputStream outputStream = System.out;    FastInput in = new FastInput(inputStream);    FastOutput out = new FastOutput(outputStream);    COnTheBench solver = new COnTheBench();    solver.solve(1, in, out);    out.close();   }  }  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;   private static 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 boolean equals(Object obj) {    if (!(obj instanceof IntegerList)) {     return false;    }    IntegerList other = (IntegerList) obj;    return SequenceUtils.equal(data, 0, size - 1, other.data, 0, other.size - 1);   }   public int hashCode() {    int h = 1;    for (int i = 0; i < size; i++) {     h = h * 31 + Integer.hashCode(data[i]);    }    return h;   }   public IntegerList clone() {    IntegerList ans = new IntegerList();    ans.addAll(this);    return ans;   }  }  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;   }  }  static class SequenceUtils {   public static boolean equal(int[] a, int al, int ar, int[] b, int bl, int br) {    if ((ar - al) != (br - bl)) {     return false;    }    for (int i = al, j = bl; i <= ar; i++, j++) {     if (a[i] != b[j]) {      return false;     }    }    return true;   }  } }
5	public class Test {    static BufferedReader reader;    static StringTokenizer tokenizer;    static PrintWriter writer;    static int nextInt() throws IOException {      return Integer.parseInt(nextToken());    }    static long nextLong() throws IOException {      return Long.parseLong(nextToken());    }    static double nextDouble() throws IOException {      return Double.parseDouble(nextToken());    }    static String nextToken() throws IOException {      while (tokenizer == null || !tokenizer.hasMoreTokens()) {        tokenizer = new StringTokenizer(reader.readLine());      }      return tokenizer.nextToken();    }    public static void main(String[] args) throws IOException {      reader = new BufferedReader(new InputStreamReader(System.in));      tokenizer = null;      writer = new PrintWriter(System.out);      solve();      reader.close();      writer.close();    }    private static void solve() throws IOException {     int n=nextInt();     int[] a=new int[n];     int first=0;     for (int i=0;i<n;i++)     {      a[i]=nextInt();      first+=a[i];     }     Arrays.sort(a);     int ans=1;     int last=a[n-1];     first-=a[n-ans];     while (true)     {      if (first<last)       break;      ans++;      last+=a[n-ans];      first-=a[n-ans];     }     writer.print(ans);    }   }
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();  int m = readInt();  int k = readInt();  int[] a = readArr(n);  Arrays.sort(a);  for(int i = 0; i <= n; i++){  int curR = k;  for(int j = n-1; j >= n-i; j--){   curR += a[j];  }  curR -= i;  if(curR >= m){   out.println(i);   return;  }  }  out.println(-1); }  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()); }  double readDouble() throws IOException {  return Double.parseDouble(readString()); }  int[] readArr(int n) throws IOException {  int[] res = new int[n];  for (int i = 0; i < n; i++) {  res[i] = readInt();  }  return res; }  long[] readArrL(int n) throws IOException {  long[] res = new long[n];  for (int i = 0; i < n; i++) {  res[i] = readLong();  }  return res; }  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);  } } }
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)); } }
5	public class A {  public A()  {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   Integer mas[] = new Integer[n];   int b = 0;   for (int i = 0 ; i < n ; i ++)   {    mas[i] = sc.nextInt();    b+=mas[i];   }   Arrays.sort(mas, new Comparator<Integer>()   {    @Override    public int compare(Integer o1, Integer o2)    {     if(o1>o2)      return -1;     else if(o1==o2)      return 0;     else      return 1;    }    });   int N = 0; int g = 0;   for (int i = 0 ; i < n ; i ++)   {    g+=mas[i];    if(g>(int)(b/2))    {     System.out.println(i+1);     return;    }   }   System.out.println(n);  }  public static void main(String[] args)  {   new A();   } }
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);   E2VrashayaStolbciUslozhnennayaVersiya solver = new E2VrashayaStolbciUslozhnennayaVersiya();   solver.solve(1, in, out);   out.close();  }  static class E2VrashayaStolbciUslozhnennayaVersiya {   public void solve(int testNumber, Scanner in, PrintWriter out) {    int tn = in.nextInt();    for (int t = 0; t < tn; t++) {     int n = in.nextInt();     int m = in.nextInt();     Col[] a = new Col[m];     for (int i = 0; i < m; i++) {      a[i] = new Col(n);     }     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       a[j].a[i] = in.nextInt();       if (a[j].a[i] > a[j].max) {        a[j].max = a[j].a[i];       }      }     }     Arrays.sort(a, (o1, o2) -> o2.max - o1.max);     if (m > n) {      m = n;     }     for (int i = 0; i < m; i++) {      a[i].calcMask();     }     int[][] dp = new int[m + 1][1 << n];     Arrays.fill(dp[0], -1);     dp[0][0] = 0;     for (int i = 0; i < m; i++) {      for (int msk = 0; msk < (1 << n); msk++) {       dp[i + 1][msk] = dp[i][msk];       for (int sub = msk; sub > 0; sub = (sub - 1) & msk) {        int v = dp[i][msk ^ sub] + a[i].mask[sub];        if (v > dp[i + 1][msk]) {         dp[i + 1][msk] = v;        }       }      }     }     out.println(dp[m][(1 << n) - 1]);    }   }   class Col {    int n;    int[] a;    int[] mask;    int max;    public Col(int n) {     this.n = n;     a = new int[n];    }    void calcMask() {     mask = new int[1 << n];     for (int i = 0; i < (1 << n); i++) {      for (int j = 0; j < n; j++) {       int sum = 0;       for (int k = 0; k < n; k++) {        if (((1 << k) & i) != 0) {         sum += a[(j + k) % n];        }       }       if (sum > mask[i]) {        mask[i] = sum;       }      }     }    }   }  } }
4	public class C { public static void main(String[] args) throws IOException {    Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));     int t = sc.nextInt();  for (int z = 0; z < t; ++z) {  int n = sc.nextInt();  ArrayList<Integer> al = new ArrayList<>();  for (int i = 0; i < n; ++i) {   int x = sc.nextInt();   if (x==1) {   al.add(x);   } else {   while (al.get(al.size()-1)!=x-1) {    al.remove(al.size()-1);   }   al.remove(al.size()-1);   al.add(x);   }   StringBuilder pr = new StringBuilder();   String d = "";   for (int xx : al) {   pr.append(d+xx);   d = ".";   }   System.out.println(pr);  }  } } }
6	public class Main11D {  private FastScanner in;  private PrintWriter out;  public void solve() throws IOException {   int N = in.nextInt();   int M = in.nextInt();   int[][] edges = new int[N][N];   for(int i = 0; i < M; i++){    int a = in.nextInt() - 1;    int b = in.nextInt() - 1;    edges[a][b] = 1;    edges[b][a] = 1;   }   int globalCountMasks = 1 << N;   int[][] masks = new int[N + 1][];   int[] countMasks = new int[N + 1];   for(int i = 0; i <= N; i++){    masks[i] = new int[combinations(N, i)];   }   for(int i = 0; i < globalCountMasks; i++){    int c = countBit1(i);    masks[c][countMasks[c]] = i;    countMasks[c]++;   }   long globalCountCycles = 0;   long[][] count = new long[globalCountMasks][N];   for(int a = 0; a < N - 2; a++){    int aBit = 1 << a;    count[aBit][a] = 1;    long countCycles = 0;    for(int i = 2; i <= N; i++){     for(int m = 0; m < countMasks[i]; m++){      int mask = masks[i][m];      if((mask & aBit) == 0) continue;      if((mask & (aBit - 1)) > 0) continue;      count[mask][a] = 0;      for(int v = a + 1; v < N; v++){       int vBit = 1 << v;       if((mask & vBit) == 0) continue;       count[mask][v] = 0;       for(int t = a; t < N; t++){        if((mask & (1 << t)) == 0 || t == v || edges[v][t] == 0) continue;        count[mask][v] += count[mask ^ vBit][t];       }       if(edges[a][v] == 1 && mask != (aBit | vBit)){        countCycles += count[mask][v];       }      }     }    }    globalCountCycles += countCycles / 2;   }   out.println(globalCountCycles);  }  private int countBit1(int k){   int c = 0;   while(k > 0){    c += k & 1;    k >>= 1;   }   return c;  }  private int combinations(int n, int k){   if(k > n || k < 0){    throw new IllegalArgumentException();   }   int r = 1;   for(int i = 1; i <= k; i++){    r = r * (n + 1 - i) / i;   }   return r;  }  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());   }  }  public static void main(String[] arg) {   new Main11D().run();  } }
1	public class p2 { final static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); private static String ss() throws IOException {return br.readLine();}  private static int stoi(String x) {return Integer.parseInt(x);} private static int si() throws IOException {return stoi(ss());} private static long sl() throws IOException {return Long.parseLong(ss());}  private static int[] sia(int len) throws IOException {  int[] ret = new int[len];  final StringTokenizer st = new StringTokenizer(ss());  for (int i = 0; i < len; ++i) {ret[i] = stoi(st.nextToken());}  return ret; } private static long[] sla(int len) throws IOException {  long[] ret = new long[len];  final StringTokenizer st = new StringTokenizer(ss());  for (int i = 0; i < len; ++i) {ret[i] = Long.parseLong(st.nextToken());}  return ret; }  public static void main (final String[] args) throws IOException {   Set<Integer> poss = new HashSet<>();  for (int i = 1; 2 * (i*i) <= 1000000000; ++i) {  poss.add(2 * (i*i));  poss.add(4 * (i*i));  }  int t = si();  for (int i = 0; i < t; ++i) {  int n = si();  if (poss.contains(n)) System.out.println("YES");  else System.out.println("NO");  } } }
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;   }   double nextDouble() {    boolean neg = false;    if (c == NC) c = getChar();    for (; (c < '0' || c > '9'); c = getChar()) {     if (c == '-') neg = true;    }    double cur = nextLong();    if (c != '.') {     return neg ? -cur : cur;    } else {     double frac = nextLong() / cnt;     return neg ? -cur - frac : cur + frac;    }   }   String next() {    StringBuilder res = new StringBuilder();    while (c <= 32) c = getChar();    while (c > 32) {     res.append(c);     c = getChar();    }    return res.toString();   }   String nextLine() {    StringBuilder res = new StringBuilder();    while (c <= 32) c = getChar();    while (c != '\n') {     res.append(c);     c = getChar();    }    return res.toString();   }   boolean hasNext() {    if (c > 32) return true;    while (true) {     c = getChar();     if (c == NC) return false;     else if (c > 32) return true;    }   }  }  static void ASSERT(boolean assertion, String message) {   if (!assertion) throw new AssertionError(message);  }  static void ASSERT(boolean assertion) {   if (!assertion) throw new AssertionError();  } }
6	public class Main {  final static boolean debug = false;  final static String fileName = "";  final static 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 Task {  int[][] dist, pre;  int[] x, y, d, prev;  String[] leafDescription;  String[] linerDescription;  String[][] allDescriptions;  int xs, ys, n;  int dist(int i, int j) {   return (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);  }  void go(int[] prev, String[] leafDescription, int[] d, int len, int add, String description){   for (int mask = 0; mask < d.length; mask++) {    if ((mask & add) != add)     continue;    int newValue = d[mask & (~add)] + len;    if (d[mask] > newValue){     d[mask] = newValue;     leafDescription[mask] = description;     prev[mask] = mask & (~add);    }   }  }  int rec(int mask) {   if (d[mask] != -1)    return d[mask];   int lowest = 0;   for (; ((1 << lowest) & mask) == 0; lowest++) ;   int newMask = mask & (~(1 << lowest));   d[mask] = rec(newMask) + dist[lowest][n];   prev[mask] = newMask;   leafDescription[mask] = linerDescription[lowest];   for (int bit = lowest + 1; bit < n; bit++) {    if (((1 << bit) & mask) > 0) {     newMask = mask & (~(1 << bit)) & (~(1 << lowest));     int newValue = rec(newMask) + pre[bit][lowest];     if (newValue < d[mask]) {      d[mask] = newValue;      prev[mask] = newMask;      leafDescription[mask] = allDescriptions[lowest][bit];     }    }   }   return d[mask];  }  public void solve() {   final int inf = (int) 1e+9;   xs = in.nextInt();   ys = in.nextInt();   n = in.nextInt();   x = new int[n + 1];   y = new int[n + 1];   for (int i = 0; i < n; i++) {    x[i] = in.nextInt();    y[i] = in.nextInt();   }   x[n] = xs;   y[n] = ys;   allDescriptions = new String[n][n];   for (int i = 0; i < n; i++){    for (int j = 0; j < n; j++){     allDescriptions[i][j] = (i + 1) + " " + (j + 1) + " ";    }   }   linerDescription = new String[n];   for (int i = 0; i < n; i++){    linerDescription[i] = (i + 1) + " ";   }   dist = new int[n + 1][n + 1];   pre = new int[n + 1][n + 1];   for (int i = 0; i <= n; i++) {    for (int j = 0; j <= n; j++) {     dist[i][j] = 2 * dist(i, j);     pre[i][j] = dist(i, n) + dist(i, j) + dist(j, n);    }   }   d = new int[1 << n];   Arrays.fill(d, -1);   d[0] = 0;   prev = new int[1 << n];   leafDescription = new String[1 << n];              int result = rec((1 << n) - 1);   String answer = "";   for (int curr = d.length - 1; prev[curr] != curr; curr = prev[curr] ){    answer += "0 " + leafDescription[curr];   }   answer += "0";   out.println(result);   out.println(answer);  }  private InputReader in;  private PrintWriter out;  Task(InputReader in, PrintWriter out) {   this.in = in;   this.out = out;  } } 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());  }  public byte nextByte(){   return Byte.parseByte(next());  } }
3	public class P911d {  private static void solve() {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  int cnt = 0;  for (int i = 0; i < n; i++) {  for (int j = i + 1; j < n; j++) {   if (a[i] > a[j]) {   cnt++;   }  }  }  cnt %= 2;  int m = nextInt();  for (int i = 0; i < m; i++) {  int l = nextInt();  int r = nextInt();   int size = r - l + 1;  long sum = ((long)size * (size - 1)) / 2;   sum %= 2;   cnt += sum;  cnt %= 2;   System.out.println(cnt == 0 ? "even" : "odd");  } }  private static void run() {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  out.close(); }  private static StringTokenizer st; private static BufferedReader br; private static PrintWriter out;  private static String next() {  while (st == null || !st.hasMoreElements()) {  String s;  try {   s = br.readLine();  } catch (IOException e) {   return null;  }  st = new StringTokenizer(s);  }  return st.nextToken(); }  private static int nextInt() {  return Integer.parseInt(next()); }  private static long nextLong() {  return Long.parseLong(next()); }  public static void main(String[] args) {  run(); } }
0	public class Fibonacci { public static void main(String[] args) {  Scanner input = new Scanner(System.in);  long num =0;  num = input.nextLong();  while (num<0 || num>Math.pow(10,9))  {  System.out.println("Invalid");  num = input.nextLong();  }  System.out.println("0 0 "+num); } }
4	public class a23 {  public static void main(String arg[])throws IOException  {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));     String s=br.readLine();int max=0;   for(int i=0;i<s.length();i++)   {    for(int j=i+1;j<=s.length();j++)    {     String g=s.substring(i,j);          if(max<g.length())     for(int k=i+1;k<=s.length()-g.length();k++)     {            if(g.compareTo(s.substring(k,k+g.length()))==0)      {       max=g.length();       break;      }      }    }   }   System.out.println(max); } }
6	public class Template {  public static void main(String[] args) throws IOException {   final Scanner in = new Scanner(System.in);   final PrintStream out = System.out;   int n = in.nextInt(), m = in.nextInt();   boolean[][] g = new boolean[n][n];   for (int i = 0; i < m; ++i) {    int a = in.nextInt(), b = in.nextInt();    --a; --b;    g[a][b] = g[b][a] = true;   }   final int mx = 1<<n;   long[][] dp = new long[mx][n];   long res = 0;   for (int mask = 0; mask < mx; ++mask)    for (int i = 0; i < n; ++i) {     if (mask == (1 << i)) {      dp[mask][i] = 1;     } else if (((mask & (1 << i)) != 0) && ((mask & ((1 << i) - 1)) != 0)) {      long r = 0;      int next = mask ^ (1<<i);      for (int j = 0; j < n; ++j) if (g[i][j]) {       r += dp[next][j];      }      dp[mask][i] = r;     } else {      dp[mask][i] = 0;     }     if ((mask & (mask-1)) != 0 && g[i][lowestBit(mask)]) {      res += dp[mask][i];     }    }   System.out.println((res-m)/2);  }  private static int lowestBit(int mask) {   for (int i = 0;;++i) {    if ((mask & (1<<i)) > 0) {     return 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);    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[perm[j]]);        } 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[perm[j]]);        }       }       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;    }   } }
5	public class test {  public static void main(String[] args)  {   Scanner in=new Scanner(System.in);   int n=in.nextInt();   int t=in.nextInt();     House[] houses=new House[n];     for(int i=0;i<n;i++)   {    houses[i]=new House(in.nextInt(),in.nextInt());   }     Arrays.sort(houses);     int count=2;     for(int i=0;i<n-1;i++)   {    double start=houses[i].x+(double)houses[i].a/2;    double end=houses[i+1].x-(double)houses[i+1].a/2;       if(end-start==t)   count++;    if(end-start>t)   count+=2;   }     System.out.println(count);   } } class House implements Comparable<House> {  int x;  int a;   public House(int _x, int _a)  { x=_x; a=_a;  }  @Override  public int compareTo(House o) { return x-o.x;  }  }
4	public class C {  static class Scan {   private byte[] buf=new byte[1024];   private int index;   private InputStream in;   private int total;   public Scan()   {    in=System.in;   }   public int scan()throws IOException   {    if(total<0)    throw new InputMismatchException();    if(index>=total)    {     index=0;     total=in.read(buf);     if(total<=0)     return -1;    }    return buf[index++];   }   public int scanInt()throws IOException   {    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();     }     else throw new InputMismatchException();    }    return neg*integer;   }   public double scanDouble()throws IOException   {    double doub=0;    int n=scan();    while(isWhiteSpace(n))    n=scan();    int neg=1;    if(n=='-')    {     neg=-1;     n=scan();    }    while(!isWhiteSpace(n)&&n!='.')    {     if(n>='0'&&n<='9')     {      doub*=10;      doub+=n-'0';      n=scan();     }     else throw new InputMismatchException();    }    if(n=='.')    {     n=scan();     double temp=1;     while(!isWhiteSpace(n))     {      if(n>='0'&&n<='9')      {       temp/=10;       doub+=(n-'0')*temp;       n=scan();      }      else throw new InputMismatchException();     }    }    return doub*neg;   }   public String scanString()throws IOException   {    StringBuilder sb=new StringBuilder();    int n=scan();    while(isWhiteSpace(n))    n=scan();    while(!isWhiteSpace(n))    {     sb.append((char)n);     n=scan();    }    return sb.toString();   }   private boolean isWhiteSpace(int n)   {    if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)    return true;    return false;   }  }   public static void sort(int arr[],int l,int r) {    if(l==r) {    return;   }   int mid=(l+r)/2;   sort(arr,l,mid);   sort(arr,mid+1,r);   merge(arr,l,mid,mid+1,r);  }  public static void merge(int arr[],int l1,int r1,int l2,int r2) {   int tmp[]=new int[r2-l1+1];   int indx1=l1,indx2=l2;     for(int i=0;i<tmp.length;i++) {    if(indx1>r1) {     tmp[i]=arr[indx2];     indx2++;     continue;    }    if(indx2>r2) {     tmp[i]=arr[indx1];     indx1++;     continue;    }    if(arr[indx1]<arr[indx2]) {     tmp[i]=arr[indx1];     indx1++;     continue;    }    tmp[i]=arr[indx2];    indx2++;   }     for(int i=0,j=l1;i<tmp.length;i++,j++) {    arr[j]=tmp[i];   }  }   public static void sort(long arr[],int l,int r) {    if(l==r) {    return;   }   int mid=(l+r)/2;   sort(arr,l,mid);   sort(arr,mid+1,r);   merge(arr,l,mid,mid+1,r);  }  public static void merge(long arr[],int l1,int r1,int l2,int r2) {   long tmp[]=new long[r2-l1+1];   int indx1=l1,indx2=l2;     for(int i=0;i<tmp.length;i++) {    if(indx1>r1) {     tmp[i]=arr[indx2];     indx2++;     continue;    }    if(indx2>r2) {     tmp[i]=arr[indx1];     indx1++;     continue;    }    if(arr[indx1]<arr[indx2]) {     tmp[i]=arr[indx1];     indx1++;     continue;    }    tmp[i]=arr[indx2];    indx2++;   }     for(int i=0,j=l1;i<tmp.length;i++,j++) {    arr[j]=tmp[i];   }  }    public static void main(String args[]) throws IOException {   Scan input=new Scan();   StringBuilder ans=new StringBuilder("");   int test=input.scanInt();   for(int tt=1;tt<=test;tt++) {    int n=input.scanInt();       ArrayList<Integer> arrli[]=new ArrayList[n];    for(int i=0;i<n;i++) {     arrli[i]=new ArrayList<>();    }       for(int i=0;i<n;i++) {     int tmp=input.scanInt();     if(i==0) {      arrli[0].add(1);      continue;     }     if(tmp==1) {      for(int j=0;j<arrli[i-1].size();j++) {       arrli[i].add(arrli[i-1].get(j));      }      arrli[i].add(tmp);      continue;     }     int indx=-1;     for(int j=0;j<arrli[i-1].size();j++) {      if(arrli[i-1].get(j)==tmp-1) {       indx=j;      }     }     for(int j=0;j<indx;j++) {      arrli[i].add(arrli[i-1].get(j));     }     arrli[i].add(tmp);    }    for(int i=0;i<n;i++) {     for(int j=0;j<arrli[i].size();j++) {      ans.append(arrli[i].get(j));      if(j!=arrli[i].size()-1) {       ans.append(".");      }     }     ans.append("\n");    }   }   System.out.println(ans);  }  }
0	public class bhaa {  InputStream is;  PrintWriter o;     boolean chpr(int n)  {  if(n==1)  {   return true;  }if(n==2)  {   return true;  }  if(n==3)  {   return true;  }  if(n%2==0)  {   return false;   }  if(n%3==0)  {   return false;  }    int w=2;  int i=5;  while(i*i<=n)  {   if(n%i==0)   {   return false;   }   i+=w;   w=6-w;  }  return true;  }   void solve() {    int n=ni();   int k=ni();   int rr=2*n;   int gr=5*n;   int br=8*n;   o.println((long)(Math.ceil(rr*1.0/k)+Math.ceil(gr*1.0/k)+Math.ceil(br*1.0/k)));      }                                       public static void main(String[] args) { new bhaa().run(); }  void run() {   is = System.in;   o = new PrintWriter(System.out);   solve();   o.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;  }   char nc() { return (char)skip(); }  String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!isSpaceChar(b)) { sb.appendCodePoint(b); b = readByte(); }   return sb.toString();  }  String nLine() {   int b = skip();   StringBuilder sb = new StringBuilder();   while( !(isSpaceChar(b) && 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;  }  double nd() { return Double.parseDouble(ns()); }  float nf() { return Float.parseFloat(ns()); }  int[] nia(int n) {   int a[] = new int[n];   for(int i = 0; i < n; i++) { a[i] = ni(); }   return a;  }  long[] nla(int n) {   long a[] = new long[n];   for(int i = 0; i < n; i++) { a[i] = nl(); }   return a;  }  int [][] nim(int n)  {   int mat[][]=new int[n][n];   for(int i=0;i<n;i++)   {    for(int j=0;j<n;j++)    {     mat[i][j]=ni();    }   }   return mat;  }  long [][] nlm(int n)  {   long mat[][]=new long[n][n];   for(int i=0;i<n;i++)   {    for(int j=0;j<n;j++)    {     mat[i][j]=nl();    }   }   return mat;  }       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);  }  void piarr(int arr[])  {   for(int i=0;i<arr.length;i++)   {    o.print(arr[i]+" ");   }   o.println();  }  void plarr(long arr[])  {   for(int i=0;i<arr.length;i++)   {    o.print(arr[i]+" ");   }   o.println();  }   void pimat(int mat[][])  {   for(int i=0;i<mat.length;i++)   {    for(int j=0;j<mat[0].length;j++)    {     o.print(mat[i][j]);    }    o.println();   }  }  void plmat(long mat[][])  {   for(int i=0;i<mat.length;i++)   {    for(int j=0;j<mat[0].length;j++)    {     o.print(mat[i][j]);    }    o.println();   }  }      }
4	public class B{ public static void main(String[] args) {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int t = fs.nextInt();  for(int tt=0;tt<t;tt++)  {  int n = fs.nextInt();  int[] arr = fs.readArray(n);  List<String> ans = new ArrayList();  List<Integer> temp = new ArrayList();  temp.add(arr[0]);  ans.add(""+arr[0]);  for(int i=1;i<n;i++)  {   int ch = arr[i];   if(ch == 1)   {   temp.add(1);   StringBuilder sb = new StringBuilder();   for(int j=0;j<temp.size();j++)   {    sb.append(temp.get(j));    if(j != temp.size()-1)    {    sb.append('.');    }   }   ans.add(sb.toString());   }   else   {   int j = temp.size()-1;   while(j>=0)   {    if(ch - temp.get(j) == 1)    {    temp.set(j,ch);    break;    }    else    {    j--;    }   }   int extra = temp.size()-1;   while(extra>j)   {    temp.remove(temp.size()-1);    extra--;   }   StringBuilder sb = new StringBuilder();   for(int jj=0;jj<temp.size();jj++)   {    sb.append(temp.get(jj));    if(jj != temp.size()-1)    {    sb.append('.');    }   }   ans.add(sb.toString());   }   }  for(String str:ans)  {   out.println(str);  }  }  out.close(); } 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());  }  int[] readArray(int n) {  int[] a=new int[n];  for (int i=0; i<n; i++) a[i]=nextInt();  return a;  }  long nextLong() {  return Long.parseLong(next());  } } public static int[] sort(int[] arr) {  List<Integer> temp = new ArrayList();  for(int i:arr)temp.add(i);  Collections.sort(temp);  int start = 0;  for(int i:temp)arr[start++]=i;  return arr; } }
3	public class Main {  static PrintWriter out; static InputReader ir;  static void solve() {  int n=ir.nextInt();  int[] a=ir.nextIntArray(n);  int m=ir.nextInt();  long ret=mergeSort(a,0,n)%2;  int p,q;  for(int i=0;i<m;i++){  p=ir.nextInt()-1;  q=ir.nextInt()-1;  if((q-p)%4==1||(q-p)%4==2)   ret^=1;  f(ret);  } }  public static void f(long a){  if(a==0){  out.println("even");  }  else  out.println("odd"); } public static long mergeSort(int[] a, int left, int right) {   long cnt = 0;   if (left + 1 < right) {    int mid = (left + right) / 2;    cnt += mergeSort(a, left, mid);    cnt += mergeSort(a, mid, right);    cnt += merge(a, left, mid, right);   }   return cnt;  }  public static long merge(int[] a, int left, int mid, int right) {   long cnt = 0;   int n1 = mid - left;   int n2 = right - mid;   int[] l = new int[n1 + 1];   int[] r = new int[n2 + 1];   for (int i = 0; i < n1; i++) {    l[i] = a[left + i];   }   for (int i = 0; i < n2; i++) {    r[i] = a[mid + i];   }   l[n1] = Integer.MAX_VALUE;   r[n2] = Integer.MAX_VALUE;   for (int i = 0, j = 0, k = left; k < right; k++) {    if (l[i] <= r[j]) {     a[k] = l[i];     i++;    } else {     a[k] = r[j];     j++;     cnt += n1 - i;    }   }   return cnt;  }  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 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;  }  public long[] nextLongArray(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  public char[][] nextCharMap(int n, int m) {  char[][] map = new char[n][m];  for (int i = 0; i < n; i++)   map[i] = next().toCharArray();  return map;  } } }
3	public class HelloWorld{   public static void main(String []args){   final long MOD = 1000000007;   Scanner scan = new Scanner(System.in);   int now = 1;   int maxStatements = scan.nextInt();   long[] dp = new long[maxStatements + 1];   dp[now] = 1;   while(maxStatements > 0)   {    String add = scan.next();    if (add.equals("f"))    {     now++;    }    else    {     for (int k = 1; k <= now; k++)     {      dp[k] = ((dp[k] + dp[k-1]) % MOD);     }    }    maxStatements--;   }   System.out.println(dp[now]);  } }
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 m, n, k;   n = in.readInt();   m = in.readInt();   k = in.readInt();   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = in.readInt() - 1;   Arrays.sort(a);   int ans = -1;   if (k >= m)    ans = 0;   else for (int i = 0; i < n; i++) {    k += a[n-i-1];    if (k >= m) {     ans = i + 1;     break;    }   }   System.out.println(ans);  } } class InputReader {  private boolean finished = false;  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 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 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 String readString() {   int c = read();   while (isSpaceChar(c))    c = read();   StringBuffer res = new StringBuffer();   do {    res.appendCodePoint(c);    c = read();   } while (!isSpaceChar(c));   return res.toString();  }  public static boolean isSpaceChar(int c) {   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  private String readLine0() {   StringBuffer buf = new StringBuffer();   int c = read();   while (c != '\n' && c != -1) {    if (c != '\r')     buf.appendCodePoint(c);    c = read();   }   return buf.toString();  }  public String readLine() {   String s = readLine0();   while (s.trim().length() == 0)    s = readLine0();   return s;  }  public String readLine(boolean ignoreEmptyLines) {   if (ignoreEmptyLines)    return readLine();   else    return readLine0();  }  public BigInteger readBigInteger() {   try {    return new BigInteger(readString());   }   catch (NumberFormatException e) {    throw new InputMismatchException();   }  }  public char readCharacter() {   int c = read();   while (isSpaceChar(c))    c = read();   return (char) c;  }  public double readDouble() {   int c = read();   while (isSpaceChar(c))    c = read();   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   double res = 0;   while (!isSpaceChar(c) && c != '.') {    if (c == 'e' || c == 'E')     return res * Math.pow(10, readInt());    if (c < '0' || c > '9')     throw new InputMismatchException();    res *= 10;    res += c - '0';    c = read();   }   if (c == '.') {    c = read();    double m = 1;    while (!isSpaceChar(c)) {     if (c == 'e' || c == 'E')      return res * Math.pow(10, readInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     m *= 10;     res += (c - '0') * m;     c = read();    }   }   return res * sgn;  }  public boolean isExhausted() {   int value;   while (isSpaceChar(value = peek()) && value != -1)    read();   return value == -1;  }  public String next() {   return readString();  } } 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 printLine(char[] array) {   writer.print(array);  }  public void printFormat(String format, Object...objects) {   writer.printf(format, objects);  }  public void close() {   writer.close();  }  public void flush() {   writer.flush();  } }
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()); }   long nextLong(){ return Long.parseLong(next()); }  }  FastScanner sc;  PrintWriter out;   public static void main(String[] args){   new Main().run();     }   void TLE(){ for(;;); }  void MLE(){   int[][] adj = new int[1024*1024][];   for( int i = 0; i < adj.length; ++i )    adj[i] = new int[1024*1024];  }  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 );  }  }
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();  }   int nextInt() throws IOException {   in.nextToken();   return (int) in.nval;  } }
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);  } }
1	public class Main {  static int n; static int a; static int b; static int g; static int ref; static int refg; static HashSet<Integer> cgroup; static HashMap<Integer,Integer> indexmap; static HashSet<Integer> nums; static HashSet<Integer> used;  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  n = scan.nextInt();  a = scan.nextInt();  b = scan.nextInt();   boolean[] where = new boolean[n];  indexmap = new HashMap<Integer,Integer>();  used = new HashSet<Integer>();  nums = new HashSet<Integer>();   if (a==b)  b = 0;   for (int i = 0; i<n; i++) {  int x = scan.nextInt();  nums.add(x);  indexmap.put(x,i);  }  scan.close();   for (int x : nums) {  if (used.contains(x))   continue;  cgroup = new HashSet<Integer>();  cgroup.add(x);  g = -1;  refg = -1;  ref = -1;  used.add(x);  if (!spawn(x,a,b) || !spawn(x,b,a)) {   System.out.println("NO");   return;  }  if (cgroup.size()%2==1 && ref == -1) {   System.out.println("NO");   return;  } else {   boolean w = true;   if (g == a)   w = false;   for (int k : cgroup) {   where[indexmap.get(k)] = w;   }  }  }   System.out.println("YES");  for (int i = 0; i<where.length; i++)  if (where[i])   System.out.print("1 ");  else   System.out.print("0 ");   }  private static boolean spawn(int x, int ab, int abo) {  int xab = ab-x;  if (xab == x) {  ref = x;  refg = ab;  } else {  if (nums.contains(xab)) {   cgroup.add(xab);   used.add(xab);   spawn(xab,abo,ab);  } else {   if (g == -1)   g = abo;   else if (g != abo) {   return false;   }  }  }  return true; } }
3	public class Main{     void pre() throws Exception{}  void solve(int TC) throws Exception{   int n = ni();   int[] a = new int[n];   for(int i = 0; i< n; i++)a[i] = ni();   HashMap<Long, ArrayList<int[]>> map = new HashMap<>();   for(int i = 0; i< n; i++){    long sum = 0;    for(int j = i; j< n; j++){     sum+=a[j];     if(!map.containsKey(sum))map.put(sum, new ArrayList<>());     map.get(sum).add(new int[]{i+1, j+1});    }   }   int[][] ans = new int[n][];int cur = 0;   int[][] tmp = new int[n][];int tc;   for(Map.Entry<Long, ArrayList<int[]>> e: map.entrySet()){    int prev = 0;    ArrayList<int[]> li = e.getValue();    Collections.sort(li, new Comparator<int[]>(){     public int compare(int[] i1, int[] i2){      if(i1[1]!=i2[1])return Integer.compare(i1[1], i2[1]);      return Integer.compare(i1[0], i1[0]);     }    });     tc = 0;    for(int[] p:li){     if(p[0]>prev){      tmp[tc++] = new int[]{p[0],p[1]};      prev = p[1];     }    }    if(tc>cur){     cur = tc;     for(int i = 0; i< tc; i++)ans[i] = new int[]{tmp[i][0], tmp[i][1]};    }   }   pn(cur);   for(int i = 0; i< cur; i++)pn(ans[i][0]+" "+ans[i][1]);  }   void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}  long mod = (long)1e9+7, IINF = (long)1e18;  final int INF = (int)1e9, MX = (int)2e3+1;  DecimalFormat df = new DecimalFormat("0.00000000000");  double PI = 3.1415926535897932384626433832792884197169399375105820974944, eps = 1e-8;  static boolean multipleTC = false, memory = false;  FastReader in;PrintWriter out;  void run() throws Exception{   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();  }  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();  }  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 p(Object o){out.print(o);}  void pn(Object o){out.println(o);}  void pni(Object o){out.println(o);out.flush();}  String n()throws Exception{return in.next();}  String nln()throws Exception{return in.nextLine();}  int ni()throws Exception{return Integer.parseInt(in.next());}  long nl()throws Exception{return Long.parseLong(in.next());}  double nd()throws Exception{return Double.parseDouble(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;   }  } }
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); } }
4	public class Main{  public static void main(String[] args)throws IOException{   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   String s=br.readLine();   int max=0;   for(int i=0;i<s.length();i++){    int len=0;    int k=i;    boolean flag=false;    for(int j=i+1;j<s.length();j++){     if(s.charAt(k)==s.charAt(j)){     len++;     k++;     flag=true;     }     else if(flag==true){      j=j-len;      k=i;      if(max<len)      max=len;      len=0;      flag=false;          }         }    if(max<len)    max=len;   }   System.out.print(max);  }}
5	public class Replacement { public static void main(String[] args) throws IOException {   BufferedReader r=new BufferedReader(new InputStreamReader(System.in));  String s=r.readLine();  int n=new Integer(s);  int[]arr=new int[n];  String[]sp=r.readLine().split("[ ]+");  for (int i = 0; i < sp.length; i++) {  arr[i]=new Integer(sp[i]);  }  Arrays.sort(arr);  if(arr[arr.length-1]==1){  arr[arr.length-1]=2;  Arrays.sort(arr);  for (int i = 0; i < n; i++) {   if(i==n-1){   System.out.println(arr[i]);   }else   System.out.print(arr[i]+" ");  }  return;  }  arr[arr.length-1]=1;  Arrays.sort(arr);  for (int i = 0; i < n; i++) {  if(i==n-1){   System.out.println(arr[i]);  }else  System.out.print(arr[i]+" ");  } } }
1	public class Codeshefcode { final static long r = 1000000007 ; static FasterScanner ip = new FasterScanner() ; static PrintWriter op = new PrintWriter(System.out) ; public static void main(String[] args) throws IOException{  int n = ip.i() ;  TreeMap<Character,Integer> map = new TreeMap<Character,Integer>() ;  TreeSet<Character> set = new TreeSet<Character>() ;  char c[] = ip.S().toCharArray() ;  for(char t : c)   set.add(t) ;  int size = set.size() ;  for(int i=0 ; i<size ; i++)   map.put(set.pollFirst(),i) ;  int a[] = new int[n] ;  for(int i=0 ; i<n ; i++)   a[i]=map.get(c[i]) ;  int erl[][] = new int[size][n] ;  for(int i=0 ; i<size ; i++)   for(int j=n-1 ; j>=0 ; j--)   erl[i][j]=(a[j]==i) ? j : (j==n-1 ? -1 : erl[i][j+1]) ;  long min = Long.MAX_VALUE ;  for(int i=0 ; i<n ; i++){   long maxt = Long.MIN_VALUE ;   for(int j=0 ; j<size ; j++)    if(erl[j][i]!=-1)    maxt = Long.max(maxt,(erl[j][i]-i+1)) ;   else{    maxt = Long.MAX_VALUE ;    break ;   }   min = Long.min(min,maxt) ;    }  op.print(min) ;  Finish() ; } static void Finish(){  op.flush();   op.close();  } } @SuppressWarnings("serial") class MyList extends ArrayList<Long>{  } class pair { private int x ; private int y ; pair(int a,int b){  x=a ;  y=b ;  } public int x(){  return x ; } public int y(){  return y ; } } class FasterScanner {  private InputStream mIs;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  public FasterScanner() {   this(System.in);  }  public FasterScanner(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 nextLine(){   int c = read();   while (isSpaceChar(c))    c = read();     StringBuilder res = new StringBuilder();   do {    res.appendCodePoint(c);    c = read();   } while (!isEndOfLine(c));   return res.toString();  }  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 long l(){   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 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;  } }
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;  public void run() {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  System.err.println("");    long tot = 0;  for(int i = 0; i < 19999; i++) tot += i;  System.err.println(tot);   n = fs.nextInt(); m = fs.nextInt();  byte[] str = fs.next().getBytes();  int[] occs = new int[1<<m];  for(int i = 0; i < n-1; i++) {  int l1 = str[i] - 'a';  int l2 = str[i+1] - 'a';  occs[(1<<l1) | (1<<l2)]++;  occs[(1<<l2) | (1<<l1)]++;  }   int all = (1<<m)-1;  cost = new int[m][1<<m];  for(int i = 0; i < m; i++) {  for(int mask = 1; mask < all; mask++) {   if(((1<<i)&mask) > 0) continue;   int lb = mask & (-mask);   int trail = Integer.numberOfTrailingZeros(lb);   int nmask = mask ^ lb;   cost[i][mask] = cost[i][nmask]+occs[1<<i | 1<<trail];  }  }   dp = new int[1<<m];  for(int mask = dp.length-2; mask >= 0; mask--) {  int addOn = 0;  for(int nxt = 0; nxt < m; nxt++) {   if(((1<<nxt)&mask) > 0) continue;   addOn += cost[nxt][mask];  }  int res = oo;  for(int nxt = 0; nxt < m; nxt++) {   if(((1<<nxt)&mask) > 0) continue;   int ret = addOn+dp[mask | (1<<nxt)];   res = min(res, ret);  }  dp[mask] = res;  }   System.out.println(dp[0]>>1);   out.close(); }  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 double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }  public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }  public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  }   public int[] nextIntArray(int n) {  int[] res = new int[n];  for(int i = 0; i < n; i++) res[i] = nextInt();  return res;  }   } }
0	public class Berland implements Runnable {  private void solve() throws IOException {   double a = nextInt();   double v = nextInt();   double l = nextInt();   double d = nextInt();   double w = nextInt();   double res;   if (v <= w) {                  res = simpleCase(a, v, l, 0);   } else {    double vMax = Math.sqrt(2 * d * a);    if (vMax <= w) {     res = simpleCase(a, v, l, 0);    } else {     double tFullSpeed = v / a;     double tSlowdown = (v - w) / a;     if (a * tFullSpeed * tFullSpeed / 2 + v * tSlowdown - a * tSlowdown * tSlowdown / 2 <= d) {      res = tFullSpeed + tSlowdown + (d - (a * tFullSpeed * tFullSpeed / 2 + v * tSlowdown - a * tSlowdown * tSlowdown / 2)) / v + simpleCase(a, v, l - d, w);     } else {      double min = w;      double max = v;      for (int i = 0; i < 1000; ++i) {       double cur = (min + max) / 2;       double cFullSpeed = cur / a;       double cSlowdown = (cur - w) / a;       if (a * cFullSpeed * cFullSpeed / 2 + cur * cSlowdown - a * cSlowdown * cSlowdown / 2 <= d)        min = cur;       else        max = cur;      }      res = min / a + (min - w) / a + simpleCase(a, v, l - d, w);     }    }   }   writer.printf("%.20f\n", res);  }  private double simpleCase(double a, double v, double l, double v0) {   double tFullSpeed = (v - v0) / a;   if (v0 * tFullSpeed + a * tFullSpeed * tFullSpeed / 2 <= l) {    return tFullSpeed + (l - (v0 * tFullSpeed + a * tFullSpeed * tFullSpeed / 2)) / v;   } else {    double min = 0;    double max = tFullSpeed;    for (int i = 0; i < 1000; ++i) {     double cur = (min + max) / 2;     if (v0 * cur + a * cur * cur / 2 <= l)      min = cur;     else      max = cur;    }    return min;   }  }   public static void main(String[] args) {   new Berland().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();  } }
0	public class D5 {   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)));   double a = nextInt();   double v = nextInt();   double L = nextInt();   double d = nextInt();   double w = nextInt();   double ans = 0;   if (w >= v)    ans = go(0, a, L, v);   else {    ans = go(Math.min(w, Math.sqrt(2*a*d)), a, L-d, v);    if (2*a*d < w*w)     ans += Math.sqrt(2*d/a);    else {     if (d-v*v/(2*a) >= (v*v-w*w)/(2*a))      ans += v/a+(v-w)/a+(d-v*v/(2*a)-(v*v-w*w)/(2*a))/v;     else {      double x = Math.sqrt((w*w+2*a*d)/2);      ans += x/a+(x-w)/a;     }    }   }   System.out.println(ans);   pw.close();  }   private static double go(double v0, double a, double s, double vmax) {   double t = (vmax-v0) / a;   if (v0*t+a*t*t/2 < s)    return t+(s-v0*t-a*t*t/2) / vmax;   else {    double D = v0*v0+2*a*s;    return (-v0+Math.sqrt(D))/a;   }  }   private static int nextInt() throws IOException{   return Integer.parseInt(next());  }   private static long nextLong() throws IOException{   return Long.parseLong(next());  }   private static double nextDouble() throws IOException{   return Double.parseDouble(next());  }   private static String next() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  }
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(); } }
1	public class A implements Runnable { String file = "input";  void init() throws IOException {   input = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new BufferedOutputStream(System.out)); }  void solve() throws IOException {  int odd = 0, even = 0;  int n = nextInt();  int[] a = new int[n];  for(int i = 0; i < n; i++)  {  a[i] = nextInt();  if(a[i] % 2 == 0) even++;  else odd++;  }  if(even >= 2)  {  for(int i = 0; i < n; i++) if(a[i] % 2 == 1)  {   System.out.println(i + 1);   return;  }  }  else  {  for(int i = 0; i < n; i++) if(a[i] % 2 == 0)  {   System.out.println(i + 1);   return;  }  } }  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()); }  long nextLong() throws IOException {  return Long.parseLong(next()); }  double nextDouble() throws IOException {  return Double.parseDouble(next()); }  void print(Object... o) {  System.out.println(deepToString(o)); }  void gcj(Object o) {  String s = String.valueOf(o);  out.println("Case #" + test + ": " + s);  System.out.println("Case #" + test + ": " + s); }  BufferedReader input; PrintWriter out; StringTokenizer st; int test;  public static void main(String[] args) throws IOException {  new Thread(null, new A(), "", 1 << 20).start(); }  public void run() {  try  {  init();  solve();  out.close();   }  catch(Exception e)  {  e.printStackTrace();  System.exit(1);  } } }
1	public class Main {  public void solve(InputProvider input, PrintWriter output) throws IOException {   int n = input.nextInt();   int d = input.nextInt();   int count = 1;   int current = input.nextInt();   for (int i = 1; i < n; i++) {    int x = input.nextInt();    if (x - current == d * 2) {     count++;    } else if (x - current > d * 2) {     count += 2;    }    current = x;   }   count++;   output.print(count);  }  public static void main(String[] args) throws Exception {   try (InputProvider input = new InputProvider(System.in);    PrintWriter output = new PrintWriter(System.out)) {    new Main().solve(input, output);   }  }  public static class InputProvider implements AutoCloseable {   private final BufferedReader reader;   private StringTokenizer tokenizer;   public InputProvider(Reader reader) {    this.reader = new BufferedReader(reader);   }   public InputProvider(InputStream input) {    reader = new BufferedReader(new InputStreamReader(input));   }   public String next() throws IOException {    if (Objects.isNull(tokenizer) || !tokenizer.hasMoreTokens())     tokenizer = new StringTokenizer(reader.readLine());    return tokenizer.nextToken();   }   public int nextInt() throws IOException {    return Integer.parseInt(next());   }   public long nextLong() throws IOException {    return Long.parseLong(next());   }   public double nextDouble() throws IOException {    return Double.parseDouble(next());   }   public String nextLine() throws IOException {    return reader.readLine();   }   @Override   public void close() throws Exception {    reader.close();   }  } }
5	public class Main { public static void main(String args[]) throws IOException {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt(), t = sc.nextInt(), x, a, kol = 2;  ArrayList<Double> al = new ArrayList<Double>();  for(int i=0;i<n;i++)  {  x = sc.nextInt();  a = sc.nextInt();  al.add(x - a/2.);  al.add(x + a/2.);  }  Collections.sort(al);  double d0 = 0; int k = 0, kn = al.size();  for(Double d: al)  {  if (k == 2)  {   if (d-d0>t) kol+=2; else   if (d-d0==t) kol++;   d0 = d;   k = 1;   } else   {   k++;   d0 = d;  }   }  System.out.print(kol); } }
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 m = in.nextInt();   int k = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = in.nextInt();   Arrays.sort(a);   if (k >= m) {    out.println(0);    return;   }   for (int i = 1; i <= n; i++) {    int sockets = k - 1;    for (int j = 0; j < i; j++)     sockets += a[n - j - 1];    sockets -= i - 1;    if (sockets >= m) {     out.println(i);     return;    }   }   out.println(-1);  } } class InputReader {  private BufferedReader reader;  private StringTokenizer tokenizer;  public InputReader(InputStream stream) {   reader = new BufferedReader(new InputStreamReader(stream));   tokenizer = null;  }  public int nextInt() {   return Integer.parseInt(next());  }  public String next() {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    try {     tokenizer = new StringTokenizer(reader.readLine());    } catch (IOException e) {     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  } }
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());   }  }  static class IntegerUtils {   public static long pow(long a, long base, long mod) {    if (base == 0) return 1;    if (base == 1) return a;    if ((base & 1) == 1)     return (a * pow(a, base - 1, mod)) % mod;    return pow((a * a) % mod, base / 2, mod);   }  } }
2	public class C992 {  static class Scanner  {   BufferedReader br;   StringTokenizer tk=new StringTokenizer("");   public Scanner(InputStream is)   {    br=new BufferedReader(new InputStreamReader(is));   }   public int nextInt() throws IOException   {    if(tk.hasMoreTokens())     return Integer.parseInt(tk.nextToken());    tk=new StringTokenizer(br.readLine());    return nextInt();   }   public long nextLong() throws IOException   {    if(tk.hasMoreTokens())     return Long.parseLong(tk.nextToken());    tk=new StringTokenizer(br.readLine());    return nextLong();   }   public String next() throws IOException   {    if(tk.hasMoreTokens())     return (tk.nextToken());    tk=new StringTokenizer(br.readLine());    return next();   }   public String nextLine() throws IOException   {    tk=new StringTokenizer("");    return br.readLine();   }   public double nextDouble() throws IOException   {    if(tk.hasMoreTokens())     return Double.parseDouble(tk.nextToken());    tk=new StringTokenizer(br.readLine());    return nextDouble();   }   public char nextChar() throws IOException   {    if(tk.hasMoreTokens())     return (tk.nextToken().charAt(0));    tk=new StringTokenizer(br.readLine());    return nextChar();   }   public int[] nextIntArray(int n) throws IOException   {    int a[]=new int[n];    for(int i=0;i<n;i++)     a[i]=nextInt();    return a;   }   public long[] nextLongArray(int n) throws IOException   {    long a[]=new long[n];    for(int i=0;i<n;i++)     a[i]=nextLong();    return a;   }   public int[] nextIntArrayOneBased(int n) throws IOException   {    int a[]=new int[n+1];    for(int i=1;i<=n;i++)     a[i]=nextInt();    return a;   }   public long[] nextLongArrayOneBased(int n) throws IOException   {    long a[]=new long[n+1];    for(int i=1;i<=n;i++)     a[i]=nextLong();    return a;   }     }  static long mod=1000000007;  static long mod_exp(long base,long exp)  {   long ans=1;   base%=mod;   while(exp>0)   {    if(exp%2==1)    {     ans*=base;     ans%=mod;    }    exp/=2;    base*=base;    base%=mod;   }   return ans;  }  public static void main(String args[]) throws IOException  {   Scanner in=new Scanner(System.in);   PrintWriter out=new PrintWriter(System.out);   long x=in.nextLong();   long k=in.nextLong();     long ans=mod_exp(2,k+1);   ans*=(x%mod);   ans%=mod;   ans-=mod_exp(2,k);   ans%=mod;   ans++;   ans%=mod;   if(ans<0)    ans+=mod;   if(x==0)    ans=0;   out.println(ans);   out.close();  } }
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(); } }
4	public class p1523C {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int t = sc.nextInt();   for (int i = 0; i < t ; i++) {    int n = sc.nextInt();    ArrayList<Stack<Integer>> ar = new ArrayList<Stack<Integer>>();    for (int j = 0; j < n + 1; j++) {     ar.add(new Stack<Integer>());    }    HashMap <Integer , Integer> hm = new HashMap<Integer, Integer>();    StringBuilder cur = new StringBuilder();    int l = 0;    for (int j = 0; j < n; j++) {     int a = sc.nextInt();     if( a == 1)     {      if(cur.length() == 0)       cur.append("1");      else       cur.append(".1");      l++;      ar.get(1).add(l);      hm.put(l , 1);     }     else     {      int newl = ar.get( a - 1).pop();      for (int k = newl + 1; k <= l ; k++) {       ar.get(hm.get(k)).pop();       hm.remove(k);       cur.delete(cur.lastIndexOf(".") + 1, cur.length());       cur.delete(cur.length() - 1 , cur.length());      }      cur.delete(cur.lastIndexOf(".") + 1, cur.length());      cur.append(a);      ar.get(a).add(newl);      hm.put(newl , a);      l = newl;     }     System.out.println(cur);    }   }  } }
1	public class B {  void solve() throws IOException {   int n=nextInt();   int a=nextInt();   int b=nextInt();   int[] p=new int[n];   for(int i=0;i<n;i++)p[i]=nextInt();     TreeSet<Integer>[] s=new TreeSet[n];   for(int i=0;i<n;i++)s[i]=new TreeSet<Integer>();   HashMap<Integer,Integer> m=new HashMap<Integer, Integer>();   for(int i=0;i<n;i++)    m.put(p[i],i);   for(int i=0;i<n;i++){    if(m.containsKey(a-p[i])){     s[i].add(a-p[i]);     s[m.get(a-p[i])].add(p[i]);    }    if(m.containsKey(b-p[i])){     s[i].add(b-p[i]);     s[m.get(b-p[i])].add(p[i]);    }   }   int last=-1;   LinkedList<Integer> q=new LinkedList<Integer>();   for(int i=0;i<n;i++){    if(s[i].size()==0){     out.println("NO");     return;    }    if(s[i].size()==1){     q.add(i);    }   }   int[] ans=new int[n];   while(last!=n){    while(!q.isEmpty()){     int cur=q.poll();     if(s[cur].size()==0)continue;     int x=p[cur];     int y=s[cur].first();     if(x==a-y){      ans[cur]=1;      ans[m.get(y)]=1;     }     else{      ans[cur]=2;      ans[m.get(y)]=2;     }     for(Integer u:s[m.get(y)]){      int o=m.get(u);      if(o!=m.get(y)) {       s[o].remove(y);       if (s[o].size() == 1) q.add(o);      }     }     for(Integer u:s[cur]){      int o=m.get(u);      if(o!=m.get(y)) {       s[o].remove(y);       if (s[o].size() == 1) q.add(o);      }     }    }    last++;    while(last!=n){     if(s[last].size()!=0&&ans[last]==0)break;     last++;    }    if(last!=n){     q.add(last);    }   }   for(int i=0;i<n;i++)    if(ans[i]==0){     out.println("NO");     return;    }   out.println("YES");   for(int i=0;i<n;i++)    out.print((ans[i]-1)+" ");  }  public static void main(String[] args) throws IOException {   new B().run();  }  void run() throws IOException {   reader = new BufferedReader(new InputStreamReader(System.in));   tokenizer = null;   out = new PrintWriter(new OutputStreamWriter(System.out));   solve();   reader.close();   out.flush();  }  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter out;  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();  } }
5	public class CF903D {  public static void main(String[] args) throws Exception {   FastReader in = new FastReader(System.in);   PrintWriter pw = new PrintWriter(System.out);   int n = in.nextInt();   int a[] = new int[n+1];   int b[] = new int[n+1];   TreeSet<Integer> set = new TreeSet<>();   for(int i = 1; i <= n; i++){    a[i] = in.nextInt();    set.add(a[i]);   }   int k = 0;   HashMap<Integer, Integer> map = new HashMap<>();   int last = set.first();   for(int i : set){    if(i - last > 1) k += 2;    else k += 1;    map.put(i, k);    last = i;   }   for(int i = 1; i <= n; i++){    b[i] = map.get(a[i]);   }   BinaryIndexTree bit = new BinaryIndexTree(k);   BinaryIndexTree freq = new BinaryIndexTree(k);    BigInteger res = BigInteger.ZERO;   for(int i = n; i >= 1; i--){    long l = bit.query(1, b[i]-2), r = bit.query(b[i]+2, k);    long lf = freq.query(1, b[i]-2), rf = freq.query(b[i]+2, k);    res = res.add(BigInteger.valueOf(r));    res = res.add(BigInteger.valueOf(l));    res = res.subtract(BigInteger.valueOf(rf*a[i]));    res = res.subtract(BigInteger.valueOf(lf*a[i]));       bit.add(b[i], a[i]);    freq.add(b[i], 1);   }   pw.println(res);   pw.close();  }  static class BinaryIndexTree{   public long bit[];   int n, len;   public BinaryIndexTree(int nn){    n = nn;    bit = new long[n+1];    len = bit.length;   }   public void add(int index, long value){    for(; index < len;index = index + ( index & -index)){     bit[index] += value;    }   }   public long sum(int index){    if(index <= 0) return 0;    long sum = 0;    for(; index > 0;index = index - (index & -index)){     sum += bit[index];    }    return sum;   }   public long query(int i, int j){    if(j < i) return 0;    return sum(j) - sum(i-1);   }   }   static void debug(Object... obj) {   System.err.println(Arrays.deepToString(obj));  }  static class FastReader {   InputStream is;   private byte[] inbuf = new byte[1024];   private int lenbuf = 0, ptrbuf = 0;   static final int ints[] = new int[128];   public FastReader(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 boolean isSpaceChar(int c) {    return !(c >= 33 && c <= 126);   }   public int skip() {    int b;    while ((b = readByte()) != -1 && isSpaceChar(b)) ;    return b;   }   public String next() {    int b = skip();    StringBuilder sb = new StringBuilder();    while (!(isSpaceChar(b))) {     sb.appendCodePoint(b);     b = readByte();    }    return sb.toString();   }   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();    }   }   public long nextLong() {    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 << 3) + (num << 1) + ints[b];     } else {      return minus ? -num : num;     }     b = readByte();    }   }   public double nextDouble() {    return Double.parseDouble(next());   }      public char[] next(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);   }     } }
6	public class Main implements Runnable { private void solution() throws IOException {  int n = in.nextInt();  int m = in.nextInt();  boolean[][] adj = new boolean[n][n];  long res = 0;  for (int i = 0; i < m; ++i) {  int x = in.nextInt();  int y = in.nextInt();  adj[x - 1][y - 1] = true;  adj[y - 1][x - 1] = true;  }  final long[][] dp = new long[1 << n][n];  for (int i = 0; i < n; ++i) {  int Limit = 1 << (n - i);  int nn = n - i;  for (int mask = 0; mask < Limit; ++mask) {   for (int j = 0; j < nn; ++j) {   dp[mask][j] = 0;   }  }  dp[0][0] = 1;  for (int mask = 0; mask < Limit; ++mask) {   for (int j = 0; j < nn; ++j) {   if (dp[mask][j] != 0) {    long am = dp[mask][j];    for (int k = 0; k < nn; ++k) {    if (((mask >> k) & 1) == 0 && adj[j + i][k + i]) {     dp[mask | (1 << k)][k] += am;    }    }   }   }   if (((mask >> 0) & 1) != 0) {   res += dp[mask][0];   }  }  }  out.println((res - m) / 2); }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  private class Scanner {  BufferedReader reader;  StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  public boolean hasNext() throws IOException {  while (!tokenizer.hasMoreTokens()) {   String next = reader.readLine();   if (next == null) {   return false;   }   tokenizer = new StringTokenizer(next);  }  return true;  }  public String next() throws IOException {  hasNext();  return tokenizer.nextToken();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
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(); } }
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(); } }
1	public class B {  public B () {  int N = sc.nextInt();  int a = sc.nextInt();  int b = sc.nextInt();  int [] P = sc.nextInts();  TreeSet<Integer> S = new TreeSet<>();  Set<Integer> A = new HashSet<>();  Set<Integer> B = new HashSet<>();  for (int p : P) S.add(p);  while (!S.isEmpty()) {  int q = S.first();  int x = a - q, y = b - q;  if (S.contains(x) && S.contains(y)) {   if (x > y) {   S.remove(q); S.remove(x);   A.add(q); A.add(x);   } else {   S.remove(q); S.remove(y);   B.add(q); B.add(y);   }  }  else if (S.contains(x)) {   S.remove(q); S.remove(x);   A.add(q); A.add(x);  }  else if (S.contains(y)) {   S.remove(q); S.remove(y);   B.add(q); B.add(y);  }  else   exit("NO");  }  int [] res = new int[N];  for (int i : rep(N))  if (B.contains(P[i]))   res[i] = 1;  print("YES");  exit(res); }  private static int [] rep(int N) { return rep(0, N); } private static 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; }  private final static IOUtils.MyScanner sc = new IOUtils.MyScanner(); private static void print (Object o, Object ... A) { IOUtils.print(o, A); } private static void exit (Object o, Object ... A) { IOUtils.print(o, A); IOUtils.exit(); } private static class IOUtils {  public static class MyScanner {  public String next() { newLine(); return line[index++]; }  public int nextInt() { return Integer.parseInt(next()); }  public String nextLine() { line = null; return readLine(); }  public String [] nextStrings() { return split(nextLine()); }  public int [] nextInts() {   String [] L = nextStrings();   int [] res = new int [L.length];   for (int i = 0; i < L.length; ++i)   res[i] = Integer.parseInt(L[i]);   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 java.io.BufferedReader r;  private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }  private MyScanner (java.io.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 = split(readLine());   index = 0;   }  }  private String [] split(String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }  }  private static String build(Object o, Object ... A) { return buildDelim(" ", o, A); }  private static String buildDelim(String delim, Object o, Object ... A) {  StringBuilder b = new StringBuilder();  append(b, o, delim);  for (Object p : A)   append(b, p, delim);  return b.substring(delim.length());  }   private static void start() { if (t == 0) t = millis(); }  private static void append(StringBuilder b, Object o, String delim) {  if (o.getClass().isArray()) {   int len = java.lang.reflect.Array.getLength(o);   for (int i = 0; i < len; ++i)   append(b, java.lang.reflect.Array.get(o, i), delim);  } else if (o instanceof Iterable<?>)   for (Object p : (Iterable<?>) o)   append(b, p, delim);  else {   if (o instanceof Double)   o = new java.text.DecimalFormat("#.############").format(o);   b.append(delim).append(o);  }  }  private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);  private static void print(Object o, Object ... A) { pw.println(build(o, A)); }  private static void err(Object o, Object ... A) { System.err.println(build(o, A)); }  private static void exit() {  IOUtils.pw.close();  System.out.flush();  err("------------------");  err(IOUtils.time());  System.exit(0);  }  private static long t;  private static long millis() { return System.currentTimeMillis(); }  private static String time() { return "Time: " + (millis() - t) / 1000.0; } } public static void main (String[] args) { new B(); IOUtils.exit(); } }
0	public class D {  public static void main(String[] args) throws IOException {   new D().solve();  }  static final double EPS = 1e-10;  Parser parser;  enum Result {   UNDER, OVER  }  private void solve() throws IOException {   this.parser = new Parser(new BufferedReader(new InputStreamReader(System.in)));   double a = parser.nextInt();   double vmax = parser.nextInt();   double l = parser.nextInt();   double d = parser.nextInt();   double w = parser.nextInt();   double low = 0;   double high = 20000;   while (Math.abs(high - low) > 1e-10) {    double accelerateTime = (low + high) / 2;    Result res = check(accelerateTime, a, vmax, d, w).result;    if (res == Result.UNDER) {     low = accelerateTime;    } else {     high = accelerateTime;    }   }   IP ip = check(high, a, vmax, d, w);   TV tv = tv(ip.v, l - d, a, vmax);   PrintWriter pw = new PrintWriter(System.out);   pw.printf("%.5f\n", ip.time + tv.time);   pw.close();  }  private IP check(double accelerateTime, double a, double vmax, double d, double w) {   DV dv = dv(0, a, accelerateTime, vmax);   if (dv.d > d) {    return new IP(accelerateTime, dv.v, Result.OVER);   }   Double slowTime = time2MakeDist(-a, dv.v, d - dv.d);   if (slowTime == null) {    return new IP(0, 0, Result.UNDER);   }   double vDown = dv.v - a * slowTime;   if (vDown < w) {    return new IP(0, 0, Result.UNDER);   } else {    return new IP(accelerateTime + slowTime, vDown, Result.OVER);   }  }  static class IP {   final double time;   final double v;   final Result result;   IP(double time, double v, Result result) {    this.time = time;    this.v = v;    this.result = result;   }  }  static class DV {   final double d;   final double v;   DV(double d, double v) {    this.d = d;    this.v = v;   }  }  static class TV {   final double time;   final double v;   TV(double time, double v) {    this.time = time;    this.v = v;   }  }  static Double time2MakeDist(double a, double v0, double dist) {   return quadric(a / 2, v0, -dist);  }  static TV tv(double v0, double d, double a, double vmax) {   double acTime = (vmax - v0) / a;   double unboundedTime = time2MakeDist(a, v0, d);   if (unboundedTime > acTime) {    double ad = dist(v0, a, acTime);    return new TV(acTime + (d - ad) / vmax, vmax);   } else {    return new TV(unboundedTime, v0 + a * unboundedTime);   }  }  static DV dv(double v0, double a, double time, double vmax) {   double time2maxV = (vmax - v0) / a;   if (time2maxV < time) {    return new DV(dist(v0, a, time2maxV) + dist(vmax, 0, time - time2maxV), vmax);   } else {    return new DV(dist(v0, a, time), v0 + a * time);   }  }  static double dist(double v0, double a, double time) {   return v0 * time + a * time * time / 2;  }  static Double quadric(final double a, final double b, final double c) {   double d = b * b - 4 * a * c;   if (d < -EPS) {    return null;   }   d = Math.abs(d);   double x1 = (-b + Math.sqrt(d)) / (2 * a);   double x2 = (-b - Math.sqrt(d)) / (2 * a);   double r = Integer.MAX_VALUE;   if (x1 > -EPS) {    r = x1;   }   if (x2 > -EPS) {    r = Math.min(r, x2);   }   if (r == Integer.MAX_VALUE) {    throw new RuntimeException("BOTVA");   }   return r;  }  static class Parser {   final BufferedReader br;   StringTokenizer st = new StringTokenizer("");   public Parser(BufferedReader bufferedReader) {    this.br = bufferedReader;   }   String nextToken() throws IOException {    while (!st.hasMoreTokens()) {     st = new StringTokenizer(br.readLine());    }    return st.nextToken();   }   int nextInt() throws IOException {    return Integer.parseInt(nextToken());   }  } }
3	public class F1141 {  private static class Interval {  public int l;  public int r;   public Interval(int l,int r) {  this.l = l;  this.r = r;  } }  public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String s = br.readLine();  int n = Integer.parseInt(s);  long[] a = new long[n];  String[] as = br.readLine().split(" ");  for(int i=0;i<n;i++) {  a[i] = Long.parseLong(as[i]);  }  StringBuffer sb = solve(a,n);  System.out.println(sb.toString()); }  private static StringBuffer solve(long[] a, int n) {  StringBuffer ret = new StringBuffer("");  Map<Long,List<Interval>> mp = new HashMap<Long,List<Interval>>();  long max = 0,maxId = -1;  for(int i=n-1;i>=0;i--) {  long s=0;  long prev = 1;  for(int j=i;j<n;j++) {   s+=a[j];   Interval inter = new Interval(i,j);    List<Interval> ints = mp.get(s);   if(ints==null) ints = new ArrayList<Interval>();   if(ints.size()==0 || ints.get(0).l>j) {    ints.add(0,inter);   }   if(ints.size()>max) {    max = ints.size();    maxId = s;   }   mp.put(s, ints);   if(j<n-1) prev = a[j+1]-a[j];  }  }  List<Interval> l = mp.get(maxId);  ret.append(l.size()+ "\n");  for(Interval inter : l) {  ret.append((inter.l+1) + " " + (inter.r+1) + "\n");  }  return ret; } }
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 nextLine() {   int c = read();   while (isSpaceChar(c)) {    c = read();   }   StringBuilder res = new StringBuilder();   do {    res.appendCodePoint(c);    c = read();   } while (!isEndOfLine(c));   return res.toString();  }   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();  }   double nextDouble()  {   return Double.parseDouble(next());  }   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 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();   } }
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;  outer:  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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
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	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);   }  } }
2	public class Main {  public static void main(String[] args) {  Scanner s=new Scanner(System.in);   double n=s.nextLong();  double k=s.nextLong();   double num=(-3+Math.sqrt(9+8*(n+k)))/2;   System.out.println((long)(n-num));   }  }
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));   }  } }
5	public class Village { static Scanner in = new Scanner( new BufferedReader( new InputStreamReader( System.in ) ) );  public static void main( String[] args ) {  int n = in.nextInt(), t = 2*in.nextInt(), h[][] = new int[n][2], ans = 2;  for( int i = 0; i < n; i++ )  {  h[i][0] = 2*in.nextInt();  h[i][1] = in.nextInt();  }  Arrays.sort( h, new Comp() );  for( int i = 1; i < n; i++ )  {  int d = (h[i][0]-h[i][1])-(h[i-1][0]+h[i-1][1]);  if( d>t ) ans += 2;  if( d==t ) ans++;  }  System.out.println( ans ); }  static class Comp implements Comparator<int[]> {  public int compare( int[] a, int[] b ) { return a[0]-b[0]; } } }
1	public class _1000_A {  public static void main(String[] args) throws IOException {  HashMap<String, Integer> map1 = new HashMap<>(), map2 = new HashMap<>(); int N = readInt();  for(int i = 1; i<=N; i++) {  String s = read(); if(!map1.containsKey(s)) map1.put(s, 1); else map1.put(s, map1.get(s)+1);  }  int tot = 0; for(int i = 1; i<=N; i++) {  String s = read(); if(!map2.containsKey(s)) map2.put(s, 1); else map2.put(s, map2.get(s)+1);  }  for(String s : map2.keySet()) {  tot += Math.max(0, map2.get(s) - (map1.containsKey(s) ? map1.get(s) : 0));  }  println(tot); exit(); }  final private static int BUFFER_SIZE = 1 << 16; private static DataInputStream din = new DataInputStream(System.in); private static byte[] buffer = new byte[BUFFER_SIZE]; private static int bufferPointer = 0, bytesRead = 0; static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  public static String readLine() throws IOException {  byte[] buf = new byte[64];  int cnt = 0, c;  while ((c = Read()) != -1) {  if (c == '\n')   break;  buf[cnt++] = (byte) c;  }  return new String(buf, 0, cnt); }  public static String read() throws IOException {  byte[] ret = new byte[1024];  int idx = 0;  byte c = Read();  while (c <= ' ') {  c = Read();  }  do {  ret[idx++] = c;  c = Read();  } while (c != -1 && c != ' ' && c != '\n' && c != '\r');  return new String(ret, 0, idx); }  public static int readInt() throws IOException {  int ret = 0;  byte c = Read();  while (c <= ' ')  c = Read();  boolean neg = (c == '-');  if (neg)  c = Read();  do {  ret = ret * 10 + c - '0';  } while ((c = Read()) >= '0' && c <= '9');  if (neg)  return -ret;  return ret; }  public static long readLong() throws IOException {  long ret = 0;  byte c = Read();  while (c <= ' ')  c = Read();  boolean neg = (c == '-');  if (neg)  c = Read();  do {  ret = ret * 10 + c - '0';  } while ((c = Read()) >= '0' && c <= '9');  if (neg)  return -ret;  return ret; }  public static double readDouble() throws IOException {  double ret = 0, div = 1;  byte c = Read();  while (c <= ' ')  c = Read();  boolean neg = (c == '-');  if (neg)  c = Read();  do {  ret = ret * 10 + c - '0';  } while ((c = Read()) >= '0' && c <= '9');  if (c == '.') {  while ((c = Read()) >= '0' && c <= '9') {   ret += (c - '0') / (div *= 10);  }  }  if (neg)  return -ret;  return ret; }  private static void fillBuffer() throws IOException {  bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);  if (bytesRead == -1)  buffer[0] = -1; }  private static byte Read() throws IOException {  if (bufferPointer == bytesRead)  fillBuffer();  return buffer[bufferPointer++]; }  static void print(Object o) {  pr.print(o); }  static void println(Object o) {  pr.println(o); }  static void flush() {  pr.flush(); }  static void println() {  pr.println(); }  static void exit() throws IOException {  din.close();  pr.close();  System.exit(0); } }
1	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) {    int n = in.nextInt(), d = in.nextInt();    long a[] = in.parseLong1D(n);    int cnt = 0;    HashSet<Long> ans = new HashSet<>();    for (long v : a) {     long c = v - d;     if (isPos(a, c, d)) ans.add(c);     c = v + d;     if (isPos(a, c, d)) ans.add(c);    }    out.println(ans.size());   }   private boolean isPos(long a[], long c, long d) {    for (long v : a) {     if (Math.abs(v - c) < d) return false;    }    return true;   }  }  static class OutputWriter {   private final PrintWriter writer;   public OutputWriter(OutputStream outputStream) {    writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));   }   public OutputWriter(Writer writer) {    this.writer = new PrintWriter(writer);   }   public void close() {    writer.close();   }   public void println(int i) {    writer.println(i);   }  }  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 int nextInt() {    return readInt();   }   public long[] parseLong1D(int n) {    long r[] = new long[n];    for (int i = 0; i < n; i++) {     r[i] = readLong();    }    return r;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
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 String next() {    try {     currentArray = null;     return reader.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public void nextChars(char[] t) {    try {     currentArray = null;     reader.read(t);    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public char nextChar() {    try {     currentArray = null;     return (char) reader.read();    } catch (IOException e) {     throw new RuntimeException(e);    }   }   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++]);   }   public long nextLong() {    if ((currentArray == null) || (curPointer >= currentArray.length)) {     try {      currentArray = reader.readLine().split(" ");     } catch (IOException e) {      throw new RuntimeException(e);     }     curPointer = 0;    }    return Long.parseLong(currentArray[curPointer++]);   }  } }
5	public class Main{  Scanner sc=new Scanner(System.in);   void run(){   int n = sc.nextInt();     int x[] = new int [n];     for (int i=0;i<n;i++)    x[i] = sc.nextInt();     java.util.Arrays.sort(x);     int i = 0;     for(i=0;i<n-1;i++) {    if (x[i] != x[i+1]) {     System.out.println( x[i+1] );     return;    }   }   System.out.println("NO");     return;    }   public static void main(String[] args){   new Main().run();  } }
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; } }
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 int nextInt() {   return Integer.parseInt(next());  }  public long nextLong() {  return Long.parseLong(next());  }; }
2	public class JavaApplication4 {    static long k, n, ans;  static private long binsearch(long l, long r)  {   if(l==r) return l;   long m=(l+r)/2;   long res=(m*(k+k-m+1)/2);   if(res>=n)    return binsearch(l, m);   else    return binsearch(m+1, r);  }  public static void main(String[] args) {   Scanner in=new Scanner(System.in);   n=in.nextLong();   k=in.nextLong();   n--;   k--;   if(k*(k+1)/2<n)    ans=-1;   else    ans=binsearch(0, k);   System.out.println(ans);     } }
5	public class A {  static StreamTokenizer st;  static class Sort implements Comparable<Sort> {   int val;   public int compareTo(Sort o) {    return this.val-o.val;   }  }  public static void main(String[] args) throws IOException{   st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));   PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   int n = nextInt();   Sort[]a = new Sort[n+1];   int[]b = new int[n+1];   for (int i = 1; i <= n; i++) {    a[i] = new Sort();    a[i].val = nextInt();    b[i] = a[i].val;   }   Arrays.sort(a, 1, n+1);   int k1 = 0, k2 = 0;   for (int i = 1; i <= n; i++) {    if (b[i] != a[i].val) {     if (k1==0)      k1 = i;     else if (k2==0)      k2 = i;     else {      System.out.println("NO");      return;     }    }   }   if (k1==0)    System.out.println("YES");   else if (k2==0)    System.out.println("NO");   else {    if (b[k1]==a[k2].val && b[k2]==a[k1].val)     System.out.println("YES");    else     System.out.println("NO");   }   pw.close();  }  private static int nextInt() throws IOException{   st.nextToken();   return (int) st.nval;  } }
4	public class ProblemC {  static int[] dx = {1, 0, 0, -1}; static int[] dy = {0, 1, -1, 0};   public static void main(String[] args) throws IOException {  BufferedReader s = new BufferedReader(new FileReader("input.txt"));  PrintWriter out = new PrintWriter(new FileWriter("output.txt"));    String[] nm = s.readLine().split(" ");  int n = Integer.valueOf(nm[0]);  int m = Integer.valueOf(nm[1]);  int k = Integer.valueOf(s.readLine());   int[][] dp = new int[n][m];  for (int i = 0 ; i < n ; i++) {  Arrays.fill(dp[i], Integer.MAX_VALUE);  }  String[] st = s.readLine().split(" ");  int[][] trees = new int[k][2];  for (int l = 0 ; l < k ; l++) {  trees[l][0] = Integer.valueOf(st[l*2])-1;  trees[l][1] = Integer.valueOf(st[l*2+1])-1;  }   int maxtime = -1;  int max_x = -1;  int max_y = -1;  for (int i = 0 ; i < n ; i++) {  for (int j = 0 ; j < m ; j++) {   int minDist = n+m;   for (int l = 0 ; l < k ; l++) {   minDist = Math.min(minDist, Math.abs(i - trees[l][0]) + Math.abs(j - trees[l][1]));   }   if (maxtime < minDist) {   maxtime = minDist;   max_x = i+1;   max_y = j+1;   }  }  }      out.println(max_x + " " + max_y);  out.flush(); }  public static void debug(Object... os){  System.err.println(Arrays.deepToString(os)); } }
0	public class n122A {  Scanner in;  PrintWriter out;  void solve() {   int n = in.nextInt();   boolean good = false;   if (n % 4 == 0) {    good = true;   }   if (n % 7 == 0) {    good = true;   }   if (n % 44 == 0) {    good = true;   }   if (n % 47 == 0) {    good = true;   }   if (n % 74 == 0) {    good = true;   }   if (n % 77 == 0) {    good = true;   }   if (n % 444 == 0) {    good = true;   }   if (n % 447 == 0) {    good = true;   }   if (n % 474 == 0) {    good = true;   }   if (n % 477 == 0) {    good = true;   }   if (n % 744 == 0) {    good = true;   }   if (n % 747 == 0) {    good = true;   }   if (n % 774 == 0) {    good = true;   }   if (n % 777 == 0) {    good = true;   }   if (good) {    out.println("YES");   } else {    out.println("NO");   }  }  void run() {   in = new Scanner(System.in);   out = new PrintWriter(System.out);   try {    solve();   } finally {    out.close();   }  }  public static void main(String[] args) {   new n122A().run();  } }
5	public class A implements Runnable {  String file = "input";   boolean TEST = System.getProperty("ONLINE_JUDGE") == null;   void solve() throws IOException  {   int n = nextInt();   int[] a = new int[n];   for(int i = 0; i < n; i++) a[i] = nextInt();   int[] b = a.clone();   qsort(b);     int count = 0;   for(int i = 0; i < a.length; i++)    if(a[i] != b[i]) count++;   if(count == 0 || count == 2) out.println("YES");   else out.println("NO");  }   void qsort(int[] a)  {   List<Integer> as = new ArrayList<Integer>();   for(int x : a) as.add(x);   Collections.shuffle(as);   int j = 0;   for(int x : as) a[j++] = x;   sort(a);  }   Random rnd = new Random();   void sortInt(int[] a)  {   sortInt(a, 0, a.length - 1);  }   void sortInt(int[] a, int from, int to)  {   if(from >= to) return;   int i = from - 1;   int p = rnd.nextInt(to - from + 1) + from;   int t = a[p]; a[p] = a[to]; a[to] = t;   for(int j = from; j < to; j++)    if(a[j] <= a[to])    {     i++;     t = a[i]; a[i] = a[j]; a[j] = t;    }   t = a[i + 1]; a[i + 1] = a[to]; a[to] = t;   sortInt(a, i + 2, to);   while(i >= 0 && a[i] == a[i + 1]) i--;   sortInt(a, from, i);    }   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());  }   long nextLong() throws IOException  {   return Long.parseLong(next());  }   double nextDouble() throws IOException  {   return Double.parseDouble(next());  }   void print(Object... o)  {   System.out.println(deepToString(o));  }   void gcj(Object o)  {   String s = String.valueOf(o);   out.println("Case #" + test + ": " + s);   System.out.println("Case #" + test + ": " + s);  }   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 A(), "", 1 << 22).start();  }   public void run()  {   try   {    init();    if(TEST)    {     int runs = nextInt();     for(int i = 0; i < runs; i++) solve();    }    else solve();    out.close();     }   catch(Exception e)   {    e.printStackTrace();    System.exit(1);   }  } }
2	public class B implements Runnable {  private static 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());  }  long readLong() {   return Long.parseLong(readString());  }  double readDouble() {   return Double.parseDouble(readString());  }  int[] readIntArray(int size) {   int[] a = new int[size];   for (int i = 0; i < size; i++) {    a[i] = readInt();   }   return a;  }  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};  } }
2	public class Ds {  static long lim;  public static void main(String[] args) throws NumberFormatException, IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   String[] line = in.readLine().split("\\s+");   long n = Long.parseLong(line[0]);   lim = Long.parseLong(line[1]);    long pos = -1;   for(int i=61; i>=0; i--) {    long shift = (long) Math.pow(2, i);    if(pos + shift - sumOfDigits(pos + shift) < lim) {   pos += shift;  }  }   pos++;   if(pos <= n && pos- sumOfDigits(pos) >= lim) {  System.out.println(n - pos + 1);  }  else {  System.out.println(0);  }   }  private static long sumOfDigits(long d) {   long sum = 0;  long num = d;   while(num != 0) {  sum += (num%10);  num /= 10;  }   return sum; } }
1	public class Main {  static final long MOD = 1000000007L;   public static void main(String[] args) throws Exception {   Scanner scan = new Scanner(System.in);   int n = scan.nextInt();   int k = scan.nextInt();   int res = -1;   int[] arr = new int[n];   for (int i = 0; i < arr.length; i++) {    arr[i] = scan.nextInt();   }   BitSet bits = new BitSet();   int count = 0;   int end = -1;   for (int i = 0; i < arr.length; i++) {    if (!bits.get(arr[i])) {     bits.set(arr[i]);     count++;     if (count == k) {      end = i;      break;     }    }   }   if (end == -1) {    System.out.print("-1 -1");    return;   }   bits = new BitSet();   count = 0;   int start = end;   while (start >= 0) {    if (!bits.get(arr[start])) {     bits.set(arr[start]);     count++;     if (count == k) {      break;     }    }    start--;   }   System.out.println((start + 1) + " " + (end + 1));  } }
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(); } }
4	public class A23 implements Runnable {  private void Solution() throws IOException {  String s = in.readLine();  int n = s.length(), ans = 0;  for (int i = 0; i < n; i ++) {  for (int j = i; j < n; j ++) {   for (int k = i+1; k <= n; k ++) {   for (int g = k; g <= n; g ++) {    if (s.substring(i,j).equals(s.substring(k,g))) {    int l = s.substring(i,j).length();    ans = Math.max(ans, l);    }   }   }  }  }  System.out.println(ans); }  public static void main(String args[]) {  new A23().run(); }  BufferedReader in; StringTokenizer tokenizer;  public void run() {  try {    in = new BufferedReader(new InputStreamReader(System.in));    tokenizer = null;    Solution();    in.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   } }  int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(nextToken()); }  String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens())  tokenizer = new StringTokenizer(in.readLine());  return tokenizer.nextToken(); } }
3	public class Fingerprints {  public static void main(String[] args) {  Scanner scanner = new Scanner(System.in);  int[] code = new int[scanner.nextInt()];  int[] prints = new int[scanner.nextInt()];  for (int i = 0; i < code.length; i++) {  code[i] = scanner.nextInt();  }  for (int i = 0; i < prints.length; i++) {  prints[i] = scanner.nextInt();  }  for (int i = 0; i < code.length; i++) {  for (int j = 0; j < prints.length; j++) {   if (code[i] == prints[j]) {   System.out.print(prints[j] + " ");   }  }  }  scanner.close(); } }
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());  }  private static 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();  } } class NumberUtils {  public static boolean checkBit(int mask, int bit) {   return (mask & (1 << bit)) != 0;  }  } class ArrayUtils {  private ArrayUtils() {  }  public static List<Double> asList(double[] array) {   return new DoubleList(array);  }  private static class DoubleList extends AbstractList<Double> {   double[] array;   private DoubleList(double[] array) {    this.array = array;   }   public Double set(int index, Double element) {    double result = array[index];    array[index] = element;    return result;   }   public Double get(int index) {    return array[index];   }   public int size() {    return array.length;   }  }  }
5	public class Main {  public static void main(String[] args) throws NumberFormatException, IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(in.readLine());   int nums[] = new int[n];  StringTokenizer tokenizer = new StringTokenizer(in.readLine(), " ");  for (int i = 0; i < n; i++) {  nums[i] = Integer.parseInt(tokenizer.nextToken());  }   Arrays.sort(nums);  int min = nums[0];  int so = -200;  for (int i = 1; i < n; i++) {  if(nums[i] != min) {   so = nums[i];   break;  }  }  if(so != -200)  System.out.println(so);  else  System.out.println("NO"); } }
3	public class CF1141F { static class V {  int l, r, a;  V(int l, int r, int a) {  this.l = l; this.r = r; this.a = a;  } } 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());  StringTokenizer st = new StringTokenizer(br.readLine());  int[] aa = new int[n + 1];  for (int i = 1; i <= n; i++)  aa[i] = Integer.parseInt(st.nextToken());  for (int i = 1; i <= n; i++)  aa[i] += aa[i - 1];  int m = n * (n + 1) / 2;  V[] vv = new V[m];  m = 0;  for (int i = 1; i <= n; i++)  for (int j = i; j <= n; j++)   vv[m++] = new V(i, j, aa[j] - aa[i - 1]);  Arrays.sort(vv, (u, v) -> u.a != v.a ? u.a - v.a : u.r - v.r);  int[] ii_ = new int[m];  int[] ii = new int[m];  int k_ = 0;  for (int i = 0, j; i < m; i = j) {  j = i + 1;  while (j < m && vv[j].a == vv[i].a)   j++;  int k = 0, r = 0;  for (int h = i; h < j; h++)   if (vv[h].l > r) {   ii[k++] = h;   r = vv[h].r;   }  if (k_ < k) {   k_ = k;   int[] tmp = ii_; ii_ = ii; ii = tmp;  }  }  pw.println(k_);  for (int h = 0; h < k_; h++) {  int i = ii_[h];  pw.println(vv[i].l + " " + vv[i].r);  }  pw.close(); } }
5	public class Main {  protected static final double EPS = 1e-11;  private static StreamTokenizer in;  private static Scanner ins;  private static PrintWriter out;  protected static final Double[] BAD = new Double[]{null, null};  private boolean[][] layouts;  private int c;  private int b;  private int a;  private String word;  public static void main(String[] args) {   try {    in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));    ins = new Scanner(new BufferedReader(new InputStreamReader(System.in)));    out = new PrintWriter(System.out);    try {     if (System.getProperty("xDx") != null) {      in = new StreamTokenizer(new BufferedReader(new FileReader("input.txt")));      ins = new Scanner(new FileReader("input.txt"));      out = new PrintWriter(new FileWriter("output.txt"));     }    } catch (Exception e) {     in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));     ins = new Scanner(new BufferedReader(new InputStreamReader(System.in)));     out = new PrintWriter(System.out);    }    new Main().run();   } catch (Throwable e) {    throw new RuntimeException(e);   } finally {    out.close();   }  }  private int nextInt() throws IOException {   in.nextToken();   return (int) in.nval;  }  private long nextLong() throws IOException {   in.nextToken();   return (long) in.nval;  }  private double nextDouble() throws IOException {   in.nextToken();   return in.nval;  }  private String nextString() throws IOException {   in.nextToken();   return in.sval;  }  private char nextChar() throws IOException {   in.nextToken();   return (char) in.ttype;  }  private void run() throws Exception {     solve();  }  private void solve() throws IOException {   int n = ins.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = ins.nextInt();   }   Map<Long, Integer> map = new HashMap<>();   BigInteger res = BigInteger.ZERO;   long sum = 0;   long amount = 0;   for (int i = n - 1; i >= 0; i--) {    long cur = a[i];    Pair same = getZeroAmount(cur, map);    res = res.add(BigInteger.valueOf((sum - same.sum) - cur * (amount - same.amount)));    amount++;    sum += cur;    map.put(cur, map.getOrDefault(cur, 0) + 1);   }   out.println(res);  }  class Pair {   long amount;   long sum;   public Pair(long amount, long sum) {    this.amount = amount;    this.sum = sum;   }  }  private Pair getZeroAmount(long cur, Map<Long, Integer> map) {   long amount = 0;   long sum = 0;   for (long i = cur - 1; i <= cur + 1; i++) {    long amountI = map.getOrDefault(i, 0);    amount += amountI;    sum += amountI * i;   }   return new Pair(amount, sum);  }  private List<Integer> iterate(List<Integer> a) {   ArrayList<Integer> b = new ArrayList<>();   int prev = -1;   for (int x : a) {    if (x == prev) {     b.add(x);    } else {     prev = x;    }   }   return b;  }  private long gcd(long a, long b) {   while (a > 0 && b > 0) {    long k = a % b;    a = b;    b = k;   }   return a | b;  } }
2	public class Main { PrintWriter out = new PrintWriter(System.out); BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer tok = new StringTokenizer("");  String next() throws IOException {   if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }   return tok.nextToken();  }  int ni() throws IOException { return Integer.parseInt(next()); }  long nl() throws IOException { return Long.parseLong(next()); }   void solve() throws IOException {   int n=ni(),k=ni();   int puts=(int)Math.sqrt(2*k);   int t=(puts*(puts+1))/2;   puts++;   while (t<k) { t+=puts; puts++; }     int turns=puts-1;   while (t-k!=n-turns) {    t+=puts;    puts++;    turns++;   }   System.out.println(t-k);  }   public static void main(String[] args) throws IOException {   new Main().solve();  } }
4	public class Main {  public static void main(String []args)throws Exception  {   String inp="";   String res="";   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   inp=br.readLine();   for(int i=0;i<inp.length();i++)   {    for(int j=0;j<(inp.length()-i);j++)    {     for(int k=j+1;k<=inp.length()-i;k++)     {      if(inp.substring(j,j+i).equals(inp.substring(k,k+i)))       res =inp.substring(j,j+i);     }    }   }   System.out.println(res.length());   } }
0	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 n1 = n/10;   int s = n % 10;   int n2 = n / 100 * 10+s;   System.out.println(Math.max(n, Math.max(n1, n2)));   pw.close();  }  private static int nextInt() throws IOException{   return Integer.parseInt(next());  }   private static long nextLong() throws IOException{   return Long.parseLong(next());  }   private static double nextDouble() throws IOException{   return Double.parseDouble(next());  }   private static String next() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  } }
6	public class ProblemC_008 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 ProblemC_008(), "", 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)); }  void debug(Object... objects){  if (ONLINE_JUDGE){  for (Object o: objects){   System.err.println(o.toString());  }  } }    public void run(){  try{  timeBegin = System.currentTimeMillis();  Locale.setDefault(Locale.US);    init();  solve();    out.close();  time();  }catch (Exception e){  e.printStackTrace(System.err);  System.exit(-1);  } }    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';  char readChar() throws IOException{  int intValue = in.read();   if (intValue == -1){  return NOT_A_SYMBOL;  }   return (char) intValue; }  char[] readCharArray() throws IOException{  return readLine().toCharArray(); }    int readInt() throws IOException{  return Integer.parseInt(readString()); }  int[] readIntArray(int size) throws IOException{  int[] array = new int[size];   for (int index = 0; index < size; ++index){  array[index] = readInt();  }   return array; }    long readLong() throws IOException{  return Long.parseLong(readString()); }  long[] readLongArray(int size) throws IOException{  long[] array = new long[size];   for (int index = 0; index < size; ++index){  array[index] = readLong();  }   return array; }    double readDouble() throws IOException{  return Double.parseDouble(readString()); }  double[] readDoubleArray(int size) throws IOException{  double[] array = new double[size];   for (int index = 0; index < size; ++index){  array[index] = readDouble();  }   return array; }    Point readPoint() throws IOException{  return new Point(readInt(), readInt()); }  Point[] readPointArray(int size) throws IOException{  Point[] array = new Point[size];   for (int index = 0; index < size; ++index){  array[index] = readPoint();  }   return array; }    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);  }   public int getPrecision() {  return precision;  }  public void setPrecision(int precision) {  this.precision = precision;    format = createFormat(precision);  formatWithSpace = format + " ";  }   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}};   boolean check(int index, int lim){  return (0 <= index && index < lim); }    void solve() throws IOException{  Point bag = readPoint();   int n = readInt();   Point[] points = new Point[n];   for (int i = 0; i < n; ++i){  points[i] = readPoint();  }   int[] dist = new int[n];  for (int i = 0; i < n; ++i){  int dx = points[i].x - bag.x;  int dy = points[i].y - bag.y;    dist[i] = dx * dx + dy * dy;  }   int[][] d = new int[n][n];  for (int i = 0; i < n; ++i){  for (int j = 0; j < n; ++j){   int dx = points[i].x - points[j].x;   int dy = points[i].y - points[j].y;     d[i][j] = dx * dx + dy * dy;   d[i][j] += dist[i] + dist[j];  }  }   int[] singleMasks = new int[n];  for (int i = 0; i < n; ++i){  singleMasks[i] = (1 << i);  }   int[][] doubleMasks = new int[n][n];  for (int i = 0; i < n; ++i){  for (int j = 0; j < n; ++j){   doubleMasks[i][j] = (singleMasks[i] | singleMasks[j]);  }  }   int lim = (1 << n);  int[] dp = new int[lim];   Arrays.fill(dp, Integer.MAX_VALUE);  dp[0] = 0;   int[] p = new int[lim];  Arrays.fill(p, -1);   for (int mask = 0; mask < lim; ++mask){  if (dp[mask] == Integer.MAX_VALUE){   continue;  }    int minBit = -1;    for (int bit = 0; bit < n; ++bit){   if (checkBit(mask, bit)) continue;     if (minBit == -1 || (dist[minBit] > dist[bit])){   minBit = bit;   }  }    if (minBit == -1){   continue;  }    for (int bit = 0; bit < n; ++bit){   if (checkBit(mask, bit)) continue;     int newMask = (mask | (1 << minBit) | (1 << bit));     if (dp[newMask] > dp[mask] + d[minBit][bit]){   dp[newMask] = dp[mask] + d[minBit][bit];   p[newMask] = minBit * n + bit;   }  }  }   out.println(dp[lim-1]);   int curMask = lim - 1;  while (p[curMask] != -1){  out.print("0 ");    int first = p[curMask] / n;  int second = p[curMask] % n;    out.print((first + 1) + " ");  curMask ^= (1 << first);    if (first != second){   out.print((second + 1) + " ");   curMask ^= (1 << second);  }  }   out.println("0"); }  private boolean checkBit(int mask, int bitNumber) {  return (mask & (1 << bitNumber)) != 0; }  boolean checkMask(int mask, int innerMask){  return (mask & innerMask) == innerMask; } }
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; } }
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; }  private static 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();  }  String nextLine() throws IOException {  return br.readLine();  }  int nextInt() throws IOException {  return Integer.parseInt(next());  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(next());  }  boolean ready() throws IOException {  return br.ready();  }  } }
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 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"); }  private static final boolean ONE_TEST_CASE = false;  private static void init() { }   private static IOUtils.MyScanner sc = new IOUtils.MyScanner(); private static Object print (Object o, Object ... A) { IOUtils.print(o, A); return null; } private static class IOUtils {  public static class MyScanner {  public String next() { newLine(); return line[index++]; }  public int nextInt() { return Integer.parseInt(next()); }  public long nextLong() { return Long.parseLong(next()); }    private boolean eol() { return index == line.length; }  private String readLine() {   try {   return r.readLine();   } catch (Exception e) {   throw new Error (e);   }  }  private final java.io.BufferedReader r;  private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }  private MyScanner (java.io.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 = split(readLine());   index = 0;   }  }  private String [] split(String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }  }  private static String build(Object o, Object ... A) { return buildDelim(" ", o, A); }  private static String buildDelim(String delim, Object o, Object ... A) {  StringBuilder b = new StringBuilder();  append(b, o, delim);  for (Object p : A)   append(b, p, delim);  return b.substring(delim.length());  }   private static final java.text.DecimalFormat formatter = new java.text.DecimalFormat("#.#########");  private static void start() { if (t == 0) t = millis(); }  private static void append(java.util.function.Consumer<Object> f, java.util.function.Consumer<Object> g, final Object o) {  if (o.getClass().isArray()) {   int len = java.lang.reflect.Array.getLength(o);   for (int i = 0; i < len; ++i)   f.accept(java.lang.reflect.Array.get(o, i));  }  else if (o instanceof Iterable<?>)   ((Iterable<?>)o).forEach(f::accept);  else   g.accept(o instanceof Double ? formatter.format(o) : o);  }  private static void append(final StringBuilder b, Object o, final String delim) {  append(x -> { append(b, x, delim); }, x -> b.append(delim).append(x), o);  }  private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);  private static Object print(Object o, Object ... A) {   pw.println(build(o, A));  if (DEBUG)   System.err.println(build(o, A));   return null;  }  private static void err(Object o, Object ... A) { System.err.println(build(o, A)); }  private static boolean PRINT, DEBUG;  private static void write(Object o) {  err(o, '(', time(), ')');  if (PRINT)   pw.println(o);  }  private static void exit() {  IOUtils.pw.close();  System.out.flush();  err("------------------");  err(time());  System.exit(0);  }  private static long t;  private static long millis() { return System.currentTimeMillis(); }  private static String time() { return "Time: " + (millis() - t) / 1000.0; }  private static void run(int N) {  try {   DEBUG = System.getProperties().containsKey("DEBUG");   PRINT = System.getProperties().containsKey("PRINT");  }  catch (Throwable t) {}   for (int n = 1; n <= N; ++n) {   Object res = new D().solve();   if (res != null)   write("Case #" + n + ": " + build(res));  }  exit();  } }  public static void main(String[] args) {  init();  int N = ONE_TEST_CASE ? 1 : sc.nextInt();  IOUtils.run(N); } }
2	public class D {   public static void main(String[] args) throws Exception {    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));    PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));       StringTokenizer st = new StringTokenizer(bf.readLine());    int n = Integer.parseInt(st.nextToken());    int k = Integer.parseInt(st.nextToken());       for(int i=0; i<100000; i++) {    long mult = 1L*i*(i+1)/2;    long b = 1L*mult - k;    if(i+b == n*1L) {     out.println(b);     out.close(); System.exit(0);    }    }       out.close(); System.exit(0);   }  }
1	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 boolean isSq(int x) {   int sq = (int) Math.sqrt(x);   return sq * sq == x;  }  static void solve() {   int n = in.nextInt();   if ((n % 2 == 0 && isSq(n / 2)) || (n % 4 == 0 && isSq(n / 4)))    out.println("YES");   else    out.println("NO");  }  public static void main(String[] args) {   in = new FastReader();   out = new PrintWriter(System.out);   int t = 1;   t = in.nextInt();   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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(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;   }  } }
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();   }  } }
1	public class a {   public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  int a[] = new int[n];  for(int i=0;i<n;i++) a[i] = in.nextInt()%2;   int z = 0;  for(int i=0;i<n;i++) z+=(a[i] == 0)?1:0;  if (z == 1) z = 0;  else z = 1;   for(int i=0;i<n;i++)  if (a[i] == z){   System.out.println(i+1);   break;  } } }
4	public class realfast implements Runnable  {  private static 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();  }   private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  private BufferedReader reader;  private StringTokenizer tokenizer;  private PrintWriter out;   @Override  public void run() {   try {    if (ONLINE_JUDGE || !new File("input.txt").exists()) {     reader = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);    } else {     reader = new BufferedReader(new FileReader("input.txt"));     out = new PrintWriter("output.txt");    }    solve();   } catch (IOException e) {    throw new RuntimeException(e);   } finally {    try {     reader.close();    } catch (IOException e) {        }    out.close();   }  }   private String readString() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }   @SuppressWarnings("unused")  private int readInt() throws IOException {   return Integer.parseInt(readString());  }   @SuppressWarnings("unused")  private long readLong() throws IOException {   return Long.parseLong(readString());  }   @SuppressWarnings("unused")  private double readDouble() throws IOException {   return Double.parseDouble(readString());  } } class edge implements Comparable<edge>{  int u ;  int v;   edge(int u, int v)  {   this.u=u;   this.v=v;  }  public int compareTo(edge e)  {   return this.v-e.v;  } }
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 String nextLine() {  try {  return reader.readLine();  } catch (Exception e) {  return null;  } }  public static int nextInt() throws IOException {  return Integer.parseInt(next()); }  public static long nextLong() throws IOException {  return Long.parseLong(next()); }  public static double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static char nextChar() throws IOException {  return next().charAt(0); }  static class Pair {  char first;  boolean second;  public Pair(char first, boolean second) {     this.first = first;  this.second = second;  }   @Override  public String toString() {    return "(" + this.first + ", " + this.second + ")";  } } }
2	public class B {   public static void main(String[] args) {  Pipes pipes = new Pipes();  pipes.solve();  pipes.print(); } } class Pipes {  Pipes() {  Scanner scr = new Scanner(System.in);  n = scr.nextLong();  k = scr.nextLong(); }  long bs(long nb, long nk) {   long left = 2;  long ls = (nk - left + 1) * (nk + left) / 2 - (nk - left);  long right = nk;  long rs = nk;   if (nb > ls) {  return -1;  }    long mid = left;   while (rs < ls){  mid = (left + right)/2;  long ms = (nk - mid + 1) * (nk + mid) / 2 - (nk - mid);  if (nb > ms) {   right = mid;   rs = ms;  }  else if (nb < ms){   left = mid+1;   ls = (nk - left + 1) * (nk + left) / 2 - (nk - left);  }  else {   left = mid;   break;  }    }   return left;   }  void solve() {  long nn = n;  long kk = k;  ans = 0;  long ps = 1;  long add;   if (n == 1) {  ans = 0;  return;  }   nn = n - (ps - 1);  while (nn > kk){  add = bs(nn, kk);  if (add == -1) {   ans = -1;   return;  }  else {   ans = ans + (kk - add + 1);  }      long addn = (kk - add + 1) * (kk + add) / 2 - (kk - add);   ps = ps - 1 + addn;  if (ps == n)   return;  nn = nn - (ps - 1);  kk = add - 1;  }   if (nn > 0) {  ans++;  }   }   void print() {  System.out.println(ans); }  long ans; long n; long k; }
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);   G1PlaylistForPolycarpEasyVersion solver = new G1PlaylistForPolycarpEasyVersion();   solver.solve(1, in, out);   out.close();  }  static class G1PlaylistForPolycarpEasyVersion {   public void solve(int testNumber, InputReader sc, PrintWriter out) {    int n = sc.nextInt();    int T = sc.nextInt();    int mod = (int) 1e9 + 7;    int dp[][][] = new int[1 << n][226][3];    int t[] = new int[n];    int g[] = new int[n];    for (int i = 0; i < n; ++i) {     t[i] = sc.nextInt();     g[i] = sc.nextInt() - 1;     dp[1 << i][t[i]][g[i]] = 1;    }    for (int i = 0; i < (1 << n); ++i) {     for (int j = 0; j < n; ++j) {      if ((i >> j & 1) == 1) {       int newMask = i ^ (1 << j);       for (int k = t[j]; k <= T; ++k) {        for (int l = 0; l < 3; ++l) {         if (l == g[j])          continue;         dp[i][k][g[j]] = (dp[i][k][g[j]] + dp[newMask][k - t[j]][l]) % mod;        }       }      }     }    }    long ans = 0;    for (int i = 0; i < (1 << n); ++i) {     for (int j = 0; j < 3; ++j) {      ans += dp[i][T][j];     }    }    ans %= mod;    out.print(ans);   }  }  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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
5	public class Main {    static InputReader in;   public static void main(String[] args) throws IOException{       File file = new File("input.txt");   if(file.exists())in = new InputReader( new FileInputStream(file) );   else in = new InputReader( System.in );     int n=in.nextInt(), m=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 i=n-1, ans=0;   while( k<m && i>=0 ) {    k+=a[i]-1;    i--;    ans++;   }   if( m<=k ) System.out.println( ans );   else System.out.println("-1");  }       static void out(Object ...o){   System.out.println(Arrays.deepToString(o));  }    static class InputReader {     private BufferedInputStream inp; private int offset; private final int size=5120000;   private byte buff[];    InputReader( InputStream in ) throws IOException {  inp = new BufferedInputStream( in );     buff=new byte[size];     offset=0;  inp.read( buff, 0, size ); }  int nextInt() throws IOException {       int parsedInt=0;    int i=offset;    if( buff[i]==0 ) throw new IOException();        while ( i<size && ( buff[i]<'0' || buff[i]>'9' ) ) i++;       while( i<size && buff[i]>='0' && buff[i]<='9') {     parsedInt*=10;     parsedInt+=buff[i]-'0';     i++;    }       if ( i==size ) {      int j = 0;  for ( ; offset<buff.length; j++, offset++ )       buff[j] = buff[offset];   inp.read( buff, j, size - j );   offset = 0;  parsedInt = nextInt();    } else offset=i;    return parsedInt; }     long nextLong() throws IOException{       long parsedLong=0;    int i=offset;    if( buff[i]==0 ) throw new IOException();        while( i<size && ( buff[i]<'0' || buff[i]>'9' ) ) i++;       while( i<size && buff[i]>='0' && buff[i]<='9') {     parsedLong*=10L;     parsedLong+=buff[i]-'0';     i++;    }       if ( i==size ) {      int j = 0;  for ( ; offset<buff.length; j++, offset++ )       buff[j] = buff[offset];   inp.read( buff, j, size - j );   offset = 0;  parsedLong = nextLong();    } else offset=i;    return parsedLong;   }     String next() throws IOException {       StringBuilder token=new StringBuilder();    int i=offset;    if( buff[i]==0 ) throw new IOException();        while( i<size && ( buff[i]=='\n' || buff[i]==' ' || buff[i]=='\r' ||      buff[i]=='\t' ) ) i++;       while( i<size && buff[i]!='\n' && buff[i]!=' ' && buff[i]!='\r' &&      buff[i]!='\t' && buff[i]!=0 ) {     token.append( (char)buff[i] );     i++;    }       if ( i==size ) {      int j = 0;  for ( ; offset<buff.length; j++, offset++ )       buff[j] = buff[offset];   inp.read( buff, j, size - j );   offset = 0;  return next();    } else offset=i;    return token.toString();   }     String nextLine() throws IOException {       StringBuilder line=new StringBuilder();    int i=offset;    if( buff[i]==0 ) throw new IOException();        while( i<size && buff[i]!='\n' && buff[i]!=0 ) {     line.append( (char)buff[i] );     i++;    }    if( i<size && buff[i]=='\n' ) i++;       if ( i==size ) {      int j = 0;  for ( ; offset<buff.length; j++, offset++ )       buff[j] = buff[offset];   inp.read( buff, j, size - j );   offset = 0;  return nextLine();    } else offset=i;    line.deleteCharAt( line.length()-1 );    return line.toString();   }    } }
0	public class BB { public static void main(String[] args) { Scanner sc=new Scanner(System.in); long a=sc.nextLong(); long b=sc.nextLong();  if(b-a>(long)2){  if(a%(long)2==0){  System.out.print(a+" "+(a+1)+" "+(a+2));  return;  }else{  System.out.print(a+1+" "+(a+2)+" "+(a+3));  return;  }   }else{  if(b-a<=(long)1){  System.out.println(-1);  return;  }  if(b-a==(long)2){  if(a%(long)2==0){   System.out.print(a+" "+(a+1)+" "+(a+2));   return;  }else{   System.out.print(-1);   return;  }     } } } }
5	public class codeee {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);   int n=sc.nextInt();   if(n==1){System.out.println(1); return;}   int []mas=new int[n];   int sum=0;   for (int i = 0; i < n; i++) {    mas[i]=sc.nextInt();    sum+=mas[i];   }   Arrays.sort(mas);   int sum1=0;   int ans=0;   for(int i=0;i<n;i++){    sum1+=mas[n-i-1];    if(sum1>(sum-sum1)){     ans=i;     break;    }   }   System.out.println(ans+1);  } }
3	public class C{  static long mod=1000000007; static int n; static long w[][]; static void MainMethod()throws Exception{  n=reader.nextInt();  w=new long[n+2][n+2];  for (int i=0;i<=(n+1);i++)  Arrays.fill(w[i], 0);  w[1][0]=1;  String prev,next;  prev=reader.next();  long s[]=new long[n+2];  for (int i=2;i<=n;i++) {  next=reader.next();  if (prev.equals("f"))   for (int lv=0;lv<=n;lv++)    w[i][lv+1]=w[i-1][lv];  else   for (int lv=n;lv>=0;lv--){   w[i][lv]=(w[i-1][lv]+w[i][lv+1])%mod;   }  prev=next;  }  long res=0;  for (int i=0;i<=n;i++)  res=(res+w[n][i])%mod;  printer.print(res); } public static void main(String[] args)throws Exception{  MainMethod();  printer.close(); } static void halt(){  printer.close();  System.exit(0); } static PrintWriter printer=new PrintWriter(new OutputStreamWriter(System.out)); static class reader{  static BufferedReader bReader=new BufferedReader(new InputStreamReader(System.in));  static StringTokenizer token=new StringTokenizer("");  static String readNextLine() throws Exception{  return bReader.readLine();  }  static String next() throws Exception{  while (token.hasMoreTokens()==false){   token=new StringTokenizer(bReader.readLine());  }  return token.nextToken();  }  static int nextInt()throws Exception{  while (token.hasMoreTokens()==false){   token=new StringTokenizer(bReader.readLine());  }  return Integer.parseInt(token.nextToken());  }  static long nextLong()throws Exception{  while (token.hasMoreTokens()==false){   token=new StringTokenizer(bReader.readLine());  }  return Long.parseLong(token.nextToken());  }  static double nextDouble()throws Exception{  while (token.hasMoreTokens()==false){   token=new StringTokenizer(bReader.readLine());  }  return Double.parseDouble(token.nextToken());  } } static class MyMathCompute{  static long [][] MatrixMultiplyMatrix(long [][] A, long [][] B, long mod) throws Exception{  int n=A.length, m=B[0].length;   int p=A[0].length;  int i,j,k;  if (B.length!=p) throw new Exception("invalid matrix input");  long [][] res=new long [n][m];  for (i=0;i<n;i++) for (j=0;j<m;j++){   if (A[i].length!=p) throw new Exception("invalid matrix input");   res[i][j]=0;   for (k=0;k<p;k++)   res[i][j]=(res[i][j]+((A[i][k]*B[k][j])% mod))% mod;  }  return res;  }  static double [][] MatrixMultiplyMatrix(double [][] A, double [][] B ) throws Exception{  int n=A.length, m=B[0].length;   int p=A[0].length;  int i,j,k;  if (B.length!=p) throw new Exception("invalid matrix input");  double [][] res=new double [n][m];  for (i=0;i<n;i++) for (j=0;j<m;j++){   if (A[i].length!=p) throw new Exception("invalid matrix input");   res[i][j]=0;   for (k=0;k<p;k++)   res[i][j]=res[i][j]+(A[i][k]*B[k][j]);  }  return res;  }  static long [][] MatrixPow(long [][] A,long n, long mod) throws Exception{  if (n==1) return A;  long [][] res=MatrixPow(A, n/2, mod);  res=MatrixMultiplyMatrix(res, res, mod);  if ((n % 2) == 1) res=MatrixMultiplyMatrix(A,res, mod);   return res;  }  static double [][] MatrixPow(double [][] A,long n) throws Exception{  if (n==1) return A;  double[][] res=MatrixPow(A, n/2);  res=MatrixMultiplyMatrix(res, res);  if ((n % 2) == 1) res=MatrixMultiplyMatrix(A,res);   return res;  }  static long pow(long a,long n,long mod){  a= a % mod;  if (n==0) return 1;  long k=pow(a,n/2,mod);  if ((n % 2)==0) return ((k*k)%mod);  else return (((k*k) % mod)*a) % mod;  }  static double pow(double a,long n){  if (n==0) return 1;  double k=pow(a,n/2);  if ((n % 2)==0) return (k*k);  else return (((k*k) )*a) ;  } } }
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(); } }
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 int nextInt() throws Exception{  return Integer.parseInt(next()); }  private long nextLong() throws Exception{  return Long.parseLong(next()); }  private double nextDouble() throws Exception{  return Double.parseDouble(next()); }  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(); } }
5	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(br.readLine());   int[] arr = new int[n];   HashMap<Integer, Integer> map = new HashMap<>();   StringTokenizer st = new StringTokenizer(br.readLine());   for (int i = 0; i < n; i++) {    int x = Integer.parseInt(st.nextToken());    arr[i] = x;    if (!map.containsKey(x)) {     map.put(x, 1);    } else {     map.replace(x, map.get(x) + 1);    }   }   int[] power = new int[31];   for (int i = 0; i < 31; i++) {    power[i] = 1 << i;   }   int c = 0;   for (int i = 0; i < n; i++) {   boolean f = false;   for (int j = 0; j <= 30; j++) {   int check = power[j] - arr[i];     if ((map.containsKey(check) && check != arr[i])) {     f = true; break;}     if((map.containsKey(check) && check == arr[i] && map.get(check) >=2)) {      f = true; break;     }    }    if (!f) {     c++;    }   }   System.out.println(c);  } }
3	public class Hack{ 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(); Arrays.sort(arr); Set<Integer> set = new TreeSet<Integer>(); for(int i=0;i<n;i++){ boolean flag=false; for(Integer x:set){ if(arr[i]%x==0){ flag=true; break; } } if(!flag) set.add(arr[i]); } System.out.println(set.size()); } }
2	public class B implements Runnable {    private static final String TASK_NAME_FOR_IO = "";    private static final String FILE_IN = TASK_NAME_FOR_IO + ".in";  private static final String FILE_OUT = TASK_NAME_FOR_IO + ".out";  BufferedReader in;  PrintWriter out;  StringTokenizer tokenizer = new StringTokenizer("");  public static void main(String[] args) {   new Thread(new B()).start();  }  private void solve() throws IOException {   long n = nextLong();   long k = nextLong();   n--;   k--;   long answer = 0;   while (n > 0 && k >= 1) {    if (k > 2000) {     long step1000 = (k + (k - 999)) * 500;     if (n - step1000 >= 0) {      n -= step1000;      answer += 1000;      k -= 1000;      continue;     }    }    if (n - k >= 0) {     n -= k;     answer++;    }    k--;    k = Math.min(n, k);   }   if (n == 0) {    out.println(answer);   } else {    out.println(-1);   }  }  public void run() {   long timeStart = System.currentTimeMillis();   boolean fileIO = TASK_NAME_FOR_IO.length() > 0;   try {    if (fileIO) {     in = new BufferedReader(new FileReader(FILE_IN));     out = new PrintWriter(new FileWriter(FILE_OUT));    } else {     in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(new OutputStreamWriter(System.out));    }    solve();    in.close();    out.close();   } catch (IOException e) {    throw new IllegalStateException(e);   }   long timeEnd = System.currentTimeMillis();   if (fileIO) {    System.out.println("Time spent: " + (timeEnd - timeStart) + " ms");   }  }  private String nextToken() throws IOException {   while (!tokenizer.hasMoreTokens()) {    String line = in.readLine();    if (line == null) {     return null;    }    tokenizer = new StringTokenizer(line);   }   return tokenizer.nextToken();  }  private int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  private BigInteger nextBigInt() throws IOException {   return new BigInteger(nextToken());  }  private long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  private double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
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)); } }
6	public class Main {  public static void main(String[] args) throws IOException { InputStream fin = System.in;  Scanner cin = new Scanner(fin);  int n = cin.nextInt(); int m = cin.nextInt(); int bound = 1 << n; boolean[][] mp = new boolean[n][n]; long[][] dp = new long[bound][n]; int used = 0; long ret = 0; for (int i = 0; i < n; i++) {  Arrays.fill(mp[i], false); }  for (int i = 0; i < m; i++) {  int u = cin.nextInt() - 1;  int v = cin.nextInt() - 1;  mp[u][v] = mp[v][u] = true; }  for (int k = 0; k < n; k++) {  for (int i = k; i < bound; i++) {  Arrays.fill(dp[i], 0);  }  dp[1 << k][k] = 1;  for (int mask = 1 << k; mask < bound; mask++) {  if ((mask & used) != 0)   continue;  for (int i = k; i < n; i++) {   if (dp[mask][i] != 0) {  if (mp[k][i] && bitcount(mask) > 2)   ret += dp[mask][i];  for (int j = k; j < n; j++) {   if ((mask & (1 << j)) == 0 && mp[i][j]) {   dp[mask ^ (1 << j)][j] += dp[mask][i];   }  }   }  }  }  used |= 1 << k; }  System.out.println(ret / 2);  fin.close(); cin.close();  }  private static int bitcount(int mask) {  int ret = 0; while (mask > 0) {  ret += mask & 1;  mask >>= 1; } return ret;  } }
4	public class Fire_Again {  static int N;  static int M;  static int K;  private class Pos {   public int r;   public int c;   int last;   public Pos(int r,int c, int last) {    this.r = r;    this.c = c;    this.last = last;   }  }  static ArrayList<Pos> pos = new ArrayList<>();  static boolean[][] used;  static int[] rows = {-1,1,0,0};  static int[] cols = {0,0,-1,1};  int LAST = 0;  int lastRow = 1;  int lastCol = 1;  public static void main(String[] args) throws IOException {   Fire_Again fire_again = new Fire_Again();   BufferedReader bufferedReader =     new BufferedReader(new FileReader("input.txt"));   String[] nm = bufferedReader.readLine().split(" ");   N = Integer.parseInt(nm[0]) + 1;   M = Integer.parseInt(nm[1]) + 1;   K = Integer.parseInt(bufferedReader.readLine());   used = new boolean[N][M];   String[] rc = bufferedReader.readLine().split(" ");   for(int k = 0;k < rc.length;k+=2) {    int r = Integer.parseInt(rc[k]);    int c = Integer.parseInt(rc[k+1]);    pos.add(fire_again.new Pos(r,c,0));   }   fire_again.bfs();   PrintStream ps = new PrintStream("output.txt");   ps.printf("%d %d\n",fire_again.lastRow,fire_again.lastCol);   ps.flush();   ps.close();  }  Queue<Pos> queue = new LinkedList<>();  private void bfs() {  queue.addAll(pos);  for(Pos p : pos) {   used[p.r][p.c] = true;     }  while(!queue.isEmpty()) {   Pos p = queue.poll();   if(p.last > LAST) {    LAST = p.last;    lastRow = p.r;    lastCol = p.c;   }   for(int i = 0;i < rows.length;i++) {    int currR = p.r;    int currC = p.c;    if(currR + rows[i] >= 1 && currR + rows[i] < N &&    currC + cols[i] >= 1 && currC + cols[i] < M &&    !used[currR + rows[i] ] [currC + cols[i] ] ) {         queue.add(new Pos(currR+rows[i],currC+cols[i],p.last+1));     used[currR + rows[i] ] [currC + cols[i] ] = true;    }   }  }  } }
2	public class Solution {  public static void main(String[] args) {   Scanner scanner = new Scanner(System.in);   long n = scanner.nextLong();   long s = scanner.nextLong();   long myLong = s;   long count =0;  while(true){   if(myLong>n){   break;   }   char[] num = (""+myLong).toCharArray();  int sum = 0;  for (int j = 0; j < num.length; j++)   sum += num[j] - '0';     if(myLong- sum>=s){      break;   }     myLong++;  }  System.out.println(Math.max(n-myLong+1,0));   scanner.close();  } }
1	public class C138B {  private static StringTokenizer st;   public static void nextLine(BufferedReader br) throws IOException  {   st = new StringTokenizer(br.readLine());  }   public static int nextInt()  {   return Integer.parseInt(st.nextToken());  }   public static String next()  {   return st.nextToken();  }   public static long nextLong()  {   return Long.parseLong(st.nextToken());  }   public static void main(String[] args) throws IOException  {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   nextLine(br);   int n = nextInt();   int k = nextInt();   int[] a = new int[n];   nextLine(br);   for (int i = 0; i < n; i++) a[i] = nextInt();     int bp = 0, fp = 0, count = 0;   boolean good = false;   int[] mark = new int[100001];   for (fp = 0; fp < n; fp++)   {    if (mark[a[fp]] == 0)    {     count++;    }    mark[a[fp]]++;    if (count == k)    {     good = true;     break;    }   }   if (!good)   {    System.out.println("-1 -1");    return;   }   for (bp = 0; bp < fp; bp++)   {    if (mark[a[bp]] > 1)    {     mark[a[bp]]--;    }    else break;   }   System.out.println((bp+1) + " " + (fp+1));  }  }
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; } private static 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();  }  String nextLine() throws IOException {  return br.readLine();  }  int nextInt() throws IOException {  return Integer.parseInt(next());  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(next());  }  boolean ready() throws IOException {  return br.ready();  }  } }
3	public class Codechef {    public static void main(String[] args) {    Scanner s = new Scanner(System.in);    int n=s.nextInt();    int a[]=new int[n];    for(int i=0;i<n;i++)    a[i]=s.nextInt();    Arrays.sort(a);    ArrayList<Integer>al=new ArrayList();    int k=a[0];    int count=0;    for(int j=0;j<n;j++)    {k=a[j];     if(Collections.frequency(al,a[j])==0)     {for(int i=0;i<n;i++)    {if(a[i]%k==0)    {al.add(a[i]);}}    count++;}}    System.out.println(count);}}
3	public class Main {      public static void main(String[] args) throws IOException {     PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   br = new BufferedReader(new InputStreamReader(System.in));   int n=nextInt();   int arr[]=new int[n];   for(int i=0;i<n;i++){    arr[i]=nextInt();   }   Arrays.sort(arr);   int c=0;   for(int i=0;i<n;i++){    if(arr[i]!=0){     int a=arr[i];     c++;     for(int j=i;j<n;j++){           if(arr[j]%a==0){       arr[j]=0;      }     }    }   }   pw.println(c);   pw.close();  }   static long maxSubArraySum(long a[],int size) {    long max_so_far = 0, max_ending_here = 0;   for (int i = 0; i < size; i++)  {   max_ending_here = max_ending_here + a[i];   if (max_ending_here < 0)    max_ending_here = 0;         else if (max_so_far < max_ending_here)    max_so_far = max_ending_here;     }  return max_so_far; }  public static BufferedReader br;  public static StringTokenizer st;  public static String next() {   while (st == null || !st.hasMoreTokens()) {   try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     throw new RuntimeException(e);    }   }   return st.nextToken();  }   public static Integer nextInt() {   return Integer.parseInt(next());  }   public static Long nextLong() {   return Long.parseLong(next());  }   public static Double nextDouble() {   return Double.parseDouble(next());  }  static class Pair{   int x;int y;int z;   Pair(int x,int y,int z){    this.x=x;    this.y=y;    this.z=z;      }  }  static class sorting implements Comparator<Pair>{   public int compare(Pair a,Pair b){       return (a.x-b.x);   }  }  public static int[] na(int n)throws IOException{   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = nextInt();   return a;  }  static class query implements Comparable<query>{   int l,r,idx,block;   static int len;   query(int l,int r,int i){    this.l=l;    this.r=r;    this.idx=i;    this.block=l/len;   }    public int compareTo(query a){    return block==a.block?r-a.r:block-a.block;   }  }  static boolean isPrime(int n) {   if (n <= 1)    return false;   if (n <= 3)    return true;   if (n % 2 == 0 ||    n % 3 == 0)    return false;     for (int i = 5;      i * i <= n; i = i + 6)    if (n % i == 0 ||     n % (i + 2) == 0)     return false;     return true;  }  static long gcd(long a, long b) {   if (b == 0)   return a;   return gcd(b, a % b);  }  static long modInverse(long a, long m) {   long g = gcd(a, m);   if (g != 1)    return -1;   else{           return (power(a, m - 2, m));   }  }      static long power(long x, long y, long m){   if (y == 0)    return 1;    long p = power(x, y / 2, m) % m;   p = (p * p) % m;     if (y % 2 == 0)    return p;   else    return (x * p) % m;  }  static long fast_pow(long base,long n,long M){   if(n==0)    return 1;   if(n==1)   return base;   long halfn=fast_pow(base,n/2,M);   if(n%2==0)    return ( halfn * halfn ) % M;   else    return ( ( ( halfn * halfn ) % M ) * base ) % M;  }   static long modInverse(long n,int M){   return fast_pow(n,M-2,M);  }  }
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))));   } }
1	public class test{         static StreamTokenizer in = new StreamTokenizer(new BufferedReader(    new InputStreamReader(System.in)));  static PrintWriter out = new PrintWriter(System.out);     static int nextInt() {   try {    in.nextToken();   } catch (IOException ex) {    Logger.getLogger(test.class.getName()).log(Level.SEVERE, null, ex);   }   return (int) in.nval;  }  static String nextString() {   try {    in.nextToken();   } catch (IOException ex) {    Logger.getLogger(test.class.getName()).log(Level.SEVERE, null, ex);   }   return in.sval;  }  public static void main(String args[]) throws Exception {   int n = nextInt();   long k = nextInt();   long a[] = new long[n + 1];   Map<Long, Long> drb = new HashMap<Long, Long>();   int elso = 1;   long sk = 0;   long sm = 0;   long minjo = Long.MAX_VALUE;   long minjoh = Long.MAX_VALUE;   Vector<long[]> ret = new Vector<long[]>();   for (int i = 1; i <= n; i++) {    a[i] = nextInt();    if (true) {     sm += a[i];     if (drb.containsKey(a[i])) {      drb.put(a[i], drb.get(a[i]) + 1);     } else {      drb.put(a[i], (long) 1);      sk++;     }     while (sk > k || drb.get(a[elso]) > 1) {      long s = drb.get(a[elso]);      if (s == 1) {       drb.remove(a[elso]);       sk--;      } else {       drb.put(a[elso], s - 1);      }      sm -= a[elso];      elso++;     }     if (sk == k) {      if (minjo > sm) {       minjo = sm;       ret.clear();       minjoh = i - elso;      }      if (minjo == sm) {       if (minjoh > i - elso) {        ret.clear();        minjoh = i - elso;       }       ret.add(new long[]{elso, i});      }     }    } else {     elso = i;     drb.clear();     drb.put(a[i], (long) 1);     sk = 1;     sm = a[i];     if (k == 1) {      if (minjo > sm) {       minjo = sm;       ret.clear();      }      if (minjo == sm) {       ret.add(new long[]{elso, i});      }     }    }   }   for (long[] r : ret) {    System.out.print(r[0] + " ");    System.out.print(r[1] + " ");    break;   }   if (ret.size() == 0) {    System.out.print(-1 + " ");    System.out.print(-1 + " ");   }  } }
4	public class TestClass {  public static class FastWriter {   private static 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;   }   private static 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;   }   private static 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();   }  }   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 {    return (int) readLong();   }   public final long readLong() throws IOException {    int c = read();    while (isSpaceChar(c)) {     c = read();     if (c == -1) throw new IOException();    }    boolean negative = false;    if (c == '-') {     negative = true;     c = read();    }    long res = 0;    do {     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return negative ? -res : res;   }   public final int[] readIntArray(int size) throws IOException {    int[] array = new int[size];    for (int i = 0; i < size; i++) {     array[i] = readInt();    }    return array;   }   public final long[] readLongArray(int size) throws IOException {    long[] array = new long[size];    for (int i = 0; i < size; i++) {     array[i] = readLong();    }    return array;   }   public final String readString() throws IOException {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     res.append((char) c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  }  static long mulmod(long a, long b,       long mod) {   long res = 0;   a = a % mod;   while (b > 0) {       if (b % 2 == 1) {     res = (res + a) % mod;    }        a = (a * 2) % mod;        b /= 2;   }      return res % mod;  }  static long pow(long a, long b, long MOD) {   long x = 1, y = a;   while (b > 0) {    if (b % 2 == 1) {     x = (x * y);     if (x > MOD) x %= MOD;    }    y = (y * y);    if (y > MOD) y %= MOD;    b /= 2;   }   return x;  }  static long[] f = new long[200001];  static long InverseEuler(long n, long MOD) {   return pow(n, MOD - 2, MOD);  }  static long C(int n, int r, long MOD) {   return (f[n] * ((InverseEuler(f[r], MOD) * InverseEuler(f[n - r], MOD)) % MOD)) % MOD;  }   static int[] h = {0, 0, -1, 1};  static int[] v = {1, -1, 0, 0};   public static class Pair {   public int a;   public int b;   @Override   public boolean equals(Object o) {    if (this == o) return true;    if (o == null || getClass() != o.getClass()) return false;    Pair pair = (Pair) o;    return a == pair.a &&      b == pair.b;   }   @Override   public int hashCode() {    return Objects.hash(a, b);   }   public Pair(int a, int b) {    this.a = a;    this.b = b;   }  }  static class Pair2 {   public long cost;   int node;   public Pair2(long cos, int node) {    this.cost = cos;    this.node = node;   }  }  static long compute_hash(String s) {   int p = 31;   int m = 1000000007;   long hash_value = 0;   long p_pow = 1;   for (int i = 0; i < s.length(); ++i) {    char c = s.charAt(i);    hash_value = (hash_value + (c - 'a' + 1) * p_pow) % m;    p_pow = (p_pow * p) % m;   }   return hash_value;  }  public static class SegmentTree {   long[][] tree;   int n;   public SegmentTree(int[] nodes) {    tree = new long[nodes.length * 4][2];    n = nodes.length;    build(0, n - 1, 0, nodes);   }   private void build(int l, int r, int pos, int[] nodes) {    if (l == r) {     tree[pos][0] = nodes[l];     tree[pos][1] = l;     return;    }    int mid = (l + r) / 2;    build(l, mid, 2 * pos + 1, nodes);    build(mid + 1, r, 2 * pos + 2, nodes);    if (tree[2 * pos + 1][0] > tree[2 * pos + 2][0]) {     tree[pos][1] = tree[2 * pos + 1][1];    } else {     tree[pos][1] = tree[2 * pos + 2][1];    }    tree[pos][0] = Math.max(tree[2 * pos + 1][0], tree[2 * pos + 2][0]);   }           public long[] get(int l, int r) {    return getUtil(0, n - 1, 0, l, r);   }   private long[] getUtil(int l, int r, int pos, int ql, int qr) {    if (ql > r || qr < l) {     return new long[]{-1, -1};    }    if (l >= ql && r <= qr) {     return tree[pos];    }    int mid = (l + r) / 2;    long[] left = getUtil(l, mid, 2 * pos + 1, ql, qr);    long[] right = getUtil(mid + 1, r, 2 * pos + 2, ql, qr);    long choice = right[1];    if (left[0] > right[0]) choice = left[1];    return new long[]{Math.max(left[0], right[0]), choice};   }                                   }  static int counter = 0;  static int[] rIn;  static int[] rOut;  static int[] lIn;  static int[] lOut;  private static int[] flatten;  private static int[] lFlatten;  static long answer = 0;  static int VISITED = 1;  static int VISITING = 2;  static int[] DIRX = new int[]{0, 0, 1, -1};  static int[] DIRY = new int[]{1, -1, 0, 0};  public static class Pair22 {   int num, pos;   public Pair22(int x, int y) {    this.num = x;    this.pos = y;   }  }  public static long sumofdig(long n) {   long sum = 0;   while (n > 0) {    sum += n % 10;    n /= 10;   }   return sum;  }  public static void main(String[] args) throws Exception {     InputReader in = new InputReader(System.in);   FastWriter out = new FastWriter(System.out);       int t = in.readInt();    while (t-- > 0) {    int n = in.readInt();    Stack<Integer> s = new Stack<>();    System.out.println("1");    int i1 = in.readInt();    assert i1 == 1;    s.add(1);    for (int i = 1; i < n; ++i) {     int next = in.readInt();     if (next == 1) {     } else {      while ((s.peek() + 1) != next) {       s.pop();      }      s.pop();     }     s.add(next);     StringBuilder ans = new StringBuilder();     for (int c: s) {      ans.append(c).append(".");     }     out.println(ans.substring(0, ans.length() - 1));     out.flush();    }   }  }  private static void solvedd(int[] arr, int left, int right, int[] ans, int depth) {   if (left > right) return;   int maxInd = left;   for (int i = left; i <= right; ++i) {    if (arr[i] > arr[maxInd]) {     maxInd = i;    }   }   ans[maxInd] = depth;   solvedd(arr, left, maxInd - 1, ans, depth + 1);   solvedd(arr, maxInd + 1, right, ans, depth + 1);  }   private static void solved(List<List<Integer>> g, int node, int[][] dp, int last, int[] a) {   int donttake = 0;   int take = 0;   for (int i = 0; i < g.get(node).size(); ++i) {    int ntb = g.get(node).get(i);    if (ntb != last) {     solved(g, ntb, dp, node, a);     donttake += Math.max(dp[ntb][0], dp[ntb][1]);     take += dp[ntb][1];    }   }   dp[node][0] = a[node] + take;   dp[node][1] = donttake;  }   private static boolean solve(int n, List<Integer> nums, int cur, int pos, Boolean[][] dp) {   if (cur > n) return false;   if (cur == n) return true;   if (pos >= nums.size()) return false;   if (dp[cur][pos] != null) {    return dp[cur][pos];   }   boolean without = solve(n, nums, cur, pos + 1, dp);   boolean with = false;   int ogcur = cur;   for (int i = 1; i < 12; ++i) {    with |= solve(n, nums, cur + nums.get(pos), pos + 1, dp);    cur += nums.get(pos);   }   return dp[ogcur][pos] = with | without;  }            private static int dfs(HashMap<Pair, TreeSet<Pair>> grid, int x, int y, int ti, HashSet<Pair> vis, int r, int startX, int startY) {     int taken = ti - Math.abs(startX - x) - Math.abs(startY - y);   if (taken < 0) return 0;   if (x < 0 || y < 0 || x > r || y > r) return 0;   if (vis.contains(new Pair(x, y))) return 0;   int max = 0;   if (grid.containsKey(new Pair(x, y))) {    TreeSet<Pair> times = grid.get(new Pair(x, y));    for (Pair t : times) {     if (t.a <= taken) {      max = Math.max(t.b, max);     } else break;    }   }   vis.add(new Pair(x, y));   max = Math.max(dfs(grid, x + 1, y, ti, vis, r, startX, startY), max);   max = Math.max(dfs(grid, x, y + 1, ti, vis, r, startX, startY), max);   max = Math.max(dfs(grid, x - 1, y, ti, vis, r, startX, startY), max);   max = Math.max(dfs(grid, x, y - 1, ti, vis, r, startX, startY), max);   return max;  }  private static int solver(int[] nums, int pos, int[] dp) {   if (pos >= nums.length) return 0;   if (dp[pos] != Integer.MAX_VALUE) return dp[pos];   int min = solver(nums, pos + 2, dp) + nums[pos];   min = Math.min(solver(nums, pos + 3, dp) + nums[pos], min);   if (pos + 1 < nums.length) min = Math.min(min, nums[pos] + nums[pos + 1] + solver(nums, pos + 3, dp));   if (pos + 1 < nums.length) min = Math.min(min, nums[pos] + nums[pos + 1] + solver(nums, pos + 4, dp));      return dp[pos] = min;  }   static int countFreq(String pattern, String text) {   int m = pattern.length();   int n = text.length();   int res = 0;   for (int i = 0; i <= n - m; i++) {    int j;    for (j = 0; j < m; j++) {     if (text.charAt(i + j) != pattern.charAt(j)) {      break;     }    }    if (j == m) {     res++;     j = 0;    }   }   return res;  }  private static void dfsR(List<List<Integer>> g, int node, int[] v) {   rIn[node] = counter;   flatten[counter++] = v[node];   for (int i = 0; i < g.get(node).size(); ++i) {    dfsR(g, g.get(node).get(i), v);   }   rOut[node] = counter;   flatten[counter++] = v[node] * -1;  }  private static void dfsL(List<List<Integer>> g, int node, int[] v) {   lIn[node] = counter;   lFlatten[counter++] = v[node];   for (int i = 0; i < g.get(node).size(); ++i) {    dfsL(g, g.get(node).get(i), v);   }   lOut[node] = counter;   lFlatten[counter++] = v[node] * -1;   TreeMap<String, Integer> map = new TreeMap<>();  }   private static void preprocess(int pos, int[][] pre, List<List<Integer>> tree, int[] traverse, int depth, int last, int[] tin, int[] tout) {   tin[pos] = counter++;   traverse[depth] = pos;   for (int i = 0; depth - (1 << i) >= 0; ++i) {    pre[pos][i] = traverse[depth - (1 << i)];   }   for (int i = 0; i < tree.get(pos).size(); ++i) {    if (tree.get(pos).get(i) != last)     preprocess(tree.get(pos).get(i), pre, tree, traverse, depth + 1, pos, tin, tout);   }   tout[pos] = counter++;  }  static long gcd(long a, long b) {   while (b != 0) {    long t = a;    a = b;    b = t % b;   }   return a;  }   static boolean submit = true;  static void debug(String s) {   if (!submit)    System.out.println(s);  }  static void debug(int s) {   LinkedHashSet<Integer> exist = new LinkedHashSet<>();     }   }
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);   G1PleilistDlyaPolikarpaUproshennayaVersiya solver = new G1PleilistDlyaPolikarpaUproshennayaVersiya();   solver.solve(1, in, out);   out.close();  }  static class G1PleilistDlyaPolikarpaUproshennayaVersiya {   static final int MOD = (int) 1e9 + 7;   int n;   int t;   int[][] a = new int[15][2];   long[][] mem = new long[1 << 15][4];   public void solve(int testNumber, InputReader in, PrintWriter out) {    for (int i = 0; i < (1 << 15); i++) {     for (int h = 0; h < 4; h++) {      mem[i][h] = -1;     }    }    n = in.nextInt();    t = in.nextInt();    for (int i = 0; i < n; i++) {     a[i][0] = in.nextInt();     a[i][1] = in.nextInt();    }    out.println(doit(0, 0, 0));   }   private long doit(int mask, int genre, int sum) {    if (mem[mask][genre] != -1) {     return mem[mask][genre];    }    if (sum > t) {     mem[mask][genre] = 0;     return mem[mask][genre];    }    if (sum == t) {     mem[mask][genre] = 1;     return mem[mask][genre];    }    long ct = 0;    for (int i = 0; i < n; i++) {     if ((mask & (1 << i)) > 0 || genre == a[i][1]) {      continue;     }     ct = (ct + doit(mask | (1 << i), a[i][1], sum + a[i][0])) % MOD;    }    mem[mask][genre] = ct;    return mem[mask][genre];   }  }  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 CDS2021{   public static void main(String[] args)throws IOException{  BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);    int t = Integer.parseInt(f.readLine());    for(int q = 1; q <= t; q++){    int n = Integer.parseInt(f.readLine());     int[] array = new int[n];   for(int k = 0; k < n; k++){    array[k] = Integer.parseInt(f.readLine());   }      StringJoiner sj = new StringJoiner("\n");   Stack<Entry> stack = new Stack<Entry>();         sj.add("1");   stack.push(new Entry("1",1));      for(int k = 1; k < n; k++){    if(array[k] == 1){         String s = stack.peek().s + ".1";     sj.add(s);     stack.push(new Entry(s,1));    } else {     while(!stack.isEmpty() && stack.peek().last != array[k]-1){     stack.pop();     }         if(stack.isEmpty()) break;             String s = "";     int index = stack.peek().s.lastIndexOf(".");     if(index == -1) s = "" + array[k];     else s = stack.peek().s.substring(0,index+1) + array[k];     sj.add(s);     stack.pop();     stack.push(new Entry(s,array[k]));    }   }      out.println(sj.toString());  }          out.close();  }   public static class Entry{  String s;  int last;  public Entry(String a, int b){   s = a;   last = b;  }  }   }
2	public class con169_D {  private static 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 );  } }  private static int length( long l ) {  int res = 0;  while ( l > 0 ) {  ++res;  l >>= 1;  }  return res; } }
1	public class A { public static int sol(String n,String p) {  int sol=0;  for(int i=0;i<n.length();i++)  {  if(n.charAt(i)!=p.charAt(i))   sol++;  }  return sol; } public static void main(String[] args) throws IOException  {  Scanner sc = new Scanner();  PrintWriter pw = new PrintWriter(System.out);  int n=sc.nextInt();  ArrayList<String>p=new ArrayList<>();  ArrayList<String>ne=new ArrayList<>();  for(int i=0;i<n;i++)  p.add(sc.nextLine());  for(int i=0;i<n;i++)  {   String t=sc.nextLine();  if(p.contains(t))   p.remove(t);  else   ne.add(t);  }  Collections.sort(p);  Collections.sort(ne);  int ans=0;  for(int i=0;i<ne.size();i++)  {  ans+=sol(ne.get(i),p.get(i));  }  System.out.println(ans);  pw.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());  }   long nextLong() throws IOException {  return Long.parseLong(next());  }   double nextDouble() throws IOException {  return Double.parseDouble(next());  }   String nextLine() throws IOException {  return br.readLine();  }  boolean hasnext() throws IOException{  return br.ready();  }   } }
2	public class C {  public static void main(String[] args) throws IOException {   init(System.in);   BigInteger x = new BigInteger(next());   if (x.compareTo(BigInteger.ZERO) == 0) {    System.out.println(0);    return;   }   BigInteger k = new BigInteger(next());   BigInteger mod = new BigInteger("1000000007");   BigInteger two = BigInteger.ONE.add(BigInteger.ONE);   BigInteger ans = two.modPow(k, mod);   ans = ans.multiply(two.multiply(x).subtract(BigInteger.ONE)).add(BigInteger.ONE).mod(mod);   System.out.println(ans);  }    private static BufferedReader reader;  private static StringTokenizer tokenizer;  private static void init(InputStream inputStream) {   reader = new BufferedReader(new InputStreamReader(inputStream));   tokenizer = new StringTokenizer("");  }  private static String next() throws IOException {   String read;   while (!tokenizer.hasMoreTokens()) {    read = reader.readLine();    if (read == null || read.equals(""))     return "-1";    tokenizer = new StringTokenizer(read);   }   return tokenizer.nextToken();  }         }
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); }  }
3	public class java2 {  public static void main(String[] args) {   Scanner r = new Scanner(System.in);   int n=r.nextInt();   int []l=new int[1005];   int []ri=new int[1005];   int []candy=new int[1005];   for(int i=1;i<=n;++i)   {    l[i]=r.nextInt();   }   for(int i=1;i<=n;++i)   {    ri[i]=r.nextInt();   }   for(int i=1;i<=n;++i)   {    if(l[i]>i-1||ri[i]>n-i)    {     System.out.println("NO");     System.exit(0);    }    candy[i]=n-l[i]-ri[i];   }   for(int i=1;i<=n;++i)   {    int left=0,right=0;    for(int j=1;j<=i-1;++j)    {     if(candy[j]>candy[i])     {      ++left;     }    }    for(int j=i+1;j<=n;++j)    {     if(candy[j]>candy[i])     {      ++right;     }    }    if(left!=l[i]||right!=ri[i])    {     System.out.println("NO");     System.exit(0);    }   }   System.out.println("YES");   for(int i=1;i<=n;++i)   {    System.out.print(candy[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);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); }  static class TaskA {  public void solve(int testNumber, InputReader in, OutputWriter out) {  int n = in.nextInt();  boolean[] a = new boolean[218];  for (int i = 0; i < n; ++i) {   a[in.nextInt()] = true;  }  int res = 0;  for (int i = 1; i < a.length; ++i) {   if (a[i]) {   ++res;   for (int j = i; j < a.length; j += i) {    a[j] = false;   }   }  }  out.printLine(res);  }  }  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;  }  } }
0	public class d {  double a, v, l, d, w;  private void solve() throws Exception {  a = nextInt(); v = nextInt(); l = nextInt(); d = nextInt(); w = nextInt();  double ans;  if (w >= v){  ans = fromSign(0, l);  }  else{  double tToW = w / a;  double dToW = tToW * tToW * a / 2.;  if (dToW > d){   double curT = Math.sqrt(d * 2. / a);   ans = curT;   double curV = a * curT;   ans += fromSign(curV, l - d);  }  else{   double tToMax = v / a;   double dToMax = tToMax * tToMax * a / 2.;   double tFromMax = (v - w) / a;   double dFromMax = tFromMax * v - tFromMax * tFromMax * a / 2.;   if (dToMax + dFromMax <= d){   ans = tToMax + tFromMax + (d - dToMax - dFromMax) / v;   }   else{   double lo = w, hi = v;   for (int i = 0; i < 1000; ++i){    double mi = (lo + hi) / 2.;    double tTo = mi / a;    double dTo = tTo * tTo * a / 2.;    double tFrom = (mi - w) / a;    double dFrom = tFrom * mi - tFrom * tFrom * a / 2.;    if (dTo + dFrom <= d)    lo = mi;    else    hi = mi;   }   ans = lo / a + (lo - w) / a;   }   ans += fromSign(w, l - d);  }  }  out.printf("%.8f", ans); }  private double fromSign(double curV, double d) {  double tToMax = (v - curV) / a;  double dToMax = tToMax * curV + tToMax * tToMax * a / 2.;  if (dToMax <= d){  return tToMax + (d - dToMax) / v;  }  else{  double lo = 0, hi = tToMax;  for (int i = 0; i < 1000; ++i){   double mi = (lo + hi) / 2.;   double curD = mi * curV + mi * mi * a / 2.;   if (curD <= d)   lo = mi;   else   hi = mi;  }  return lo;  } }  public void run() {  try {  solve();  } catch (Exception e) {  NOO(e);  } finally {  out.close();  } }  PrintWriter out; BufferedReader in; StringTokenizer St;  void NOO(Exception e) {  e.printStackTrace();  System.exit(1); }  int nextInt() {  return Integer.parseInt(nextToken()); }  long nextLong() {  return Long.parseLong(nextToken()); }  double nextDouble() {  return Double.parseDouble(nextToken()); }  String nextToken() {  while (!St.hasMoreTokens()) {  try {   String line = in.readLine();   St = new StringTokenizer(line);  } catch (Exception e) {   NOO(e);  }  }  return St.nextToken(); }  private d(String name) {  try {  in = new BufferedReader(new FileReader(name + ".in"));  St = new StringTokenizer("");  out = new PrintWriter(new FileWriter(name + ".out"));  } catch (Exception e) {  NOO(e);  } }  private d() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  St = new StringTokenizer("");  out = new PrintWriter(System.out);  } catch (Exception e) {  NOO(e);  } }  public static void main(String[] args) {  Locale.setDefault(Locale.US);  new d().run(); } }
3	public class F11141 { static class Solver {  ArrayList<int[]> ranges[];  HashMap<Long, Integer> hm = new HashMap<>();  int id(long s) {  if (!hm.containsKey(s))   hm.put(s, hm.size());  return hm.get(s);  }     int[] memo;  int go(int r) {  memo[N] = 0;  int last = N;  for(int[] a : ranges[r]) {   while(a[0] < last) {   memo[last - 1] = memo[last];   last--;   }   memo[a[0]] = Math.max(memo[a[0]], Math.max(memo[a[0]], 1 + memo[a[1] + 1]));   last = a[0];  }  while(0 < last) {   memo[last - 1] = memo[last];   last--;  }  return memo[0];  }  ArrayDeque<int[]> ans = new ArrayDeque<>();   void go2(int r) {  memo[N] = 0;  int last = N;  int minAt[] = new int[N], oo = 987654321;  Arrays.fill(minAt, oo);  for(int[] a : ranges[r]) {   minAt[a[0]] = Math.min(minAt[a[0]], a[1] - a[0]);   while(a[0] < last) {   memo[last - 1] = memo[last];   last--;   }   memo[a[0]] = Math.max(memo[a[0]], Math.max(memo[a[0]], 1 + memo[a[1] + 1]));   last = a[0];  }  while(0 < last) {   memo[last - 1] = memo[last];   last--;  }  int k = 0;  for(; k < N;) {   if(minAt[k] == oo || memo[k] != 1 + memo[k + minAt[k] + 1]) k++;   else {   ans.push(new int[] {k, k + minAt[k]});   k += minAt[k] + 1;   }  }  }   @SuppressWarnings("unchecked")  Solver() {  ranges = new ArrayList[2250001];  for (int i = 0; i < ranges.length; i++)   ranges[i] = new ArrayList<>();  }  int N, LID;  long[] a;  void solve(Scanner s, PrintWriter out) {  N = s.nextInt();  a = new long[N + 1];  for (int i = 1; i <= N; i++)   a[i] = s.nextLong() + a[i - 1];  for (int i = N; i >= 1; i--)   for (int j = i; j <= N; j++) {   int x = id(a[j] - a[i - 1]);   ranges[x].add(new int[] { i - 1, j - 1 });   }    int best = 0, bid = -1;  memo = new int[N + 1];   for(int i = 0; i < ranges.length; i++, LID++) {   if(ranges[i].size() <= best) continue;   int ans = go(i);   if(ans > best) {   best = ans;   bid = i;   }  }      out.println(best);  go2(bid);      while(!ans.isEmpty()) {   int[] c = ans.pop();   out.println(++c[0] + " " + ++c[1]);  }    }  }  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  Solver solver = new Solver();  solver.solve(s, out);  out.close();  } }
1	public class PrB {  public static long time;  public static void main(String[] args) throws Exception {  time = System.currentTimeMillis();  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 = new int[n];  st = new StringTokenizer(br.readLine());  for(int i = 0; i < n; i++)   a[i] = Integer.parseInt(st.nextToken());  int end = end();  if(end < 0) System.out.println("-1 -1");  else System.out.println((start(end) + 1) + " " + (end + 1));  br.close();  System.exit(0); }  static int n, k; static int[] a;  public static int end() throws Exception {  boolean[] reached = new boolean[100002];  int rem = k;  for(int i = 0; i < n; i++) {  if(!reached[a[i]]) {   rem--;   if(rem == 0) return i;  }  reached[a[i]] = true;  }  return -1; }  public static int start(int end) throws Exception {  boolean[] reached = new boolean[100002];  int rem = k;  for(int i = end; i >= 0; i--) {  if(!reached[a[i]]) {   rem--;   if(rem == 0) return i;  }  reached[a[i]] = true;  }  return 0; }  public static void checkTime() {  System.out.println(System.currentTimeMillis() - time);  time = System.currentTimeMillis(); } }
1	public class Main {     static final long MOD = 998244353L;   static final int INF = 1000000005;  static final int NINF = -1000000005;   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);      int Q = sc.ni();   for (int q = 0; q < Q; q++) {    int N = sc.ni();    String ans = "NO";    if (N%2==0 && isSquare(N/2))     ans = "YES";    if (N%4==0 && isSquare(N/4))     ans = "YES";    pw.println(ans);   }   pw.close();  }  public static boolean isSquare(int x) {   int s = (int)Math.round(Math.sqrt(x));   return s*s==x;  }   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[]>() {    @Override    public int compare(int[] a, int[] b) {     return a[0]-b[0];    }   });  }   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[]>() {    @Override    public int compare(long[] a, long[] b) {     if (a[0] > b[0])      return 1;     else if (a[0] < b[0])      return -1;     else      return 0;        }   });  }   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());   }    int[][] graph(int N, int[][] edges) {    int[][] graph = new int[N][];    int[] sz = new int[N];    for (int[] e: edges) {     sz[e[0]] += 1;     sz[e[1]] += 1;    }    for (int i = 0; i < N; i++) {     graph[i] = new int[sz[i]];    }    int[] cur = new int[N];    for (int[] e: edges) {     graph[e[0]][cur[e[0]]] = e[1];     graph[e[1]][cur[e[1]]] = e[0];     cur[e[0]] += 1;     cur[e[1]] += 1;    }    return graph;   }    int[] intArray(int N, int mod) {    int[] ret = new int[N];    for (int i = 0; i < N; i++)     ret[i] = ni()+mod;    return ret;   }    long nl() {    return Long.parseLong(next());   }    long[] longArray(int N, long mod) {    long[] ret = new long[N];    for (int i = 0; i < N; i++)     ret[i] = nl()+mod;    return ret;   }    double nd() {    return Double.parseDouble(next());   }    String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
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 String readString() throws IOException {  int c = read();  while (isSpaceChar(c)) {   c = read();  }  StringBuilder res=new StringBuilder();  do {   res.append((char)c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  public final int readInt() throws IOException {  int c = read();  boolean neg=false;  while (isSpaceChar(c)) {   c = read();  }  char d=(char)c;    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;  } } }
2	public class Main {   long mod = 1000000007;  long pow(long x,long y) {  if(y==0)  return 1;  else if(y==1)  return x%mod;  else if(y%2==0)  return pow((x*x)%mod,y/2)%mod;  else  return (x*pow((x*x)%mod,y/2)%mod)%mod; }  void solve() {  FastReader sc =new FastReader();  long x = sc.nextLong();  long k = sc.nextLong();   if(x == 0) {  System.out.println(0);  return;  }  long ans = pow(2, k);  x = (2*x)%mod;  x = (x - 1 + mod)%mod;  ans = (ans*x)%mod;  ans = (ans + 1)%mod;   System.out.println(ans); }  public static void main(String[] args)  {   new Main().solve();  }   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());   }    double nextDouble()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  } }
0	public class Main {   public static void main(String[] args) {   Scanner scanner = new Scanner(System.in);   long n = scanner.nextLong();   long x = scanner.nextLong(), y = scanner.nextLong();   long whiteSteps, blackSteps;   if(x == 1 || y == 1){    whiteSteps = (x - 1) + (y - 1);   } else {    whiteSteps = Math.min((x - 1) + Math.abs(y - x), (y - 1) + Math.abs(y - x));   }   if(x == n || y == n){    blackSteps = (n - x) + (n - y);   } else {    blackSteps = Math.min((n - x) + Math.abs(y - x), (n - y) + Math.abs(y - x));   }   if (whiteSteps <= blackSteps){    System.out.println("White");   } else {    System.out.println("Black");   }  } }
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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static final class TaskC {   private static final int MODULO = 1_000_000_000 + 7;   public void solve(int __, InputReader in, PrintWriter out) {    long qty = in.nextLong();    long months = in.nextLong();    if (qty == 0) {     out.println(0);     return;    }    qty %= MODULO;    long pow = pow(2, months + 1);    qty = (qty * pow) % MODULO;    long sub = (pow - 2 + MODULO) % MODULO * pow(2, MODULO - 2) % MODULO;    qty = (qty - sub + MODULO) % MODULO;    out.println(qty);   }   private long pow(long base, long power) {    long result = 1;    while (power > 0) {     if ((power & 1) != 0) {      result = (result * base) % MODULO;     }     base = (base * base) % MODULO;     power >>>= 1;    }    return result;   }  }  static class InputReader {   private final BufferedReader reader;   private StringTokenizer tokenizer;   public InputReader(InputStream in) {    reader = new BufferedReader(new InputStreamReader(in));   }   public long nextLong() {    return Long.parseLong(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;   }  } }
0	public class A275 {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);     long a=sc.nextLong();   long b=sc.nextLong();     if(b-a<2){    System.out.println(-1);   }else if(b-a==2 && a%2==1){    System.out.println(-1);   }else if(b-a==2 && a%2==0){    System.out.println(a+" "+(a+1)+" "+(a+2));   }else{    if(a%2==0){     System.out.println(a+" "+(a+1)+" "+(a+2));    }else{     System.out.println((a+1)+" "+(a+2)+" "+(a+3));    }   }  } }
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)); } }
3	public class utkarsh{ BufferedReader br;  void solve(){  br = new BufferedReader(new InputStreamReader(System.in));  int i, j, n, mod = (int)(1e9 + 7);  n = ni();  char c[] = new char[n];  for(i = 0; i < n; i++) c[i] = ns().charAt(0);  long dp[][] = new long[n][n];  dp[0][0] = 1;  for(i = 1; i < n; i++){  if(c[i-1] == 'f'){   for(j = 0; j < i; j++){   dp[i][j+1] = dp[i-1][j];   }  }else{   for(j = i-1; j >= 0; j--){   dp[i][j] = dp[i-1][j] + dp[i][j+1];   dp[i][j] %= mod;   }  }  }  long ans = 0;  for(long x : dp[n-1]){  ans += x;  ans %= mod;  }  System.out.println(ans); }  int ni(){  return Integer.parseInt(ns()); }  String ip[]; int len, sz;  String ns(){  if(len >= sz){  try{   ip = br.readLine().split(" ");   len = 0;   sz = ip.length;  }catch(IOException e){   throw new InputMismatchException();  }  if(sz <= 0) return "-1";  }  return ip[len++]; }  public static void main(String[] args){ new utkarsh().solve(); } }
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);   F2SameSumBlocksHard solver = new F2SameSumBlocksHard();   solver.solve(1, in, out);   out.close();  }  static class F2SameSumBlocksHard {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    long[] a = in.nextLongArray(n);    long[] p = in.calculatePrefixSum(a);    Map<Long, Integer> map = new HashMap<>();    for (int i = 0; i < n; i++) {     long sum = 0;     for (int j = i; j < n; j++) {      sum += a[j];      map.merge(sum, 1, (x, y) -> x + y);     }    }    List<sum> sums = new ArrayList<>();    for (long sum : map.keySet()) {     sums.add(new sum(sum, map.get(sum)));    }    sums.sort((x, y) -> y.c - x.c);    int ans = -1;    int[] fca = null;    long mxsum = -1;    for (int i = 0; i < sums.size(); i++) {     sum cs = sums.get(i);     long sum = cs.sum;     long c = cs.c;     if (c < ans) {      continue;     }     Map<Long, Integer> lm = new HashMap<>();     int[] ca = new int[n];     lm.put(0l, -1);     for (int j = 0; j < n; j++) {      long val = p[j];      if (j > 0) {       ca[j] = ca[j - 1];      }      long req = val - sum;      if (lm.containsKey(req)) {       int li = lm.get(req);       if (li == -1)        ca[j] = Math.max(1, ca[j]);       else        ca[j] = Math.max(1 + ca[li], ca[j]);      }      lm.put(val, j);     }     if (ca[n - 1] > ans) {      ans = ca[n - 1];      mxsum = sum;      fca = ca;     }    }    List<Integer> al = new ArrayList<>();    long sum = 0;    for (int i = n - 1; i >= 0; i--) {     if (i > 0 && fca[i] != fca[i - 1]) {      sum = 0;      al.add(i + 1);      do {       sum += a[i];       i--;      } while (i >= 0 && sum != mxsum);      i++;      al.add(i + 1);     } else if (i == 0) {      if (a[i] == mxsum) {       al.add(i + 1);       al.add(i + 1);      }     }    }    out.println(al.size() / 2);    for (int i = al.size() - 1; i >= 0; i -= 2) {     out.println(al.get(i) + " " + al.get(i - 1));    }   }   class sum {    long sum;    int c;    public sum(long sum, int c) {     this.sum = sum;     this.c = c;    }   }  }  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 long[] nextLongArray(int n) {    long[] array = new long[n];    for (int i = 0; i < n; ++i) array[i] = nextLong();    return array;   }   public long[] calculatePrefixSum(long[] a) {    int n = a.length;    long[] prefixSum = new long[n];    prefixSum[0] = a[0];    for (int i = 1; i < n; i++) {     prefixSum[i] = prefixSum[i - 1] + a[i];    }    return prefixSum;   }   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 println(Object... objects) {    print(objects);    writer.println();   }   public void close() {    writer.close();   }   public void println(int i) {    writer.println(i);   }  } }
0	public class Subtractions {  public static void main(String[] args) {   InputReader r = new InputReader(System.in);   int n = r.nextInt();   while (n-- > 0) {    int a = r.nextInt();    int b = r.nextInt();    int res = 0;    while (a > 0 && b > 0) {     if (a > b) {      int div = a / b;      a -= div * b;      res += div;     } else {      int div = b / a;      b -= div * a;      res += div;     }    }    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 String nextLine() {    try {     return reader.readLine();    } catch (IOException e) {         e.printStackTrace();     return 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());   }  } }
4	public class Main { public static void main(String[] args) {  InputStream inputStream;  try {  inputStream = new FileInputStream("input.txt");  } catch (IOException e) {  throw new RuntimeException(e);  }  OutputStream outputStream;  try {  outputStream = new FileOutputStream("output.txt");  } catch (IOException e) {  throw new RuntimeException(e);  }  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskC solver = new TaskC();  solver.solve(1, in, out);  out.close(); } } class TaskC {  public void solve(int testNumber, InputReader in, OutputWriter out) {  int maxdist = -1, maxrow = -1, maxcol = -1;  int rows = in.ri(), cols = in.ri();  int k = in.ri();  IntPair[] points = new IntPair[k];  for(int i = 0; i < k; i++) points[i] = new IntPair(in.ri(), in.ri());  for(int row = 1; row <= rows; row++) {   for(int col = 1; col <= cols; col++) {   int mindist = Integer.MAX_VALUE;   for(int i = 0; i < k; i++)    mindist = Math.min(mindist, Math.abs(row - points[i].first) + Math.abs(col - points[i].second));   if (mindist > maxdist){    maxdist = mindist;    maxrow = row;    maxcol = col;   }   }  }  out.printLine(maxrow, maxcol);  } } 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 ri(){  return readInt(); }  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); } } class OutputWriter { private final PrintWriter writer;  public OutputWriter(OutputStream outputStream) {  writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } 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 IntPair implements Comparable<IntPair> { public int first, second;  public IntPair(int first, int second) {  this.first = first;  this.second = second; } public String toString() {  return "(" + first + "," + second + ")"; }  public boolean equals(Object o) {  if (this == o) return true;  if (o == null || getClass() != o.getClass()) return false;  IntPair intPair = (IntPair) o;  return first == intPair.first && second == intPair.second;  }  public int hashCode() {  int result = first;  result = 31 * result + second;  return result; }  public int compareTo(IntPair o) {  if (first < o.first)  return -1;  if (first > o.first)  return 1;  if (second < o.second)  return -1;  if (second > o.second)  return 1;  return 0; } }
1	public class _1004_A {  public static void main(String[] args) throws IOException {  int N = readInt(), D = readInt(); long arr[] = new long[N+2]; arr[0] = -3000000000L; arr[N+1] = -arr[0];  for(int i = 1; i<=N; i++) arr[i] = readInt();  int cnt = 1; if(Math.abs(arr[2]-(arr[1] + D)) >= D) cnt++; for(int i = 2; i<=N; i++) {  if(Math.abs(arr[i-1]-(arr[i] - D)) > D) cnt++;  if(Math.abs(arr[i+1]-(arr[i] + D)) >= D) cnt++;  }  println(cnt); exit(); }  final private static int BUFFER_SIZE = 1 << 16; private static DataInputStream din = new DataInputStream(System.in); private static byte[] buffer = new byte[BUFFER_SIZE]; private static int bufferPointer = 0, bytesRead = 0; static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  public static String readLine() throws IOException {  byte[] buf = new byte[64];  int cnt = 0, c;  while ((c = Read()) != -1) {  if (c == '\n')   break;  buf[cnt++] = (byte) c;  }  return new String(buf, 0, cnt); }  public static String read() throws IOException {  byte[] ret = new byte[1024];  int idx = 0;  byte c = Read();  while (c <= ' ') {  c = Read();  }  do {  ret[idx++] = c;  c = Read();  } while (c != -1 && c != ' ' && c != '\n' && c != '\r');  return new String(ret, 0, idx); }  public static int readInt() throws IOException {  int ret = 0;  byte c = Read();  while (c <= ' ')  c = Read();  boolean neg = (c == '-');  if (neg)  c = Read();  do {  ret = ret * 10 + c - '0';  } while ((c = Read()) >= '0' && c <= '9');  if (neg)  return -ret;  return ret; }  public static long readLong() throws IOException {  long ret = 0;  byte c = Read();  while (c <= ' ')  c = Read();  boolean neg = (c == '-');  if (neg)  c = Read();  do {  ret = ret * 10 + c - '0';  } while ((c = Read()) >= '0' && c <= '9');  if (neg)  return -ret;  return ret; }  public static double readDouble() throws IOException {  double ret = 0, div = 1;  byte c = Read();  while (c <= ' ')  c = Read();  boolean neg = (c == '-');  if (neg)  c = Read();  do {  ret = ret * 10 + c - '0';  } while ((c = Read()) >= '0' && c <= '9');  if (c == '.') {  while ((c = Read()) >= '0' && c <= '9') {   ret += (c - '0') / (div *= 10);  }  }  if (neg)  return -ret;  return ret; }  private static void fillBuffer() throws IOException {  bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);  if (bytesRead == -1)  buffer[0] = -1; }  private static byte Read() throws IOException {  if (bufferPointer == bytesRead)  fillBuffer();  return buffer[bufferPointer++]; }  static void print(Object o) {  pr.print(o); }  static void println(Object o) {  pr.println(o); }  static void flush() {  pr.flush(); }  static void println() {  pr.println(); }  static void exit() throws IOException {  din.close();  pr.close();  System.exit(0); } }
0	public class MAIN { public static void main(String args[]) {  Scanner sn=new Scanner(System.in);  int n,n1,n2,n3;  int arr[]={0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811,514229,832040,1346269,2178309,3524578,5702887,9227465,14930352,24157817,39088169,63245986,102334155,165580141,267914296,433494437,701408733,1134903170};  n=sn.nextInt();   if(n==2)  {  n1=n2=1;  n3=0;  }  else if(n==1)  {  n3=n2=0;  n1=1;  }  else if(n==0)  {  n1=n2=n3=0;  }  else if(n==3)  {  n1=n2=n3=1;  }  else  {  int index=bsearch(arr,0,arr.length-1,n);  n1=arr[index-1];  n2=arr[index-3];  n3=arr[index-4];  }  System.out.println(n3+" "+n2+" "+n1);  }  static int bsearch(int arr[],int l,int h,int n) {  if(l>h)  return -1;  int mid=(l+h)/2;  if(n==arr[mid])  return mid;  else if(n>arr[mid])  return(bsearch(arr,mid+1,h,n));  else  return(bsearch(arr,l,mid-1,n)); } }
1	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 nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}   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 long l(){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 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 double d() throws IOException {return Double.parseDouble(s()) ;}   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[])  {   Reader sc=new Reader();   PrintWriter out=new PrintWriter(System.out);   int n=sc.i();   String s1=sc.s();   String s2=sc.s();   int pos1=-1;   int pos2=-1;   int arr[][][]=new int[100][100][2];   for(int i=0;i<n;i++)   {    if(s1.charAt(i)!=s2.charAt(i))    {     if(arr[s2.charAt(i)-97][s1.charAt(i)-97][0]==1)     {      pos2=i;      pos1=arr[s2.charAt(i)-97][s1.charAt(i)-97][1];      break;     }     arr[s1.charAt(i)-97][s2.charAt(i)-97][0]=1;     arr[s1.charAt(i)-97][s2.charAt(i)-97][1]=i;    }   }   int ham=0;   for(int i=0;i<n;i++)   {    if(s1.charAt(i)!=s2.charAt(i))    ham++;   }   if(pos1!=-1&&pos2!=-1)   {    System.out.println(ham-2);    System.out.println(pos1+1+" "+(pos2+1));    System.exit(0);   }     int arr1[][]=new int[100][2];   int arr2[][]=new int[100][2];   for(int i=0;i<n;i++)   {    if(s1.charAt(i)!=s2.charAt(i))    {     if(arr1[s1.charAt(i)-97][0]==1)     {      pos2=i;      pos1=arr1[s1.charAt(i)-97][1];      break;     }     if(arr2[s2.charAt(i)-97][0]==1)     {      pos2=i;      pos1=arr2[s2.charAt(i)-97][1];      break;     }     arr1[s2.charAt(i)-97][0]=1;     arr1[s2.charAt(i)-97][1]=i;     arr2[s1.charAt(i)-97][0]=1;     arr2[s1.charAt(i)-97][1]=i;    }   }   if(pos1!=-1&&pos2!=-1)   {    System.out.println(ham-1);    System.out.println(pos1+1+" "+(pos2+1));    System.exit(0);   }   System.out.println(ham);   System.out.println(pos1+" "+pos2);  } }
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;  public void run() {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  System.err.println("");     n = fs.nextInt(); m = fs.nextInt();  byte[] str = fs.next().getBytes();  int[] occs = new int[1<<m];  for(int i = 0; i < n-1; i++) {  int l1 = str[i] - 'a';  int l2 = str[i+1] - 'a';  occs[(1<<l1) | (1<<l2)]++;  occs[(1<<l2) | (1<<l1)]++;  }   int all = (1<<m)-1;  cost = new int[m][1<<m];  for(int i = 0; i < m; i++) {  for(int mask = 1; mask < all; mask++) {   if(((1<<i)&mask) > 0) continue;   int lb = mask & (-mask);   int trail = Integer.numberOfTrailingZeros(lb);   int nmask = mask ^ lb;   cost[i][mask] = cost[i][nmask]+occs[1<<i | 1<<trail];  }  }   dp = new int[1<<m];  for(int mask = dp.length-2; mask >= 0; mask--) {  int addOn = 0;  for(int nxt = 0; nxt < m; nxt++) {   if(((1<<nxt)&mask) > 0) continue;   addOn += cost[nxt][mask];  }  int res = oo;  for(int nxt = 0; nxt < m; nxt++) {   if(((1<<nxt)&mask) > 0) continue;   int ret = addOn+dp[mask | (1<<nxt)];   res = min(res, ret);  }  dp[mask] = res;  }   System.out.println(dp[0]>>1);   out.close(); }  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 double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }  public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }  public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  }   public int[] nextIntArray(int n) {  int[] res = new int[n];  for(int i = 0; i < n; i++) res[i] = nextInt();  return res;  }   } }
3	public class D {  private void solve() {   br = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   int n = nextInt(), m = nextInt();   boolean[][] used = new boolean[n + 1][m + 1];   for (int j = 1; j <= (m + 1) / 2; j++) {    int x1 = 1, x2 = n;    for (int i = 1; i <= n; i++) {     if (x1 <= n && !used[x1][j]) {      out.println(x1 + " " + j);      used[x1++][j] = true;     }     if (x2 > 0 && !used[x2][m - j + 1]) {      out.println(x2 + " " + (m - j + 1));      used[x2--][m - j + 1] = true;     }    }   }   out.close();  }  public static void main(String[] args) {   new D().solve();  }  private BufferedReader br;  private StringTokenizer st;  private PrintWriter out;  private String next() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     throw new RuntimeException(e);    }   }   return st.nextToken();  }  private int nextInt() {   return Integer.parseInt(next());  }  private long nextLong() {   return Long.parseLong(next());  }  private double nextDouble() {   return Double.parseDouble(next());  } }
5	public class A {  public static void main(String args[])  {   Scanner scan = new Scanner(System.in);     int n = scan.nextInt();     int[] a = new int[n];     for(int i=0;i < n;i++)    a[i] = scan.nextInt();      Arrays.sort(a);     int min = a[0];     for(int i=1;i < n;i++)   {    if(a[i] > min)    {     System.out.println(a[i]);     return;    }   }     System.out.println("NO");  } }
0	public class Main implements Runnable {  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;  }  PrintWriter pw;  BufferedReader in;  StringTokenizer st;  void initStreams() throws FileNotFoundException,    UnsupportedEncodingException {   pw = new PrintWriter(System.out);   if (System.getProperty("ONLINE_JUDGE") == null) {    System.setIn(new FileInputStream("1"));   }   in = new BufferedReader(new InputStreamReader(System.in, "ISO-8859-9"));  }  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());  }  public void run() {   try {    initStreams();    double a = nextDouble(), vmax = nextDouble(), l = nextDouble(), d = nextDouble(), w = nextDouble();    if (vmax <= w) {     double v = Math.sqrt(2 * a * l);     if (v <= vmax) {      out(v / a);     } else {      double s = vmax * vmax / (2 * a);      double t = (l - s) / vmax;      out(vmax / a + t);     }    } else {     double v = Math.sqrt(a * d + w * w / 2);     double t1 = 0;     if (w <= Math.sqrt(2 * a * d)) {      if (v <= vmax) {       t1 = v / a + (v - w) / a;      } else {       double s = d - vmax * vmax / (2 * a) - (vmax * vmax - w * w) / (2 * a);       t1 = s / vmax + vmax / a + (vmax - w) / a;      }      } else {      t1 = Math.sqrt(2 * d / a);      w = a * t1;     }     v = Math.sqrt(2 * a * (l - d) + w * w);     double t2 = 0;     if (v <= vmax) {      t2 = (v - w) / a;     } else {      double s = l - d - (vmax * vmax - w * w) / (2 * a);      t2 = (vmax - w) / a + s / vmax;     }     out(t1 + t2);    }   } catch (Throwable e) {    sError = e;   } finally {    pw.flush();    pw.close();   }  }  private void out(double t) {   pw.println(t);  } }
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); }  void debug(Object... os){  System.err.println(Arrays.deepToString(os)); }  public static void main(String[] args){  Locale.setDefault(Locale.US);  new P111C().run(); } }
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);   TaskE1 solver = new TaskE1();   solver.solve(1, in, out);   out.close();  }  static class TaskE1 {   int n;   int m;   int[][] map;   int[][] dp;   int two(int idx) {    return 1 << idx;   }   boolean contain(int mask, int idx) {    return (mask & two(idx)) > 0;   }   int best(int mask, int col) {    int res = 0;    for (int rot = 0; rot < n; rot++) {     int sum = 0;     for (int i = 0; i < n; i++) {      int curRow = (rot + i) % n;      if (contain(mask, curRow)) {       sum += map[i][col];      }     }     res = Math.max(res, sum);    }    return res;   }   int rec(int col, int used) {    if (col == m)     return 0;    int res = dp[col][used];    if (res != -1)     return res;    res = 0;    for (int mask = 0; mask < two(n); mask++)     if ((mask & used) == 0) {      res = Math.max(res, rec(col + 1, used | mask) + best(mask, col));     }    dp[col][used] = res;    return res;   }   public void solve(int testNumber, InputReader in, PrintWriter out) {    int t = in.nextInt();    for (int test = 0; test < t; test++) {     n = in.nextInt();     m = in.nextInt();     map = new int[n][m];     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       map[i][j] = in.nextInt();      }     }     dp = new int[m][1 << n];     for (int[] aux : dp)      Arrays.fill(aux, -1);     int ans = rec(0, 0);     out.println(ans);    }   }  }  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 Main {  public static void main(String[] args) throws Exception {   new Main().run();}                                                                                                       static long mul(long a, long b, long p)  {   long res=0,base=a;   while(b>0)   {    if((b&1L)>0)     res=(res+base)%p;    base=(base+base)%p;    b>>=1;   }   return res;  }  static long mod_pow(long k,long n,long p){   long res = 1L;   long temp = k;   while(n!=0L){    if((n&1L)==1L){     res = (res*temp)%p;    }    temp = (temp*temp)%p;    n = n>>1L;   }   return res%p;  }  int ct = 0;  int f[] =new int[200001];  int b[] =new int[200001];  int str[] =new int[200001];  void go(int rt,List<Integer> g[]){   str[ct] = rt;   f[rt] = ct;   for(int cd:g[rt]){    ct++;    go(cd,g);   }   b[rt] = ct;  }  int add =0;  void go(int rt,int sd,int k,List<Integer> g[],int n){   if(add>n) {    return;   }   Queue<Integer> q =new LinkedList<>();   q.offer(rt);   for(int i=1;i<=sd;++i){    int sz =q.size();    if(sz==0) break;    int f = (i==1?2:1);    while(sz-->0){     int cur = q.poll();     for(int j=0;j<k-f;++j){      q.offer(add);      g[cur].add(add);add++;      if(add==n+1){       return;      }     }    }   }   }   void solve() {   int n = ni();   long s[] = new long[n+1];   for(int i=0;i<n;++i){    s[i+1] = s[i] + ni();   }   Map<Long,List<int[]>> mp = new HashMap<>();   for(int i=0;i<n;++i) {    for (int j = i; j>=0; --j) {     long v = s[i+1]-s[j];     if(!mp.containsKey(v)){      mp.put(v, new ArrayList<>());     }     mp.get(v).add(new int[]{j,i});    }   }   int all = 0;long vv = -1;   for(long v:mp.keySet()){    List<int[]> r = mp.get(v);    int sz = r.size();int c = 0;    int ri = -2000000000;    for(int j=0;j<sz;++j){     if(r.get(j)[0]>ri){      ri = r.get(j)[1];c++;     }    }    if(c>all){     all = c;     vv = v;    }   }   println(all);   List<int[]> r = mp.get(vv);   int sz = r.size();int c = 0;   int ri = -2000000000;   for(int j=0;j<sz;++j){    if(r.get(j)[0]>ri){     ri = r.get(j)[1];println((1+r.get(j)[0])+" "+(1+r.get(j)[1]));    }   }                                                                                                                                                }       long t1[];   void update(long[] t,int i,long v){   for(;i<t.length;i+=(i&-i)){    t[i] += v;   }  }  long get(long[] t,int i){   long s = 0;   for(;i>0;i-=(i&-i)){    s += t[i];   }   return s;  }  int equal_bigger(long t[],long v){   int s=0,p=0;   for(int i=Integer.numberOfTrailingZeros(Integer.highestOneBit(t.length));i>=0;--i) {    if(p+(1<<i)< t.length && s + t[p+(1<<i)] < v){     v -= t[p+(1<<i)];     p |= 1<<i;    }   }   return p+1;  }      static class S{   int l = 0;   int r = 0 ;   long le = 0;   long ri = 0;   long tot = 0;   long all = 0;   public S(int l,int r) {    this.l = l;    this.r = r;   }  }  static S a[];  static int[] o;  static void init(int[] f){   o = f;   int len = o.length;   a = new S[len*4];   build(1,0,len-1);  }  static void build(int num,int l,int r){   S cur = new S(l,r);   if(l==r){    a[num] = cur;    return;   }else{    int m = (l+r)>>1;    int le = num<<1;    int ri = le|1;    build(le, l,m);    build(ri, m+1,r);    a[num] = cur;    pushup(num, le, ri);   }  }                static long dd = 10007;  static void update(int num,int l,long v){   if(a[num].l==a[num].r){    a[num].le = v%dd;    a[num].ri = v%dd;    a[num].all = v%dd;    a[num].tot = v%dd;   }else{    int m = (a[num].l+a[num].r)>>1;    int le = num<<1;    int ri = le|1;    pushdown(num, le, ri);    if(l<=m){     update(le,l,v);    }    if(l>m){     update(ri,l,v);    }    pushup(num,le,ri);   }  }  static void pushup(int num,int le,int ri){   a[num].all = (a[le].all*a[ri].all)%dd;   a[num].le = (a[le].le + a[le].all*a[ri].le)%dd;   a[num].ri = (a[ri].ri + a[ri].all*a[le].ri)%dd;   a[num].tot = (a[le].tot + a[ri].tot + a[le].ri*a[ri].le)%dd;     }  static void pushdown(int num,int le,int ri){  }   int gcd(int a,int b){ return b==0?a: gcd(b,a%b);}  InputStream is;PrintWriter out;  void run() throws Exception {is = System.in;out = new PrintWriter(System.out);solve();out.flush();}  private byte[] inbuf = new byte[2];  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 double nd() {return Double.parseDouble(ns());}  private char nc() {return (char) skip();}  private char ncc() {int b;while((b = readByte()) != -1 && !(b >= 32 && b <= 126));return (char)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 String nline() {int b = skip();StringBuilder sb = new StringBuilder();   while (!isSpaceChar(b) || b == ' ') { sb.appendCodePoint(b);b = readByte(); }   return sb.toString();}  private char[][] nm(int n, int m) {char[][] a = new char[n][];for (int i = 0; i < n; i++) a[i] = ns(m);return a;}  private int[] na(int n) {int[] a = new int[n];for (int i = 0; i < n; i++) a[i] = ni();return a;}  private long[] nal(int n) { long[] a = new long[n];for (int i = 0; i < n; i++) a[i] = nl();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 << 3) + (num << 1) + (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();}}  void print(Object obj){out.print(obj);}  void println(Object obj){out.println(obj);}  void println(){out.println();} }
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); } }
1	public class TaskB {   public static int strIndex;  public static void main(String[] args) throws IOException {   Scanner scanner = new Scanner(System.in);   int n = scanner.nextInt();   char[] s = scanner.next().toCharArray();   int[][] r = new int[n][54];   Set<Character> chars = new HashSet<>();   for (int i= 0 ;i < n; ++ i)chars.add(s[i]);   List<Character> all = new ArrayList<>();   for (Character c: chars)all.add(c);   for (int i = n - 1; i >= 0; -- i){    for (int j = 0;j < 54; ++ j){     if (i == n - 1){      r[i][j] = -1;     }else {      r[i][j] = r[i + 1][j];     }    }    r[i][getCode(s[i])] = i;   }   int res = n;    for (int i =0; i < n; ++ i){    int mx = 1;    boolean fl = false;    for (Character c: all){     if (r[i][getCode(c)] == -1){      fl = true;      break;     }     mx = Math.max(mx, r[i][getCode(c)] - i + 1);    }    if (fl){     System.out.println(res);     return;    }    res = Math.min(res, mx);   }   System.out.println(res);   scanner.close();    }  public static int getCode(char a){   if (Character.isUpperCase(a))return a - 'A';   return (a - 'a') + 26;  }  public static int getLetter(int n){   if (n > 25)return (char)((n - 26) + 'a');   return (char)((n) + 'A');  }   static class IO{    BufferedReader reader;   StringTokenizer tokenizer;   PrintWriter writer;   public void init() {    try {     reader = new BufferedReader(new InputStreamReader(System.in),8*1024);     writer = new PrintWriter(System.out);    } catch (Exception e) {     e.printStackTrace();     System.exit(261);    }   }   void destroy() {    writer.close();    System.exit(0);   }   void print(Object... objects) {    for (int i = 0; i < objects.length; i++) {     if (i != 0)      writer.print(' ');     writer.print(objects[i]);    }   }   void println(Object... objects) {    print(objects);    writer.println();   }   String nextLine() throws IOException {    return reader.readLine();   }   String nextToken() throws IOException {    while (tokenizer == null || !tokenizer.hasMoreTokens())     tokenizer = new StringTokenizer(nextLine());    return tokenizer.nextToken();   }   int nextInt() throws NumberFormatException, IOException {    return Integer.parseInt(nextToken());   }   long nextLong() throws NumberFormatException, IOException {    return Long.parseLong(nextToken());   }   double nextDouble() throws NumberFormatException, IOException {    return Double.parseDouble(nextToken());   }  }  }
3	public class Main {  private static class Interval implements Comparable<Interval> {  public int start , end;  public Interval(int start , int end) {  this.start = start;  this.end = end;   }  @Override  public int compareTo(Interval interval) {  return this.end - interval.end;   }  }  private static int getTotal(List<Interval> list) {  int ans = 0 , i , n = list.size();  for (i = 0;i < n;i ++) {  int end = list.get(i).end;  while (i < n && list.get(i).start <= end) {   i ++;    }  i --;  ans ++;  }   return ans; }  private static void solve(List<Interval> list) {  List<int[]> ans = new ArrayList<>();  int i , n = list.size();  for (i = 0;i < n;i ++) {  int start = list.get(i).start , end = list.get(i).end;  while (i < n && list.get(i).start <= end) {   i ++;    }  i --;  ans.add(new int[] {start , end});  }  System.out.println(ans.size());  for (int[] array : ans) {  System.out.println(array[0] + " " + array[1]);  } }  private static long[] a = new long[2000];   public static void main(String[] args) {           Scanner scan = new Scanner(System.in);    Map<Long , List<Interval>> map = new HashMap<>();   int i , j , n = scan.nextInt() , max = 0;  long ans = 0;  for (i = 1;i <= n;i ++) {  a[i] = scan.nextLong();  }  for (i = 1;i <= n;i ++) {  long sum = 0;  for (j = i;j <= n;j ++) {     sum += a[j];   if (!map.containsKey(sum)) {   map.put(sum , new ArrayList<>());   }   map.get(sum).add(new Interval(i , j));    }  }  for (List<Interval> list : map.values()) {  Collections.sort(list);   }   for (Map.Entry<Long , List<Interval>> entry : map.entrySet()) {  int total = getTotal(entry.getValue());  if (total > max) {   max = total;   ans = entry.getKey();    }  }  solve(map.get(ans));   }  }
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 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();   }  }  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 mask = 0; mask < (1 << n); ++mask) {    int val0 = buf[mask];    for (int j = 0; j < n; ++j) {    if ((mask >> j) % 2 == 0) {     int val = val0 + b[j];     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 x1185G1b  {  static long MOD = 1000000007L;  public static void main(String args[]) throws Exception  {   BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));    StringTokenizer st = new StringTokenizer(infile.readLine());   int N = Integer.parseInt(st.nextToken());   int T = Integer.parseInt(st.nextToken());   Song[] arr = new Song[N];   for(int i=0; i < N; i++)   {    st = new StringTokenizer(infile.readLine());    int a = Integer.parseInt(st.nextToken());    int b = Integer.parseInt(st.nextToken())-1;    arr[i] = new Song(a, b);   }      long[][] dp = new long[1 << N][3];   Arrays.fill(dp[0], 1L);   for(int mask=0; mask < dp.length; mask++)   {    for(int i=0; i < N; i++)     if((mask & (1 << i)) == 0)     {     Song c = arr[i];          if(mask == 0 && c.t <= T)     {      dp[mask|(1 << i)][c.g]++;      dp[mask|(1 << i)][c.g] %= MOD;     }          else     {      for(int gen=0; gen < 3; gen++)       if(gen != c.g)       {        dp[mask|(1 << i)][c.g] += dp[mask][gen];        dp[mask|(1 << i)][c.g] %= MOD;       }            }     }   }   long res = 0L;   for(int mask=1; mask < dp.length; mask++)    for(int i=0; i < 3; i++)    {     int sum = 0;     for(int b=0; b < N; b++)     if((mask & (1 << b)) > 0)      sum += arr[b].t;     if(sum == T)     res = (res+dp[mask][i])%MOD;    }   System.out.println(res);  }  }  class Song  {  public int t;  public int g;    public Song(int a, int b)  {   t = a;   g = b;  }  }
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();  }  String nextString() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return "0";    }   }   return st.nextToken("\n");  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
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);  } }
4	public class Main { public static void solve() {  int n = in.nextInt();  ArrayList<Integer> ans = new ArrayList<>();  out.println(in.nextInt());  ans.add(1);  for(int i = 0; i<n-1; i++) {  int cur = in.nextInt();  if(ans.isEmpty() || cur==1) ans.add(cur);  else {   while((!ans.isEmpty()) && (ans.get(ans.size()-1)+1!=cur)) ans.remove(ans.size()-1);   if(!ans.isEmpty()) ans.remove(ans.size()-1);   ans.add(cur);  }  int cnt = 0;  for(int j : ans) {   cnt++;   out.print(j+(cnt==ans.size()?"":"."));  }  out.println();  }   } static boolean equal(ArrayList<Integer> a, ArrayList<Integer> b) {  if(a.size()!=b.size()) return false;  for(int i = 0; i<a.size(); i++) if(a.get(i)!=b.get(i)) return false;  return true; }  public static void main(String[] args) {  in = new Reader();  out = new Writer();  int t = in.nextInt();  while(t-->0) solve();  out.exit(); } static Reader in; static Writer out; static class Reader { static BufferedReader br; static StringTokenizer st;  public Reader() {  this.br = new BufferedReader(new InputStreamReader(System.in)); }  public Reader(String f){  try {  this.br = new BufferedReader(new FileReader(f));  } catch (IOException e) {  e.printStackTrace();  } }  public int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++) a[i] = nextInt();  return a; }  public double[] nd(int n) {  double[] a = new double[n];  for (int i = 0; i < n; i++) a[i] = nextDouble();  return a; }  public long[] nl(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++) a[i] = nextLong();  return a; }  public char[] nca() {  return next().toCharArray(); }  public String[] ns(int n) {  String[] a = new String[n];  for (int i = 0; i < n; i++) a[i] = next();  return a; }  public int nextInt() {  ensureNext();  return Integer.parseInt(st.nextToken()); }  public double nextDouble() {  ensureNext();  return Double.parseDouble(st.nextToken()); }  public Long nextLong() {  ensureNext();  return Long.parseLong(st.nextToken()); }  public String next() {  ensureNext();  return st.nextToken(); }  public String nextLine() {  try {  return br.readLine();  } catch (Exception e) {  e.printStackTrace();  return null;  } }  private void ensureNext() {  if (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(br.readLine());  } catch (IOException e) {   e.printStackTrace();  }  } } } static class Util{  private static Random random = new Random();  static long[] fact;   public static void initFactorial(int n, long mod) {  fact = new long[n+1];  fact[0] = 1;  for (int i = 1; i < n+1; i++) fact[i] = (fact[i - 1] * i) % mod;  }   public static long modInverse(long a, long MOD) {  long[] gcdE = gcdExtended(a, MOD);  if (gcdE[0] != 1) return -1;   long x = gcdE[1];  return (x % MOD + MOD) % MOD;  }   public static long[] gcdExtended(long p, long q) {  if (q == 0) return new long[] { p, 1, 0 };  long[] vals = gcdExtended(q, p % q);  long tmp = vals[2];  vals[2] = vals[1] - (p / q) * vals[2];  vals[1] = tmp;  return vals;  }   public static long nCr(int n, int r, long MOD) {  if (r == 0) return 1;  return (fact[n] * modInverse(fact[r], MOD) % MOD * modInverse(fact[n - r], MOD) % MOD) % MOD;  }   public static long nCr(int n, int r) {  return (fact[n]/fact[r])/fact[n-r];  }   public static long nPr(int n, int r, long MOD) {  if (r == 0) return 1;  return (fact[n] * modInverse(fact[n - r], MOD) % MOD) % MOD;  }  public static long nPr(int n, int r) {  return fact[n]/fact[n-r];  }   public static boolean isPrime(int n) {    if (n <= 1) return false;    if (n <= 3) return true;    if (n % 2 == 0 || n % 3 == 0) return false;    for (int i = 5; i * i <= n; i = i + 6)     if (n % i == 0 || n % (i + 2) == 0)     return false;    return true;   }    public static boolean[] getSieve(int n) {   boolean[] isPrime = new boolean[n+1];   for (int i = 2; i <= n; i++) isPrime[i] = true;   for (int i = 2; i*i <= n; i++) if (isPrime[i])      for (int j = i; i*j <= n; j++) isPrime[i*j] = false;   return isPrime;  }    public static int gcd(int a, int b) {   int tmp = 0;   while(b != 0) {   tmp = b;   b = a%b;   a = tmp;   }   return a;  }    public static long gcd(long a, long b) {   long tmp = 0;   while(b != 0) {   tmp = b;   b = a%b;   a = tmp;   }   return a;  }    public static int random(int min, int max) {   return random.nextInt(max-min+1)+min;  }    public static void dbg(Object... o) {   System.out.println(Arrays.deepToString(o));  }   public static void reverse(int[] s, int l , int r) {  for(int i = l; i<=(l+r)/2; i++) {   int tmp = s[i];   s[i] = s[r+l-i];   s[r+l-i] = tmp;  }  }   public static void reverse(int[] s) {  reverse(s, 0, s.length-1);  }   public static void reverse(long[] s, int l , int r) {  for(int i = l; i<=(l+r)/2; i++) {   long tmp = s[i];   s[i] = s[r+l-i];   s[r+l-i] = tmp;  }  }   public static void reverse(long[] s) {  reverse(s, 0, s.length-1);  }   public static void reverse(float[] s, int l , int r) {  for(int i = l; i<=(l+r)/2; i++) {   float tmp = s[i];   s[i] = s[r+l-i];   s[r+l-i] = tmp;  }  }   public static void reverse(float[] s) {  reverse(s, 0, s.length-1);  }   public static void reverse(double[] s, int l , int r) {  for(int i = l; i<=(l+r)/2; i++) {   double tmp = s[i];   s[i] = s[r+l-i];   s[r+l-i] = tmp;  }  }   public static void reverse(double[] s) {  reverse(s, 0, s.length-1);  }   public static void reverse(char[] s, int l , int r) {  for(int i = l; i<=(l+r)/2; i++) {   char tmp = s[i];   s[i] = s[r+l-i];   s[r+l-i] = tmp;  }  }   public static void reverse(char[] s) {  reverse(s, 0, s.length-1);  }   public static <T> void reverse(T[] s, int l , int r) {  for(int i = l; i<=(l+r)/2; i++) {   T tmp = s[i];   s[i] = s[r+l-i];   s[r+l-i] = tmp;  }  }   public static <T> void reverse(T[] s) {  reverse(s, 0, s.length-1);  }   public static void shuffle(int[] s) {   for (int i = 0; i < s.length; ++i) {    int j = random.nextInt(i + 1);    int t = s[i];    s[i] = s[j];    s[j] = t;   }  }    public static void shuffle(long[] s) {   for (int i = 0; i < s.length; ++i) {    int j = random.nextInt(i + 1);    long t = s[i];    s[i] = s[j];    s[j] = t;   }  }    public static void shuffle(float[] s) {   for (int i = 0; i < s.length; ++i) {    int j = random.nextInt(i + 1);    float t = s[i];    s[i] = s[j];    s[j] = t;   }  }    public static void shuffle(double[] s) {   for (int i = 0; i < s.length; ++i) {    int j = random.nextInt(i + 1);    double t = s[i];    s[i] = s[j];    s[j] = t;   }  }    public static void shuffle(char[] s) {   for (int i = 0; i < s.length; ++i) {    int j = random.nextInt(i + 1);    char t = s[i];    s[i] = s[j];    s[j] = t;   }  }    public static <T> void shuffle(T[] s) {   for (int i = 0; i < s.length; ++i) {    int j = random.nextInt(i + 1);    T t = s[i];    s[i] = s[j];    s[j] = t;   }  }    public static void sortArray(int[] a) {   shuffle(a);   Arrays.sort(a);  }   public static void sortArray(long[] a) {  shuffle(a);   Arrays.sort(a);  }   public static void sortArray(float[] a) {  shuffle(a);   Arrays.sort(a);  }   public static void sortArray(double[] a) {  shuffle(a);   Arrays.sort(a);  }   public static void sortArray(char[] a) {  shuffle(a);   Arrays.sort(a);  }   public static <T extends Comparable<T>> void sortArray(T[] a) {   Arrays.sort(a);  } } static class Writer { private PrintWriter pw; public Writer(){  pw = new PrintWriter(System.out); }  public Writer(String f){  try {  pw = new PrintWriter(new FileWriter(f));  } catch (IOException e) {  e.printStackTrace();  } }  public void printArray(int[] a) {  for(int i = 0; i<a.length; i++) print(a[i]+" "); }  public void printlnArray(int[] a) {  for(int i = 0; i<a.length; i++) print(a[i]+" ");  pw.println(); }  public void printArray(long[] a) {  for(int i = 0; i<a.length; i++) print(a[i]+" "); }  public void printlnArray(long[] a) {  for(int i = 0; i<a.length; i++) print(a[i]+" ");  pw.println(); }  public void print(Object o) {  pw.print(o.toString()); }  public void println(Object o) {  pw.println(o.toString()); }  public void println() {  pw.println(); }  public void flush() {  pw.flush(); } public void exit() {  pw.close(); } } }
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 + " ");  } } }
1	public class Main {  public static StreamTokenizer in;  public static PrintStream out;  public static BufferedReader br;  public static String readString() throws IOException {   in.nextToken();   return in.sval;   }  public static double readDouble() throws IOException {   in.nextToken();   return in.nval;   }  public static int readInt() throws IOException {   in.nextToken();   return (int) in.nval;  }   public static String readLine() throws IOException {  return br.readLine();  }   public static int genans(String ss) {    int n = ss.length();  char[] s = ss.toCharArray();  int res = 0;  while (true) {   int firstT = -1;   for (int i=0; i<n; i++)   if (s[i]=='T') { firstT = i; break; }     int lastH = -1;   for (int i=n-1; i>=0; i--)   if (s[i]=='H') { lastH=i; break; }     if (firstT<lastH) {   res++;   s[firstT] = 'H';   s[lastH] = 'T';   } else break;     }   return res;  }   public static void main(String[] args) throws IOException {   in = new StreamTokenizer(new InputStreamReader (System.in) );   br = new BufferedReader(new InputStreamReader(System.in));   out = new PrintStream(System.out);   readLine();   String s = readLine();   int n = s.length();   String kk = s;   int ans = n*100;   for (int tr=0; tr<n+2; tr++) {   String kk2 = "";   for (int i=1; i<n; i++) kk2 = kk2 +kk.charAt(i);   kk2 = kk2 + kk.charAt(0);   kk = kk2;     int cur = genans(kk);     if (cur<ans) ans = cur;   }     out.println(ans);  }   }
6	public class Main implements Runnable { private void solution() throws IOException {  int n = in.nextInt();  int m = in.nextInt();  boolean[][] adj = new boolean[n][n];  long res = 0;  for (int i = 0; i < m; ++i) {  int x = in.nextInt();  int y = in.nextInt();  adj[x - 1][y - 1] = true;  adj[y - 1][x - 1] = true;  }  for (int i = 0; i < n; ++i) {  for (int j = i + 1; j < n; ++j) {   if (adj[i][j]) {   --res;   }  }  }  long[][] dp = new long[1 << n][n];  for (int i = 0; i < n; ++i) {  for (int mask = 0; mask < (1 << (n - i)); ++mask) {   for (int j = 0; j < n - i; ++j) {   dp[mask][j] = 0;   }  }  dp[0][0] = 1;  for (int mask = 0; mask < (1 << (n - i)); ++mask) {   for (int j = 0; j < n - i; ++j) {   if (dp[mask][j] != 0) {    for (int k = 0; k < n - i; ++k) {    if (((mask >> k) & 1) == 0 && adj[j + i][k + i]) {     dp[mask | (1 << k)][k] += dp[mask][j];    }    }   }   }   if (((mask >> 0) & 1) != 0) {   res += dp[mask][0];   }  }  }  out.println(res / 2); }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  private class Scanner {  BufferedReader reader;  StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  public boolean hasNext() throws IOException {  while (!tokenizer.hasMoreTokens()) {   String next = reader.readLine();   if (next == null) {   return false;   }   tokenizer = new StringTokenizer(next);  }  return true;  }  public String next() throws IOException {  hasNext();  return tokenizer.nextToken();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
4	public class Answer23A{  public static void main(String[] args){ BufferedReader reader=new BufferedReader(new InputStreamReader(System.in)); new Kai(reader).solve();  } } class Kai{  BufferedReader reader;  public Kai(BufferedReader reader){ this.reader=reader;  }  public void solve(){  String s=read(); int max=0; for(int i=1;i<=s.length()-1;i++){  for(int j=0;j<=s.length()-i;j++){  String h=s.substring(j,j+i);  for(int k=j+1;k<=s.length()-i;k++){   if(h.equals(s.substring(k,k+i))){  max=i;   }  }  } } pln(max);    }   public String read(){ String s=null; try{  s=reader.readLine(); }catch(IOException e){  e.printStackTrace(); } return s;  }  public int[] to_i(String[] s){ int[] tmp=new int[s.length]; for(int i=0;i<s.length;i++){  tmp[i]=to_i(s[i]); } return tmp;  }  public long[] to_l(String[] s){ long[] tmp=new long[s.length]; for(int i=0;i<s.length;i++){  tmp[i]=to_l(s[i]); } return tmp;  }  public int to_i(String s){ return Integer.parseInt(s);  }  public long to_l(String s){ return Long.parseLong(s);  }  public void p(Object s){ System.out.print(s);  }  public void pln(Object s){ System.out.println(s);  }  public void debug(Object s){ System.err.print(s);  }  public void debugln(Object s){ System.err.println(s);  } }
0	public class Solution {  Scanner in = new Scanner(System.in);  void run() throws Exception {   int tests = in.nextInt();   while (tests > 0) {    --tests;    int a = in.nextInt();    int b = in.nextInt();    int res = 0;    while (a > 0 && b > 0) {     if (a >= b) {      res += a / b;      a %= b;     }     else {      res += b / a;      b %= a;     }    }    System.out.println(res);   }  }  public static void main(String args[]) throws Exception {   new Solution().run();  } }
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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    int[] a = in.readIntArray(n);    ArrayUtils.radixSort(a);    int answer = 0;    boolean[] used = new boolean[a.length];    for (int i = 0; i < a.length; ++i) {     if (used[i]) continue;     used[i] = true;     answer++;     for (int j = i + 1; j < a.length; ++j)      if (a[j] % a[i] == 0)       used[j] = true;    }    out.println(answer);   }  }  static class ArrayUtils {   public static void radixSort(int[] array) {    int[] ordered = new int[array.length];    {     int[] freq = new int[0xFFFF + 2];     for (int i = 0; i < array.length; ++i) freq[(array[i] & 0xFFFF) + 1]++;     for (int i = 1; i < freq.length; ++i) freq[i] += freq[i - 1];     for (int i = 0; i < array.length; ++i)      ordered[freq[array[i] & 0xFFFF]++] = array[i];     for (int i = 0; i < array.length; ++i)      array[i] = ordered[i];    }    {     int[] freq = new int[0xFFFF + 2];     for (int i = 0; i < array.length; ++i) freq[(array[i] >>> 16) + 1]++;     for (int i = 1; i < freq.length; ++i) freq[i] += freq[i - 1];     for (int i = 0; i < array.length; ++i)      ordered[freq[array[i] >>> 16]++] = array[i];     int indexOfFirstNegative = freq[0x7FFF];     int index = 0;     for (int i = indexOfFirstNegative; i < ordered.length; ++i, ++index)      array[index] = ordered[i];     for (int i = 0; i < indexOfFirstNegative; ++i, ++index)      array[index] = ordered[i];    }   }  }  static class OutputWriter extends PrintWriter {   public OutputWriter(OutputStream outputStream) {    super(outputStream);   }   public OutputWriter(Writer writer) {    super(writer);   }   public OutputWriter(String filename) throws FileNotFoundException {    super(filename);   }   public void close() {    super.close();   }  }  static class InputReader extends BufferedReader {   StringTokenizer tokenizer;   public InputReader(InputStream inputStream) {    super(new InputStreamReader(inputStream), 32768);   }   public InputReader(String filename) {    super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));   }   public String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(readLine());     } catch (IOException e) {      throw new RuntimeException();     }    }    return tokenizer.nextToken();   }   public Integer nextInt() {    return Integer.valueOf(next());   }   public int[] readIntArray(int size) {    int[] array = new int[size];    for (int i = 0; i < size; i++)     array[i] = nextInt();    return array;   }  } }
5	public class Main {  public static void main(String[]args){   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int t = sc.nextInt();   double [] left = new double[n];   double [] right = new double[n];   for (int i = 0; i<n; i++){    int x = sc.nextInt();    int a = sc.nextInt();    double l = x - (double)a/2;    double r = x + (double)a/2;    left[i] = l;    right[i] = r;   }   int answer = 2;   quickSort(left, right, 0, n-1);   for (int i = 0; i<n-1; i++){    if (left[i+1] - right[i] == t){     answer++;     }    if (left[i+1] - right[i] > t){     answer += 2;    }   }   System.out.println(answer);  }    int partition(double arr[], int left, int right)  {   int i = left, j = right;   double tmp;   double pivot = arr[(left + right) / 2];   while (i <= j) {     while (arr[i] < pivot)      i++;     while (arr[j] > pivot)      j--;     if (i <= j) {      tmp = arr[i];      arr[i] = arr[j];      arr[j] = tmp;      i++;      j--;     }   };   return i;  }  void quickSort(double arr[], int left, int right) {   int index = partition(arr, left, right);   if (left < index - 1)     quickSort(arr, left, index - 1);   if (index < right)     quickSort(arr,index, right);  }  static int partition(double arr[], double arr2[], int left, int right)  {   int i = left, j = right;   double tmp; double tmp2;   double pivot = arr[(left + right) / 2];    while (i <= j) {     while (arr[i] < pivot)      i++;     while (arr[j] > pivot)      j--;     if (i <= j) {      tmp = arr[i];      arr[i] = arr[j];      arr[j] = tmp;      tmp2 = arr2[i];      arr2[i] = arr2[j];      arr2[j] = tmp2;      i++;      j--;     }   };   return i;  }  static void quickSort(double arr[], double[]arr2, int left, int right) {   int index = partition(arr, arr2, left, right);   if (left < index - 1)     quickSort(arr, arr2, left, index - 1);   if (index < right)     quickSort(arr, arr2, index, right);  }  }
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;    }    public String toString() {     return from + " " + to + " " + 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 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();  }  int readInt(){   return Integer.parseInt(readString());  }  long readLong(){   return Long.parseLong(readString());  }  double readDouble(){   return Double.parseDouble(readString());  } }
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());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  } } }
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); } }
3	public class first {  public static void main(String[] args) {   Scanner s=new Scanner(System.in);  int n=s.nextInt();  int[] a=new int[n];  for (int i = 0; i < a.length; i++) {  a[i]=s.nextInt();  }  Arrays.sort(a);  int count=0;  for (int i = 0; i < a.length; i++) {  if(a[i]!=0) {   int x=a[i];   count++;   for (int j = i; j < a.length; j++) {   if(a[j]%x==0) {    a[j]=0;   }   }  }  }  System.out.println(count); } }
5	public class codeforces {  static int count =0;  static boolean f=false;  static int [] arr; static PrintWriter pw=new PrintWriter(System.out); static void solve(int index , int mask) {  if(index==arr.length) {  int sum1=0; int sum2=0;  for(int i=0;i<arr.length;i++) {   if((mask & 1<<i)!=0) sum1+=arr[i];     }  return;  }  solve(index+1, mask | 1<<index);  solve(index+1, mask); } public static void main(String [] args) throws IOException, InterruptedException {  Scanner sc=new Scanner(System.in);  int x=sc.nextInt();  int y=sc.nextInt();  pair [] arr=new pair[x];  for(int i=0;i<x;i++) arr[i]=new pair(i, sc.nextInt(),0);  for(int i=0;i<x;i++) arr[i].y=sc.nextInt();  Arrays.sort(arr);  PriorityQueue<Integer> qq=new PriorityQueue<>();   Long [] list=new Long [x];  long sum=0;  for(int i=0;i<x;i++) {  pair w=arr[i];  if(qq.size()<y) {   qq.add(w.y);   sum+=w.y;   list[w.i]=sum;   }else if(!qq.isEmpty()) {   sum+=w.y;   list[w.i]=sum;   int first=qq.poll();   if(w.y>first) {   sum-=first;   qq.add(w.y);   }else {   qq.add(first);   sum-=w.y;   }  } else list[w.i]=(long) w.y;    }  for(Long w:list) pw.print(w+" ");  pw.flush();  pw.close(); }   static class pair implements Comparable<pair>{  String name; int x,y,i ;  public pair(String name , int x) {  this.name=name; this.x=x;  }   public pair (int i,int x,int y) {  this.i=i; this.x=x; this.y=y;  }  public int compareTo(pair o) {  return x-o.x;  }  public int compareTo1(pair o) {  if(!name.equals(o.name))   return name.compareTo(o.name);  return x-o.x;  }  public String toString() {  return i+" "+x+" "+y;  } }  static class Scanner {  StringTokenizer st;  BufferedReader br;   public Scanner(InputStream system) {  br = new BufferedReader(new InputStreamReader(system));  }   public Scanner(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 String nextLine() throws IOException {  return br.readLine();  }   public int nextInt() throws IOException {  return Integer.parseInt(next());  }   public double nextDouble() throws IOException {  return Double.parseDouble(next());  }   public char nextChar() throws IOException {  return next().charAt(0);  }   public Long nextLong() throws IOException {  return Long.parseLong(next());  }   public boolean ready() throws IOException {  return br.ready();  }   public void waitForInput() throws InterruptedException {  Thread.sleep(3000);  } } }
4	public class PracticeProblem {   public static class FastReader  {   BufferedReader br;   StringTokenizer st;   public FastReader() throws FileNotFoundException   {    br = new BufferedReader(new FileReader(new File("input.txt")));   }   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());   }   String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  }  public static FastReader in;  public static PrintWriter out;  public static final int INF = Integer.MAX_VALUE;  public static int n, m;  public static final int[] dr = {-1, 0, 0, +1};  public static final int[] dc = {0, -1, +1, 0};  public static void main(String[] args) throws FileNotFoundException  {   in = new FastReader();   out = new PrintWriter(new File("output.txt"));   solve();   out.close();  }  private static void solve()  {   n = in.nextInt();   m = in.nextInt();   int k = in.nextInt();   int[][] timeToBurn = new int[n][m];   for (int i = 0; i < n; i++)    Arrays.fill(timeToBurn[i], INF);   for (int i = 0; i < k; i++)   {    int r = in.nextInt() - 1;    int c = in.nextInt() - 1;    for (int j = 0; j < n; j++)    {     for (int l = 0; l < m; l++)     {      timeToBurn[j][l] = min(timeToBurn[j][l], abs(r - j) + abs(c - l));     }    }   }   int max = -1;   Point p = null;   for (int i = 0; i < n; i++)   {    for (int j = 0; j < m; j++)    {     if (timeToBurn[i][j] > max)     {      max = timeToBurn[i][j];      p = new Point(i, j);     }    }   }   out.println((p.x + 1) + " " + (p.y + 1));  } }
4	public class Main {  static PrintWriter pw;  static _Scanner sc;  public static void main(String[] args) throws Exception {   sc = new _Scanner(System.in);   pw = new PrintWriter(System.out);        int t = 1;   while (t-- > 0) {    solve();   }   pw.flush();    }  private static void solve() throws Exception {   int n = sc.nextInt(), m = sc.nextInt(), k = sc.nextInt();   int[][] h = new int[n][m - 1];   int[][] v = new int[n - 1][m];   for (int i = 0; i < n; ++i) {    for (int j = 0; j < m - 1; ++j) {     h[i][j] = sc.nextInt();    }   }   for (int i = 0; i < n - 1; ++i) {    for (int j = 0; j < m; ++j) {     v[i][j] = sc.nextInt();    }   }   if (k % 2 == 1) {    for (int i = 0; i < n; ++i) {     for (int j = 0; j < m; ++j) {      if (j > 0) {       pw.print(" ");      }      pw.print(-1);     }     pw.println();    }    return;   }   k = k / 2;   long[][] d = new long[n][m];   for (int ki = 0; ki < k; ++ki) {    long[][] dk = new long[n][m];    for (int i = 0; i < n; ++i) {     for (int j = 0; j < m; ++j) {      long val = Integer.MAX_VALUE;      if (j < m - 1) {       val = Math.min(val, d[i][j + 1] + h[i][j]);      }      if (i < n - 1) {       val = Math.min(val, d[i + 1][j] + v[i][j]);      }      if (j > 0) {       val = Math.min(val, d[i][j - 1] + h[i][j - 1]);      }      if (i > 0) {       val = Math.min(val, d[i - 1][j] + v[i - 1][j]);      }      dk[i][j] = val;     }    }    d = dk;   }   for (int i = 0; i < n; ++i) {    for (int j = 0; j < m; ++j) {     if (j > 0) {      pw.print(" ");     }     pw.print(d[i][j] * 2);    }    pw.println();   }  }  static class Shuffle {   static void run(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 run(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;    }   }   static <T> void run(List<T> in) {    for (int i = 0; i < in.size(); i++) {     int idx = (int) (Math.random() * in.size());     T tmp = in.get(i);     in.set(i, in.get(idx));     in.set(idx, tmp);    }   }  }  static class _Scanner {   StringTokenizer st;   BufferedReader br;   _Scanner(InputStream system) {    br = new BufferedReader(new InputStreamReader(system));   }   _Scanner(String file) throws Exception {    br = new BufferedReader(new FileReader(file));   }   String nextToken() throws IOException {    while (st == null || !st.hasMoreTokens())     st = new StringTokenizer(br.readLine());    return st.nextToken();   }   int[] intArr(int n) throws IOException {    int[] in = new int[n];    for (int i = 0; i < n; i++) in[i] = nextInt();    return in;   }   long[] longArr(int n) throws IOException {    long[] in = new long[n];    for (int i = 0; i < n; i++) in[i] = nextLong();    return in;   }   int[] intArrSorted(int n) throws IOException {    int[] in = new int[n];    for (int i = 0; i < n; i++) in[i] = nextInt();    Shuffle.run(in);    Arrays.sort(in);    return in;   }   long[] longArrSorted(int n) throws IOException {    long[] in = new long[n];    for (int i = 0; i < n; i++) in[i] = nextLong();    Shuffle.run(in);    Arrays.sort(in);    return in;   }   Integer[] IntegerArr(int n) throws IOException {    Integer[] in = new Integer[n];    for (int i = 0; i < n; i++) in[i] = nextInt();    return in;   }   Long[] LongArr(int n) throws IOException {    Long[] in = new Long[n];    for (int i = 0; i < n; i++) in[i] = nextLong();    return in;   }   String nextLine() throws IOException {    return br.readLine();   }   int nextInt() throws IOException {    return Integer.parseInt(nextToken());   }   double nextDouble() throws IOException {    return Double.parseDouble(nextToken());   }   char nextChar() throws IOException {    return nextToken().charAt(0);   }   long nextLong() throws IOException {    return Long.parseLong(nextToken());   }   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;   LightScanner in = new LightScanner(inputStream);   LightWriter out = new LightWriter(outputStream);   APaintTheNumbers solver = new APaintTheNumbers();   solver.solve(1, in, out);   out.close();  }  static class APaintTheNumbers {   public void solve(int testNumber, LightScanner in, LightWriter out) {       int n = in.ints();    int[] a = in.ints(n);    IntroSort.sort(a);    boolean[] done = new boolean[n];    int ans = 0;    for (int i = 0; i < n; i++) {     if (done[i]) continue;     int d = a[i];     ans++;     for (int j = 0; j < n; j++) {      if (a[j] % d == 0) {       done[j] = true;      }     }    }    out.ans(ans).ln();   }  }  static class IntroSort {   private static int INSERTIONSORT_THRESHOLD = 16;   private IntroSort() {   }   static void sort(int[] a, int low, int high, int maxDepth) {    while (high - low > INSERTIONSORT_THRESHOLD) {     if (maxDepth-- == 0) {      HeapSort.sort(a, low, high);      return;     }     int cut = QuickSort.step(a, low, high);     sort(a, cut, high, maxDepth);     high = cut;    }    InsertionSort.sort(a, low, high);   }   public static void sort(int[] a) {    if (a.length <= INSERTIONSORT_THRESHOLD) {     InsertionSort.sort(a, 0, a.length);    } else {     sort(a, 0, a.length, 2 * BitMath.msb(a.length));    }   }  }  static final class ArrayUtil {   private ArrayUtil() {   }   public static void swap(int[] a, int x, int y) {    int t = a[x];    a[x] = a[y];    a[y] = t;   }  }  static class LightScanner {   private BufferedReader reader = null;   private StringTokenizer tokenizer = null;   public LightScanner(InputStream in) {    reader = new BufferedReader(new InputStreamReader(in));   }   public String string() {    if (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      throw new UncheckedIOException(e);     }    }    return tokenizer.nextToken();   }   public int ints() {    return Integer.parseInt(string());   }   public int[] ints(int length) {    return IntStream.range(0, length).map(x -> ints()).toArray();   }  }  static final class BitMath {   private BitMath() {   }   public static int count(int v) {    v = (v & 0x55555555) + ((v >> 1) & 0x55555555);    v = (v & 0x33333333) + ((v >> 2) & 0x33333333);    v = (v & 0x0f0f0f0f) + ((v >> 4) & 0x0f0f0f0f);    v = (v & 0x00ff00ff) + ((v >> 8) & 0x00ff00ff);    v = (v & 0x0000ffff) + ((v >> 16) & 0x0000ffff);    return v;   }   public static int msb(int v) {    if (v == 0) {     throw new IllegalArgumentException("Bit not found");    }    v |= (v >> 1);    v |= (v >> 2);    v |= (v >> 4);    v |= (v >> 8);    v |= (v >> 16);    return count(v) - 1;   }  }  static class HeapSort {   private HeapSort() {   }   private static void heapfy(int[] a, int low, int high, int i, int val) {    int child = 2 * i - low + 1;    while (child < high) {     if (child + 1 < high && a[child] < a[child + 1]) {      child++;     }     if (val >= a[child]) {      break;     }     a[i] = a[child];     i = child;     child = 2 * i - low + 1;    }    a[i] = val;   }   static void sort(int[] a, int low, int high) {    for (int p = (high + low) / 2 - 1; p >= low; p--) {     heapfy(a, low, high, p, a[p]);    }    while (high > low) {     high--;     int pval = a[high];     a[high] = a[low];     heapfy(a, low, high, low, pval);    }   }  }  static class LightWriter implements AutoCloseable {   private final Writer out;   private boolean autoflush = false;   private boolean breaked = true;   public LightWriter(Writer out) {    this.out = out;   }   public LightWriter(OutputStream out) {    this(new BufferedWriter(new OutputStreamWriter(out, Charset.defaultCharset())));   }   public LightWriter print(char c) {    try {     out.write(c);     breaked = false;    } catch (IOException ex) {     throw new UncheckedIOException(ex);    }    return this;   }   public LightWriter print(String s) {    try {     out.write(s, 0, s.length());     breaked = false;    } catch (IOException ex) {     throw new UncheckedIOException(ex);    }    return this;   }   public LightWriter ans(String s) {    if (!breaked) {     print(' ');    }    return print(s);   }   public LightWriter ans(int i) {    return ans(Integer.toString(i));   }   public LightWriter ln() {    print(System.lineSeparator());    breaked = true;    if (autoflush) {     try {      out.flush();     } catch (IOException ex) {      throw new UncheckedIOException(ex);     }    }    return this;   }   public void close() {    try {     out.close();    } catch (IOException ex) {     throw new UncheckedIOException(ex);    }   }  }  static class QuickSort {   private QuickSort() {   }   private static void med(int[] a, int low, int x, int y, int z) {    if (a[z] < a[x]) {     ArrayUtil.swap(a, low, x);    } else if (a[y] < a[z]) {     ArrayUtil.swap(a, low, y);    } else {     ArrayUtil.swap(a, low, z);    }   }   static int step(int[] a, int low, int high) {    int x = low + 1, y = low + (high - low) / 2, z = high - 1;    if (a[x] < a[y]) {     med(a, low, x, y, z);    } else {     med(a, low, y, x, z);    }    int lb = low + 1, ub = high;    while (true) {     while (a[lb] < a[low]) {      lb++;     }     ub--;     while (a[low] < a[ub]) {      ub--;     }     if (lb >= ub) {      return lb;     }     ArrayUtil.swap(a, lb, ub);     lb++;    }   }  }  static class InsertionSort {   private InsertionSort() {   }   static void sort(int[] a, int low, int high) {    for (int i = low; i < high; i++) {     for (int j = i; j > low && a[j - 1] > a[j]; j--) {      ArrayUtil.swap(a, j - 1, j);     }    }   }  } }
2	public class Tester {   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());   }    double nextDouble()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  }   static long mod = 1000000007;  public static void main(String[] args) {    solveQ3();   }  private static void solveQ3() {     FastReader sc = new FastReader();   long x = sc.nextLong();  long k = sc.nextLong();   if(x == 0) {  System.out.println(0);  return;  }  long ans = modExp(2, k);  x = (2*x)%mod;  x = (x - 1 + mod)%mod;  ans = (ans*x)%mod;  ans = (ans + 1)%mod;   System.out.println(ans);   }  private static long modExp(long a, long n) {   if(n == 0)  return 1;  if(n%2 == 0)  return modExp((a*a)%mod, n/2);  else  return (a*modExp((a*a)%mod, n/2))%mod;   }  private static void solveQ2() {     FastReader sc = new FastReader();  long l = sc.nextLong();  long r = sc.nextLong();   long x = sc.nextLong();  long y = sc.nextLong();   long n = x*y;  long count = 0;   for(long i=l; (i<=Math.sqrt(n)) && (n/i<=r); i++) {    if((n%i == 0) && (gcd(i, n/i)==x)) {     if(i*i != n)   count += 2;   else   count += 1;     }    }   System.out.println(count);    }  public static long gcd(long a, long b) {   if(b==0)  return a;  else  return gcd(b, a%b);   }  private static void solveQ1() {     FastReader sc = new FastReader();  int n = sc.nextInt();   HashSet<Integer> hs = new HashSet<Integer>();  for(int i=0; i<n; i++) {  int x = sc.nextInt();  if(x != 0) {   hs.add(x);  }  }   System.out.println(hs.size());     } }
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 {  final private 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 String nextLine() {  int c;  while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));  StringBuilder s = new StringBuilder();  while (c != -1)  {   if (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 int[] readIntArray(int n, int os) {  int[] ar = new int[n];  for(int i=0; i<n; ++i)   ar[i]=nextInt()+os;  return ar;  }  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;  }  public long[] readLongArray(int n, long os) {  long[] ar = new long[n];  for(int i=0; i<n; ++i)   ar[i]=nextLong()+os;  return ar;  }  public double nextDouble() {  double ret = 0, div = 1;  byte c = read();  while (c <= ' ')   c = read();  boolean neg = (c == '-');  if (neg)   c = read();  do   ret = ret * 10 + c - '0';  while ((c = read()) >= '0' && c <= '9');  if (c == '.')   while ((c = read()) >= '0' && c <= '9')   ret += (c - '0') / (div *= 10);  if (neg)   return -ret;  return ret;  }  private void fillBuffer() throws IOException {  bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);  if (bytesRead == -1)   buffer[0] = -1;  }  private byte read() {  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();  } } }
1	public class Contest25_A {   static int[] parity;   public static void main(String[] args) {   Scanner scan = new Scanner(System.in);     int numberEntries = scan.nextInt();   scan.nextLine();   String[] numbers = scan.nextLine().split(" ");   numbers = parity(numbers);   int evenOdd = evenOdd(parity);     for (int i = 0; i < parity.length; i++) {    if (parity[i] == evenOdd) {     System.out.println(i + 1);     System.exit(0);    }   }        }  public static int evenOdd(int[] parity) {     int numberOnes = 0;   int numberZeroes = 0;     int one = parity[0];   int two = parity[1];   int three = parity[2];     if (one == 1)    numberOnes++;   else    numberZeroes++;     if (two == 1)    numberOnes++;   else    numberZeroes++;     if (three == 1)    numberOnes++;   else    numberZeroes++;     if (numberOnes >= 2)    return 0;   else    return 1;    }  public static String[] parity(String[] numbers) {   parity = new int[numbers.length];   for (int i = 0; i < numbers.length; i++) {    parity[i] = Integer.parseInt(numbers[i]) % 2;    numbers[i] = Integer.toString(parity[i]);   }   return numbers;  }  }
1	public class Solution {  StreamTokenizer in;  PrintWriter out;  public static void main(String[] args) throws Exception {   new Solution().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;  }  String next() throws Exception {   in.nextToken();   return in.sval;  }  public void solve() throws Exception {   int n=nextInt();   String s=next();   String ss = s + s;   int t = 0;   for (int i = 0; i < n; i++) {    if (s.charAt(i) == 'T') {     t++;    }   }   if (t == 1 || t == n - 1) {    out.println(0);   } else {    int sum = 0;    for (int i = 0; i < t; i++) {     if (s.charAt(i) == 'T') {      sum++;     }    }       int max = sum;    for (int i = 0; i < s.length(); i++) {     if (ss.charAt(i) == 'T') {      if (ss.charAt(i + t) == 'H') {       sum--;      }     } else {      if (ss.charAt(i + t) == 'T') {       sum++;       max = Math.max(max, sum);      }     }    }    out.println(t - max);   }  } }
4	public class Main {   public static void main(String[] args) throws IOException{   Scanner scan = new Scanner("input.txt");  PrintWriter out = new PrintWriter(new FileWriter("output.txt"));   int n,m;  n = scan.nextInt();  m = scan.nextInt();  boolean visited[][] = new boolean[n][m];   int numOfStartingPoints;  numOfStartingPoints = scan.nextInt();     int resX = 0, resY = 0;   Queue<Point> que = new LinkedList<Point>();  for (int i = 0; i < numOfStartingPoints; i++) {  int x = scan.nextInt() - 1;  int y = scan.nextInt() - 1;  que.add(new Point(x, y));  visited[x][y] = true;  }   while (true) {  Point current = que.poll();   if (current == null) {   break;  } else {   resX = current.x;   resY = current.y;     if (current.x + 1 < n && !visited[current.x + 1][current.y])   {   que.add(new Point(current.x + 1, current.y));   visited[current.x + 1][current.y] = true;    }   if (current.y + 1 < m && !visited[current.x][current.y + 1])   {   que.add(new Point(current.x, current.y + 1));   visited[current.x][current.y + 1] = true;     }   if (current.x - 1 >= 0 && !visited[current.x - 1][current.y])   {   que.add(new Point(current.x - 1, current.y));   visited[current.x - 1][current.y] = true;     }   if (current.y - 1 >= 0 && !visited[current.x][current.y - 1])   {   que.add(new Point(current.x, current.y - 1));   visited[current.x][current.y - 1] = true;     }     }  }     out.printf("%d %d\n", ++resX, ++resY);  out.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(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 String nextLine() throws IOException {return br.readLine();}  public double nextDouble() throws IOException { return Double.parseDouble(next()); }  public boolean ready() throws IOException {return br.ready();}  } }
3	public class Colours {  public static void main(String args[] ) throws Exception {     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   String line = br.readLine();   int n = Integer.parseInt(line);   line = br.readLine();   String[] values = line.split(" ");   int[] arr = new int[n];   TreeSet<Integer> set = new TreeSet<>();   for (int i = 0; i < n; i++) {    arr[i] = Integer.parseInt(values[i]);    set.add(arr[i]);   }   int count=0;   TreeSet<Integer> copy = new TreeSet<>();        copy.addAll(set);   int prev = copy.size();     for(Integer i: set){       if(copy.size()==0){     break;    }    Iterator<Integer> iterator = copy.iterator();    while (iterator.hasNext()) {     Integer e = iterator.next();     if (e % i == 0) {      iterator.remove();     }    }    if(copy.size()!=prev){     count++;     prev = copy.size();    }          }      System.out.println(count);  } }
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 logWln(Object X){if (verb) System.err.print(X);} static void info(Object o){ System.out.println(o);} static void output(Object o){outputWln(""+o+"\n"); } static void outputWln(Object o){try {out.write(""+ o);} catch (Exception e) {}}  static long mod=1000000007;   static BufferedWriter out; static InputReader reader;  static class Composite implements Comparable<Composite>{  int idx;  int v;  public int compareTo(Composite X) {  if (v!=X.v)   return v-X.v;  return idx-X.idx;   }  public Composite(int idx, int v) {  this.idx = idx;  this.v = v;  }   }  static void test() {  log("testing");  log("done");  }  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 String readString() throws IOException {  int c = read();  while (isSpaceChar(c)) {   c = read();  }  StringBuilder res = new StringBuilder();  do {   res.append((char) c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  public final int readInt() throws IOException {  int c = read();  boolean neg = false;  while (isSpaceChar(c)) {   c = read();  }  char d = (char) c;    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;  } } }
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]);    i++;    base=base*10+9;   }   return res;  }      }
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));  }  boolean hasNext()  {  while (st == null || !st.hasMoreElements())  {   try   {    st = new StringTokenizer(br.readLine());   }   catch (Exception e)   {    return false;   }  }  return true;  }   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());  }   String nextLine()  {  String str = "";  try  {   str = br.readLine();  }  catch (IOException e)  {   e.printStackTrace();  }  return str;  } }
1	public class Iq {  static void metod() throws Exception {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[] m = new int[n];   for (int i = 0; i < n; i++)    m[i] = in.nextInt();   byte k = 0;   if (m[0] % 2 == 0) {    if (m[1] % 2 == 0) {     k = 0;    } else {     if (m[2] % 2 == 0) {      System.out.println(2);      return;     } else {      System.out.println(1);      return;     }    }   } else {    if (m[1] % 2 == 1) {     k = 1;    } else {     if (m[2] % 2 == 0) {      System.out.println(1);      return;     } else {      System.out.println(2);      return;     }    }   }   if (k == 0) {    for (int i = 0; i < m.length; i++) {     if (m[i] % 2 == 1) {      System.out.println(i + 1);      break;     }    }   } else {    for (int i = 0; i < m.length; i++) {     if (m[i] % 2 == 0) {      System.out.println(i + 1);      break;     }    }   }  }  public static void main(String args[]) throws Exception {   Iq.metod();  } }
0	public class A { public static void main(String[] args) throws Throwable{  BufferedReader in=new BufferedReader(new InputStreamReader(System.in));  String ln=in.readLine().trim();  System.out.println(max(parseInt(ln),max(parseInt(ln.substring(0,ln.length()-1)),parseInt(ln.substring(0, ln.length()-2)+ln.substring(ln.length()-1))))); } }
3	public class C {    int n; char[] a; long[][] memo; long mod = (long) 1e9 + 7;  boolean lastFor(int i) {  if(i == 0) return false;  return a[i - 1] == 'f'; }  long dp(int ind, int curIndent) {  if(ind == n) return 1;  if(curIndent < 0) return 0;  if(memo[ind][curIndent] != -1) return memo[ind][curIndent];  long ans = 0;  if(a[ind] == 'f' && lastFor(ind)) {  ans += dp(ind + 1, curIndent + 1);  } else if(a[ind] == 'f' && !lastFor(ind)) {  ans += dp(ind, curIndent - 1);  ans += dp(ind + 1, curIndent + 1);   } else if(a[ind] == 's' && lastFor(ind)) {  ans += dp(ind + 1, curIndent);  } else if(a[ind] == 's' && !lastFor(ind)) {  ans += dp(ind + 1, curIndent);  ans += dp(ind, curIndent - 1);   }  return memo[ind][curIndent] = ans % mod; }  public void solve(Scanner in, PrintWriter out) {  n = in.nextInt();  a = new char[n];  int forCount = 0;  int[] fc = new int[n + 1];  for(int i = 0; i < n; ++i) {  a[i] = in.next().charAt(0);  if(a[i] == 'f') ++forCount;  fc[i] = forCount;  }  fc[n] = fc[n - 1];  memo = new long[n][forCount + 1];  for(long[] aa : memo) {  Arrays.fill(aa, -1);  }  for(int i = n; i >= 0; --i) {  for(int indent = fc[i] - 1; indent >= 0; --indent) {   dp(i, indent);  }  }  out.println(dp(0, 0) % mod);  }  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  new C().solve(in, out);  in.close();  out.close(); } }
3	public class CF911D { 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());  StringTokenizer st = new StringTokenizer(br.readLine());  int[] aa = new int[n];  for (int i = 0; i < n; i++)  aa[i] = Integer.parseInt(st.nextToken());  boolean odd = false;  for (int i = 0; i < n; i++)  for (int j = i + 1; j < n; j++)   if (aa[i] > aa[j])   odd = !odd;  int m = Integer.parseInt(br.readLine());  while (m-- > 0) {  st = new StringTokenizer(br.readLine());  int l = Integer.parseInt(st.nextToken());  int r = Integer.parseInt(st.nextToken());  int k = r - l + 1;  if ((long) k * (k - 1) / 2 % 2 != 0)   odd = !odd;  pw.println(odd ? "odd" : "even");  }  pw.close(); } }
4	public class Solution35C {     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 FileReader("input.txt"));      out = new PrintWriter("output.txt");     }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());   }     double readDouble() throws IOException{     return Double.parseDouble(readString());   }     public static void main(String[] args){     new Solution35C().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);     }   }     static class Utils {      private Utils() {}      public static void mergeSort(int[] a) {       mergeSort(a, 0, a.length - 1);     }      private static void mergeSort(int[] a, int leftIndex, int rightIndex) {       final int MAGIC_VALUE = 50;       if (leftIndex < rightIndex) {         if (rightIndex - leftIndex <= MAGIC_VALUE) {           insertionSort(a, leftIndex, rightIndex);         } else {           int middleIndex = (leftIndex + rightIndex) / 2;           mergeSort(a, leftIndex, middleIndex);           mergeSort(a, middleIndex + 1, rightIndex);           merge(a, leftIndex, middleIndex, rightIndex);         }       }     }      private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {       int length1 = middleIndex - leftIndex + 1;       int length2 = rightIndex - middleIndex;       int[] leftArray = new int[length1];       int[] rightArray = new int[length2];       System.arraycopy(a, leftIndex, leftArray, 0, length1);       System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);       for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {         if (i == length1) {           a[k] = rightArray[j++];         } else if (j == length2) {           a[k] = leftArray[i++];         } else {           a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];         }       }     }      private static void insertionSort(int[] a, int leftIndex, int rightIndex) {       for (int i = leftIndex + 1; i <= rightIndex; i++) {         int current = a[i];         int j = i - 1;         while (j >= leftIndex && a[j] > current) {           a[j + 1] = a[j];           j--;         }         a[j + 1] = current;       }     }   }     void solve() throws IOException{   int n = readInt();   int m = readInt();   int k = readInt();   Point[] focuses = new Point[k];   for(int i = 0; i < k; i++){    int a = readInt() - 1;    int b = readInt() - 1;    focuses[i] = new Point(a,b);   }   int maxI = 0, maxJ = 0;   int max = 0;   for(int i = 0; i < n; i++)    for(int j = 0; j < m; j++){    int curMin = 1000000;    for(int r = 0; r < k; r++)     if(abs(focuses[r].x - i) + abs(focuses[r].y - j) < curMin){     curMin = abs(focuses[r].x - i) + abs(focuses[r].y - j);     if(curMin < max) break;     }    if(curMin > max){    max = curMin;    maxI = i;    maxJ = j;    }         }   maxI++;   maxJ++;   out.println(maxI + " " + maxJ);   }     static double distance(long x1, long y1, long x2, long y2){   return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));   }     static long gcd(long a, long b){   while(a != b){    if(a < b) a -=b;    else b -= a;   }   return a;   }     static long lcm(long a, long b){   return a * b /gcd(a, b);   } }
4	public class Solution {  static class Reader {  BufferedReader br;  StringTokenizer st;   public Reader() {  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[] nextArr(int n)  {   int a[]=new int[n];   for (int i=0;i<n;i++)a[i]=nextInt();   return a;  }   int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }   double nextDouble() {  return Double.parseDouble(next());  }   String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }  }  static class Ele implements Comparable<Ele>  {   public int x,y;   Ele(int x1,int y1)   {    x=x1;y=y1;   }   public int compareTo(Ele ob) {   if(ob.x!=x)return x-ob.x;   return this.y-ob.y;   }    public String toString()   {   return "["+x+","+y+"]";   }  } void disp(PrintWriter o,boolean b)  {   if (b) o.println("Yes");   else o.println("No");  }  void disp(PrintWriter o,int ...a)  {   o.println(Arrays.toString(a));  }  void disp(PrintWriter o,long ...a)  {   o.println(Arrays.toString(a));  }  void func(PrintWriter o,ArrayList<Integer> a)  {   for (int i=0;i<a.size();i++)   {    if (i!=a.size()-1)    o.print(a.get(i)+".");    else o.println(a.get(i));   }  }  int dp[][];  public static void main(String[] args) throws IOException  {  Reader sc=new Reader();Solution G=new Solution();  PrintWriter o = new PrintWriter(System.out);  int t=1;t=sc.nextInt();  int mod=(int)1e9+7;  int x,x0,x1,x2;int y,y0,y1,y2;int s,s0,s1,s2;  int n,m;int a[],b[],in[],in1[];  long k,l;boolean v[],b1,b2;String ss;char c1[];   ArrayList<ArrayList<Integer>> ll=new ArrayList<>();  ArrayList<Integer> a1=new ArrayList<>();  ArrayList<Integer> a2=new ArrayList<>();  PriorityQueue<Integer> pq1=new PriorityQueue<>();  PriorityQueue<Integer> pq2=new PriorityQueue<>(Collections.reverseOrder());  ArrayDeque<Integer> dq=new ArrayDeque<>();  TreeSet<Integer> h0=new TreeSet<>();  TreeSet<Integer> h1=new TreeSet<>();  TreeMap<Integer,Integer> h=new TreeMap<>();  try{  while (t-->0)  {   n=sc.nextInt();a=sc.nextArr(n);b=new int[(int)1e4];   a1.add(a[0]);b[1]=a[0];   for (int i=1;i<n;i++)   {    G.func(o,a1);    x=a1.get(a1.size()-1);    if (a[i]==1)    {     a1.add(a[i]);     b[a1.size()]=a[i];    }    else if (a[i]==x+1)    {     a1.remove(a1.size()-1);     a1.add(a[i]);     b[a1.size()]=a[i];    }    else    {     while (a1.get(a1.size()-1)!=a[i]-1)     a1.remove(a1.size()-1);     a1.remove(a1.size()-1);     a1.add(a[i]);    }   }   G.func(o,a1);                    h0.clear();ll.clear();a1.clear();a2.clear();h1.clear();h.clear();pq1.clear();pq2.clear();  }  }  catch (Throwable e)  {   e.printStackTrace();  }      o.flush();   o.close(); } }
4	public class Main implements Runnable {  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private SpaceCharFilter filter;   private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   public InputReader(InputStream stream) {    this.stream = stream;   }   public int read() {    if (numChars == -1)     throw new InputMismatchException();    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (numChars <= 0)      return -1;    }    return buf[curChar++];   }   public String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   public int nextInt() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public long nextLong() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public double nextDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, nextInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, nextInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }   public String readString() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   public boolean isSpaceChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public String next() {    return readString();   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  public static void main(String args[]) throws Exception {   new Thread(null, new Main(), "Main", 1 << 27).start();  }  static class Pair {   int f;   int s;   int p;   PrintWriter w;      Pair(int f, int s) {       this.f = f;    this.s = s;              }   public static Comparator<Pair> wc = new Comparator<Pair>() {    public int compare(Pair e1,Pair e2){        if(Math.abs(e1.f)-Math.abs(e2.f)!=0){        return -1*(Math.abs(e1.f)-Math.abs(e2.f));    }    else{        return(Math.abs(e1.s)-Math.abs(e2.s));    }   }};  }  public Integer[] sort(Integer[] a) {   Arrays.sort(a);   return a;  }  public Long[] sort(Long[] a) {   Arrays.sort(a);   return a;  }  public static ArrayList<Integer> sieve(int N) {   int i, j, flag;   ArrayList<Integer> p = new ArrayList<Integer>();   for (i = 1; i < N; i++) {    if (i == 1 || i == 0)     continue;    flag = 1;    for (j = 2; j <= i / 2; ++j) {     if (i % j == 0) {      flag = 0;      break;     }    }    if (flag == 1) {     p.add(i);    }   }   return p;  }  public static long gcd(long a, long b) {   if (b == 0)    return a;   else    return gcd(b, a % b);  }  public static int gcd(int a, int b) {   if (b == 0)    return a;   else    return gcd(b, a % b);  }    public static int dfs(int s, ArrayList<Integer>[] g, long[] dist, boolean[] v, PrintWriter w, int p) {   v[s] = true;   int ans = 1;     int t = g[s].size();     for (int i = 0; i < t; i++) {    int x = g[s].get(i);    if (!v[x]) {         ans = Math.min(ans, dfs(x, g, dist, v, w, s));    } else if (x != p) {         ans = 0;    }   }     return ans;  }    public static int bfs(int s, ArrayList<Integer>[] g, long[] dist, boolean[] b, PrintWriter w, int p) {   b[s] = true;   int siz = 1;     Queue<Integer> q = new LinkedList<>();   q.add(s);   while (q.size() != 0) {    int i = q.poll();    Iterator<Integer> it = g[i].listIterator();    int z = 0;    while (it.hasNext()) {     z = it.next();     if (!b[z]) {      b[z] = true;           dist[z] = dist[i] + 1;           q.add(z);     } else if (z != p) {      siz = 0;     }    }   }   return siz;  }  public static int lower(int a[], int x) {   int l = -1, r = a.length;   while (l + 1 < r) {    int m = (l + r) >>> 1;    if (a[m] >= x)     r = m;    else     l = m;   }   return r;  }  public static int upper(int a[], int x) {   int l = -1, r = a.length;   while (l + 1 < r) {    int m = (l + r) >>> 1;    if (a[m] <= x)     l = m;    else     r = m;   }   return l + 1;  }  public static int lower(ArrayList<Integer> a, int x) {   int l = -1, r = a.size();   while (l + 1 < r) {    int m = (l + r) >>> 1;    if (a.get(m) >= x)     r = m;    else     l = m;   }   return r;  }  public static int upper(ArrayList<Integer> a, int x) {   int l = -1, r = a.size();   while (l + 1 < r) {    int m = (l + r) >>> 1;    if (a.get(m) <= x)     l = m;    else     r = m;   }   return l + 1;  }  public static long power(long x, long y, long m) {   if (y == 0)    return 1;   long p = power(x, y / 2, m) % m;   p = (p * p) % m;   if (y % 2 == 0)    return p;   else    return (x * p) % m;  }  public void yesOrNo(boolean f){   if(f){    w.println("YES");   }   else{    w.println("NO");   }  }       int oo = (int) 1e9;  int[] parent;  int[] dist;  int[] height;  boolean[] vis;      char[][] g;        long[][][] dp;  long mod;  int n;  int m;  int k;  long[][] pre;      int[][] col;  int[][] row;  PrintWriter w = new PrintWriter(System.out);  public void run() {   InputReader sc = new InputReader(System.in);   int defaultValue = 0;   mod = 1000000007;   int test = 1;     while (test-- > 0) {    n = sc.nextInt();    m = sc.nextInt();    k = sc.nextInt();    col = new int[n][m-1];    row = new int[n-1][m];    dp = new long[n][m][21];    for(int i=0;i<n;i++){     for(int j=0;j<m;j++){      Arrays.fill(dp[i][j],oo);     }    }     for(int i=0;i<n;i++){     for(int j=0;j<m-1;j++){      col[i][j] = sc.nextInt();     }    }    for(int i=0;i<n-1;i++){     for(int j=0;j<m;j++){      row[i][j] = sc.nextInt();     }    }    if(k%2!=0){     for(int i=0;i<n;i++){      for(int j=0;j<m;j++){       w.print(-1+" ");      }      w.println("");     }    }    else{     for(int i=0;i<n;i++){      for(int j=0;j<m;j++){       long ans = sol(i,j,k/2);       w.print((ans*2)+" ");      }      w.println("");     }          }       }   w.flush();   w.close();  }  public long sol(int i, int j, int steps){   if(steps == 0)return 0;   else if(dp[i][j][steps]!=oo)return dp[i][j][steps];   else{    long ans = oo;    if(i-1>-1){     ans = Math.min(ans,sol(i-1,j,steps-1)+row[i-1][j]);    }    if(i+1<n){     ans = Math.min(ans,sol(i+1,j,steps-1)+row[i][j]);    }    if(j-1>-1){     ans = Math.min(ans,sol(i,j-1,steps-1)+col[i][j-1]);    }    if(j+1<m){     ans = Math.min(ans,sol(i,j+1,steps-1)+col[i][j]);    }    dp[i][j][steps] = Math.min(dp[i][j][steps],ans);    return dp[i][j][steps];   }  }    }
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 + " ");   }  } }
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; } }
0	public class ProblemA {  static final int INF = 100000000;  public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);   String[] nmd = in.readLine().split(" ");  long a = Long.valueOf(nmd[0]);  long b = Long.valueOf(nmd[1]);  long cnt = 0;  while (true) {  if (a == 0) {   break;  }  if (a >= b) {   cnt += a / b;   a = a % b;  } else {   if (b % a == 0) {   cnt += b / a - 1;   b = a;   } else {   cnt += b / a;   b = b % a;     }  }  }  out.println(cnt);  out.flush(); }   public static void debug(Object... o) {  System.err.println(Arrays.deepToString(o)); } }
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;  } }  static void shuffle(int[] arr) {  Random rng = new Random();  int length = arr.length;  for (int idx = 0; idx < arr.length; idx++) {  int toSwap = idx + rng.nextInt(length - idx);  int tmp = arr[idx];  arr[idx] = arr[toSwap];  arr[toSwap] = tmp;  } }  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());  }  String readNextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }  int[] readIntArray(int n) {  int[] a = new int[n];  for (int idx = 0; idx < n; idx++) {   a[idx] = nextInt();  }  return a;  }  long[] readLongArray(int n) {  long[] a = new long[n];  for (int idx = 0; idx < n; idx++) {   a[idx] = nextLong();  }  return a;  } } }
1	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();  } } class TaskB {  int val[];  int p[];  int aneigh[], bneight[], deg[];  public void solve(int testNumber, FastReader in, PrintWriter out)  {   int n = in.ni ();   val = new int[n];   int a = in.ni ();   int b = in.ni ();   Map<Integer, Integer> set = new TreeMap<Integer, Integer> ();   p = in.iArr (n);   for (int i = 0; i < n; i++)   {    set.put (p[i], i);   }   aneigh = new int[n];   bneight = new int[n];   deg = new int[n];   for (int i = 0; i < n; i++)   {    aneigh[i] = val[i] = bneight[i] = -1;    deg[i] = 0;   }   Queue<Integer> queue = new ArrayDeque<Integer> ();   for (int i = 0; i < n; i++)   {    Integer x1 = set.get (a - p[i]);    Integer x2 = set.get (b - p[i]);    if (x1 != null)    {     aneigh[i] = x1;     deg[i]++;    }    if (x2 != null && a != b)    {     bneight[i] = x2;     deg[i]++;    }    if (deg[i] == 1)    {     queue.add (i);    }   }   while (!queue.isEmpty ())   {    int idx = queue.remove ();    if (deg[idx] != 1)    {     continue;    }    int aa = aneigh[idx];    int bb = bneight[idx];    if (aa != -1)    {     val[idx] = val[aa] = 0;     deg[aa]--;     deg[idx]--;     aneigh[aa] = -1;     aneigh[idx] = -1;     if (deg[aa] == 1)     {      int zz = bneight[aa];      bneight[zz] = -1;      deg[zz]--;      if(deg[zz] == 1)      queue.add (zz);     }    }    else    {     val[idx] = val[bb] = 1;     deg[bb]--;     deg[idx]--;     bneight[idx] = bneight[bb] = -1;     if (deg[bb] == 1)     {           int zz = aneigh[bb];      aneigh[zz] = -1;      deg[zz]--;      if(deg[zz] == 1)       queue.add (zz);     }    }   }   for (int i = 0; i < n; i++)   {    if (val[i] == -1 && cantBePaired(i))    {     out.println ("NO");     return;    }   }      out.println ("YES");   for (int i = 0; i < n; i++)   {    out.print (val[i] + " ");   }   out.println ();  }  private boolean cantBePaired(int i)  {   int aa = aneigh[i];   int bb = bneight[i];   if (aa != -1 && val[aa] == -1)   {    return false;   }   if (bb != -1 && val[bb] == -1)   {    return false;   }   return true;  } } class FastReader {  public InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  private SpaceCharFilter filter;  public FastReader(InputStream stream)  {   this.stream = stream;  }  public FastReader()  {  }  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 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 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[] iArr(int n)  {   int a[] = new int[n];   for (int i = 0; i < n; i++)   {    a[i] = ni ();   }   return a;  }  public interface SpaceCharFilter  {   public boolean isSpaceChar(int ch);  } }
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);   }  } }
6	@SuppressWarnings("unused") public class Solution{  static long inf = (long)1e18+100; static final long mod = (long)1e9+7;  @SuppressWarnings("unchecked") 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) {     int n = fs.nextInt(), T = fs.nextInt();   int[] t = new int[n], g = new int[n];     for(int i=0;i<n;i++) {   t[i] = fs.nextInt(); g[i] = fs.nextInt();   }        long[][] dp = new long[1<<n][4];   dp[0][0] = 1;     long ans = 0;     for(int mask=0;mask<(1<<n);mask++) {   for(int pre=0;pre<=3;pre++) {    for(int i=0;i<n;i++)    if((mask&(1<<i))==0 && g[i]!=pre)     dp[mask^(1<<i)][g[i]] = add(dp[mask^(1<<i)][g[i]], dp[mask][pre]);    int sum = 0;    for(int i=0;i<n;i++) {    if((mask&(1<<i))!=0) sum += t[i];    }    if(sum==T) ans = add(ans, dp[mask][pre]);   }   }     out.println(ans);                 }    out.close();  }  static long add(long a, long b) {  a += b;  if(a>mod) return a - mod;  return a; }    static final Random random=new Random();   static <T> void shuffle(T[] arr) {  int n = arr.length;  for(int i=0;i<n;i++ ) {   int k = random.nextInt(n);   T temp = arr[k]; arr[k] = arr[i]; arr[i] = temp;  }  }     static void ruffleSort(int[] a) {  int n=a.length;  for (int i=0; i<n; i++) {   int oi=random.nextInt(n); int temp=a[oi];   a[oi]=a[i]; a[i]=temp;  }  Arrays.sort(a);  }   static void ruffleSort(long[] a) {  int n=a.length;  for (int i=0; i<n; i++) {   int oi=random.nextInt(n); long temp=a[oi];   a[oi]=a[i]; a[i]=temp;  }  Arrays.sort(a);  }      static void reverse(int[] arr, int l, int r) {  for(int i=l;i<l+(r-l)/2;i++){   int temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;  }  }   static void reverse(long[] arr, int l, int r) {  for(int i=l;i<l+(r-l)/2;i++){   long temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;  }  }     static <T> void reverse(T[] arr, int l, int r) {  for(int i=l;i<l+(r-l)/2;i++) {   T temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;  }  }      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 String nextLine() throws IOException {   return br.readLine();  }     public int nextInt(){   return Integer.parseInt(next());  }    public int[] readArray(int n){   int[] a = new int[n];   for(int i=0;i<n;i++)   a[i] = nextInt();   return a;  }     public long nextLong() {   return Long.parseLong(next());  }     public char nextChar() {   return next().toCharArray()[0];  }  }    }
6	public class D11 { static boolean[][] g; static int n, m; public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out); n = input.nextInt(); m = input.nextInt(); g = new boolean[n][n]; for(int i = 0; i<m; i++) {  int a = input.nextInt()-1, b = input.nextInt()-1;  g[a][b] = g[b][a] = true; } long res = 0; map = new HashMap<Integer, Long>(); for(int i = n-1; i>=0; i--) {  memo = new long[i+1][1<<(i+1)];  for(long[] A : memo) Arrays.fill(A, -1);  res += count(i, i, 1<<i)/2; } out.println(res); out.close(); } static long[][] memo; static HashMap<Integer, Long> map; static long count(int at, int start, int mask) { if(memo[at][mask] != -1) return memo[at][mask]; int bits = Integer.bitCount(mask); if(at == start && bits > 2) return 1; long res = 0; for(int i = 0; i<=start; i++) {  if(!g[at][i]) continue;  if(i != start && (mask & (1<<i)) > 0) continue;  if(i == start && bits <= 2) continue;  res += count(i, start, mask | (1<<i)); } return memo[at][mask] = res; } public static class input { static BufferedReader reader; static StringTokenizer tokenizer;  static void init(InputStream input) {  reader = new BufferedReader(new InputStreamReader(input));  tokenizer = new StringTokenizer(""); }  static String next() throws IOException {  while (!tokenizer.hasMoreTokens())  tokenizer = new StringTokenizer(reader.readLine());  return tokenizer.nextToken(); }  static int nextInt() throws IOException {  return Integer.parseInt(next()); }  static double nextDouble() throws IOException {  return Double.parseDouble(next()); }  static long nextLong() throws IOException {  return Long.parseLong(next()); } } }
3	public class lc1 implements Runnable{     public void run() {   InputReader s = new InputReader(System.in);  PrintWriter w = new PrintWriter(System.out);   int t = 1;   while(t-- > 0) {    int n = s.nextInt();    int[] a = new int[n + 1];    for(int i = 1; i <= n; i++)   a[i] = s.nextInt();    int curr = 0;    for(int i = 1; i <= n; i++)   for(int j = i + 1; j <= n; j++)   if(a[i] > a[j])    curr++;    curr = curr % 2;    int m = s.nextInt();    while(m-- > 0) {     int l = s.nextInt();   int r = s.nextInt();     int fact = (r - l) % 4;     if(fact == 1 || fact == 2)   curr = 1 - curr;     if(curr % 2 == 0)   w.println("even");   else   w.println("odd");  }  }   w.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);  } }   public static void main(String args[]) throws Exception {  new Thread(null, new lc1(),"lc1",1<<26).start(); } }
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 pair implements Comparable<pair>{    int i;    long dist;    public pair(int i,long dist)    {     this.i=i;     this.dist=dist;    }    public int compareTo(pair p)    {     return Long.compare(this.dist,p.dist);    }   }    class Node implements Comparable < Node > {    int i;    int cnt;     Node(int i, int cnt) {     this.i = i;     this.cnt = cnt;    }     public int compareTo(Node n) {     if (this.cnt == n.cnt) {      return Integer.compare(this.i, n.i);     }     return Integer.compare(this.cnt, n.cnt);    }   }    public boolean done(int[] sp, int[] par) {    int root;     root = findSet(sp[0], par);     for (int i = 1; i < sp.length; i++) {     if (root != findSet(sp[i], par))      return false;    }    return true;   }   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 void unionSet(int i, int j, int[] par) {    int x = findSet(i, par);    int y = findSet(j, par);    if (x < y) {     par[y] = x;    } else {     par[x] = y;    }   }    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 boolean isPrime(int n)   {    for(int i=2;i<n;i++)    {     if(n%i==0)     {      return false;     }    }    return true;   }     public void minPrimeFactor(int n, int[] s) {    boolean prime[] = new boolean[n + 1];    Arrays.fill(prime, true);    s[1] = 1;    s[2] = 2;    for (int i = 4; i <= n; i += 2) {     prime[i] = false;     s[i] = 2;    }     for (int i = 3; i <= n; i += 2) {     if (prime[i]) {      s[i] = i;      for (int j = 2 * i; j <= n; j += i) {       prime[j] = false;       s[j] = i;      }     }    }    }     public void findAllPrime(int n, ArrayList < Node > al, int s[]) {    int curr = s[n];    int cnt = 1;    while (n > 1) {     n /= s[n];     if (curr == s[n]) {      cnt++;      continue;      }     Node n1 = new Node(curr, cnt);     al.add(n1);      curr = s[n];     cnt = 1;    }   }      public int binarySearch(int n, int k) {    int left = 1;    int right = 100000000 + 5;    int ans = 0;    while (left <= right) {     int mid = (left + right) / 2;     if (n / mid >= k) {      left = mid + 1;      ans = mid;     } else {      right = mid - 1;     }    }     return ans;   }   public boolean checkPallindrom(String s) {    char ch[] = s.toCharArray();     for (int i = 0; i < s.length() / 2; i++) {     if (ch[i] != ch[s.length() - 1 - i])      return false;    }    return true;   }       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 void printDivisors(long n, ArrayList < Long > al) {       for (long i = 1; i <= Math.sqrt(n); i++) {     if (n % i == 0) {           if (n / i == i) {       al.add(i);      } else      {       al.add(i);       al.add(n / i);      }      }    }   }    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];   }    public void dfs(ArrayList[] al, int[] s, int[] lvl) {     boolean vis[] = new boolean[al.length];    for (int i = 0; i < al.length; i++) {     if (!vis[i]) {      lvl[i] = 1;      dfs_util(al, vis, i, s, lvl);     }    }   }    public int[] computeLps(String s)   {    int ans[] =new int[s.length()];    char ch[] = s.toCharArray();    int n = s.length();    int i=1;    int len=0;    ans[0]=0;    while(i<n)    {     if(ch[i]==ch[len])     {      len++;      ans[i]=len;      i++;     }     else     {      if(len!=0)      {       len=ans[len-1];      }      else      {       ans[i]=len;       i++;      }     }    }    return ans;   }     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());   }  } } class ele implements Comparable < ele > {  int value;  int i;  boolean flag;  public ele(int value, int i) {   this.value = value;   this.i = i;   this.flag = false;  }  public int compareTo(ele e) {   return Integer.compare(this.value, e.value);  } }
5	public class A { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni(), m = ni(), K = ni();  int[] a = na(n);  a = radixSort(a);   if(K >= m){  out.println(0);  return;  }  int p = 1;  for(int i = n-1;i >= 0;i--){  K += a[i]-1;  if(K >= m){   out.println(p);   return;  }  p++;  }  out.println(-1); }  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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
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  {   final private 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 char nextChar() throws Exception   {    byte c=read();    while(c<=' ') c= read();    return (char)c;   }   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++];   }  }
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();   }   String nextLine() {    if (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      return reader.readLine();     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken("\n");   }   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;   }   long[] nextLongArray(int n) {    long[] a = new long[n];    for (int i = 0; i < n; i++)     a[i] = nextLong();    return a;   }  }  static <A> void writeLines(A[] as, Function<A, String> f) {   PrintWriter pw = new PrintWriter(System.out);   for (A a : as) {    pw.println(f.apply(a));   }   pw.flush();  }  static void writeLines(int[] as) {   PrintWriter pw = new PrintWriter(System.out);   for (int a : as) pw.println(a);   pw.flush();  }  static void writeLines(long[] as) {   PrintWriter pw = new PrintWriter(System.out);   for (long a : as) pw.println(a);   pw.flush();  }  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;  }  static void debug(Object... args) {   StringJoiner j = new StringJoiner(" ");   for (Object arg : args) {    if (arg instanceof int[]) j.add(Arrays.toString((int[]) arg));    else if (arg instanceof long[]) j.add(Arrays.toString((long[]) arg));    else if (arg instanceof double[]) j.add(Arrays.toString((double[]) arg));    else if (arg instanceof Object[]) j.add(Arrays.toString((Object[]) arg));    else j.add(arg.toString());   }   System.err.println(j.toString());  } }
3	public class A01Easy { private static interface Matrix {  boolean get(int i, int j);  int size(); }  private static class MData implements Matrix {  private final boolean[][] m;  MData(boolean[][] m) {  this.m = m;  }  @Override  public boolean get(int i, int j) {  return m[i][j];  }  @Override  public int size() {  return m.length;  } }  private static abstract class MDecorator implements Matrix {  protected final Matrix inner;  MDecorator(Matrix inner) {  this.inner = inner;  }  @Override  public int size() {  return inner.size();  } }  private static class MHFlip extends MDecorator {  MHFlip(Matrix inner) {  super(inner);  }  @Override  public boolean get(int i, int j) {  return inner.get(size() - 1 - i, j);  } }  private static class MVFlip extends MDecorator {  MVFlip(Matrix inner) {  super(inner);  }  @Override  public boolean get(int i, int j) {  return inner.get(i, size() - 1 - j);  } }  private static class MRot extends MDecorator {  MRot(Matrix inner) {  super(inner);  }  @Override  public boolean get(int i, int j) {  return inner.get(j, size() - 1 - i);  } }  public static void main(String[] args) {  try (BufferedReader r = new BufferedReader(new InputStreamReader(System.in))) {  final int N = Integer.parseInt(r.readLine());  Matrix m1 = readMatrix(r, N), m2 = readMatrix(r, N);  boolean matched = matchesFlipped(m1, m2);  int i = 0;  while (i < 3 && !matched) {   m1 = new MRot(m1);   matched = matchesFlipped(m1, m2);   i++;  }  System.out.println(matched ? "Yes" : "No");  }  catch (IOException e) {  e.printStackTrace();  } }  private static Matrix readMatrix(BufferedReader r, int n) throws IOException {  boolean[][] m = new boolean[n][n];  for (int i = 0; i < n; i++) {  String line = r.readLine();  for (int j = 0; j < n; j++) {   m[i][j] = line.charAt(j) == 'X';  }  }  return new MData(m); }  private static boolean matches(Matrix m1, Matrix m2) {  int i = 0, j = 0, n = m1.size();  while (i < n && m1.get(i, j) == m2.get(i, j)) {  j++;  if (j == n) {   j = 0;   i++;  }  }  return i == n; }  private static boolean matchesFlipped(Matrix m1, Matrix m2) {  return matches(m1, m2) || matches(new MHFlip(m1), m2) || matches(new MVFlip(m1), m2); } }
2	public class A { private static 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(); } }
1	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(); } } class TaskB { public void solve(int testNumber, FastScanner in, PrintWriter out) {  int n = in.nextInt();  int a = in.nextInt();  int b = in.nextInt();  List<Clause> clauses = new ArrayList<Clause>();  int[] p = new int[n];  Map<Integer, Integer> id = new HashMap<>();  for (int i = 0; i < n; i++) {  p[i] = in.nextInt();  id.put(p[i], i);  }   for (int i = 0; i < n; i++) {  int x = p[i];  Integer j = id.get(a - x);  if (j == null) {     clauses.add(new Clause(i, i, true, false));  } else {   clauses.add(new Clause(i, j, true, true));   clauses.add(new Clause(j, i, false, false));  }   j = id.get(b - x);  if (j == null) {     clauses.add(new Clause(i, i, false, true));  } else {   clauses.add(new Clause(i, j, false, false));   clauses.add(new Clause(j, i, true, true));  }  }  SAT2Solver solver = new SAT2Solver(n);  if (!solver.solve(clauses)) {  out.println("NO");  return;  }  out.println("YES");  for (int i = 0; i < n; i++) {  if (i > 0) {   out.print(" ");  }  if (solver.isTrue[i]) {   out.print(0);  } else {   out.print(1);  }  }  out.println(); }  class Clause {  int v1, v2;  boolean neg1, neg2;    Clause(int v1, int v2, boolean pos1, boolean pos2) {  this.v1 = v1;  this.v2 = v2;  this.neg1 = !pos1;  this.neg2 = !pos2;  } }  class SAT2Solver {  List<Integer>[] g;  boolean[] isTrue;  int n;  int numComps;  int[] low;  int[] vis;  int[] comp;  boolean[] onStack;  int[] stack;  int sp;  int globalTime;  SAT2Solver(int n) {  this.n = n;  isTrue = new boolean[2 * n];  vis = new int[2 * n];  low = new int[2 * n];  stack = new int[2 * n];  comp = new int[2 * n];  onStack = new boolean[2 * n];  g = new List[2 * n];  }  public boolean solve(List<Clause> clauses) {  for (int i = 0; i < 2 * n; i++) {   g[i] = new ArrayList<Integer>();  }  for (Clause clause : clauses) {   int v1 = clause.v1;   int v2 = clause.v2;   boolean neg1 = clause.neg1;   boolean neg2 = clause.neg2;   if (neg1) {   v1 = negate(v1);   }   if (neg2) {   v2 = negate(v2);   }        g[v1].add(v2);  }  Arrays.fill(vis, -1);  Arrays.fill(onStack, false);  sp = 0;  globalTime = 0;  numComps = 0;  for (int i = 0; i < 2 * n; i++) {   if (vis[i] < 0) {   dfsTarjan(i);   }  }  int[] firstInComp = new int[numComps];  Arrays.fill(firstInComp, -1);  int[] nextSameComp = new int[2 * n];  for (int i = 0; i < 2 * n; i++) {   int c = comp[i];   nextSameComp[i] = firstInComp[c];   firstInComp[c] = i;  }  List<Integer>[] invertedCompEdges = new List[numComps];  for (int i = 0; i < numComps; i++) {   invertedCompEdges[i] = new ArrayList<Integer>();  }  for (int i = 0; i < 2*n; i++) {   for (int j : g[i]) {   invertedCompEdges[comp[j]].add(comp[i]);   }  }  boolean[] compIsTrue = new boolean[numComps];  Arrays.fill(compIsTrue, true);  for (int c = 0; c < numComps; c++) {   if (!compIsTrue[c]) {   continue;   }   for (int i = firstInComp[c]; i >= 0; i = nextSameComp[i]) {   int nc = comp[negate(i)];   if (c == nc) {    return false;   }   }   for (int i = firstInComp[c]; i >= 0; i = nextSameComp[i]) {   int nc = comp[negate(i)];   dfsReject(nc, invertedCompEdges, compIsTrue);   }  }  for (int i = 0; i < 2 * n; i++) {   isTrue[i] = compIsTrue[comp[i]];  }  for (int i = 0; i < n; i++) {   if (isTrue[i] && isTrue[negate(i)]) {   throw new AssertionError();   }   if (!isTrue[i] && !isTrue[negate(i)]) {   return false;   }  }  return true;  }  private int negate(int i) {  return i + (i < n ? n : -n);  }  private void dfsReject(int c, List<Integer>[] invertedCompEdges, boolean[] compIsTrue) {  if (!compIsTrue[c]) {   return;  }  compIsTrue[c] = false;  for (int p : invertedCompEdges[c]) {   dfsReject(p, invertedCompEdges, compIsTrue);  }  }  void dfsTarjan(int v) {  vis[v] = globalTime;  low[v] = globalTime;  ++globalTime;  stack[sp++] = v;  onStack[v] = true;  for (int u : g[v]) {   if (vis[u] < 0) {   dfsTarjan(u);   if (low[v] > low[u]) {    low[v] = low[u];   }   } else if (onStack[u] && low[v] > vis[u]) {   low[v] = vis[u];   }  }  if (low[v] == vis[v]) {   while (true) {   int u = stack[--sp];   onStack[u] = false;   comp[u] = numComps;   if (u == v) {    break;   }   }   ++numComps;  }  }  }  } 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 Main {  public static void main(String[] args) {   new Thread(null, new Runnable() {    public void run() {     new Main().solve();    }   }, "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(dp[i & 1], 0);     for (int k = 0; k < n; k++) {      System.arraycopy(dp[(i - 1) & 1], 0, cur, 0, 1 << n);      for (int l = 0; l < n; l++) {       for (int j = 0; j < 1 << n; j++) {        if ((j & (1 << l)) == 0) {         cur[j ^ (1 << l)] = Math.max(cur[j ^ (1 << l)], cur[j] + ar[(k + l) % n][max[i][1]]);        }       }      }      for (int j = 0; j < 1 << n; j++) dp[i & 1][j] = Math.max(dp[i & 1][j], cur[j]);     }    }    out.println(dp[Math.min(n, m) & 1 ^ 1][(1 << n) - 1]);   }  }  static class CodeHash {   public static void shuffle(int[][] ar) {    Random rd = new Random(new Random().nextInt());    for (int i = 0; i < ar.length; i++) {     int index = rd.nextInt(ar.length);     int[] temp = ar[i];     ar[i] = ar[index];     ar[index] = temp;    }   }  }  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;   }  } }
5	public class A { public static void main(String args[]){  Scanner in = new Scanner(System.in); int n=in.nextInt(),s=0; int[] a= new int[n]; for (int i=0;i<n;i++) {a[i]=in.nextInt(); s+=a[i];} Arrays.sort(a); int k=0,ans=0; for (int i=n-1;i>=0;i--)  if (k<=s/2) {k+=a[i];ans++;} System.out.println(ans);     }  }
1	public class Main{  private static 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);  }  private static void out(int a, int b) {   cout(a);   cout(" ");   cout(b);  }  private static void cout(Object a) {   System.out.print(a);  } }
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;   }  } }
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 goodLeft(int n, int[] p) {   int begin = 0;   for (int i=0;i<n;i++) {    if (n-i==p[n-i-1]) {     begin++;    } else {     break;    }   }   return begin;  }  public static int goodRight(int n, int[] p) {   int end = 0;   for (int i=n-1;i>=0;i--) {    if (i==p[i]) {     end++;    } else {     break;    }   }   return end;  }  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);   }  } }
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);  } }
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));  } }
1	public class C { Scanner in; PrintWriter out; String INPUT = "";  void solve() {  int n = ni();  char[] x = in.next().toCharArray();  int t = 0;  for(int i = 0;i < n;i++){  if(x[i] == 'T'){   t++;  }  }   int min = 9999;  for(int i = 0;i < n;i++){  int y = 0;  for(int j = i;j < i + t;j++){   if(x[j % n] == 'T'){   y++;   }  }  min = Math.min(min, t - y);  }  out.println(min); }  void run() throws Exception {  in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);  out = new PrintWriter(System.out);  solve();  out.flush(); }   public static void main(String[] args) throws Exception {  new C().run(); }  int ni() { return Integer.parseInt(in.next()); } void tr(Object... o) { if(INPUT.length() != 0)System.out.println(o.length > 1 || o[0].getClass().isArray() ? Arrays.deepToString(o) : o[0]); } }
1	public class B {   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());  st = new StringTokenizer(br.readLine());  int[] a = new int[n];  for(int i = 0 ; i <n;i++)  a[i] = Integer.parseInt(st.nextToken());   int l = 0, r = 0;  int[] t = new int[100001];  int kk = 0;  int min = 1 << 25 , ll =-1 , rr = -1;  while(r < n)  {  int x = a[r++];  t[x]++;  if(t[x] == 1)   kk++;  while(r < n && kk < k)  {   x = a[r++];   t[x]++;   if(t[x] == 1)   kk++;  }  while(kk == k && l < r)  {   x = a[l];   if(t[x] == 1)   break;   t[x]--;   l++;  }  if(kk == k)  {   int m = r-l+1;   if(m < min)   {   ll = l+1;   rr = r;   min = m;   }  }  }  System.out.println(ll +" "+rr); } }
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 logWln(Object X){if (verb) System.err.print(X);} static void info(Object o){ System.out.println(o);} static void output(Object o){outputWln(""+o+"\n"); } static void outputWln(Object o){try {out.write(""+ o);} catch (Exception e) {}}  static long mod=1000000007;   static BufferedWriter out; static InputReader reader;  static class Composite implements Comparable<Composite>{  int idx;  int v;  public int compareTo(Composite X) {  if (v!=X.v)   return v-X.v;  return idx-X.idx;   }  public Composite(int idx, int v) {  this.idx = idx;  this.v = v;  }   }  static void test() {  log("testing");  log("done");  }  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 String readString() throws IOException {  int c = read();  while (isSpaceChar(c)) {   c = read();  }  StringBuilder res = new StringBuilder();  do {   res.append((char) c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  public final int readInt() throws IOException {  int c = read();  boolean neg = false;  while (isSpaceChar(c)) {   c = read();  }  char d = (char) c;    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;  } } }
3	public class paintTheNumbers {  public static void main (String [] args){   Scanner scanner = new Scanner(System.in);   int n = scanner.nextInt();   int [] arr = new int[n];   for(int i = 0; i < n; i++){    arr[i] = scanner.nextInt();   }   System.out.print(paint(arr));  }  public static int paint(int [] arr){   Arrays.sort(arr);   HashSet<Integer> set = new HashSet<>();   int num = arr[0];   set.add(num);   for(int i = 1; i < arr.length; i++){    if(!divBySet(set, arr[i])){     set.add(arr[i]);    }   }   return set.size();  }    public static boolean divBySet(HashSet<Integer> set, int a){   for(int s: set){    if(a % s == 0){     return true;    }   }   return false;  } }
3	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));   int n=Integer.parseInt(f.readLine());   StringTokenizer st=new StringTokenizer(f.readLine());   int[]arr=new int[n];   for(int i=0;i<n;i++){    arr[i]=Integer.parseInt(st.nextToken());   }   Arrays.sort(arr);   int ans=0;   boolean[]used=new boolean[n];   for(int i=0;i<n;i++){    if(!used[i]){     ans++;     for(int j=i+1;j<n;j++){      if(!used[j] && arr[j]%arr[i]==0){       used[j]=true;      }     }     used[i]=true;    }   }   System.out.print(ans);   f.close();   out.close();  } } class pair implements Comparable <pair>{  int num;  int idx;  public int compareTo(pair other){   return num- other.num;  }   pair(int a, int b)  {   num=a;   idx=b;  } }
0	public class p343A {  static long n = 0;  static void resistance(long a, long b)  {   n += a/b;   a %= b;   if(a!=0) resistance(b, a);  }  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   long a = in.nextLong();   long b = in.nextLong();   resistance(a, b);   System.out.println(n);  } }
0	public class Division {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int l = sc.nextInt();  String c = String.valueOf(l);  if (String.valueOf(c).contains("0") || String.valueOf(c).contains("1")   || String.valueOf(c).contains("2")   || String.valueOf(c).contains("3")   || String.valueOf(c).contains("5")   || String.valueOf(c).contains("6")   || String.valueOf(c).contains("8")   || String.valueOf(c).contains("9"))  if (l % 777 == 0 || l % 774 == 0 || l % 747 == 0 || l % 744 == 0   || l % 477 == 0 || l % 474 == 0 || l % 447 == 0   || l % 444 == 0 || l % 77 == 0 || l % 74 == 0   || l % 47 == 0 || l % 44 == 0 || l % 7 == 0 || l % 4 == 0)   System.out.println("YES");  else   System.out.println("NO");  else  System.out.println("YES"); } }
3	public class Main {  public static void main(String[] args) throws IOException {  int n = in.nextInt();  int[] a = in.nextIntArray(n);  sort(a);  int ans = 0;  boolean[] done = new boolean[n];  for(int i = 0; i < n; i ++) {  if(done[i])   continue;  ans ++;  for(int j = i + 1; j < n; j ++)   if(a[j] % a[i] == 0)   done[j] = true;  }  out.write(ans + "\n");  out.flush(); }  public static FastReader in = new FastReader(); public static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));  public static void gcj(int cn, Object ans) throws IOException {  System.out.print("Case #" + cn + ": " + ans + "\n"); }  public static ArrayList <Integer>[] ALArrayI(int size) {  ArrayList <Integer>[] l = new ArrayList[size];  for(int i = 0; i < size; i ++)  l[i] = new ArrayList <> ();  return l; }  public static ArrayList <Long>[] ALArrayL(int size) {  ArrayList <Long>[] l = new ArrayList[size];  for(int i = 0; i < size; i ++)  l[i] = new ArrayList <> ();  return l; }  public static Integer[] integerList(int fi, int fo) {  Integer[] l = new Integer[fo - fi];  for(int i = 0; i < fo - fi; i ++)  l[i] = fi + i;  return l; } }  class Graph { TreeSet <Integer>[] g;  public Graph(int n) {  g = new TreeSet[n];  for(int i = 0; i < n; i ++)  g[i] = new TreeSet <> (); }  public void addEdge(int u, int v) {  g[u].add(v); }  public TreeSet <Integer> getAdj(int u) {  return g[u]; }  public int nodes() {  return g.length; } }  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 char nextChar() {  return next().charAt(0);  }   public int nextInt() {   return Integer.parseInt(next());  }   public long nextLong() {   return Long.parseLong(next());  }   public double nextDouble() {   return Double.parseDouble(next());  }   public String nextLine() {   String str = "";   try {    str = br.readLine();   } catch (IOException e) {    e.printStackTrace();   }   return str;  }   public int[] nextIntArray(int n) {  int[] a = new int[n];  for(int i = 0; i < n; i ++)   a[i] = nextInt();  return a;  }   public Integer[] nextIntegerArray(int n) {  Integer[] a = new Integer[n];  for(int i = 0; i < n; i ++)   a[i] = nextInt();  return a;  }   public long[] nextLongArray(int n) {  long[] a = new long[n];  for(int i = 0; i < n; i ++)   a[i] = nextLong();  return a;  }   public double[] nextDoubleArray(int n) {  double[] a = new double[n];  for(int i = 0; i < n; i ++)   a[i] = nextDouble();  return a;  }   public String[] nextStringArray(int n) {  String[] a = new String[n];  for(int i = 0; i < n; i ++)   a[i] = next();  return a;  } }
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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(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;   }  } }
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(); } public static class input { static BufferedReader reader; static StringTokenizer tokenizer;  static void init(InputStream input) {  reader = new BufferedReader(new InputStreamReader(input));  tokenizer = new StringTokenizer(""); }  static String next() throws IOException {  while (!tokenizer.hasMoreTokens())  tokenizer = new StringTokenizer(reader.readLine());  return tokenizer.nextToken(); }  static int nextInt() throws IOException {  return Integer.parseInt(next()); }  static double nextDouble() throws IOException {  return Double.parseDouble(next()); }  static long nextLong() throws IOException {  return Long.parseLong(next()); } } }
4	public class D { public static int dir[][]={{-1,0},{1,0},{0,-1},{0,1}}; public static void main(String[] args) {  FastScanner sc = new FastScanner();  FastOutput out = new FastOutput(System.out);  int n=sc.nextInt();  int m=sc.nextInt();  int k=sc.nextInt();  int ans[][][]=new int[n][m][11];  int arr[][]=new int[n*m][4];  for(int i=0;i<n;i++){  for(int j=0;j<m-1;j++){   int x=sc.nextInt();   arr[i*m+j][3]=x;   arr[i*m+j+1][2]=x;  }  }  for(int i=0;i<n-1;i++){  for(int j=0;j<m;j++){   int x=sc.nextInt();   arr[i*m+j][1]=x;   arr[(i+1)*m+j][0]=x;  }  }  if(k%2==1){  for(int i=0;i<n;i++){   StringBuilder sb=new StringBuilder("");   for(int j=0;j<m;j++){   ans[i][j][10]=-1;   sb.append(ans[i][j][10]+" ");   }   out.println(sb.toString());  }  }else{    for(int ceng=1;ceng<=k/2;ceng++){   for(int i=0;i<n;i++){   for(int j=0;j<m;j++){    ans[i][j][ceng]=Integer.MAX_VALUE/3;    for(int dr=0;dr<4;dr++){    int nx=i+dir[dr][0];    int ny=j+dir[dr][1];    if(nx<n&&ny<m&&nx>=0&&ny>=0){     ans[i][j][ceng]=Math.min(ans[i][j][ceng], ans[nx][ny][ceng-1]+arr[i*m+j][dr]);    }    }   }   }  }  for(int i=0;i<n;i++){   StringBuilder sb=new StringBuilder("");   for(int j=0;j<m;j++){   sb.append(ans[i][j][k/2]*2+" ");   }   out.println(sb.toString());  }  }  out.close(); }  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());  }  int[] readIntArray(int n) {  int[] a=new int[n];  for (int i=0; i<n; i++) a[i]=nextInt();  return a;  }  long[] readLongArray(int n) {  long[] a=new long[n];  for (int i=0; i<n; i++) a[i]=nextLong();  return a;  }  long nextLong() {  return Long.parseLong(next());  } } static class FastOutput implements AutoCloseable, Closeable, Appendable {  private static final int THRESHOLD = 1 << 13;  private final Writer os;  private StringBuilder cache = new StringBuilder(THRESHOLD * 2);  public FastOutput append(CharSequence csq) {  cache.append(csq);  return this;  }  public FastOutput append(CharSequence csq, int start, int end) {  cache.append(csq, start, end);  return this;  }  private void afterWrite() {  if (cache.length() < THRESHOLD) {   return;  }  flush();  }  public FastOutput(Writer os) {  this.os = os;  }  public FastOutput(OutputStream os) {  this(new OutputStreamWriter(os));  }  public FastOutput append(char c) {  cache.append(c);  afterWrite();  return this;  }  public FastOutput append(int c) {  cache.append(c);  afterWrite();  return this;  }  public FastOutput append(String c) {  cache.append(c);  afterWrite();  return this;  }  public FastOutput println(String c) {  return append(c).println();  }  public FastOutput println() {  return append(System.lineSeparator());  }  public FastOutput flush() {  try {   os.append(cache);   os.flush();   cache.setLength(0);  } catch (IOException e) {   throw new UncheckedIOException(e);  }  return this;  }  public void close() {  flush();  try {   os.close();  } catch (IOException e) {   throw new UncheckedIOException(e);  }  }  public String toString() {  return cache.toString();  } } }
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));   }  } }
0	public class a extends Thread {  BufferedReader bf; PrintWriter out; FastScanner in;  void solve() throws Exception {  long n = in.nextLong();  long f[] = new long[2001];  int i = 2;  f[0] = 0;  f[1] = 1;  while (true){  f[i] = f[i-1] + f[i-2];  if (f[i] < n) i++;  else break;  }  if (n == 1) out.println("1 0 0");  else if (n == 0) out.println("0 0 0");  else  if (i - 3 >= 0) out.println(f[i-2] +" " + f[i-2] + " " +f[i-3]);  else out.println("I'm too stupid to solve this problem"); }  public void run() {  try {  bf = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  in = new FastScanner(bf);  solve();  out.flush();  } catch (Exception ex) {  ex.printStackTrace();  } finally {  out.close();  } }  public static void main(String args[]) {  new a().start(); }  class FastScanner {  BufferedReader bf;  StringTokenizer st;  public FastScanner(BufferedReader bf) {  this.bf = bf;  }  public String nextToken() throws Exception {  while (st == null || !st.hasMoreTokens()) {   st = new StringTokenizer(bf.readLine());  }  return st.nextToken();  }  public int nextInt() throws Exception {  return Integer.parseInt(nextToken());  }  public long nextLong() throws Exception {  return Long.parseLong(nextToken());  }  public Double nextDouble() throws Exception {  return Double.parseDouble(nextToken());  }  public BigInteger nextBigInteger() throws Exception {  return new BigInteger(nextToken());  } } }
4	public class Main{  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());   }   int[] nextArray(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++) a[i] = nextInt();    return a;   }   long[] nextArray(long n) {    long[] a = new long[(int) n];    for (int i = 0; i < n; i++) a[i] = nextLong();    return a;   }   long nextLong() {    return Long.parseLong(next());   }  }  static class FastWriter extends PrintWriter {   FastWriter(){    super(System.out);   }   void println(int[] array) {    for(int i=0; i<array.length; i++) {     print(array[i]+" ");    }    println();   }   void println(long [] array) {    for(int i=0; i<array.length; i++) {     print(array[i]+" ");    }    println();   }  }  static class Interval {   long start,end;   Interval(long start, long end)   {    this.start=start;    this.end=end;   }  }  static int MOD=998244353;  public static void main(String[] args){   FastScanner in = new FastScanner();   FastWriter out = new FastWriter();   Scanner sc=new Scanner(System.in);   int t=in.nextInt();     while (t-->0){    int n=in.nextInt();    int[] ar=in.nextArray(n);    int[] level=new int[1005];    int j=1;    level[1]=1;    out.println(1);    for (int i = 1; i < n; i++) {     if(ar[i]==1) {      j++;      level[j] = 1;     }else {      while (j>=1){       if(level[j]+1!=ar[i]){        j--;       }else {        break;       }      }      level[j]++;     }     for (int k = 1; k <= j; k++) {      if(k==j){       out.print(level[k]);      }else {       out.print(level[k]+".");      }     }     out.println();    }   }   out.close();  }  static int highestPowerOf2(int n) {   if (n < 1){ return 0; }   int res = 1;   for (int i = 0; i < 8 * Integer.BYTES; i++) {    int curr = 1 << i;    if (curr > n){ break; }    res = curr;   }   return res;  }  static int reduceFraction(int x, int y) {   int d= gcd(x, y);   return x/d+y/d;  }  static boolean subset(int[] ar,int n,int sum){   if(sum==0){    return true;   }   if(n<0||sum<0){    return false;   }   return subset(ar,n-1,sum)||subset(ar,n-1,sum-ar[n]);  }  static boolean isPrime(int n){   if(n<=1) return false;   for(int i = 2;i<=Math.sqrt(n);i++){    if (n % i == 0) return false;   }   return true;  }  static int gcd(int a, int b) {   if (b == 0) return a;   return gcd(b, a % b);  }  static long gcd(long a, long b) {   if (b == 0) return a;   return gcd(b, a % b);  }  static long lcm(long a, long b) {   return (a * b) / gcd(a, b);  }  static int lcm(int a, int b) {   return (a * b) / gcd(a, b);  }  static boolean isPowerOfTwo(int n) {   if(n==0||n==1){return false;}   double v = Math.log(n) / Math.log(2);   return ((int)(Math.ceil(v)) == (int)(Math.floor(v)));  }  static boolean isPerfectSquare(int x){   if (x >= 0) {    int sr = (int)Math.sqrt(x);    return ((sr * sr) == x);   }   return false;  }  static int lower_bound(int[] arr, int x) {   int low_limit = 0, high_limit = arr.length, mid = -1;   while (low_limit < high_limit) {    mid = (low_limit + high_limit) / 2;    if (arr[mid] >= x){     high_limit = mid;    }else{     low_limit = mid + 1;    }   }   return low_limit;  }  static int upper_bound(int[] arr, int x) {   int low_limit = 0, high_limit = arr.length, mid = -1;   while (low_limit < high_limit) {    mid = (low_limit + high_limit) / 2;    if (arr[mid] > x){     high_limit = mid;    }else{     low_limit = mid + 1;    }   }   return low_limit;  }  static int binarySearch(int[] ar,int n,int num){   int low=0,high=n-1;   while (low<=high){    int mid=(low+high)/2;    if(ar[mid]==num){     return mid;    }else if(ar[mid]>num){     high=mid-1;    }else {     low=mid+1;    }   }   return -1;  } }
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 {   @Override   public void run() {    InputStream inputStream = System.in;    OutputStream outputStream = System.out;    FastInput in = new FastInput(inputStream);    FastOutput out = new FastOutput(outputStream);    EPhoenixAndComputers solver = new EPhoenixAndComputers();    solver.solve(1, in, out);    out.close();   }  }  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 {   private static 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 class CachedEulerFunction {   private static int boundary = 1 << 16;   private static int[] euler = MultiplicativeFunctionSieve.getInstance(boundary).getEuler();   private static IntegerHashMap map = new IntegerHashMap(64, true);   public static int get(int x) {    return get(x, 2);   }   private static int get(int x, int begin) {    if (x <= boundary) {     return euler[x];    }    int ans = map.getOrDefault(x, -1);    if (ans == -1) {     int factor = findPrimeFactor(x, begin);     int y = x;     int exp = 1;     while (y % factor == 0) {      y /= factor;      exp *= factor;     }     ans = get(y, factor + 1) * (exp - exp / factor);         map.put(x, ans);    }    return ans;   }   private static int findPrimeFactor(int x, int begin) {    for (int i = Math.max(2, begin); i * i <= x; i++) {     if (x % i == 0) {      return i;     }    }    return 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 DigitUtils {   private DigitUtils() {   }   public static int mod(long x, int mod) {    if (x < -mod || x >= mod) {     x %= mod;    }    if (x < 0) {     x += mod;    }    return (int) x;   }   public static int mod(int x, int mod) {    if (x < -mod || x >= mod) {     x %= mod;    }    if (x < 0) {     x += mod;    }    return x;   }   public static int modPow(int x, long n, int m) {    if (n == 0) {     return DigitUtils.mod(1, m);    }    int ans = modPow(x, n / 2, m);    ans = DigitUtils.mod((long) ans * ans, m);    if (n % 2 == 1) {     ans = DigitUtils.mod((long) ans * x, m);    }    return ans;   }  }  static class Combination implements IntCombination {   final Factorial factorial;   int modVal;   public Combination(Factorial factorial) {    this.factorial = factorial;    this.modVal = factorial.getMod();   }   public Combination(int limit, int mod) {    this(new Factorial(limit, mod));   }   public int combination(int m, int n) {    if (n > m || n < 0) {     return 0;    }    return (int) ((long) factorial.fact(m) * factorial.invFact(n) % modVal * factorial.invFact(m - n) % modVal);   }  }  static class Log2 {   public static int ceilLog(int x) {    if (x <= 0) {     return 0;    }    return 32 - Integer.numberOfLeadingZeros(x - 1);   }  }  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();   }  } }
2	public class P {  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  long N = sc.nextLong(), S = sc.nextLong();  long lo = 0, hi = N;  long pivot = 0;  while (lo <= hi) {  long mid = lo + (hi - lo) / 2;  int sumOfDigits = 0;  long saveMid = mid;  while (saveMid > 0) {   sumOfDigits += saveMid % 10;   saveMid /= 10;  }  if (mid - sumOfDigits < S) {   pivot = mid;   lo = mid + 1;  } else   hi = mid - 1;  }  System.out.println(N - pivot); }  static class Scanner {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s));  }  public Scanner(String f) throws FileNotFoundException {  br = new BufferedReader(new FileReader(f));  }  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 String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(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;  }  public int[] nextIntArray1(int n) throws IOException {  int[] a = new int[n + 1];  for (int i = 1; i <= n; i++)   a[i] = nextInt();  return a;  }  public int[] shuffle(int[] a, int n) {  int[] b = new int[n];  for (int i = 0; i < n; i++)   b[i] = a[i];  Random r = new Random();  for (int i = 0; i < n; i++) {   int j = i + r.nextInt(n - i);   int t = b[i];   b[i] = b[j];   b[j] = t;  }  return b;  }  public int[] nextIntArraySorted(int n) throws IOException {  int[] a = nextIntArray(n);  a = shuffle(a, n);  Arrays.sort(a);  return a;  }  public long[] nextLongArray(int n) throws IOException {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  public long[] nextLongArray1(int n) throws IOException {  long[] a = new long[n + 1];  for (int i = 1; i <= n; i++)   a[i] = nextLong();  return a;  }  public long[] nextLongArraySorted(int n) throws IOException {  long[] a = nextLongArray(n);  Random r = new Random();  for (int i = 0; i < n; i++) {   int j = i + r.nextInt(n - i);   long t = a[i];   a[i] = a[j];   a[j] = t;  }  Arrays.sort(a);  return a;  } } }
1	public class Main {  BufferedReader in; StringTokenizer str = null; PrintWriter out;  private String next() throws Exception{  while (str == null || !str.hasMoreElements())  str = new StringTokenizer(in.readLine());  return str.nextToken(); }  private int nextInt() throws Exception{  return Integer.parseInt(next()); }  private long nextLong() throws Exception{  return Long.parseLong(next()); }  private double nextDouble() throws Exception{  return Double.parseDouble(next()); }  Map<Integer, Integer> map; int []p, rank;  public void run() throws Exception{  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  map = new HashMap<Integer, Integer>();  int n = nextInt();  int x = nextInt(), y = nextInt();  int []a = new int[n];  p = new int[n];  for(int i = 1; i < n; ++i) p[i] = i;  rank = new int[n];  for(int i = 0; i < n; ++i) {  a[i] = nextInt();  map.put(a[i], i);  }  int mask[] = new int[n];  for(int i = 0; i < n; ++i) {  if (map.containsKey(x - a[i])) {   union(map.get(x - a[i]), i);   mask[i] |= 1;   }   if (map.containsKey(y - a[i])) {   union(map.get(y - a[i]), i);   mask[i] |= 2;  }  }  int []b = new int[n];  Arrays.fill(b, 3);  for(int i = 0; i < n; ++i) b[find(i)] &= mask[i];  for(int i = 0; i < n; ++i) {  if (b[i] == 0) {   out.println("NO");   out.close();   return;  }  }  out.println("YES");  for(int i = 0; i < n; ++i) {  out.print((b[find(i)] & 1) == 1 ? 0 : 1);  if (i != n - 1) out.print(" ");  }  out.println();  out.close(); }  private int find(int x) {  if (x != p[x])  return p[x] = find(p[x]);  return x; } private void union(int a, int b) {  a = find(a);  b = find(b);  if (rank[a] < rank[b]) {  int tmp = a;  a = b;  b = tmp;  }  p[b] = a;  if (rank[a] == rank[b]) ++rank[a]; }   public static void main(String[] args) throws Exception{  new Main().run(); } }
1	public class RoundOneProblemB {   public static void main(String[] args) {    int n=1;   BufferedReader input = new BufferedReader(new InputStreamReader(System.in), 50);   try {    n = Integer.valueOf(input.readLine());    if (! ((1 <= n) && (n <= Math.pow(10, 5)))) {   formatError();  }    Pattern typeOne = Pattern.compile("^([A-Z]+)([0-9]+)$");  Pattern typeTwo = Pattern.compile("^R([0-9]+)C([0-9]+)$");  for (int i=0; i < n; i++) {   String line = input.readLine();   Matcher matchOne = typeOne.matcher(line);   if (matchOne.find()) {   System.out.println(convertOneToTwo(matchOne.group(2), matchOne.group(1)));   } else {   Matcher matchTwo = typeTwo.matcher(line);   if (matchTwo.find()) {    System.out.println(convertTwoToOne(matchTwo.group(1), matchTwo.group(2)));   }   }  }     } catch (Exception e) {  formatError();   }   }  private static String convertTwoToOne(String row, String col) {  StringBuilder result = new StringBuilder();   long c = Long.parseLong(col);  while ( c > 0) {  result.append((char)(((c-1) % 26)+'A'));  c = (c-1) / 26;  }  result.reverse();  result.append(Long.parseLong(row));   return result.toString(); }  private static String convertOneToTwo(String row, String col) {  StringBuilder result = new StringBuilder();   int l = col.length();  col = col.toUpperCase();   long base = 1;  long c = 0;  for (int i=l-1; i >= 0; i--) {  c = c + ((col.charAt(i) - 'A' + 1) * base);  base = base * 26;  }   result.append("R").append(Long.parseLong(row)).append("C").append(c);  return result.toString(); }   private static void formatError() {  System.out.println("Unexpected input");  System.exit(1);  } }
0	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   long n = in.nextLong();   out.println(0 + " " + 0 + " " + n);   in.close();   out.close();  } }
1	public class Round364C { public static void main(String[] args) throws NumberFormatException, IOException {  Scanner sc = new Scanner(System.in);  n = sc.nextInt();  k = 0;   String line = sc.nextLine();   ArrayList<Character> poks = new ArrayList<Character>();  boolean ex[] = new boolean[256];   for(int i=0; i<n; i++)  {  if(!ex[line.charAt(i)])  {   ex[line.charAt(i)] = true;   poks.add(line.charAt(i));  }  }     int l = 0;  int r = 0;  int dist = 1;  int occ[] = new int[256];  occ[line.charAt(0)] = 1;   int min = n;  while(r < n)  {  if(dist == poks.size())   min = Math.min(min, r - l + 1);  if(l < r && dist == poks.size())  {     occ[line.charAt(l)]--;   if(occ[line.charAt(l)] == 0)   dist--;   l++;   continue;  }  if(r < n-1){   occ[line.charAt(r+1)]++;   if(occ[line.charAt(r+1)] == 1)   dist++;  }  r++;  }  System.out.println(min);   }  static int n,k; static int dp[][][];  static class Scanner {  BufferedReader br;  StringTokenizer st;  Scanner(FileReader f) {  br = new BufferedReader(f);  }  public boolean ready() throws IOException {  return br.ready();  }  Scanner(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();  }  String nextLine() throws IOException {  return br.readLine();  }  int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(next());  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  } } }
5	public class ProblemOne {  public static void main(String [] args) {   Scanner scanner = new Scanner(System.in);   int problemCount = scanner.nextInt();   int petrCount = scanner.nextInt();   int vasCount = scanner.nextInt();   int [] problems = new int[problemCount];   for (int i = 0; i < problemCount; i++) {    problems[i] = scanner.nextInt();       }   Arrays.sort(problems);   System.out.println(-problems[vasCount - 1] + problems[vasCount]);  } }
1	public class Main{  public static void main(String[] args) throws IOException {      open ("input.txt", "output.txt", false, true);   char[] alph = " ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();   Pattern pat = Pattern.compile("[A-Z]+[\\d]+");   Matcher mat;   boolean b ;   String s;   int index, coef, row, col;   int n = nextInt();   String[] tmp;   char[] c;   for (int i=0; i<n; i++)   {    s = nextLine();    c = s.toCharArray();    mat = pat.matcher(s);    b = mat.matches();    if (b)    {         index = c.length-1;     coef = 1;     row = 0;     while (c[index]>='0' && c[index]<='9')     {      row += (c[index]-'0')*coef;      coef*=10;      index--;     }     coef = 1;     col = 0;     while (index>=0)     {      col += (Arrays.binarySearch(alph, c[index]))*coef;           coef*=26;      index--;     }     out.println("R"+row+"C"+col);    }    else    {     tmp = s.split("R|C");              col = Integer.parseInt(tmp[2]);     char[] temp = new char[10];     int len = 0;     int v = 0;     while (col>0)     {      index = col%26;      if (index==0)       { index=26;       v = 1;       }      else v = 0;      temp[len]=alph[index];           col = (col/26) - v;      len++;     }     for (int j=len-1; j>=0; j--)     {      out.print(temp[j]);     }     out.println(tmp[1]);    }   }   close();  }   static StringTokenizer st;  static StreamTokenizer strTok;  static BufferedReader in;  static PrintWriter out;   static String nextToken(boolean f) throws IOException {   if (f) {    return in.readLine();   } else {    while (st == null || !st.hasMoreTokens()) {     st = new StringTokenizer(in.readLine());    }    return st.nextToken();   }  }   static String nextLine() throws IOException {   return nextToken(true);  }   static int nextInt() throws NumberFormatException, IOException {   return Integer.parseInt(nextToken(false));  }   static long nextLong() throws NumberFormatException, IOException {   return Long.parseLong(nextToken(false));  }   static double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextToken(false));  }   static char nextChar() throws IOException {   return ((char)in.read());  }   static void close(){   out.flush();   out.close();  }   static void open(String filein, String fileout, boolean flag, boolean console) throws IOException{   if (flag) {    strTok = new StreamTokenizer(new FileReader (new File(filein)));    in = new BufferedReader(new FileReader (new File(filein)));    out = new PrintWriter(new FileWriter(new File (fileout)));   } else {    if (console){     strTok = new StreamTokenizer(new InputStreamReader (System.in, "ISO-8859-1"));     in = new BufferedReader (new InputStreamReader (System.in, "ISO-8859-1"));     out = new PrintWriter (new OutputStreamWriter (System.out, "ISO-8859-1"));    } else {     strTok = new StreamTokenizer(new FileReader (new File("input.txt")));     in = new BufferedReader(new FileReader (new File("input.txt")));     out = new PrintWriter(new FileWriter(new File ("output.txt")));    }   }  } }
1	public class ProblemA {  public void solve() {   boolean oj = true;   try {    Reader reader = oj ? new InputStreamReader(System.in) : new FileReader("A.in");    Writer writer = oj ? new OutputStreamWriter(System.out) : new FileWriter("A.out");    BufferedReader br = new BufferedReader(reader);    PrintWriter out = new PrintWriter(writer);    MyTokenizer tok = new MyTokenizer(br.readLine());    int n = (int)tok.getNum();    int k = (int)tok.getNum();    boolean[] isPrime = new boolean[n + 1];    for(int i=1;i<=n;i++)     isPrime[i] = true;    isPrime[1] = false;    isPrime[2] = true;    for(int i=2;i*i<=n;i++)     for(int j=2*i;j<=n;j+=i)      isPrime[j] = false;    int[] primes = new int[n];    int cur = 0;    for(int i=2;i<=n;i++)     if (isPrime[i]) {      primes[cur] = i;      cur++;     }    int count = 0;    for(int i=0;i<cur-1;i++) {     if (primes[i] + primes[i+1] + 1 <= n && isPrime[primes[i] + primes[i+1] + 1])      count++;    }    if (count >= k)     out.printf("YES");    else     out.printf("NO");        br.close();    out.close();    reader.close();    writer.close();   }   catch (Exception ex) {    ex.printStackTrace();   }   finally {   }  }  public static void main(String[] args) {   ProblemA f = new ProblemA();   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);   }   public String getString() {    skip();    String s2 = "";    while (cur < s.length() && (s.charAt(cur) >= 'a' && s.charAt(cur) <= 'z')) {     s2 += s.charAt(cur);     cur++;    }    return s2;   }   public char getCurrentChar() throws Exception {    if (cur < s.length())     return s.charAt(cur);    else     throw new Exception("Current character out of string length");   }   public void moveNextChar() {    if (cur < s.length())     cur++;   }   public boolean isFinished() {    return cur >= s.length();   }  } }
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();  } }
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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.readInt();    int[] a = in.readIntArray(n);    ArrayUtils.sort(a);    boolean[] done = new boolean[n];    int answer = 0;    for (int i = 0; i < n; i++) {     if (done[i]) {      continue;     }     answer++;     for (int j = i; j < n; j++) {      if (a[j] % a[i] == 0) {       done[j] = true;      }     }    }    out.printLine(answer);   }  }  static class Sorter {   private static final int INSERTION_THRESHOLD = 16;   private Sorter() {   }   public static void sort(IntList list, IntComparator comparator) {    quickSort(list, 0, list.size() - 1, (Integer.bitCount(Integer.highestOneBit(list.size()) - 1) * 5) >> 1,      comparator);   }   private static void quickSort(IntList list, int from, int to, int remaining, IntComparator comparator) {    if (to - from < INSERTION_THRESHOLD) {     insertionSort(list, from, to, comparator);     return;    }    if (remaining == 0) {     heapSort(list, from, to, comparator);     return;    }    remaining--;    int pivotIndex = (from + to) >> 1;    int pivot = list.get(pivotIndex);    list.swap(pivotIndex, to);    int storeIndex = from;    int equalIndex = to;    for (int i = from; i < equalIndex; i++) {     int value = comparator.compare(list.get(i), pivot);     if (value < 0) {      list.swap(storeIndex++, i);     } else if (value == 0) {      list.swap(--equalIndex, i--);     }    }    quickSort(list, from, storeIndex - 1, remaining, comparator);    for (int i = equalIndex; i <= to; i++) {     list.swap(storeIndex++, i);    }    quickSort(list, storeIndex, to, remaining, comparator);   }   private static void heapSort(IntList list, int from, int to, IntComparator comparator) {    for (int i = (to + from - 1) >> 1; i >= from; i--) {     siftDown(list, i, to, comparator, from);    }    for (int i = to; i > from; i--) {     list.swap(from, i);     siftDown(list, from, i - 1, comparator, from);    }   }   private static void siftDown(IntList list, int start, int end, IntComparator comparator, int delta) {    int value = list.get(start);    while (true) {     int child = ((start - delta) << 1) + 1 + delta;     if (child > end) {      return;     }     int childValue = list.get(child);     if (child + 1 <= end) {      int otherValue = list.get(child + 1);      if (comparator.compare(otherValue, childValue) > 0) {       child++;       childValue = otherValue;      }     }     if (comparator.compare(value, childValue) >= 0) {      return;     }     list.swap(start, child);     start = child;    }   }   private static void insertionSort(IntList list, int from, int to, IntComparator comparator) {    for (int i = from + 1; i <= to; i++) {     int value = list.get(i);     for (int j = i - 1; j >= from; j--) {      if (comparator.compare(list.get(j), value) <= 0) {       break;      }      list.swap(j, j + 1);     }    }   }  }  static interface IntStream extends Iterable<Integer>, Comparable<IntStream> {   public IntIterator intIterator();   default public Iterator<Integer> iterator() {    return new Iterator<Integer>() {     private IntIterator it = intIterator();     public boolean hasNext() {      return it.isValid();     }     public Integer next() {      int result = it.value();      it.advance();      return result;     }    };   }   default public int compareTo(IntStream c) {    IntIterator it = intIterator();    IntIterator jt = c.intIterator();    while (it.isValid() && jt.isValid()) {     int i = it.value();     int j = jt.value();     if (i < j) {      return -1;     } else if (i > j) {      return 1;     }     it.advance();     jt.advance();    }    if (it.isValid()) {     return 1;    }    if (jt.isValid()) {     return -1;    }    return 0;   }  }  static interface IntComparator {   public static final IntComparator DEFAULT = (first, second) -> {    if (first < second) {     return -1;    }    if (first > second) {     return 1;    }    return 0;   };   public int compare(int first, int second);  }  static class IntArray extends IntAbstractStream implements IntList {   private int[] data;   public IntArray(int[] arr) {    data = arr;   }   public int size() {    return data.length;   }   public int get(int at) {    return data[at];   }   public void addAt(int index, int value) {    throw new UnsupportedOperationException();   }   public void removeAt(int index) {    throw new UnsupportedOperationException();   }   public void set(int index, int value) {    data[index] = value;   }  }  static interface IntIterator {   public int value() throws NoSuchElementException;   public boolean advance();   public boolean isValid();  }  static abstract class IntAbstractStream implements IntStream {   public String toString() {    StringBuilder builder = new StringBuilder();    boolean first = true;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     if (first) {      first = false;     } else {      builder.append(' ');     }     builder.append(it.value());    }    return builder.toString();   }   public boolean equals(Object o) {    if (!(o instanceof IntStream)) {     return false;    }    IntStream c = (IntStream) o;    IntIterator it = intIterator();    IntIterator jt = c.intIterator();    while (it.isValid() && jt.isValid()) {     if (it.value() != jt.value()) {      return false;     }     it.advance();     jt.advance();    }    return !it.isValid() && !jt.isValid();   }   public int hashCode() {    int result = 0;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     result *= 31;     result += it.value();    }    return result;   }  }  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 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 interface IntCollection extends IntStream {   public int size();   default public void add(int value) {    throw new UnsupportedOperationException();   }   default public IntCollection addAll(IntStream values) {    for (IntIterator it = values.intIterator(); it.isValid(); it.advance()) {     add(it.value());    }    return this;   }  }  static interface IntReversableCollection extends IntCollection {  }  static class IntArrayList extends IntAbstractStream implements IntList {   private int size;   private int[] data;   public IntArrayList() {    this(3);   }   public IntArrayList(int capacity) {    data = new int[capacity];   }   public IntArrayList(IntCollection c) {    this(c.size());    addAll(c);   }   public IntArrayList(IntStream c) {    this();    if (c instanceof IntCollection) {     ensureCapacity(((IntCollection) c).size());    }    addAll(c);   }   public IntArrayList(IntArrayList c) {    size = c.size();    data = c.data.clone();   }   public IntArrayList(int[] arr) {    size = arr.length;    data = arr.clone();   }   public int size() {    return size;   }   public int get(int at) {    if (at >= size) {     throw new IndexOutOfBoundsException("at = " + at + ", size = " + size);    }    return data[at];   }   private void ensureCapacity(int capacity) {    if (data.length >= capacity) {     return;    }    capacity = Math.max(2 * data.length, capacity);    data = Arrays.copyOf(data, capacity);   }   public void addAt(int index, int value) {    ensureCapacity(size + 1);    if (index > size || index < 0) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    if (index != size) {     System.arraycopy(data, index, data, index + 1, size - index);    }    data[index] = value;    size++;   }   public void removeAt(int index) {    if (index >= size || index < 0) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    if (index != size - 1) {     System.arraycopy(data, index + 1, data, index, size - index - 1);    }    size--;   }   public void set(int index, int value) {    if (index >= size) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    data[index] = value;   }  }  static class ArrayUtils {   public static int[] sort(int[] array) {    return sort(array, IntComparator.DEFAULT);   }   public static int[] sort(int[] array, IntComparator comparator) {    return sort(array, 0, array.length, comparator);   }   public static int[] sort(int[] array, int from, int to, IntComparator comparator) {    if (from == 0 && to == array.length) {     new IntArray(array).sort(comparator);    } else {     new IntArray(array).subList(from, to).sort(comparator);    }    return array;   }  }  static interface IntList extends IntReversableCollection {   public abstract int get(int index);   public abstract void set(int index, int value);   public abstract void addAt(int index, int value);   public abstract void removeAt(int index);   default public void swap(int first, int second) {    if (first == second) {     return;    }    int temp = get(first);    set(first, get(second));    set(second, temp);   }   default public IntIterator intIterator() {    return new IntIterator() {     private int at;     private boolean removed;     public int value() {      if (removed) {       throw new IllegalStateException();      }      return get(at);     }     public boolean advance() {      at++;      removed = false;      return isValid();     }     public boolean isValid() {      return !removed && at < size();     }     public void remove() {      removeAt(at);      at--;      removed = true;     }    };   }   default public void add(int value) {    addAt(size(), value);   }   default public IntList sort(IntComparator comparator) {    Sorter.sort(this, comparator);    return this;   }   default public IntList subList(final int from, final int to) {    return new IntList() {     private final int shift;     private final int size;     {      if (from < 0 || from > to || to > IntList.this.size()) {       throw new IndexOutOfBoundsException("from = " + from + ", to = " + to + ", size = " + size());      }      shift = from;      size = to - from;     }     public int size() {      return size;     }     public int get(int at) {      if (at < 0 || at >= size) {       throw new IndexOutOfBoundsException("at = " + at + ", size = " + size());      }      return IntList.this.get(at + shift);     }     public void addAt(int index, int value) {      throw new UnsupportedOperationException();     }     public void removeAt(int index) {      throw new UnsupportedOperationException();     }     public void set(int at, int value) {      if (at < 0 || at >= size) {       throw new IndexOutOfBoundsException("at = " + at + ", size = " + size());      }      IntList.this.set(at + shift, value);     }     public IntList compute() {      return new IntArrayList(this);     }    };   }  }  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);   }  } }
1	public class Solution {  public static void main(String str[]) throws Exception{   Scanner sc = new Scanner(System.in);   BufferedWriter output = new BufferedWriter(     new OutputStreamWriter(System.out));   int t = sc.nextInt();   while(t-->0){    int n = sc.nextInt();    if((n%2==0 && Math.pow(n/2,0.5)%1.0==0) || (n%4==0 && Math.pow(n/4,0.5)%1.0==0) ) output.write("YES\n");    else {     output.write("NO\n");    }   }   output.flush();  } }
6	public class Main {  static int inf = (int) 1e9 + 7;  static int n, m, a[][];  static ArrayList<Integer> used;  static int num[];  static int ans;  static void rec(int id) {   if (id == used.size()) {    check();    return;   }   for(int i = 0;i < n;i++) {    num[id] = i;    rec(id + 1);   }  }  static void check() {   int new_ans = 0;   for(int i = 0;i < n;i++) {    int max = 0;    for(int j = 0;j < used.size();j++) {     max = Math.max(max, a[(i + num[j]) % n][used.get(j)]);    }    new_ans += max;   }   ans = Math.max(ans, new_ans);  }  public static void main(String[] args) throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));   pw = new PrintWriter(System.out);   int test = nextInt();   while(test-- > 0) {    n = nextInt();    m = nextInt();    a = new int [n][m];    for(int i = 0;i < n;i++) {     for(int j = 0;j < m;j++) a[i][j] = nextInt();    }    used = new ArrayList<>();    num = new int [n * m];    ans = 0;    pair b[] = new pair[n * m];    for(int i = 0;i < n;i++) {     for(int j = 0;j < m;j++) {      b[i * m + j] = new pair(a[i][j], j);     }    }    Arrays.sort(b, new pair());    for(int i = b.length - 1;i >= Math.max(0, b.length - 5);i--) {     int v = b[i].y;     boolean bad = false;     for(int j = 0;j < used.size();j++) if (used.get(j) == v) bad = true;     if (!bad) used.add(v);    }    rec(0);    pw.println(ans);   }   pw.close();  }  static BufferedReader br;  static StringTokenizer st = new StringTokenizer("");  static PrintWriter pw;  static String next() throws IOException {   while (!st.hasMoreTokens()) st = new StringTokenizer(br.readLine());   return st.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt(next());  }  static long nextLong() throws IOException {   return Long.parseLong(next());  } } class pair implements Comparator<pair>{  int x, y;  pair(int x, int y) {   this.x = x;   this.y = y;  }  pair() {}  @Override  public int compare(pair o1, pair o2) {   return Integer.compare(o1.x, o2.x);  } }
4	public class ProblemA {  public void solve() {   boolean oj = true;   try {    Reader reader = oj ? new InputStreamReader(System.in) : new FileReader("A.in");    Writer writer = oj ? new OutputStreamWriter(System.out) : new FileWriter("A.out");    BufferedReader br = new BufferedReader(reader);    StreamTokenizer st = new StreamTokenizer(reader);    PrintWriter out = new PrintWriter(writer);    String s = br.readLine();    int n = s.length();    int max = 0;    for (int i = 0; i < n; i++)     for (int j = i; j < n; j++) {      int len = j - i + 1;      int count = 0;      for (int k = 0; k < n - len + 1; k++) {       boolean eq = true;       for(int l = 0; l < len;l++) {        if (s.charAt(i + l) != s.charAt(k + l)) {         eq = false;         break;        }       }       if (eq) {        count++;       }      }      if (count >= 2 && len > max) {       max = len;      }     }    out.printf("%d", max);    br.close();    out.close();    reader.close();    writer.close();   }   catch (Exception ex) {    ex.printStackTrace();   }   finally {   }  }   public static void main(String[] args) {   ProblemA f = new ProblemA();   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) == '.' || s.charAt(cur) == '-')) {     snum += s.charAt(cur);     cur++;    }    return Double.valueOf(snum);   }   public String getString() {    skip();    String s2 = "";    while (cur < s.length() && (((s.charAt(cur) >= 'a' && s.charAt(cur) <= 'z')) || ((s.charAt(cur) >= 'A' && s.charAt(cur) <= 'Z')))) {     s2 += s.charAt(cur);     cur++;    }    return s2;   }   public char getCurrentChar() throws Exception {    if (cur < s.length())     return s.charAt(cur);    else     throw new Exception("Current character out of string length");   }   public void moveNextChar() {    if (cur < s.length())     cur++;   }   public boolean isFinished() {    return cur >= s.length();   }  } }
1	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 {  public void solve(int testNumber, InputReader in, PrintWriter out) {   int n = in.readInt();   int a = in.readInt();   int b = in.readInt();   TreeMap<Integer, Integer> mp = new TreeMap<Integer, Integer>();   for (int i = 0; i < n; ++i) {    mp.put(in.readInt(), i);   }   int aname = 0;   int bname = 1;   if (a > b) {    int t = a;    a = b;    b = t;    aname = 1;    bname = 0;   }   int[] res = new int[n];   while (mp.size() > 0) {    Map.Entry<Integer, Integer> e = mp.firstEntry();    int val = e.getKey();    if (mp.containsKey(b - val)) {     res[mp.get(val)] = res[mp.get(b - val)] = bname;     mp.remove(val);     mp.remove(b - val);    } else if (mp.containsKey(a - val)) {     res[mp.get(val)] = res[mp.get(a - val)] = aname;     mp.remove(val);     mp.remove(a - val);    } else {     break;    }   }   if (mp.size() > 0) {    out.println("NO");   } else {    out.println("YES");    for (int i = 0; i < n; ++i) {     if (i > 0) out.print(" ");     out.print(res[i]);    }    out.println();   }  } } 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 static boolean isSpaceChar(int c) {   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  } }
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]);  }  static class MyInputReader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public MyInputReader(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());   }  }  }
1	public class C {  public static void main(String[] args) throws IOException { BufferedReader in =  new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(in.readLine()); char[] ps = in.readLine().toCharArray(); HashMap<Character, TreeSet<Integer>> locs =  new HashMap<Character, TreeSet<Integer>>(); HashSet<Character> poks = new HashSet<Character>(); int lastNew = n; for (int i = 0; i < n; i++) {  if (!poks.contains(ps[i])) {  poks.add(ps[i]);  locs.put(ps[i], new TreeSet<Integer>());  lastNew = i;  }  locs.get(ps[i]).add(i); } int max = lastNew; int minRange = max+1; for (int min = 0; min < n; min++) {  char pAtMin = ps[min];  Integer nextInd = locs.get(pAtMin).higher(min);  if (nextInd == null) break;  max = Math.max(max, nextInd);  minRange = Math.min(minRange, max-min); } System.out.println(minRange);  } }
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());   }  } }
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 check(boolean f, String msg) {   if (!f) {    out.close();    throw new RuntimeException(msg);   }  }  void close() throws IOException {   out.close();  }  public void run() {   try {    solve();    close();   } catch (Exception e) {    e.printStackTrace(out);    out.flush();    throw new RuntimeException(e);   }  }  public static void main(String[] args) throws IOException {   new Thread(new B()).start();  } }
1	public class Main {  StreamTokenizer in;   PrintWriter out;  public static void main(String[] args) throws IOException {   new Main().run();  }  int ni() throws IOException {   in.nextToken(); return (int)in.nval;  }  void run() throws IOException {     in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));   out = new PrintWriter(new OutputStreamWriter(System.out));     int cprime = 0;   int[] prime = new int[1000];   for(int i = 2; i < 1001; i++) {    boolean f = false;    for(int j = 2; j*j <= i; j++)     if(i % j == 0) {      f = true; break;     }    if(!f) prime[cprime++] = i;   }   int n = ni(), k = ni();   int last = 0;   int count = 0;   for(int i = 0; i < cprime && prime[i] <= n; i++) {    for(int j = 0; j < cprime - 1; j++)     if(prime[j] + prime[j + 1] + 1 == prime[i]) {      count++; break;     }     else if(prime[j] + prime[j + 1] + 1 > prime[i]) break;   }   if(count >= k) out.print("YES");   else out.print("NO");   out.flush();  } }
5	public class ProblemA {  public static void main(String[] args) {  Scanner s = new Scanner(System.in);   int n = s.nextInt();  int t = s.nextInt();  TreeMap<Integer,Integer> map = new TreeMap<Integer,Integer>();    while(s.hasNextInt())  {  int i = s.nextInt();  int j = s.nextInt();  map.put(i,j);   }   int count = 0;  double left = -100000;  double right;  int size;  for(Integer i : map.keySet())  {  size = map.get(i);  right = (double)i - (double)size/2.0;    if(right - left > t)  {   count+=2;  }  if(right - left == t)  {   count++;  }    left = (double)i + (double)size/2.0;  }   System.out.println(count); } }
4	public class A { String line; StringTokenizer inputParser; BufferedReader is; FileInputStream fstream; DataInputStream in;  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; }  String NextString() {  String n = inputParser.nextToken();  return n; }  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];  A a = new A(filePath); }  public A(String inputFile) {  openInput(inputFile);   readNextLine();  String s=line;  int ret=0;  for(int i=0; i<s.length(); i++)  {  for(int j=i+1; j<s.length()+1; j++)  {   String a=s.substring(i, j);   if(s.indexOf(a, i+1)>-1)ret=Math.max(ret, a.length());     }  }  System.out.println(ret); }  }
1	public class CF111111 { BufferedReader in; StringTokenizer as; int nums[],nums2[]; int[] nums1[]; boolean con = true;  ArrayList < Integer > ar = new ArrayList < Integer >(); ArrayList < Integer > fi = new ArrayList < Integer >(); Map<Integer,Integer > map = new HashMap<Integer, Integer>(); public static void main (String[] args) {  new CF111111 (); }  public int GCD(int a, int b) {  if (b==0) return a;  return GCD(b,a%b); }  public int LIS(int arr[]) {  int n = arr.length;  int sun[] = new int [n];  int cur = 0;  for(int x = 0;x<n;x++)  {  int temp = Arrays.binarySearch(sun,0,cur,arr[x]);  if(temp < 0)   temp = -temp -1;  sun[temp] = arr[x];  if(temp == cur)   cur++;  }  return cur;   }     public CF111111 () {  try  {    in = new BufferedReader (new InputStreamReader (System.in));  int a = nextInt();  for(int xx1 = 0;xx1<a;xx1++)  {   int b = nextInt();   nums = new int [b];   for(int x = 0;x<b;x++)   {   nums[x] = nextInt();   }   int max = 0;   int max2 = -1;   for(int x = 0;x<b;x++)   {    if(nums[x] >= max)    {    max2 = max;    max = nums[x];    }    else if(nums[x] >= max2)    max2 = nums[x];   }   System.out.println(Math.min(max2, b-1)-1);  }  }  catch(IOException e)  {  } }        String next () throws IOException {  while (as == null || !as.hasMoreTokens ())  {  as = new StringTokenizer (in.readLine ().trim ());  }     return as.nextToken (); }    long nextLong () throws IOException {  return Long.parseLong (next ()); }   int nextInt () throws IOException {  return Integer.parseInt (next ()); }   double nextDouble () throws IOException {  return Double.parseDouble (next ()); }   String nextLine () throws IOException {  return in.readLine ().trim (); } }
3	public class Solution{   static class Node implements Comparable<Node>{   int sum;   int l;   int r;   Node next;   int nb;   Node ini;   boolean not;   public Node(int sum,int l,int r){    this.sum = sum;    this.l = l;    this.r = r;    nb = 0;    not = false;    ini = null;   }     @Override   public int compareTo(Node node){    if(sum-node.sum!=0) return sum-node.sum;    else if(l-node.l!=0) return l-node.l;    else return r - node.r;   }  }   public static void main(String[] args)throws IOException{       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(br.readLine());     PrintWriter out = new PrintWriter(System.out);     int n = Integer.parseInt(st.nextToken());     TreeSet<Node> ts = new TreeSet<Node>();     st = new StringTokenizer(br.readLine());   int[] a = new int[n+1];   for(int i=1;i<=n;i++) a[i] = Integer.parseInt(st.nextToken());     int[] s = new int[n+1];   for(int i=1;i<=n;i++) s[i] = s[i-1] + a[i];     for(int i=1;i<=n;i++){    for(int j=i;j<=n;j++){     ts.add(new Node(s[j]-s[i-1],i,j));    }   }   int minvalue = -2000*(int)Math.pow(10,5);   int maxvalue = 2000*(int)Math.pow(10,5);   ts.add(new Node(minvalue,0,0));   ts.add(new Node(maxvalue,0,0));     Node node = ts.higher(ts.first());     int sum = 0;          int max = 0;   Node m = null;     while(node.sum!=maxvalue){       sum = node.sum;    while(node.sum==sum){     node = ts.higher(node);    }       Node var = ts.lower(node);       max = 0;    while(var.sum==sum){         Node next = ts.higher(new Node(sum,var.r+1,0));         if(max>1+next.nb){      var.nb = max;      var.ini = m;     }     else if(next.ini==null){          var.nb = 1 + next.nb;      var.next = next;      if(max<var.nb){       max = var.nb;       m = var;      }                }else{           var.nb = 1 + next.nb;      var.next = next.ini;      if(max<var.nb){       max = var.nb;       m = var;      }          }             var = ts.lower(var);              }          }     int k = 0;   Node best = new Node(minvalue,0,0);      for(Node var:ts){    if(k<var.nb){     k = var.nb;     best = var;     if(var.ini!=null) best = var.ini;    }   }     if(k==0) System.out.println("erreur");   else{       out.println(k);    sum = best.sum;    while(best.sum==sum){     out.println(best.l+" "+best.r);     best = best.next;    }      }        out.flush();    }  }
3	public class E1180D {  public static void main(String args[]) {   Scanner sc = new Scanner(System.in);   PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));   int n = sc.nextInt();   int m = sc.nextInt();      for (int i= 1; i<= m/2; i++) {       int i2 = m -i + 1;        for (int j = 1; j <= n ; j++) {     int j2 = n - j + 1;         pw.println(j + " " + i);     pw.println(j2+ " " + i2);        }      }        if (m % 2 == 1) {    int i2 = m /2 + 1;    for (int j = 1; j <= n/2 ; j++) {     int j2 = n - j + 1;         pw.println(j + " " + i2);     pw.println(j2+ " " + i2);    }    if (n %2 == 1) {     int j = n /2 + 1;     pw.println(j + " " + i2);    }   }   pw.flush();   pw.close();  }  }
3	public class Solution1{  static class Node{  int start,end;  Node(int start, int end){  this.start=start;  this.end=end;  }  public String toString(){  return start+" "+end;  } }  public static void sameSumBlock(int a[],int n){  HashMap<Long,ArrayList<Node>> map=new HashMap<>();  long sum;  for(int i=0;i<n;i++){  sum=0;  for(int j=i;j<n;j++){   sum+=a[j];   if(!map.containsKey(sum))   map.put(sum,new ArrayList<>());   map.get(sum).add( new Node(i+1, j+1) );  }  }       int max=0; LinkedList<Node> list=new LinkedList<>();  for(Map.Entry<Long,ArrayList<Node>> pair: map.entrySet()){   ArrayList<Node> arr=pair.getValue();  Collections.sort(arr, (Node x, Node y)->{ return x.end-y.end; });   int count=0,end=0;  LinkedList<Node> temp=new LinkedList<>();  for(Node item: arr){   if(end<item.start){   end=item.end;   count+=1;   temp.add(new Node(item.start, item.end));   }  }   if(count>max){   max=count;   list=temp;  }  }  System.out.println(max);  for(Node item: list)  System.out.println(item.start+" "+item.end); }  public static void main(String args[]){  Scanner in=new Scanner(System.in);  int n=in.nextInt();  int a[]=new int[n];  for(int i=0;i<n;i++)  a[i]=in.nextInt();  sameSumBlock(a,n); } }
4	public class A {  private BufferedReader in;  private StringTokenizer st;  private PrintWriter out;  private void solve() throws IOException {   String s = next();   for (int length = s.length() - 1; length > 0; --length) {    Set<String> h = new HashSet<String>();    int count = 0;    for (int i = 0; i + length <= s.length(); ++i) {     h.add(s.substring(i, i + length));     ++count;    }    if (count != h.size()) {     out.println(length);     return;    }   }   out.println(0);  }  public void run() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   eat("");   solve();   out.close();   in.close();  }  private void eat(String s) {   st = new StringTokenizer(s);  }  private String next() throws IOException {   while (!st.hasMoreTokens()) {    String line = in.readLine();    if (line == null) {     return null;    }    eat(line);   }   return st.nextToken();  }  private int nextInt() throws IOException {   return Integer.parseInt(next());  }  private long nextLong() throws IOException {   return Long.parseLong(next());  }  private double nextDouble() throws IOException {   return Double.parseDouble(next());  }  private BigInteger nextBigInteger() throws IOException {   return new BigInteger(next());  }  public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);   new A().run();  } }
5	public class cf166a { private static boolean[][] matrix; private static int n; public static void main(String[] args) {  Scanner sc = new Scanner(System.in);      int n = sc.nextInt();  int k = sc.nextInt();  int[] p = new int[n];  int[] t = new int[n];  int[] score = new int[n];  for(int i=0;i<n;i++){  p[i] = sc.nextInt();  t[i] = sc.nextInt();  score[i] = p[i] * 100 + (50 - t[i]);  }  boolean[] called = new boolean[n];  int x = 0;  boolean check = false;  while(true){  int max = 0;  int y = 0;  for(int i=0;i<n;i++){   if(called[i]==false&&score[i]>max){max=score[i];}  }  for(int i=0;i<n;i++){   if(max==score[i]){   called[i] = true;   x++;   y++;   if(x==k){check=true;}   }  }  if(check){   System.out.println(y);   break;  }  } } }
0	public class Task343A {  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++]);  }  long nextLong() throws IOException {  if (cacheIndex >= cache.length) {   cache = br.readLine().split(" ");   cacheIndex = 0;  }  return Long.parseLong(cache[cacheIndex++]);  }  String next() throws IOException {  if (cacheIndex >= cache.length) {   cache = br.readLine().split(" ");   cacheIndex = 0;  }  return cache[cacheIndex++];  }  void close() throws IOException {  br.close();  }  }  static class Solution {  private static long r(long a, long b) {  if (a == 0 || b == 0) {   return 0;  }  if (a > b) {   return a / b + r(b, a % b);  }  return b / a + r(a, b % a);  }  public static void main(InputStream is, OutputStream os)   throws NumberFormatException, IOException {  PrintWriter pw = new PrintWriter(os);  Scanner sc = new Scanner(is);   long a = sc.nextLong();  long b = sc.nextLong();   pw.println(r(a, b));   pw.flush();  sc.close();  } } }
4	public class A {  public static void main(String[] args) throws IOException {   new A().solve();  }  BufferedReader br;  StringTokenizer st = new StringTokenizer("");  private void solve() throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));   String s = nextToken();   int res = 0;   for (int i = 0; i < s.length(); i++) {    for (int j = i + 1; j < s.length(); j++) {     int k = 0;     while (k < s.length() - j && s.charAt(i + k) == s.charAt(j + k)) {      k++;     }     res = Math.max(res, k);    }   }   PrintWriter pw = new PrintWriter(System.out);   pw.println(res);   pw.close();  }  String nextToken() throws IOException {   while (!st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return st.nextToken();  } }
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); } }
6	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];    for(int i=0;i<A.length;i++){     A[i][0]=Int();     A[i][1]=Int()-1;    }    Arrays.sort(A,(a,b)->{     return a[1]-b[1];    });    Solution sol=new Solution(out);    sol.solution(A,k);   }   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){   long res=0;   int n=A.length;   long dp1[][]=new long[n+1][T+1];   long dp2[][][]=new long[n+1][n+1][T+1];   dp3=new long[n+1][n+1][n+1][3];      long f[]=new long[n+1];   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;   for(int i=0;i<A.length;i++){    int p=A[i][0],type=A[i][1];    if(type==0){     long newdp[][]=new long[dp1.length][dp1[0].length];     for(int cnt=1;cnt<=n;cnt++){      for(int j=1;j<dp1[0].length;j++){       if(j>=p){        newdp[cnt][j]+=dp1[cnt-1][j-p];        newdp[cnt][j]%=mod;       }      }     }     for(int cnt=0;cnt<=n;cnt++){      for(int j=0;j<dp1[0].length;j++){       newdp[cnt][j]+=dp1[cnt][j];       newdp[cnt][j]%=mod;      }     }     dp1=newdp;    }    else{     break;    }   }     dp2[0][0][0]=1;   for(int i=0;i<A.length;i++){    int p=A[i][0],type=A[i][1];    if(type!=0){     long newdp[][][]=new long[dp2.length][dp2[0].length][dp2[0][0].length];     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){           newdp[a][b][j]+=dp2[a-1][b][j-p];          }         }         else{          if(b-1>=0) {           newdp[a][b][j]+=dp2[a][b-1][j-p];          }         }        }        newdp[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++){        newdp[a][b][j]+=dp2[a][b][j];        newdp[a][b][j]%=mod;       }      }     }     dp2=newdp;    }   }    dp3[1][0][0][0]=1;   dp3[0][1][0][1]=1;   dp3[0][0][1][2]=1;   dfs(n,n,n,0);dfs(n,n,n,1);dfs(n,n,n,2);       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(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;  } }
2	public class R489C { static long MOD=(long)1e9+7; public static void main(String[] args) {  Scanner scan=new Scanner(System.in);  long n=scan.nextLong(), k=scan.nextLong();  if(n==0) {  System.out.println(0);  return;  }  long x=2*n-1;  long e=exp(2,k);  System.out.println((x%MOD*e%MOD+1)%MOD); } public static long exp(long x, long e) {  long res=1;    while (e>0) {  if(e%2==1) res=(res*x)%MOD;    e/=2;  x=(x*x)%MOD;  }  return res; } }
1	public class Main {  public static void main(String[] args) {   ConsoleIO io = new ConsoleIO();   new Main(io).solve();   io.close();  }  ConsoleIO io;  Main(ConsoleIO io) {   this.io = io;  }  ArrayList<ArrayList<Integer>> gr;  boolean[] visit;  class Edge {   public Edge(int u, int v, int c) {    this.u = u;    this.v = v;    this.c = c;   }   public int u;   public int v;   public int c;  }  long MOD = 1_000_000_007;  int N, M, K;  double[][] map;  public void solve() {   String s = io.readLine();   N = Integer.parseInt(s);   char[] a = io.readLine().toCharArray();   int[] look = new int[256];   Arrays.fill(look, 10000);   int k = 0;   for (int i = 0; i < a.length; i++) {    if (look[a[i]] == 10000) {     look[a[i]] = k;     k++;    }   }   int res = N;   long need = (1L << k) - 1;   long mask = 0;   int head = 0;   int tail = 0;   int[] c = new int[k];   while (head < a.length) {    while (head < a.length && mask != need) {     int v = look[a[head]];     if (c[v] == 0)      mask |= (1L << v);     c[v]++;     head++;    }    while (tail < head && mask == need) {     res = Math.min(res, head - tail);     int v = look[a[tail]];     c[v]--;     if (c[v] == 0)      mask ^= (1L << v);      tail++;    }   }   io.writeLine(res + "");  }   long gcd(long a, long b) {   if (a < b) return gcd(b, a);   if (b == 0) return a;   return gcd(b, a % b);  } } class ConsoleIO {  BufferedReader br;  PrintWriter out;  public ConsoleIO(){br = new BufferedReader(new InputStreamReader(System.in));out = new PrintWriter(System.out);}  public void flush(){this.out.flush();}  public void close(){this.out.close();}  public void writeLine(String s) {this.out.println(s);}  public void writeInt(int a) {this.out.print(a);this.out.print(' ');}  public void writeWord(String s){   this.out.print(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 long readLong() {   return Long.parseLong(this.readLine());  }  public long[] readLongArray() {   String[]n=this.readLine().trim().split("\\s+");long[]r=new long[n.length];   for(int i=0;i<n.length;i++)r[i]=Long.parseLong(n[i]);   return r;  }  public int[] readIntArray() {   String[]n=this.readLine().trim().split("\\s+");int[]r=new int[n.length];   for(int i=0;i<n.length;i++)r[i]=Integer.parseInt(n[i]);   return r;  }  public int[] readIntArray(int n) {   int[] res = new int[n];   char[] all = this.readLine().toCharArray();   int cur = 0;boolean have = false;   int k = 0;   boolean neg = false;   for(int i = 0;i<all.length;i++){    if(all[i]>='0' && all[i]<='9'){     cur = cur*10+all[i]-'0';     have = true;    }else if(all[i]=='-') {     neg = true;    }    else if(have){     res[k++] = neg?-cur:cur;     cur = 0;     have = false;     neg = false;    }   }   if(have)res[k++] = neg?-cur:cur;   return res;  }  public int readInt() {   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 void writeIntArray(int[] a) {   StringBuilder sb = new StringBuilder();   for (int i = 0; i < a.length; i++) {if (i > 0) sb.append(' ');sb.append(a[i]);}   this.writeLine(sb.toString());  } } class Pair {  public Pair(int a, int b) {this.a = a;this.b = b;}  public int a;  public int b; } class Tri {  public Tri(int a, int b, int c) {this.a = a;this.b = b;this.c = c;}  public int a;  public int b;  public int c; } class PairLL {  public PairLL(long a, long b) {this.a = a;this.b = b;}  public long a;  public long b; }
6	public class E {  public static void main(String[] args) throws Exception {   new Thread(null ,new Runnable(){    public void run(){     try{solveIt();} catch(Exception e){e.printStackTrace(); System.exit(1);}    }   },"Main",1<<28).start();  }  static int dp[][], a[][], rows, cols;  public static void solveIt() throws Exception {   FastReader in = new FastReader(System.in);   PrintWriter pw = new PrintWriter(System.out);   int test = in.nextInt();   for (int t = 1; t <= test; t++) {    rows = in.nextInt();    cols = in.nextInt();    dp = new int[cols][1 << rows];    for (int x[] : dp) Arrays.fill(x, -1);    a = new int[cols][rows];    for (int i = 0; i < rows; i++) {     for (int j = 0; j < cols; j++) {      a[j][i] = in.nextInt();     }    }    debug(a);    pw.println(solve(0, 0));   }   pw.close();  }  static int solve(int pos, int mask) {   if (pos >= cols) return 0;   if (dp[pos][mask] != -1) return dp[pos][mask];   int res = 0;   for (int i = 0; i < rows; i++) {    for (int k = 0; k < (1 << rows); k++) {     if ((mask & k) != 0) continue;     int sum = 0;     for (int bit = 0; bit < rows; bit++) {      if (check(k, bit)) sum += a[pos][bit];     }     res = max(res, sum + solve(pos + 1, mask | k));    }    cyclicShift(pos);   }   return dp[pos][mask] = res;  }  static boolean check(int N, int pos) {   return (N & (1 << pos)) != 0;  }  static void cyclicShift(int col) {   int m = a[col].length;   int last = a[col][m - 1];   for (int i = m - 1; i >= 1; i--) {    a[col][i] = a[col][i - 1];   }   a[col][0] = last;  }  static void debug(Object... obj) {   System.err.println(Arrays.deepToString(obj));  }  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 boolean isSpaceChar(int c) {    return !(c >= 33 && c <= 126);   }   private boolean isEndOfLine(int c) {    return c == '\n' || c == '\r' || c == -1;   }   public int skip() {    int b;    while ((b = readByte()) != -1 && isSpaceChar(b)) ;    return b;   }   public String next() {    int b = skip();    StringBuilder sb = new StringBuilder();    while (!(isSpaceChar(b))) {     sb.appendCodePoint(b);     b = readByte();    }    return sb.toString();   }    public String nextLine() {    int c = skip();    StringBuilder sb = new StringBuilder();    while (!isEndOfLine(c)) {     sb.appendCodePoint(c);     c = readByte();    }    return sb.toString();   }   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();    }   }   public long nextLong() {    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 << 3) + (num << 1) + (b - '0');     } else {      return minus ? -num : num;     }     b = readByte();    }   }   public double nextDouble() {    return Double.parseDouble(next());   }   public char[] next(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);   }   public char readChar() {    return (char) skip();   }  } }
5	public class Main{  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int produzeni = in.nextInt();   int devices = in.nextInt();   int stekovi = in.nextInt();   int [] filter = new int[produzeni];   for(int i = 0; i<produzeni; i++){    filter[i] = in.nextInt();   }   Arrays.sort(filter);   int filt_no = filter.length-1;   if(devices<=stekovi) {    System.out.println("0");    return;   }   int used = 0;   while(devices>stekovi){    try{    stekovi+=filter[filt_no--]-1;    }    catch(Exception e){     System.out.println("-1");     return;    }   }     System.out.println(filter.length - filt_no-1);         } }
6	public class E1 { static char [] in = new char [1000000]; public static void main (String [] arg) throws Throwable {  int t = nextInt();  C : for (int ii = 0; ii<t; ++ii) {  int n = nextInt();  int m = nextInt();  Pair [] P = new Pair [n*m];  int [][] g = new int [n][m];  for (int i = 0; i<n; ++i) {   for (int j = 0; j<m; ++j) {   g[i][j] = nextInt();   P[j + m*i] = new Pair (i, j, g[i][j]);   }  }  for (int i = 0; i<P.length; ++i) if (P[i] == null) continue C;  Arrays.sort(P);  HashSet<Integer> rotcols =new HashSet<Integer>();  for (int i = 0; i<n; ++i) {     rotcols.add(P[i].j);  }    if (n <= 3 || rotcols.size() >= 3) {     int sum = 0;   for (int i = 0; i<n && i < P.length; ++i) sum += P[i].L;   System.out.println(sum);  } else {     if (P.length > 4) rotcols.add(P[4].j);     int [] rot = new int [rotcols.size()];   int maxmax = 0;   A : while (true) {   for (int i = 0; i<rot.length; ++i) {    rot[i]++;    if (rot[i] == n) {    rot[i] = 0;    if (i == rot.length-1) break A;    } else {    break;    }   }   int [] max = new int [n];   for (int i = 0; i<n; ++i) {    int j = 0;    for (int col : rotcols) {    max[i] = Math.max(max[i], g[(i+rot[j])%n][col]);    j++;    }   }   int sum = 0;   for (int m2 : max) sum+= m2;   maxmax = Math.max(maxmax, sum);   }   System.out.println(maxmax);  }  } }                  static class Pair implements Comparable<Pair> {  int i,j;long L; public Pair(int xx, int yy, long LL){i=xx;j=yy;L=LL;}  public int compareTo(Pair p) { return (this.L > p.L) ? -1 : (this.L == p.L) ? this.i - p.i : 1;} }  public static long nextLong() throws Throwable {  long i = System.in.read();boolean neg = false;while (i < 33) i = System.in.read();if (i == 45) {neg=true;i=48;}i = i - 48;  int j = System.in.read();while (j > 32) {i*=10;i+=j-48;j = System.in.read();}return (neg) ? -i : i; } public static int nextInt() throws Throwable {return (int)nextLong();} public static String next() throws Throwable {  int i = 0; while (i < 33 && i != -1) i = System.in.read(); int cptr = 0; while (i >= 33) { in[cptr++] = (char)i; i = System.in.read();}  return new String(in, 0,cptr); }  public static long gcdL(long a, long b) {while (b != 0) {long tmp = b;b = (a % b);a = tmp;}return a;} public static int gcd(int a, int b) {while (b != 0) {int tmp = b;b = (a % b);a = tmp;}return a;} public static int[] sieve(int LIM) {  int i,count = 0;  boolean [] b = new boolean [LIM];  for (i = 2;i<LIM; ++i) if (!b[i]) {count++; for (int j = i<<1; j<LIM; j+=i) b[j] = true;}  int [] primes = new int[count];  for (i = 2,count=0;i<LIM;++i) if (!b[i]) primes[count++] = i;  return primes; } public static int[] numPrimeFactors(int LIM) {  int i,count = 0;  int [] b = new int [LIM];  for (i = 2;i<LIM; ++i) if (b[i] == 0) {count++; for (int j = i; j<LIM; j+=i) b[j]++;}  return b; } public static StringBuilder stringFromArray(int [] a) {  StringBuilder b = new StringBuilder(9*a.length);  for (int i = 0; i<a.length; ++i) {  if (i != 0) b = b.append(' ');  b = b.append(a[i]);  }  return b; } public static long modPow (long a, long n, long MOD) { long S = 1; for (;n > 0; n>>=1, a=(a*a)%MOD) if ((n & 1) != 0) S = (a*S) % MOD; return S;} }
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();  }  private static 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;  } }
1	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();  int d = in.nextInt();  Set<Integer> pts = new HashSet<>();  int[] x = in.nextIntArray(n);  for (int i = 0; i < n; i++) {   pts.add(x[i] - d);   pts.add(x[i] + d);  }  Set<Integer> ans = new HashSet<>();  for (int pt : pts) {   int min = (int) (1e9 + 10);   for (int i = 0; i < n; i++) {   min = Math.min(Math.abs(x[i] - pt), min);   }   if (min >= d) {   ans.add(pt);   }  }  out.println(ans.size());  }  }  static class InputReader {  private InputStream stream;  private byte[] buf = new byte[1 << 13];  private int curChar;  private int numChars;  public InputReader(InputStream stream) {  this.stream = stream;  }  public int read() {  if (this.numChars == -1) {   throw new UnknownError();  } else {   if (this.curChar >= this.numChars) {   this.curChar = 0;    try {    this.numChars = this.stream.read(this.buf);   } catch (IOException ex) {    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;  }  public int[] nextIntArray(int n) {  int[] arr = new int[n];  for (int i = 0; i < n; i++) {   arr[i] = nextInt();  }  return arr;  }  } }
3	public class Main { long MOD = 1000000007; InputReader in; BufferedReader br; PrintWriter out;  public static void main(String[] args) throws java.lang.Exception {  Main solver = new Main();  solver.in = new InputReader(System.in);  solver.br = new BufferedReader(new InputStreamReader(System.in));  solver.out = new PrintWriter(System.out);  solver.solve();  solver.out.flush();  solver.out.close(); }  public void solve() {  int tc = 1;  for (int cas = 1; cas <= tc; cas++) {  int N = in.readInt();  int[] A = new int[N];  in.readInt(A);   int res = 0;  for(int i=0;i<N;i++){   for(int j=i+1;j<N;j++){   if(A[i]>A[j])    res++;   }  }  res = res % 2;    int Q = in.readInt();  while(Q-->0){   int l = in.readInt();   int r = in.readInt();   int add = (r-l+1)/2;   res = res + add;   res%=2;   out.println(res%2==0?"even":"odd");  }  }  } } 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 void readInt(int[] A) {  for (int i = 0; i < A.length; i++)  A[i] = readInt(); }  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 void readLong(long[] A) {  for (int i = 0; i < A.length; i++)  A[i] = readLong(); }  public double readDouble() {  int c = read();  while (isSpaceChar(c))  c = read();  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.') {  if (c == 'e' || c == 'E')   return res * Math.pow(10, readInt());  if (c < '0' || c > '9')   throw new InputMismatchException();  res *= 10;  res += c - '0';  c = read();  }  if (c == '.') {  c = read();  double m = 1;  while (!isSpaceChar(c)) {   if (c == 'e' || c == 'E')   return res * Math.pow(10, readInt());   if (c < '0' || c > '9')   throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();  }  }  return res * sgn; }  public char[] readCharA() {  return readString().toCharArray(); }  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); } }
0	public class A {  public static void main(String[]args) {   Scanner in = new Scanner(System.in);   long l = in.nextLong();   long r = in.nextLong();   if(r - l < 2) System.out.println(-1);   else {    if(l % 2 == 0)     System.out.println(l + " " + (l+1) + " " + (l+2));    else {     if(r - l < 3) System.out.println(-1);     else      System.out.println((l+1) + " " + (l+2) + " " + (l+3));    }   }  } }
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); } }
4	public class Main {  public static void main(String[] args) throws IOException {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(new FileReader("input.txt"));   PrintWriter out = new PrintWriter("output.txt");   TaskB solver = new TaskB();   solver.solve(in, out);   out.close();  }  private static class TaskB {   static final long max = 1000000000000000000L;   static final double eps = 0.0000001;   static final long mod = 1000000007;   static int N, M, K;   static long X, Y;   static boolean F[][][];   static int D[][];   void solve(InputReader in, PrintWriter out) throws IOException {    N = in.nextInt();    M = in.nextInt();    K = in.nextInt();    F = new boolean[K][N][M];    D = new int[N][M];    for (int i = 0; i < N; i++)     for (int j = 0; j < M; j++)      D[i][j] = Integer.MAX_VALUE;    List<Pair> list = new ArrayList<>();    for (int i = 0; i < K; i++) {     list.add(new Pair(in.nextInt() - 1, in.nextInt() - 1));    }     for (int i = 0; i < N; i++)     for (int j = 0; j < M; j++)      for (int k = 0; k < K; k++)       D[i][j] = Math.min(D[i][j], Math.abs(list.get(k).X - i) + Math.abs(list.get(k).Y - j));     int res = Integer.MIN_VALUE;    for (int j = 0; j < N; j++)     for (int k = 0; k < M; k++)      if (D[j][k] > res) {       X = j + 1;       Y = k + 1;       res = D[j][k];      }    out.println(X + " " + Y);   }   void bfs(int K, Pair P) {    Queue<Pair> Q = new LinkedList<>();    F[K][P.X][P.Y] = true;    D[P.X][P.Y] = 0;    Q.add(P);     while (!Q.isEmpty()) {     P = Q.poll();     int X = P.X;     int Y = P.Y;     if (check(X - 1, Y) && !F[K][X - 1][Y]) {      F[K][X - 1][Y] = true;      if (D[X - 1][Y] > D[X][Y] + 1) {       D[X - 1][Y] = D[X][Y] + 1;       Q.add(new Pair(X - 1, Y));      }     }     if (check(X + 1, Y) && !F[K][X + 1][Y]) {      F[K][X + 1][Y] = true;      if (D[X + 1][Y] > D[X][Y] + 1) {       D[X + 1][Y] = D[X][Y] + 1;       Q.add(new Pair(X + 1, Y));      }     }     if (check(X, Y - 1) && !F[K][X][Y - 1]) {      F[K][X][Y - 1] = true;      if (D[X][Y - 1] > D[X][Y] + 1) {       D[X][Y - 1] = D[X][Y] + 1;       Q.add(new Pair(X, Y - 1));      }     }     if (check(X, Y + 1) && !F[K][X][Y + 1]) {      F[K][X][Y + 1] = true;      if (D[X][Y + 1] > D[X][Y] + 1) {       D[X][Y + 1] = D[X][Y] + 1;       Q.add(new Pair(X, Y + 1));      }     }    }   }   boolean check(int X, int Y) {    return !(X < 0 || X >= N || Y < 0 || Y >= M);   }   class Pair {    int X, Y;    Pair(int X, int Y) {     this.X = X;     this.Y = Y;    }   }   long gcd(long A, long B) {    if (B == 0) return A;    return gcd(B, A % B);   }   boolean isPrime(long n) {    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))     return false;    for (long i = 5, j = 2; i * i <= n; i += j, j = 6 - j)     if (n % i == 0)      return false;    return true;   }   boolean isEqual(double A, double B) {    return Math.abs(A - B) < eps;   }   double dist(double X1, double Y1, double X2, double Y2) {    return Math.sqrt((X1 - X2) * (X1 - X2) + (Y1 - Y2) * (Y1 - Y2));   }   boolean nextPer(int[] data) {    int i = data.length - 1;    while (i > 0 && data[i] < data[i - 1]) {     i--;    }    if (i == 0) {     return false;    }    int j = data.length - 1;    while (data[j] < data[i - 1]) {     j--;    }    int temp = data[i - 1];    data[i - 1] = data[j];    data[j] = temp;    Arrays.sort(data, i, data.length);    return true;   }   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;    }   }  }  private static class InputReader {   StringTokenizer st;   BufferedReader br;   public InputReader(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }   public InputReader(FileReader s) throws FileNotFoundException {    br = new BufferedReader(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());   }   public long nextLong() {    return Long.parseLong(next());   }   public String nextLine() {    try {     return br.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public double nextDouble() {    return Double.parseDouble(next());   }   public boolean ready() {    try {     return br.ready();    } catch (IOException e) {     throw new RuntimeException(e);    }   }  } }
5	public class Solver {  StringTokenizer st;  BufferedReader in;  PrintWriter out;  public static void main(String[] args) throws NumberFormatException, IOException {   Solver solver = new Solver();   solver.open();   solver.solve();   solver.close();  }  public void open() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);  }  public String nextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  public int nextInt() throws NumberFormatException, IOException {   return Integer.parseInt(nextToken());  }  public long nextLong() throws NumberFormatException, IOException {   return Long.parseLong(nextToken());  }  public double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextToken());  }  public class result implements Comparable{   public int t = 0;   public int p = 0;     public result(int p,int t){    this.t = t;    this.p = p;   }   @Override   public int compareTo(Object o) {    result r = (result)o;    int out = r.p-p;    if (out==0) out = t-r.t;    return out;   }       }   public void solve() throws NumberFormatException, IOException {   int n = nextInt();   int k = nextInt();     result[] table = new result[n];     for (int i=0;i<n;i++){    int p = nextInt();    int t = nextInt();       table[i] = new result(p,t);   }     Arrays.sort(table);     int result = 1;   k--;     for (int i=k-1;i>=0 && table[i].p==table[k].p && table[i].t==table[k].t;i--){    result++;   }   for (int i=k+1;i<n && table[i].p==table[k].p && table[i].t==table[k].t;i++){    result++;   }   out.println(result);  }  public void close() {   out.flush();   out.close();  } }
4	public class C35C_BFS_Fire {  public static boolean[][] burning;  public static LinkedList<int[]> LitTrees;  public static int N, M;  public static int[] lastTree;  public static void main(String[] args) throws IOException {        BufferedReader input = new BufferedReader(new FileReader("input.txt"));  PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));   StringTokenizer dataR = new StringTokenizer(input.readLine());   N = Integer.parseInt(dataR.nextToken());   M = Integer.parseInt(dataR.nextToken());   burning = new boolean[N+1][M+1];   StringTokenizer dataR1 = new StringTokenizer(input.readLine());   int K = Integer.parseInt(dataR1.nextToken());   StringTokenizer dataR2 = new StringTokenizer(input.readLine());   LitTrees = new LinkedList<int[]>();   for (int j = 0; j < K; j++){    int x = Integer.parseInt(dataR2.nextToken());    int y = Integer.parseInt(dataR2.nextToken());    int[] coord = {x, y};    LitTrees.add(coord);    burning[x][y] = true;   }           spread();      out.println(lastTree[0] + " " + lastTree[1]);   out.close();  }  public static void spread(){   while(!LitTrees.isEmpty()){    int[] studying = LitTrees.removeFirst();    int[] studying1 = {studying[0]-1, studying[1]};    int[] studying2 = {studying[0], studying[1]-1};    int[] studying3 = {studying[0], studying[1]+1};    int[] studying4 = {studying[0]+1, studying[1]};    if (studying1[0] >= 1 && !burning[studying1[0]][studying1[1]]){     LitTrees.add(studying1);     burning[studying1[0]][studying1[1]] = true;    }    if (studying2[1] >= 1 && !burning[studying2[0]][studying2[1]]){     LitTrees.add(studying2);     burning[studying2[0]][studying2[1]] = true;    }    if (studying3[1] < M+1 && !burning[studying3[0]][studying3[1]]){     LitTrees.add(studying3);     burning[studying3[0]][studying3[1]] = true;    }    if (studying4[0] < N+1 && !burning[studying4[0]][studying4[1]]){     LitTrees.add(studying4);     burning[studying4[0]][studying4[1]] = true;    }    lastTree = studying;   }    }    public static boolean ExistsAliveTree() {   if (LitTrees.size() == N*M){    return false;   } else{    return true;   }  } }
4	public class D {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   int t = 1;   for (int i = 0; i < t; i++) {    solve(sc, pw);   }   pw.close();  }  static void solve(Scanner in, PrintWriter out){   int n = in.nextInt(), m = in.nextInt(), k = in.nextInt();   int[][] ri = new int[n][m - 1];   int[][] dn = new int[n - 1][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m - 1; j++) {     ri[i][j] = in.nextInt();    }   }   for (int i = 0; i < n - 1; i++) {    for (int j = 0; j < m; j++) {     dn[i][j] = in.nextInt();    }   }   long[][][] dp = new long[n][m][k + 1];   if (k % 2 == 1){    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      out.print(-1 +" ");     }     out.println();    }   }else{    for (int l = 2; l <= k; l += 2) {     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       long dm = Long.MAX_VALUE;       if (i > 0){        int pi = i - 1, pj = j;        dm = Math.min(dm, dp[pi][pj][l - 2] + dn[pi][pj] * 2);       }       if (j > 0){        int pi = i ,pj = j - 1;        dm = Math.min(dm, dp[pi][pj][l - 2] + ri[pi][pj] * 2);       }       if (i < n - 1){        dm = Math.min(dm, dp[i + 1][j][l - 2] + dn[i][j] * 2);       }       if (j < m - 1){        dm = Math.min(dm, dp[i][j + 1][l - 2] + ri[i][j] * 2);       }       dp[i][j][l] = dm;      }     }    }    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      if (dp[i][j][k] == Long.MAX_VALUE){       out.print(-1 +" ");      }else{       out.print(dp[i][j][k] +" ");      }     }     out.println();    }   }   }  static boolean isPrime(long n)  {     if (n <= 1)    return false;   if (n <= 3)    return true;        if (n % 2 == 0 || n % 3 == 0)    return false;   for (int i = 5; i * i <= n; i = i + 6)    if (n % i == 0 || n % (i + 2) == 0)     return false;   return true;  }  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;  }  public static int[] sieveEratosthenes(int n) {   if (n <= 32) {    int[] primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31};    for (int i = 0; i < primes.length; i++) {     if (n < primes[i]) {      return Arrays.copyOf(primes, i);     }    }    return primes;   }   int u = n + 32;   double lu = Math.log(u);   int[] ret = new int[(int) (u / lu + u / lu / lu * 1.5)];   ret[0] = 2;   int pos = 1;   int[] isnp = new int[(n + 1) / 32 / 2 + 1];   int sup = (n + 1) / 32 / 2 + 1;   int[] tprimes = {3, 5, 7, 11, 13, 17, 19, 23, 29, 31};   for (int tp : tprimes) {    ret[pos++] = tp;    int[] ptn = new int[tp];    for (int i = (tp - 3) / 2; i < tp << 5; i += tp) ptn[i >> 5] |= 1 << (i & 31);    for (int j = 0; j < sup; j += tp) {     for (int i = 0; i < tp && i + j < sup; i++) {      isnp[j + i] |= ptn[i];     }    }   }        int[] magic = {0, 1, 23, 2, 29, 24, 19, 3, 30, 27, 25, 11, 20, 8, 4, 13, 31, 22, 28, 18, 26, 10, 7, 12, 21, 17, 9, 6, 16, 5, 15, 14};   int h = n / 2;   for (int i = 0; i < sup; i++) {    for (int j = ~isnp[i]; j != 0; j &= j - 1) {     int pp = i << 5 | magic[(j & -j) * 0x076be629 >>> 27];     int p = 2 * pp + 3;     if (p > n) break;     ret[pos++] = p;     if ((long) p * p > n) continue;     for (int q = (p * p - 3) / 2; q <= h; q += p) isnp[q >> 5] |= 1 << q;    }   }   return Arrays.copyOf(ret, pos);  }    public static long[] rdiv2(int n, int mod){   long[] arr = new long[n + 5];   arr[0] = 1;   long rev2 = (mod + 1) / 2;   for (int i = 1; i < n; i++) {    arr[i] = arr[i - 1] * rev2 % mod;   }   return arr;  }  static List<Integer> primeFactors(int n)  {     List<Integer> ls = new ArrayList<>();   if (n % 2 == 0) ls.add(2);   while (n%2==0)   {    n /= 2;   }        for (int i = 3; i <= Math.sqrt(n); i+= 2)   {       if (n % i == 0) ls.add(i);    while (n%i == 0)    {     n /= i;    }   }   if (n > 1) ls.add(n);   return ls;  } }
3	public final class EcRound35DApplication {  public static void main(String[] args) {  Input input = new Input();  input = SystemInput();  List<String> resultList = run(input);  for(String result:resultList){  System.out.println(result);  }  }   private static void tester(Integer no,List<Integer> inputList,List<String> answer) {  Input input = new Input();  input.setInput(inputList);  List<String> result = run(input);  if(result.equals(answer)) {  System.out.println("No." + no + ":OK");  }  else {  System.out.println("No." + no + ":failed");  System.out.println("result:" + result);  System.out.println("answer:" + answer);  } }   private static Input SystemInput() {  Input input = new Input();  Scanner sc = new Scanner(System.in);  List<Integer> inputList = new ArrayList<Integer>();  while(sc.hasNextInt()) {  inputList.add(sc.nextInt());  }  input.setInput(inputList);  sc.close();  return input; }   private static List<String> run(Input input) {  List<String> result = new ArrayList<String>();  List<Integer> permutation = input.getPermutationList();  Integer count;  count = inversion(permutation);  for(Integer i = 0;i < input.getQueryNum();i++) {  count = count + change(input.getQuery(i));   result.add(evenOdd(count));  }  return result; }   private static Integer inversion(List<Integer>permutation) {  String result = new String();  Integer inversionCount = 0;  for(Integer i = 0; i < permutation.size(); i++) {  for(Integer j = i + 1; j < permutation.size(); j++) {   if(permutation.get(i) > permutation.get(j)) {   inversionCount++;   }  }  }  return inversionCount;  }   private static Integer change(Query query) {  Integer result;  result = query.getLength() * (query.getLength() - 1) / 2;  return result; }   private static String evenOdd(Integer i) {  if(i % 2 == 0) {  return "even";  }  else {  return "odd";  } }   private static class Query{  private Integer l;  private Integer r;  public void setQuery(Integer l,Integer r) {  this.l = l;  this.r = r;  }  public Integer getL() {  return l;  }  public void setL(Integer l) {  this.l = l;  }  public Integer getR() {  return r;  }  public void setR(Integer r) {  this.r = r;  }  public Integer getLength(){  return r - l + 1;  }  }    private static class Input{  private Integer length;  private List<Integer> permutationList = new ArrayList<Integer>();  private Integer queryNum;  private List<Query> queryList = new ArrayList<Query>();  public void setInput(List<Integer> inputList) {  this.length = inputList.get(0);   setPermutationList(inputList.subList(1, length+1));   this.queryNum = inputList.get(length+1);   for(Integer j = length+2; j < inputList.size()-1; j = j + 2) {   addQueryList(inputList.get(j),inputList.get(j+1));  }   }  public void checkInput() {  System.out.println("permutation length:" + permutationList.size());   System.out.println("permutation:" + permutationList);   System.out.println("query length:" + queryList.size());  System.out.println("queries:");  for(Integer i = 0;i < queryList.size();i++) {   System.out.println(this.getQueryL(i) + " " + this.getQueryR(i));  }  }  public Integer getLength() {  return length;  }  public void setLength(Integer length) {  this.length = length;  }  public List<Integer> getPermutationList() {  return permutationList;  }  public void setPermutationList(List<Integer> permutationList) {  this.permutationList = permutationList;  }  public Integer getPermutation(Integer i) {  return permutationList.get(i);  }  public void addPermutationList(Integer newPermutation) {  this.permutationList.add(newPermutation);  }  public Integer getQueryNum() {  return queryNum;  }  public void setQueryNum(Integer queryNum) {  this.queryNum = queryNum;  }  public Query getQuery(Integer i) {  return queryList.get(i);  }  public Integer getQueryL(Integer i) {  return queryList.get(i).getL();  }  public Integer getQueryR(Integer i) {  return queryList.get(i).getR();  }  public List<Query> getQueryList() {  return queryList;  }  public void setQueryList(List<Query> queryList) {  this.queryList = queryList;  }  public void addQueryList(Query newQuery) {  this.queryList.add(newQuery);  }  public void addQueryList(Integer l,Integer r) {  Query newQuery = new Query();  newQuery.setQuery(l, r);  addQueryList(newQuery);  }  } }
3	public class D {  public static void main(String[] args) throws IOException {  Scanner sc=new Scanner(System.in);  int n=sc.nextInt();  int inv=0;  int []a=new int [n];  for(int i=0;i<n;i++)  a[i]=sc.nextInt();  for(int j=0;j<n;j++)  for(int i=j+1;i<n;i++)   if(a[j]>a[i])   inv=1-inv;  int m=sc.nextInt();  StringBuilder sb=new StringBuilder();  while(m-->0)  {  int l=sc.nextInt();  int r=sc.nextInt();  int s=r-l+1;  if(s*(s-1)/2%2==1)   inv=1-inv;  if(inv==1)   sb.append("odd\n");  else   sb.append("even\n");  }  System.out.print(sb);  } 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 long nextLong() throws IOException {return Long.parseLong(next());}  public String nextLine() throws IOException {return br.readLine();}   public double nextDouble() throws IOException  {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if(x.charAt(0) == '-')  {   neg = true;   start++;  }  for(int i = start; i < x.length(); i++)   if(x.charAt(i) == '.')   {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   }   else   {   sb.append(x.charAt(i));   if(dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg?-1:1);  }   public boolean ready() throws IOException {return br.ready();}  } }
0	public class Main {  public static void main(String[] args) throws IOException{  Scanner cin = new Scanner(System.in);   int t, n, m;   t = cin.nextInt();   while(t > 0) {  t--;  int sum = 0;  n = cin.nextInt();  m = cin.nextInt();  while(n > 0 && m > 0) {   if(n < m) {   int k = n;   n = m;   m = k;   }   sum += n / m; n %= m;  }    System.out.println(sum);  } } }
2	public class B {  public static void main(String[] args) {  doIt(); }  static void doIt() {  Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);  long n = sc.nextLong();  long k = sc.nextLong();  long msum = (k - 1) * k / 2 + 1;  long u = k;  long l = 0;  long m = (u + l) / 2;  while(l < u){  m = (u + l) / 2 + (u + l) % 2;  long sum = (m - 1) * m / 2;  if(n <= msum - sum) l = m;  else u = m - 1;  }  m = (u + l) / 2 + (u + l) % 2;  if(msum - (m - 1) * m / 2 < n) System.out.println(-1);  else System.out.println(k - m); } }
3	public class D {  public static void main(String[] args){  FastScanner scan = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int n = scan.nextInt();  int[] a = new int[n+1];  for(int i = 1; i <= n; i++) a[i] = scan.nextInt();  BIT bit = new BIT(n);  int p = 0;  for(int i = 1; i <= n; i++) {  p ^= bit.atOrAbove(a[i])&1;  bit.add(a[i], 1);  }  int m = scan.nextInt();  for(int i = 0; i < m; i++) {  int l = scan.nextInt(), r = scan.nextInt();  int s = r-l+1;  int in = s*(s-1)/2;  if((in&1) == 1) p ^= 1;  out.println(p==0?"even":"odd");  }  out.close(); }  static class BIT {  int[] a;  int n;  public BIT(int n) {  this.n = n;  a = new int[n+1];  }  public void add(int i, int val) {  while(i <= n) {   a[i] += val;   i += i & -i;  }  }  public int sum(int j)  {  int res = 0;  for(int i = j; i >= 1; i -= (i & -i)) res += a[i];  return res;  }  public int sum(int i, int j) {  return sum(j)-sum(i-1);  }  public int atOrAbove(int index) {  int sub = 0;  if (index > 0) sub = sum(index-1);  return sum(n) - sub;  } }  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 String nextLine() {  String line = "";  if(st.hasMoreTokens()) line = st.nextToken();  else try {return br.readLine();}catch(IOException e){e.printStackTrace();}  while(st.hasMoreTokens()) line += " "+st.nextToken();  return line;  }  public int[] nextIntArray(int n) {  int[] a = new int[n];  for(int i = 0; i < n; i++) a[i] = nextInt();  return a;  }  public long[] nextLongArray(int n){  long[] a = new long[n];  for(int i = 0; i < n; i++) a[i] = nextLong();  return a;  }  public double[] nextDoubleArray(int n){  double[] a = new double[n];  for(int i = 0; i < n; i++) a[i] = nextDouble();  return a;  }  public char[][] nextGrid(int n, int m){  char[][] grid = new char[n][m];  for(int i = 0; i < n; i++) grid[i] = next().toCharArray();  return grid;  } }  }
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]);     }    }   }   private static class Pair implements Comparable<TaskC.Pair> {    double x;    double y;    public Pair(double x, double y) {     this.x = x;     this.y = y;    }     public int compareTo(TaskC.Pair p) {     if (this.y - p.y < 0)      return 1;     return -1;    }   }  }  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;   }  } }
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 GraphUtils {   public static int calcNumMatchingBipartite(final int n, final int m, final List<Pair<Integer, Integer>> edges) {    final MatchingBipartiteSolver solver = new MatchingBipartiteSolver(n, m, edges);    return solver.solve();   }   private static class MatchingBipartiteSolver {    private final int n;    private final int m;    private final List<Integer>[] edges;    private final Integer[] match;    private final boolean[] visited;    public MatchingBipartiteSolver (final int n, final int m, final List<Pair<Integer, Integer>> edges) {     this.n = n;     this.m = m;     this.edges = new List[n];     for(int i = 0; i < n; ++i) {      this.edges[i] = CollectionFactory.createArrayList();     }     for(final Pair<Integer, Integer> edge: edges) {      this.edges[edge.first].add(edge.second);     }     match = new Integer[n + m];     visited = new boolean[n + m];    }    public int solve() {     int result = 0;     for(;;) {      Arrays.fill(visited, false);      int gain = 0;      for(int i = 0; i < n; ++i) {       if(match[i] == null && !visited[i] && tryMatch(i)) {        ++gain;       }      }      if(gain > 0) {       result += gain;      } else {       break;      }     }     return result;    }    private boolean tryMatch(final int i) {     visited[i] = true;     for(int j : edges[i]) {      if(!visited[j + n]) {       visited[j + n] = true;       final Integer k = match[j + n];       if(k == null || (!visited[k] && tryMatch(k))) {        match[j + n] = i;        match[i] = j + n;        return true;       }      }     }     return false;    }   }  }  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;    }   }   final public Vertex[] vertices;   final public 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 ModNumberUtils {   public static int add(int mod, int a, int b) {    a += b;    if(a >= mod) {     a -= mod;    }    return a;   }   public static int norm(int mod, int a) {    a %= mod;    if(a < 0) {     a += mod;    }    return a;   }   public static int mult(int mod, int a, int b) {    return (int)((long)a * b % mod);   }  }  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;   }  }   public static class NumberUtils {   public static interface Factorizer {    List<Integer> factorize(int number);   }      public static Factorizer createSmallNumberFactorizer(final int upperBound) {    return new SmallNumberFactorizer(upperBound);   }      private static class SmallNumberFactorizer implements Factorizer {    private int[] divisors;    private final int upperBound;    private boolean prepared = false;        public SmallNumberFactorizer(final int upperBound) {     this.upperBound = upperBound;    }    private synchronized void prepare() {     divisors = new int[upperBound];     Arrays.fill(divisors, 0);     for(int i = 2; i * i < upperBound; ++i) {      if(divisors[i] == 0) {       for(int j = i * i; j < upperBound; j += i) {        if(divisors[j] == 0) {         divisors[j] = i;        }       }      }     }     prepared = true;    }        public List<Integer> factorize(int number) {     synchronized (this) {      if(!prepared) {       prepare();      }     }     final List<Integer> result = CollectionFactory.createArrayList();     if(number < 2) return result;     if(number >= upperBound) throw new RuntimeException("number should be less than upper bound");     while(divisors[number] > 0) {      result.add(divisors[number]);      number /= divisors[number];     }     result.add(number);     return result;    }   }  }  public static class CollectionFactory {   public static<T> List<T> createArrayList() {    return new ArrayList<>();   }   public static<T> List<T> createArrayList(final int capacity) {    return new ArrayList<>(capacity);   }  }  public static class CollectionUtils {   public static<T> List<T> unique(final List<T> list) {    final List<T> result = CollectionFactory.createArrayList();    T p = null;    for(T elem : list) {     if(!elem.equals(p)) {      result.add(elem);      p = elem;     }    }    return result;   }   public static<T extends Comparable<T>> T max(final List<T> list, final T lowerBound) {    T result = lowerBound;    for(T elem : list) {     if(elem.compareTo(result) > 0) {      result = elem;     }    }    return result;   }  } }
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);   C909 solver = new C909();   solver.solve(1, in, out);   out.close();  }  static class C909 {   int N;   long MOD = 1_000_000_007;   boolean[] type;   long[][] memo;   long dp(int cmd, int dep) {       if (dep < 0) return 0;    if (cmd == N) return 1;    if (memo[cmd][dep] != -1) return memo[cmd][dep];    boolean safe = cmd == 0 ? true : !type[cmd - 1];    int d = type[cmd] ? 1 : 0;    long ways = 0;    if (!safe) {         ways += dp(cmd + 1, dep + d);     ways %= MOD;    } else {     ways += dp(cmd + 1, dep + d);     ways %= MOD;     ways += dp(cmd, dep - 1);     ways %= MOD;    }    return memo[cmd][dep] = ways;   }   public void solve(int testNumber, FastScanner s, PrintWriter out) {    N = s.nextInt();    type = new boolean[N];    for (int i = 0; i < N; i++) {     type[i] = s.next().charAt(0) == 'f';    }    memo = new long[N][N + 1];    for (long[] a : memo)     Arrays.fill(a, -1);    out.println(dp(0, 0));   }  }  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();   }  } }
6	public class Main implements Runnable { static class InputReader {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  private SpaceCharFilter filter;  private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  public InputReader(InputStream stream)  {  this.stream = stream;  }   public int read()  {  if (numChars==-1)   throw new InputMismatchException();    if (curChar >= numChars)  {   curChar = 0;   try   {   numChars = stream.read(buf);   }   catch (IOException e)   {   throw new InputMismatchException();   }     if(numChars <= 0)     return -1;  }  return buf[curChar++];  }   public String nextLine()  {  String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;  }  public int nextInt()  {  int c = read();    while(isSpaceChar(c))   c = read();    int sgn = 1;    if (c == '-')   {   sgn = -1;   c = read();  }    int res = 0;  do   {   if(c<'0'||c>'9')    throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  while (!isSpaceChar(c));     return res * sgn;  }   public long nextLong()  {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-')   {   sgn = -1;   c = read();  }  long res = 0;    do   {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  while (!isSpaceChar(c));   return res * sgn;  }   public double nextDouble()  {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-')   {   sgn = -1;   c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.')   {   if (c == 'e' || c == 'E')   return res * Math.pow(10, nextInt());   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  if (c == '.')   {   c = read();   double m = 1;   while (!isSpaceChar(c))   {   if (c == 'e' || c == 'E')    return res * Math.pow(10, nextInt());   if (c < '0' || c > '9')    throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();   }  }  return res * sgn;  }   public String readString()  {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do   {   res.appendCodePoint(c);   c = read();  }   while (!isSpaceChar(c));    return res.toString();  }   public boolean isSpaceChar(int c)  {  if (filter != null)   return filter.isSpaceChar(c);  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }   public String next()  {  return readString();  }   public interface SpaceCharFilter  {  public boolean isSpaceChar(int ch);  } }   public static void main(String args[]) throws Exception {  new Thread(null, new Main(),"Main",1<<26).start(); }  int findLSB(long n)  {   long value=-n&n;   return map.get(value);  } void findMaxClique(long mask,int size)  {   if(mask==0)   {    if(size>maxClique)     maxClique=size;    return;    }   while(mask>0)   {    if(Long.bitCount(mask)+size<=maxClique)     return;    int lsb=findLSB(mask);    mask=mask^((long)1<<lsb);    findMaxClique(mask&edges[lsb],size+1);   }  }  long edges[];  HashMap<Long,Integer> map=new HashMap<>();  int maxClique; public void run() {  InputReader sc= new InputReader(System.in);  PrintWriter w= new PrintWriter(System.out);   long value=1;   for(int i=0;i<45;i++)   {    map.put(value,i);    value*=2;   }   int n=sc.nextInt();  int k=sc.nextInt();   edges=new long[n];   for(int i=0;i<n;i++)   {    for(int j=0;j<n;j++)    {     long connect=sc.nextLong();     if(j>i&&connect==1)      edges[i]|=(connect<<j);    }   }   findMaxClique(((long)1<<n)-1,0);     double size=(double)maxClique;   double perCastle=(double)k/size;   double ans=perCastle*perCastle*(size*(size-1))/2;   w.print(ans);  w.close();  } }
2	public class Test {  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 1024 * 48);   BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));   String str = br.readLine();   StringTokenizer st = new StringTokenizer(str, " ");   long x = Long.parseLong(st.nextToken());   long k = Long.parseLong(st.nextToken());   if (x == 0) {    bw.write(0 + "\n");   } else {    int power = power(k, 1000000007);    long answer = (((power * 2) % 1000000007) * (x % 1000000007)) % 1000000007;    answer -= power - 1;    answer = (answer + 1000000007) % 1000000007;    bw.write(answer + "\n");   }   bw.flush();  }  public static int power(long a, int m) {   if (a == 0) {    return 1;   }   long pow = power(a / 2, m);   if (a % 2 == 1) {    return (int)(((pow * pow) % m) * 2) % m;   } else {    return (int)((pow * pow) % m);   }  } }
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 choose(int n, int k) {   return k < 0 || k > n ? 0 : choose[n][k];  }  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 int[] nextInts(int N) {    int[] res = new int[N];    for (int i = 0; i < N; i++) {     res[i] = (int) nextLong();    }    return res;   }   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;   }   public double[] nextDoubles(int N) {    double[] res = new double[N];    for (int i = 0; i < N; i++) {     res[i] = nextDouble();    }    return res;   }   public String next() {    StringBuilder res = new StringBuilder();    while (c <= 32) c = getChar();    while (c > 32) {     res.append(c);     c = getChar();    }    return res.toString();   }   public String nextLine() {    StringBuilder res = new StringBuilder();    while (c <= 32) c = getChar();    while (c != '\n') {     res.append(c);     c = getChar();    }    return res.toString();   }   public boolean hasNext() {    if (c > 32) return true;    while (true) {     c = getChar();     if (c == NC) return false;     else if (c > 32) return true;    }   }  }  static void ASSERT(boolean assertion, String message) {   if (!assertion) throw new AssertionError(message);  }  static void ASSERT(boolean assertion) {   if (!assertion) throw new AssertionError();  } }
5	public class Flatville {  public static void main( String args[] )  {   class SquareHouse implements Comparable<SquareHouse>   {    public SquareHouse( double posLeft, double sideLen )    {     _posLeft = posLeft;     _sideLen = sideLen;    }    public double posLeft()    { return _posLeft; }    public double posRight()    { return _posLeft + _sideLen; }    public int compareTo( SquareHouse house )    {     double dist = _posLeft - house.posLeft();     if ( dist < 0 )      return -1;     else if ( dist > 0 )      return 1;     else return 0;    }    private double _posLeft;    private double _sideLen;   }   Scanner scanner = new Scanner( System.in );      final int nHouses = scanner.nextInt();   final double sideLen = scanner.nextDouble();   ArrayList<SquareHouse> houses = new ArrayList<SquareHouse>();      for ( int iHouse = 0; iHouse < nHouses; ++iHouse )   {    double pos = scanner.nextDouble();    double size = scanner.nextDouble();    double posLeft = pos - size / 2.0;    houses.add( new SquareHouse( posLeft, size ) );   }      Collections.sort( houses );   int nPositions = 2;   for ( int iHouse = 0; iHouse < nHouses - 1; ++iHouse )   {    double space = houses.get( iHouse + 1 ).posLeft() - houses.get( iHouse ).posRight();    if ( sideLen < space )     nPositions += 2;    else if ( sideLen == space )     nPositions++;   }   out.println( nPositions );  } }
6	public class E {  static InputStream is;   public static void main(String[] args) throws IOException {  is = System.in;  int n = ni();  int k = ni();   int[][] aj = new int[n][n];   for (int i = 0; i < aj.length; i++) {  aj[i] = na(n);  }   int F = (n+1)/2;  int B = n-F;   int[] spanftf = new int[F];  int[] spanftb = new int[F];  for(int i =0; i < F; i++){  for(int j =0; j < F; j++){   if(i == j || aj[i][j] == 1){   spanftf[i] |= 1<<j;   }  }  for(int j =0; j< B; j++){   if(aj[i][F+j] == 1){   spanftb[i] |= 1<<j;   }  }  }  int[] maxes = new int[1<<B];  for(int bm = 0; bm < (1<<F); bm++){  int anded = (1<<F)-1;  int spanToBack = (1<<B)-1;    for(int i =0; i < F; i++){   if((1<<i & bm) != 0){   anded &= spanftf[i];   spanToBack &= spanftb[i];   }  }    if((anded & bm) == bm){   maxes[spanToBack] = Math.max(maxes[spanToBack], Integer.bitCount(bm));  }  }  int[] spanbtb = new int[B];  for(int i =0; i < B; i++){  for(int j =0; j< B; j++){   if(aj[F+i][F+j] == 1 || i == j){   spanbtb[i] |= 1<<j;   }  }  }  boolean[] isgood = new boolean[1<<B];  for(int bm =0; bm < (1<<B); bm++){  int anded = (1<<B)-1;    for(int i =0; i < B; i++){   if((1<<i & bm) != 0){   anded &= spanbtb[i];   }  }    if((anded & bm) == bm){   isgood[bm] = true;  }    }  bybc[] tosort = new bybc[1<<B];  for (int i = 0; i < tosort.length; i++) {  tosort[i]= new bybc(i);  }  Arrays.sort(tosort);   int best = 1;  for (int i = 0; i < tosort.length; i++) {  int at =tosort[i].mask;  if(isgood[at]){   best = Math.max(best, maxes[at]+Integer.bitCount(at));  }    for(int j =0; j < B; j++){   if((1<<j & at) != 0){   int to = at - (1<<j);   maxes[to] = Math.max(maxes[to], maxes[at]);   }  }    }      double ans= best*(best-1)/2.0 * (k*k/(double)(best*best));  System.out.println(ans); }  static class bybc implements Comparable<bybc>{  int mask;  public bybc(int mask) {  super();  this.mask = mask;  }   @Override  public int compareTo(bybc o) {  return Integer.bitCount(o.mask) - Integer.bitCount(mask);  } }  private static byte[] inbuf = new byte[1024]; public static int lenbuf = 0, ptrbuf = 0;  private static 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 static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private static int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }  private static double nd() { return Double.parseDouble(ns()); } private static char nc() { return (char)skip(); }  private static String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private static 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 static char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private static int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private static 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 static 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 A{  void solve(){   int n=ni();   int P[]=new int[n+1];   for(int i=1;i<=n;i++) P[i]=ni();   a=new int[n+1];   BIT=new long[n+1];   long cnt=0;    long p=0;   for(int i=n;i>=1;i--){    p+=querry(P[i]);    if(p>=M) p%=M;    update(n,P[i],1);   }   int d=0;   if(p%2==0) d=1;   int m=ni();   while(m-->0){    int l=ni(),r=ni();    long sz=r-l+1;    sz=(sz*(sz-1))/2;    if(d==1 && sz%2==0) d=1;    else if(d==1 && sz%2!=0) d=0;    else if(d==0 && sz%2==0) d=0;    else if(d==0 && sz%2!=0) d=1;    if(d==1) pw.println("even");    else pw.println("odd");   }  }  int a[];  long BIT[];  void update(int n,int x,int val){   a[x]=val;   for(;x<=n;x+=(x&-x)) BIT[x]+=val;  }  long querry(int x){   long ans=0;   for(;x>0;x-=(x&-x)) ans+=BIT[x];   return ans;  }  static long d, x, y;  static void extendedEuclid(long A, long B) {   if(B == 0) {    d = A;    x = 1;    y = 0;   }   else {    extendedEuclid(B, A%B);    long temp = x;    x = y;    y = temp - (A/B)*y;   }  }  static long modInverse(long A, long M)  {   extendedEuclid(A,M);   return (x%M+M)%M;  }  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 double nd() { return Double.parseDouble(ns()); }  private char nc() { return (char)skip(); }  private String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b))){    sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }  private char[] ns(int n) {   char[] buf = new char[n];   int b = skip(), p = 0;   while(p < n && !(isSpaceChar(b))){    buf[p++] = (char)b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }  private char[][] nm(int n, int m) {   char[][] map = new char[n][];   for(int i = 0;i < n;i++)map[i] = ns(m);   return map;  }  private int[] na(int n) {   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = ni();   return a;  }  private int ni() {   int num = 0, b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private long nl() {   long num = 0;   int b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); } }
0	public class Sub { public static void main(String[] args) {  Scanner scan=new Scanner(System.in);  int noOfPairs=scan.nextInt();  while(noOfPairs-->0)  {  int x=scan.nextInt();  int y=scan.nextInt();  int res=0;  while(x!=0&&y!=0)  {   if(x>y)    {   res+=x/y;   x=x%y;   }   else    {   res+=y/x;   y=y%x;   }  }  System.out.println(res);  }  scan.close(); } }
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");  }  }
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;  } }
5	public class Solution{   void solve()throws Exception  {   int n=nextInt();   int[]a=new int[n];   for(int i=0;i<n;i++)    a[i]=nextInt();   ArrayList<Integer>list=new ArrayList<Integer>();   for(int i=0;i<n;i++)    list.add(a[i]);   Collections.shuffle(list);   int[]b=new int[n];   for(int i=0;i<n;i++)    b[i]=list.get(i);   Arrays.sort(b);   int cnt=0;   for(int i=0;i<n;i++)    if(a[i]!=b[i])     cnt++;   if(cnt<=2)    System.out.println("YES");   else    System.out.println("NO");  }  private void mySort(int[] a) {   if(a.length<=1)    return;   int n=a.length;   int[]left=new int[n/2];   int[]right=new int[n-n/2];   for(int i=0;i<n;i++)    if(i<left.length)     left[i]=a[i];    else     right[i-left.length]=a[i];   mySort(left);   mySort(right);   int i=0;   int j=0;   while (i<left.length || j<right.length)   {    if(i==left.length)     a[i+j]=right[j++];    else if(j==right.length)     a[i+j]=left[i++];    else if(left[i]<right[j])     a[i+j]=left[i++];    else     a[i+j]=right[j++];   }  }    BufferedReader reader;  PrintWriter writer;  StringTokenizer stk;  void run()throws Exception  {   reader=new BufferedReader(new InputStreamReader(System.in));     stk=null;        solve();   reader.close();    }  int nextInt()throws Exception  {   return Integer.parseInt(nextToken());  }  long nextLong()throws Exception  {   return Long.parseLong(nextToken());  }  double nextDouble()throws Exception  {   return Double.parseDouble(nextToken());   }  String nextString()throws Exception  {   return nextToken();  }  String nextLine()throws Exception  {   return reader.readLine();  }  String nextToken()throws Exception  {   if(stk==null || !stk.hasMoreTokens())   {    stk=new StringTokenizer(nextLine());    return nextToken();   }   return stk.nextToken();  }  public static void main(String[]args) throws Exception  {   new Solution().run();  }     }
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));  } }
5	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader r = new BufferedReader(new InputStreamReader(System.in));     int n = Integer.parseInt(r.readLine());     String[] line = r.readLine().split("[ ]+");     int[] a = new int[n];   for(int i = 0; i < n; i++)    a[i] = Integer.parseInt(line[i]);        Arrays.sort(a);     boolean found = false;   for(int i = 0; i < n && !found; i++)    if(a[i] != 1)found = true;        if(found){    System.out.println(1);    for(int i = 1; i < n; i++)     System.out.println(a[i-1]);   }else{    for(int i = 0; i < n-1; i++)     System.out.println(1);    System.out.println(2);   }  } }
1	public class A{       private BufferedReader in;   private StringTokenizer st;     void solve() throws IOException{       int n = nextInt();    int i = 0;    int[]nums = new int[n];    int numeven = 0;    int numodd = 0;    while(n-->0){     nums[i] = nextInt();     if(nums[i]%2==0) numeven++;     else numodd++;     i++;    }    for (int j = 0; j < nums.length; j++) {     if(numeven==1&&nums[j]%2==0){      System.out.println(j+1); break;     }     if(numodd==1&&nums[j]%2!=0){      System.out.println(j+1); break;     }    }          }       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());   }   long nextLong() throws IOException {    return Long.parseLong(next());   }   double nextDouble() throws IOException {    return Double.parseDouble(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);   } }
2	public class CodeForces {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt();   int ans = 0;   long x = n;   x = x*(x+1)/2;   while (x!=k) {    x-=n;    n--;    ans++;    k++;   }   System.out.println(ans);  } }
1	public class C43 implements Runnable {  public Scanner in;  public PrintWriter out;  final static String TASK_NAME = "";  C43() throws IOException {   in = new Scanner( System.in );     out = new PrintWriter( System.out );  }  void close() throws IOException {   out.close();  }  public void run() {   try {    solve();    close();   } catch ( Exception e ) {    e.printStackTrace();   }  }  public void solve() throws IOException {   int n = in.nextInt();   char[] c = in.next().toCharArray();   int t = 0;   for ( int i = 0; i < n; i ++ ) {    if ( c[i] == 'T' ) {     t ++;    }   }   int ct = 0;   for ( int i = 0; i < t; i ++ ) {    if ( c[i] == 'T' ) {     ct ++;    }   }   int r = 0;   for ( int i = 0; i < n; i ++ ) {    r = Math.max( r, ct );    if ( c[i] == 'T' ) {     ct --;    }    if ( c[( i + t ) % n] == 'T' ) {     ct ++;    }   }   out.println( t - r );  }  public static void main( String[] args ) throws IOException {   new Thread( new C43() ).start();  } }
3	public class PaintTheNumers {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);      int nums = sc.nextInt();     HashSet<Integer> elements = new HashSet<Integer>();   for (int i = 0; i < nums; i++) {    elements.add(sc.nextInt());   }     ArrayList<Integer> sortedElements = new ArrayList<Integer>(elements);   Collections.sort(sortedElements);     ArrayList<Integer> lcms = new ArrayList<Integer>();     outer:   for (int i = 0; i < sortedElements.size(); i++) {    int ele = sortedElements.get(i);    for (int j = 0; j < lcms.size(); j++) {     if (ele % lcms.get(j) == 0) {      continue outer;     }    }    lcms.add(ele);   }   System.out.println(lcms.size());   sc.close();  } }
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");  }                                   }  private static 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);  } }  private static int getMaxSplit(long k) {  for (int i = 1;; ++i) {  if ((1L << (i + 1)) - 2 - i > k) {   return i - 1;  }  } }  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 nextLine() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isEndOfLine(c));  return res.toString();  }  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 double nextDouble() {  return Double.parseDouble(nextString());  }  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 printlnArray(int[] arr) {  printArray(arr);  writer.println();  }  public void printlnArray(long[] arr) {  printArray(arr);  writer.println();  }  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(); } }
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()); }  long nextLong() throws Exception {  return Long.parseLong(nextToken()); }  double nextDouble() throws Exception {  return Double.parseDouble(nextToken()); }  public static void main(String[] args) {  new B().run(); } }
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 String[] readArrayString(int n){  String[] array = new String[n];  for(int j =0 ;j<n;j++)  array[j] = sc.next();  return array; } static int[] readArrayInt(int n){  int[] array = new int[n];  for(int j = 0;j<n;j++)   array[j] = sc.nextInt();  return array;  } static int[] readArrayInt1(int n){  int[] array = new int[n+1];  for(int j = 1;j<=n;j++){  array[j] = sc.nextInt();  }  return array; } static long[] readArrayLong(int n){  long[] array = new long[n];  for(int j =0 ;j<n;j++)  array[j] = sc.nextLong();  return array; } static double[] readArrayDouble(int n){  double[] array = new double[n];  for(int j =0 ;j<n;j++)  array[j] = sc.nextDouble();  return array; } static int minIndex(int[] array){  int minValue = Integer.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } static int minIndex(long[] array){  long minValue = Long.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } static int minIndex(double[] array){  double minValue = Double.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } 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; } static void verdict(boolean a){   out.println(a ? "YES" : "NO");  }  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());   }   String nextLine() {    String str = "";    try{     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }    } }
4	public class P35C { public static void main(String[] args) throws FileNotFoundException {  InputStream inputStream = new FileInputStream("input.txt");  OutputStream outputStream = new FileOutputStream("output.txt");  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  Task solver = new Task();  solver.solve(in, out);  out.close(); }  static class Task {  private class Point {  int x, y;   public Point(int x, int y) {   this.x = x;   this.y = y;  }  }  private int dis(int i, int j, Point p2) {  return Math.abs(i - p2.x) + Math.abs(j - p2.y);  }  public void solve(InputReader in, PrintWriter out) {  int n = in.nextInt(), m = in.nextInt();  int k = in.nextInt();  Point[] ps = new Point[k];  for (int i = 0; i < k; i++) {   ps[i] = new Point(in.nextInt() - 1, in.nextInt() - 1);  }  int max = 0;  Point argmax = ps[0];  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   int val = dis(i, j, ps[0]);   for (int l = 1; l < k; l++) {    val = Math.min(val, dis(i, j, ps[l]));   }   if (val > max) {    max = val;    argmax = new Point(i, j);   }   }  }  out.println((argmax.x + 1) + " " + (argmax.y + 1));  } }  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 String nextLine() {  try {   return reader.readLine();  } catch (IOException e) {   throw new RuntimeException(e);  }  }  } }
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());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  String nextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return st.nextToken();  } }
6	public class D {  static boolean[][] adj;  static int n;  static int first;  public static void main(String[] args) throws IOException {   InputReader in = new InputReader();   n = in.nextInt();   int m = in.nextInt();   adj = new boolean[n][n];     dp = new long[1 << n][n];   for (int i = 0; i < m; i++) {    int f = in.nextInt() - 1;    int t = in.nextInt() - 1;    adj[f][t] = adj[t][f] = true;   }   boolean[] v = new boolean[1 << n];   long res = 0;   for (int f = 0; f < n; f++) {    first = f;    int cnt;    for (int i = 0; i < 1 << n; i+=(1<<first))     if ((i & (1 << first)) == 0)      for (int j = 0; j < n; j++)       dp[i][j] = -1;       for (int i = 0; i < 1 << n; i+= (1<<first)) {     cnt = Integer.bitCount(i);     if ((i & (1 << first)) == 0 && !v[i | (1 << first)] && cnt > 1) {      v[i | (1 << first)] = true;      res += solve(i, first, cnt);     }    }   }   System.out.println(res / 2);  }  static long[][] dp;  public static long solve(int msk, int lst, int cnt) {   if (cnt == 0)    return (adj[lst][first]) ? 1 : 0;   if (dp[msk][lst] != -1)    return dp[msk][lst];   long res = 0;   for (int i = 0; i < n; i++)    if (adj[lst][i] && (msk & (1 << i)) > 0)     res += solve(msk ^ (1 << i), i, cnt - 1);   return dp[msk][lst] = 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());   }  } }
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 void debug(Object... os) {  out.println(Arrays.deepToString(os)); }  private static 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);   } }
4	public class Pjar {  static int a[][];  public static void main(String[] args) throws FileNotFoundException {   Scanner in = new Scanner(new File("input.txt"));   PrintWriter out = new PrintWriter("output.txt");   int N = in.nextInt();   int 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] = Integer.MAX_VALUE;    }   }   int k = in.nextInt();   in.nextLine();   for (int i = 0; i < k; i++) {    int x = in.nextInt();    int y = in.nextInt();    a[x - 1][y - 1] = 1;    burn(x - 1, y - 1);   }   int max = Integer.MIN_VALUE;   int x = 0;   int y = 0;   for (int i = 0; i < N; i++) {    for (int j = 0; j < M; j++) {     if(a[i][j]>max){      max = a[i][j];      x = i+1;      y = j+1;     }    }   }   out.printf("%d %d",x,y);   out.close();   in.close();  }  static void burn(int i, int j) {   for(int k = 0;k<a.length;k++){    for(int l=0;l<a[k].length;l++){     if(a[k][l]>Math.abs(k-i) + Math.abs(l-j)){      a[k][l]=Math.abs(k-i) + Math.abs(l-j);     }    }   }  } }
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; }  int sqr(int x) { return x*x; }  long sqr(long x) { return x*x; }  double sqr(double x) { return x*x; }  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());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(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();  } }
1	public class B 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 B(), "", 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)); }  void debug(Object... objects){  if (ONLINE_JUDGE){  for (Object o: objects){   System.err.println(o.toString());  }  } }    public void run(){  try{  timeBegin = System.currentTimeMillis();  Locale.setDefault(Locale.US);    init();  solve();    out.close();  time();  }catch (Exception e){  e.printStackTrace(System.err);  System.exit(-1);  } }    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';  char readChar() throws IOException{  int intValue = in.read();   if (intValue == -1){  return NOT_A_SYMBOL;  }   return (char) intValue; }  char[] readCharArray() throws IOException{  return readLine().toCharArray(); }    int readInt() throws IOException {  return Integer.parseInt(readString()); }  int[] readIntArray(int size) throws IOException {  int[] array = new int[size];   for (int index = 0; index < size; ++index){  try {   array[index] = readInt();  } catch (Exception e) {   System.err.println(index);   return null;  }  }   return array; }  int[] readSortedIntArray(int size) throws IOException {  Integer[] array = new Integer[size];   for (int index = 0; index < size; ++index) {  array[index] = readInt();  }  Arrays.sort(array);   int[] sortedArray = new int[size];  for (int index = 0; index < size; ++index) {  sortedArray[index] = array[index];  }   return sortedArray; }  int[] readIntArrayWithDecrease(int size) throws IOException {  int[] array = readIntArray(size);   for (int i = 0; i < size; ++i) {  array[i]--;  }   return array; }    int[][] readIntMatrix(int rowsCount, int columnsCount) throws IOException {  int[][] matrix = new int[rowsCount][];   for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) {  matrix[rowIndex] = readIntArray(columnsCount);  }   return matrix; }  int[][] readIntMatrixWithDecrease(int rowsCount, int columnsCount) throws IOException {  int[][] matrix = new int[rowsCount][];   for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) {  matrix[rowIndex] = readIntArrayWithDecrease(columnsCount);  }   return matrix; }    long readLong() throws IOException{  return Long.parseLong(readString()); }  long[] readLongArray(int size) throws IOException{  long[] array = new long[size];   for (int index = 0; index < size; ++index){  array[index] = readLong();  }   return array; }    double readDouble() throws IOException{  return Double.parseDouble(readString()); }  double[] readDoubleArray(int size) throws IOException{  double[] array = new double[size];   for (int index = 0; index < size; ++index){  array[index] = readDouble();  }   return array; }     BigInteger readBigInteger() throws IOException {  return new BigInteger(readString()); }  BigDecimal readBigDecimal() throws IOException {  return new BigDecimal(readString()); }    Point readPoint() throws IOException{  int x = readInt();  int y = readInt();  return new Point(x, y); }  Point[] readPointArray(int size) throws IOException{  Point[] array = new Point[size];   for (int index = 0; index < size; ++index){  array[index] = readPoint();  }   return array; }    List<Integer>[] readGraph(int vertexNumber, int edgeNumber) throws IOException{  @SuppressWarnings("unchecked")  List<Integer>[] graph = new List[vertexNumber];   for (int index = 0; index < vertexNumber; ++index){  graph[index] = new ArrayList<Integer>();  }   while (edgeNumber-- > 0){  int from = readInt() - 1;  int to = readInt() - 1;    graph[from].add(to);  graph[to].add(from);  }   return graph; }    static class IntIndexPair {   static Comparator<IntIndexPair> increaseComparator = new Comparator<B.IntIndexPair>() {    @Override  public int compare(IntIndexPair indexPair1, IntIndexPair indexPair2) {   int value1 = indexPair1.value;   int value2 = indexPair2.value;     if (value1 != value2) return value1 - value2;     int index1 = indexPair1.index;   int index2 = indexPair2.index;     return index1 - index2;  }  };   static Comparator<IntIndexPair> decreaseComparator = new Comparator<B.IntIndexPair>() {    @Override  public int compare(IntIndexPair indexPair1, IntIndexPair indexPair2) {   int value1 = indexPair1.value;   int value2 = indexPair2.value;     if (value1 != value2) return -(value1 - value2);     int index1 = indexPair1.index;   int index2 = indexPair2.index;     return index1 - index2;  }  };   int value, index;  public IntIndexPair(int value, int index) {  super();  this.value = value;  this.index = index;  }    public int getRealIndex() {  return index + 1;  } }  IntIndexPair[] readIntIndexArray(int size) throws IOException {  IntIndexPair[] array = new IntIndexPair[size];   for (int index = 0; index < size; ++index) {  array[index] = new IntIndexPair(readInt(), index);  }   return array; }    static class OutputWriter extends PrintWriter {  final int DEFAULT_PRECISION = 12;   protected int precision;  protected 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);  }   public int getPrecision() {  return precision;  }  public void setPrecision(int precision) {  precision = max(0, precision);  this.precision = precision;    format = createFormat(precision);  formatWithSpace = format + " ";  }   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();  } }    static final int[][] steps = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};  static final int[][] steps8 = {  {-1, 0}, {1, 0}, {0, -1}, {0, 1},  {-1, -1}, {1, 1}, {1, -1}, {-1, 1} };  static final boolean check(int index, int lim){  return (0 <= index && index < lim); }    static final boolean checkBit(int mask, int bit){  return (mask & (1 << bit)) != 0; }    static final long getSum(int[] array) {  long sum = 0;  for (int value: array) {  sum += value;  }   return sum; }  static final Point getMinMax(int[] array) {  int min = array[0];  int max = array[0];   for (int index = 0, size = array.length; index < size; ++index, ++index) {  int value = array[index];    if (index == size - 1) {   min = min(min, value);   max = max(max, value);  } else {   int otherValue = array[index + 1];     if (value <= otherValue) {   min = min(min, value);   max = max(max, otherValue);   } else {   min = min(min, otherValue);   max = max(max, value);   }  }  }   return new Point(min, max); }    void solve() throws IOException {  int n = readInt();   int a = readInt();  int b = readInt();   Map<Integer, Integer> numbers = new HashMap<>();  int[] p = readIntArray(n);  for (int index = 0; index < n; ++index) {  numbers.put(p[index], index);  }   Set<Integer> used = new HashSet<Integer>();  Deque<Integer> q = new ArrayDeque<Integer>();   int[] answers = new int[n];  for (int i = 0; i < n; ++i) {  if (used.contains(p[i])) continue;    int leftSize = 0;  for (int number = p[i], cur = a, next = b;   numbers.containsKey(number) && !used.contains(number);   number = cur - number, cur = (a ^ b ^ cur), next = (a ^ b ^ next)) {   q.addFirst(number);   used.add(number);     ++leftSize;  }    for (int number = b - p[i], cur = a, next = b;   numbers.containsKey(number) && !used.contains(number);   number = cur - number, cur = (a ^ b ^ cur), next = (a ^ b ^ next)) {   q.addLast(number);   used.add(number);  }    int curColor = (leftSize & 1);  if ((q.size() & 1) == 1) {   int first = q.peekFirst();        if (curColor == 0 && (first << 1) == b    ||   curColor == 1 && (first << 1) == a) {   q.poll();      curColor ^= 1;      int firstIndex = numbers.get(first);   answers[firstIndex] = curColor;   } else {   int last = q.peekLast();         if (curColor == 0 && (last << 1) == a    ||    curColor == 1 && (first << 1) == b) {    q.poll();       int firstIndex = numbers.get(first);    answers[firstIndex] = curColor;   } else {    out.println("NO");    return;   }   }  }    while (q.size() > 0) {   int first = q.poll();   int second = q.poll();     int firstIndex = numbers.get(first);   int secondIndex = numbers.get(second);     answers[firstIndex] = curColor;   answers[secondIndex] = curColor;  }  }   out.println("YES");  for (int answer : answers) {  out.print(answer + " ");  }  out.println(); } }
5	public class Main {  class team implements Comparable<team>{   int pro,time;   public int compareTo(team oth) {    if(pro>oth.pro)     return -1;    if(pro==oth.pro&&time<oth.time)     return -1;       return 1;   }    }  Scanner scan=new Scanner(System.in);  void run(){   int n=scan.nextInt();   int k=scan.nextInt()-1;   team tm[]=new team[n];   for(int i=0;i<n;i++){    tm[i]=new team();    tm[i].pro=scan.nextInt();    tm[i].time=scan.nextInt();   }   Arrays.sort(tm);   int sum=0;     for(int i=k;i>=0;i--)    if(tm[i].pro==tm[k].pro&&tm[i].time==tm[k].time)     sum++;   for(int i=k;i<n;i++)    if(tm[i].pro==tm[k].pro&&tm[i].time==tm[k].time)     sum++;   System.out.println(sum-1);  }  public static void main(String args[]) {      new Main().run();  } }
5	public class A { static BufferedReader in; static PrintWriter out; static StringTokenizer st; static Random rnd;  void solve() throws IOException {  int n = nextInt();  int[] arr = new int[n];  Integer[] arrCopy = new Integer[n];  for (int i = 0; i < n; i++)  arr[i] = arrCopy[i] = nextInt();  Arrays.sort(arrCopy);  int bad = 0;  for (int i = 0; i < n; i++)  if (arr[i] != arrCopy[i])   ++bad;  boolean fail = bad > 2;  out.println(!fail ? "YES" : "NO"); }  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()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
0	public class A_122 { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(bf.readLine());  System.out.println((n%4==0||n%7==0||n%47==0||n%74==0||n%447==0||n%474==0||n%477==0||n%744==0||n%747==0||n%774==0)?"YES":"NO"); } }
6	public class D {  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][n];   for (int i = 1; i <= m; i++) {    int v1 = sc.nextInt();    int v2 = sc.nextInt();    v1--;    v2--;    a[v1][v2] = a[v2][v1] = 1;   }   long[][]dp = new long[1 << n][n];   for (int i = 0; i < n; i++) {    dp[1 << i][i] = 1;   }   for (int mask = 0; mask < (1 << n); mask++) {    if (Integer.bitCount(mask) > 1) {     for (int i = 0; i < n; i++) {      if (i==Integer.numberOfTrailingZeros(mask))       continue;      if ((mask & (1 << i)) != 0) {       for (int j = 0; j < n; j++) {        if ((mask & (1 << j)) != 0 && a[j][i]==1) {         dp[mask][i] += dp[(mask ^ (1 << i))][j];        }       }      }     }    }   }   long ans = 0;   for (int mask = 0; mask < (1 << n); mask++) {    if (Integer.bitCount(mask) >= 3) {     int t = Integer.numberOfTrailingZeros(mask);     for (int i = 0; i < n; i++) {      if (a[t][i]==1)       ans += dp[mask][i];     }    }   }   ans /= 2;   System.out.println(ans);  } }
1	public class Ideone { public static void main (String[] args) throws java.lang.Exception {  Scanner sc=new Scanner(System.in);  int n=sc.nextInt();  ArrayList<String> s1=new ArrayList<String> ();  ArrayList<String> s2=new ArrayList<String> ();  ArrayList<String> s3=new ArrayList<String> ();  int i;  for(i=0;i<n;i++)  s1.add(sc.next());   for(i=0;i<n;i++)  s2.add(sc.next());  s3.addAll(s2);  for(i=0;i<n;i++)  {  if(s2.contains(s1.get(i)))  s3.remove(s1.get(i));      } System.out.println(s3.size());   } }
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)); } }
1	public class Q3a {  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  in.nextLine();  String s = in.nextLine();  HashMap<Integer, Integer> seen = new HashMap<>();  for (int i = 0; i < n; i++) {  Character c = s.charAt(i);  int ci = (int) c.charValue();    seen.put(ci, seen.get(ci) == null ? 1 : seen.get(ci) + 1);  }  HashMap<Integer, Integer> sub = new HashMap<Integer, Integer>();  int start = 0;  int min = 10000000;  for (int i = 0; i < n; i++) {  Character c = s.charAt(i);  int ci = (int) c.charValue();   sub.put(ci, sub.get(ci) == null ? 1 : sub.get(ci) + 1);    while(sub.size() == seen.size()) {   min = Math.min(min, i - start + 1);   c = s.charAt(start);   start ++;   ci = (int) c.charValue();   if( sub.get(ci) == 1)    sub.remove(ci);   else   sub.put(ci, sub.get(ci) - 1);  }  }  System.out.print(min);    in.close(); } }
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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  }   }
0	public class Task5d {   public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  double a = sc.nextDouble();  double v = sc.nextDouble();  double l = sc.nextDouble();  double d = sc.nextDouble();  double w = sc.nextDouble();  double t = 0;  if (w >= v) {  double t1 = v / a;  double s1 = a * t1 * t1 / 2;  if (s1 > l) {   t = Math.sqrt(2 * l / a);  } else {   t = t1 + (l - s1) / v;  }  } else {  double t2 = Math.sqrt(2 * d / a);  if (a * t2 <= w) {   double t1 = v / a;   double s1 = a * t1 * t1 / 2;   if (s1 > l) {   t = Math.sqrt(2 * l / a);   } else {   t = t1 + (l - s1) / v;   }  } else {   double tup = v / a;   double tdown = (v - w) / a;   double sup = a * tup * tup / 2;   double sdown = v * tdown - a * tdown * tdown / 2;   if (sup + sdown <= d) {   double tmax = (d - sup - sdown) / v;   t = tup + tmax + tdown;     } else {   double tw = w / a;   double sw = a * tw * tw / 2;   double sl = (d - sw) / 2;   double dis = w * w + 2 * a * sl;   double tu1 = (- w - Math.sqrt(dis)) / a;   if (tu1 < 0) {    tu1 = (- w + Math.sqrt(dis)) / a;   }   t = tw + 2 * tu1;   }   double sreup = w * tdown + a * tdown * tdown / 2;   if (sreup <= l - d) {   t += tdown;   t += (l - d - sreup) / v;   } else {   double dis = w * w - 2 * a * (d - l);   double tu1 = (- w - Math.sqrt(dis)) / a;   if (tu1 < 0) {    tu1 = (- w + Math.sqrt(dis)) / a;   }   t += tu1;   }  }  }  System.out.println(t); } }
6	public class a implements Runnable{   public static void main(String[] args) {   new Thread(null, new a(), "process", 1<<26).start();  } public void run() {  FastReader scan = new FastReader();   PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));   Task solver = new Task();   int t = 1;  for(int i = 1; i <= t; i++) solver.solve(i, scan, out);  out.close(); }  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];  l:  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 long binpow(long a, long b, long m) {  a %= m;  long res = 1;  while (b > 0) {  if ((b & 1) == 1)   res = res * a % m;  a = a * a % m;  b >>= 1;  }  return res; } 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;  }  @Override  public int compareTo(tup o){  return Integer.compare(o.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());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  } } }
3	public class Main {  private static void solve() {  int n = ni();  String[] lines = new String[n];  for(int i = 0; i < n; i ++) {  lines[i] = next();  }  int mod = 1000000000 + 7;   long[][] dp = new long[2][n + 1];  dp[0][0] = 1;  for (int i = 0; i < n; i ++) {  int from = i % 2;  int to = (i + 1) % 2;  boolean flg = i == 0 || lines[i - 1].equals("s");  if (flg) {   long v = Arrays.stream(dp[from]).sum();   for (int j = 0; j <= n; j ++) {   dp[to][j] += v;   dp[to][j] %= mod;   v -= dp[from][j];   }  } else {   for (int j = 0; j < n; j ++) {   dp[to][j + 1] += dp[from][j];   dp[to][j + 1] %= mod;   }  }  Arrays.fill(dp[from], 0);  }  long ret = Arrays.stream(dp[n % 2]).sum() % mod;  System.out.println(ret); }   public static void main(String[] args) {  new Thread(null, new Runnable() {  @Override  public void run() {   long start = System.currentTimeMillis();   String debug = args.length > 0 ? args[0] : null;   if (debug != null) {   try {    is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));   } catch (Exception e) {    throw new RuntimeException(e);   }   }   reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);   solve();   out.flush();   tr((System.currentTimeMillis() - start) + "ms");  }  }, "", 64000000).start(); }  private static java.io.InputStream is = System.in; private static java.io.PrintWriter out = new java.io.PrintWriter(System.out); private static java.util.StringTokenizer tokenizer = null; private static 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(); }  private static double nd() {  return Double.parseDouble(next()); }  private static long nl() {  return Long.parseLong(next()); }  private static int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = ni();  return a; }  private static char[] ns() {  return next().toCharArray(); }  private static long[] nal(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)  a[i] = nl();  return a; }  private static int[][] ntable(int n, int m) {  int[][] table = new int[n][m];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   table[i][j] = ni();  }  }  return table; }  private static int[][] nlist(int n, int m) {  int[][] table = new int[m][n];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   table[j][i] = ni();  }  }  return table; }  private static int ni() {  return Integer.parseInt(next()); }  private static void tr(Object... o) {  if (is != System.in)  System.out.println(java.util.Arrays.deepToString(o)); } }
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 long nextLong() {    return Long.parseLong(next());   }   public int nextInt() {    return Integer.parseInt(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    st = null;    try {     return br.readLine();    } catch (Exception e) {     throw new RuntimeException();    }   }   public boolean endLine() {    try {     String next = br.readLine();     while (next != null && next.trim().isEmpty()) {      next = br.readLine();     }     if (next == null) {      return true;     }     st = new StringTokenizer(next);     return st.hasMoreTokens();    } catch (Exception e) {     throw new RuntimeException();    }   }  } }
4	public class FireAgain { static int n; static int m;  public static void main(String[] args) throws IOException {   BufferedReader r = new BufferedReader(new FileReader("input.txt"));  String s = r.readLine();  String[] sp = s.split(" ");  n = new Integer(sp[0]);  m = new Integer(sp[1]);  boolean[][] v = new boolean[n][m];  r.readLine();  s = r.readLine();  sp = s.split(" ");  Queue<Integer> q = new LinkedList<Integer>();  for (int i = 0; i < sp.length; i += 2) {  v[new Integer(sp[i]) - 1][new Integer(sp[i + 1]) - 1] = true;  q.add(new Integer(sp[i]) - 1);  q.add(new Integer(sp[i + 1]) - 1);  }  int[] dx = { 1, -1, 0, 0 };  int[] dy = { 0, 0, 1, -1 };  int lx = -1;  int ly = -1;  while (!q.isEmpty()) {  int x = q.remove();  int y = q.remove();  lx = x;  ly = y;  for (int i = 0; i < dy.length; i++) {   int nx = x + dx[i];   int ny = y + dy[i];   if (valid(nx, ny) && !v[nx][ny]) {   v[nx][ny] = true;   q.add(nx);   q.add(ny);   }  }  }  lx++;  ly++;  BufferedWriter wr=new BufferedWriter(new FileWriter("output.txt"));  wr.write(""+lx + " " + ly);  wr.newLine();  wr.close();   }  private static boolean valid(int nx, int ny) {  return nx >= 0 && nx < n && ny >= 0 && ny < m; } }
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 void shuffleArray(Object[] arr) {   Random r = new Random();   for (int i = 0; i < arr.length; ++i) {    Object tmp = arr[i];    int j = r.nextInt(arr.length);    arr[i] = arr[j];    arr[j] = tmp;   }  }  private void shuffleArray(int[] arr) {   Random r = new Random();   for (int i = 0; i < arr.length; ++i) {    int tmp = arr[i];    int j = r.nextInt(arr.length);    arr[i] = arr[j];    arr[j] = tmp;   }  }  private int[] nextArrayInt(int n) throws Exception {   int[] res = new int[n];   for (int i = 0; i < n; i++) {    res[i] = nextInt();   }   return res;  }  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();   }  }  private long[] getFirstSimpleNums(int n) {   boolean[] notPr = new boolean[n];   int res = n;   notPr[0] = true;   res--;   notPr[1] = true;   res--;   for (int i = 2; i < n; ++i) {    if (!notPr[i]) {     for (int j = i + i; j < n; j += i) {      if (!notPr[j]) {       notPr[j] = true;       res--;      }     }    }   }   long[] resA = new long[res];   int next = 0;   for (int i = 0; i < n; i++) {    if (!notPr[i]) {     resA[next] = i;     next++;    }   }   return resA;  }  private static class Pair {   int a;   int b;   public Pair(int a, int b) {    this.a = a;    this.b = b;   }   public static final Comparator<Pair> comparator = new Comparator<Pair>() {    @Override    public int compare(Pair pair1, Pair pair2) {     return (pair1.a - pair2.a) != 0 ? (pair1.a - pair2.a) : (pair1.b - pair2.b);    }   };   @Override   public String toString() {    return "{" + a + "|" + b + '}';   }  } }
0	public class A {  public void processInput() throws IOException {   Scanner in = new Scanner(System.in);   long n = in.nextLong();   long res = go(n);   System.out.printf(Locale.ENGLISH, "%d\n", res);   in.close();  }  public long go(long n) {   long res = n;   String str = String.valueOf(n);     StringBuilder sb = new StringBuilder(str);   sb.deleteCharAt(str.length() - 1);   if (sb.length() > 0 && !sb.toString().equals("-")) {    res = Math.max(res, Long.valueOf(sb.toString()));   }     if (str.length() > 1) {    if (str.charAt(str.length() - 2) != '-') {     sb = new StringBuilder(str);     sb.deleteCharAt(str.length() - 2);     res = Math.max(res, Long.valueOf(sb.toString()));    }   }     return res;  }  public static void main(String[] args) throws Exception {   A a = new A();   a.processInput();  } }
0	public class ProblemA{   public static void main(String[] args){   Scanner sc = new Scanner(System.in);   sc.next();   System.out.println(25);   sc.close();  } }
5	public class Main { public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String[] in = br.readLine().split(" ");   int n=Integer.parseInt(in[0]),m=Integer.parseInt(in[1]),k=Integer.parseInt(in[2]);   StringTokenizer st = new StringTokenizer(br.readLine());  int[] caps = new int[n];  for (int i = 0; i < caps.length; i++) {  caps[i] = Integer.parseInt(st.nextToken());  }  Arrays.sort(caps);   int curSockets=k, neededLines=0;  int i = n-1;  while(curSockets<m && i>=0){  curSockets+=caps[i]-1;  neededLines++;  i--;  }  if(curSockets>=m)  System.out.println(neededLines);  else  System.out.println(-1); } }
0	public class MargariteBestPresent_1080B {  private static int f(int x) {  return (x%2==0)?x/2:(x-1)/2-x; }  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n,r,l;  n = sc.nextInt();  while(n-->0) {  l = sc.nextInt();  r = sc.nextInt();   System.out.println(f(r)-f(l-1));  }  sc.close(); } }
3	public class Solution {   public static void main(String[] args) {   class Pair {    int start;    int end;    public Pair(int start, int end) {     this.start = start;     this.end = end;    }   }   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[] array = new int[n];   for (int i=0; i<n; i++) array[i] = sc.nextInt();    int maxLen = 0;   int key = -1;   HashMap<Integer, List<Pair>> ans = new HashMap<>();   for (int i=0; i<n; i++){    int currSum = 0;    for (int j=i; j>=0; j--){     currSum = currSum + array[j];     if (!ans.containsKey(currSum)){      ans.put(currSum, new ArrayList<>());     }     List<Pair> pairs = ans.get(currSum);     if (pairs.size() == 0 || pairs.get(pairs.size()-1).end <= j){      pairs.add(new Pair(j+1, i+1));     }     if (pairs.size() > maxLen){      maxLen = pairs.size();      key = currSum;     }    }   }   System.out.println(maxLen);   for (Pair pair : ans.get(key)){    System.out.println(pair.start + " " + pair.end);   }  } }
1	public class A {  int n;  void run()throws IOException{  Scanner sc = new Scanner(new InputStreamReader(System.in));   n = sc.nextInt();  int i,tmp,even,odd,e,o;  even=odd=e=o=0;  for(i=1;i<=n;i++){  tmp = sc.nextInt();  if(tmp%2==0){   e++;   if(even==0) even=i;  } else{   o++;   if(odd==0) odd=i;  }  }  if(e>1) System.out.println(odd);  else System.out.println(even); }  public static void main(String[] args)throws IOException {  new A().run(); } }
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);  } }
5	public class A {  public static double EPS = .001;  public class House implements Comparable<House> {  int x;  int a;   public House(int mx, int ma) {  x = mx;  a = ma;  }  public int compareTo(House o) {  return x - o.x;  }   public double right() {  return (double)x + ((double)a)/2.0;  }   public double left() {  return (double)x - ((double)a)/2.0;  } }  public static void main(String[] args) {  new A().solve(); }   public void solve() {  Scanner in = new Scanner(System.in);   int n = in.nextInt();  int t = in.nextInt();   ArrayList<House> houses = new ArrayList<House>();   for(int i=0;i<n;i++) {  int x = in.nextInt();  int a = in.nextInt();  houses.add(new House(x,a));  }   Collections.sort(houses);     int total = 2;   for(int i=0;i<houses.size()-1;i++) {  House me = houses.get(i);  House next = houses.get(i+1);  double meright = me.right();  double nextleft = next.left();  double diff = nextleft - meright;  if(diff-EPS > ((double)t)) {   total += 2;  }  else if(diff+EPS > ((double)t)) {   total += 1;  }  }   System.out.println(total); }  }
3	public class mainA {  public static PrintWriter out = new PrintWriter(System.out);  public static FastScanner enter = new FastScanner(System.in);  public static void main(String[] args) throws IOException {   solve();   out.close();  }  public static boolean[] was;  private static void solve() throws IOException{   int n=enter.nextInt();   int[] arr=new int[n];   was=new boolean[n];   for (int i = 0; i <n ; i++) {    arr[i]=enter.nextInt();   }   Arrays.sort(arr);   int ans=0;   for (int i = 0; i <n ; i++) {    if(was[i]) continue;    find(i, arr);    ans++;   }   out.println(ans);  }  public static void find (int num, int[] arr){   for (int i = num+1; i <arr.length ; i++) {    if(arr[i]%arr[num]==0) was[i]=true;   }  }  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());   }   double nextDouble() throws IOException {    return Double.parseDouble(next());   }   char nextChar() throws IOException {    return (char) (br.read());   }   String nextLine() throws IOException {    return br.readLine();   }  } }
5	public class Test { static BufferedReader reader; static StringTokenizer tokenizer; static PrintWriter writer;  static int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  static long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  static double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  static String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  tokenizer = new StringTokenizer(reader.readLine());  }  return tokenizer.nextToken(); }  public static void main(String[] args) throws IOException {  reader = new BufferedReader(new InputStreamReader(System.in));  tokenizer = null;  writer = new PrintWriter(System.out);  solve();  reader.close();  writer.close(); }  private static void solve() throws IOException {  int n = nextInt();  int[] mas = new int[n];  int sum=0;  for(int i=0;i<n;i++)  {  mas[i]=nextInt();  sum+=mas[i];  }  Arrays.sort(mas);  int cs=0;  int res=0;  for(int i=n-1;i>=0;i--)  {  cs+=mas[i];  sum-=mas[i];  res++;  if(cs>sum)   break;  }  writer.println(res);  } }
1	public class Solution {  BufferedReader in;  PrintWriter out;  StringTokenizer st;  int n, k;  boolean[] prime;  int[] primes;  void sieve() {   prime = new boolean[n + 1];   Arrays.fill(prime, true);   prime[0] = prime[1] = false;   int cnt = 0;   for (int i = 2; i <= n; ++i)    if (prime[i]) {     ++cnt;     for (int j = i + i; j <= n; j += i)      prime[j] = false;    }   primes = new int[cnt];   cnt = 0;   for (int i = 0; i <= n; ++i)    if (prime[i])     primes[cnt++] = i;  }  void solve() throws IOException {   n = ni();   k = ni();   sieve();   int cnt = 0;   for (int i = 2; i <= n; ++i) {    if (!prime[i])     continue;    boolean ok = false;    for (int j = 0; j < primes.length - 1; ++j)     if (primes[j] + primes[j + 1] + 1 == i) {      ok = true;      break;     }    if (ok)     ++cnt;   }   if (cnt >= k)    out.println("YES");   else    out.println("NO");  }  public Solution() throws IOException {   Locale.setDefault(Locale.US);   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   solve();   in.close();   out.close();  }  String ns() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int ni() throws IOException {   return Integer.valueOf(ns());  }  long nl() throws IOException {   return Long.valueOf(ns());  }  double nd() throws IOException {   return Double.valueOf(ns());  }  public static void main(String[] args) throws IOException {   new Solution();  } }
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 long nl() throws IOException{return scan.nextLong();}  static double nd() throws IOException{return scan.nextDouble();}  static String ne() throws IOException{return scan.next();}  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+" ");}  static void psb(StringBuilder sb) throws IOException {pw.print(sb);}  public static void main(String[] args) {   new Thread(null,null,"BaZ",99999999)   {    public void run()    {     try     {      solve();     }     catch(Exception e)     {      e.printStackTrace();      System.exit(1);     }    }   }.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);  } }  static class MyFileReader            {   StringTokenizer st;   BufferedReader br;   MyFileReader() throws IOException   {    br = new BufferedReader(new FileReader("C://Users/Aman deep/Desktop/input.txt"));   }   String nextLine() throws IOException   {    return br.readLine();   }   String next() throws IOException   {    if(st==null || !st.hasMoreTokens())     st = new StringTokenizer(nextLine());    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());   }  }  static class MyFileReader1            {   StringTokenizer st;   BufferedReader br;   MyFileReader1() throws IOException   {    br = new BufferedReader(new FileReader("C://Users/Aman deep/Desktop/output.txt"));   }   String nextLine() throws IOException   {    return br.readLine();   }   String next() throws IOException   {    if(st==null || !st.hasMoreTokens())     st = new StringTokenizer(nextLine());    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());   }  } }
5	public class r220a { public static void main(String args[]) {  Scanner in =new Scanner(System.in);  int N = in.nextInt();  ArrayList<Integer> list = new ArrayList<Integer>();  ArrayList<Integer> sort = new ArrayList<Integer>();  for(int i = 0; i < N; i++) {  int k = in.nextInt();  list.add(k);  sort.add(k);  }   Collections.sort(sort);   int count = 0;  for(int i = 0; i < N; i++) {  if(sort.get(i).intValue() != list.get(i).intValue())   count++;  }  if(count != 2 && count != 0)  System.out.println("NO");  else  System.out.println("YES"); } }
3	public class Main extends PrintWriter {  static BufferedReader s = new BufferedReader(new InputStreamReader(System.in));   Main () { super(System.out); }  public static void main(String[] args) throws IOException{   Main d1=new Main ();d1.main();d1.flush();  }  void main() throws IOException {   BufferedReader s = new BufferedReader(new InputStreamReader(System.in));   StringBuffer sb = new StringBuffer();   StringBuffer sb1 = new StringBuffer();   PrintWriter out = new PrintWriter(System.out);   int t=1;   while(t-->0) {       String[] s1 = s();    int n = i(s1[0]);    long[] a=new long[n];    arr(a,n);    HashMap<Long,Integer>[] dp=new HashMap[n];     long[] presum=new long[n];    for(int i=0;i<n;i++){     if(i==0){      presum[i]=a[i];     }else{      presum[i]=a[i]+presum[i-1];     }    }HashMap<Long,TreeMap<Integer,Long> > tm=new HashMap<>();int ans=0;long maxsum=0;    for(int i=0;i<n;i++){     dp[i]=new HashMap<>();     for(int j=-1;j<i;j++){      long sum=0;      if(j==-1) sum=presum[i];else sum=presum[i]-presum[j];       if(tm.containsKey(sum)&&tm.get(sum).floorKey(j)!=null){       dp[i].put(sum,Math.max(dp[i].getOrDefault(sum,0),dp[tm.get(sum).floorKey(j)].getOrDefault(sum,0)+1));       if(dp[i].get(sum)>ans){        maxsum=sum;       }       ans=Math.max(ans,dp[i].get(sum));      }else if(dp[i].containsKey(sum)==false){       if(dp[i].getOrDefault(sum,0)<1) dp[i].put(sum,1);       if(dp[i].get(sum)>ans){        maxsum=sum;       }       ans=Math.max(ans,1);      }      long val=dp[i].getOrDefault(sum,0);        if(!tm.containsKey(sum)||tm.get(sum).floorKey(i-1)==null||dp[tm.get(sum).floorKey(i-1)].getOrDefault(sum,0)<val) {         TreeMap<Integer, Long> tt = new TreeMap<>();        tt.put(i, val);        tm.put(sum, tt);       }       }    }int cnt=0;int last=-1;    for(int i=0;i<n;i++){     for(int j=i-1;j>=-1;j--){      long sum=0;      if(j==-1) sum=presum[i];      else sum=presum[i]-presum[j];      if(dp[i].getOrDefault(maxsum,0)>cnt&&maxsum==sum){       sb.append(j+2+" "+(i+1)+"\n");cnt++;       break;      }     }    } System.out.println(ans);    System.out.println(sb);   }  }   long[] st;  void buildtree(int i,int s,int e,long[] a){   if(s==e){    st[i]=a[s];    return;   }   int mid=(s+e)/2;   buildtree(2*i,s,mid,a);   buildtree(2*i+1,mid+1,e,a);   st[i]=Math.min(st[2*i],st[2*(i)+1]);  }  long query(int i,int s,int e,int qs,int qe){   if(qs>e||qe<s) return Integer.MIN_VALUE;   if(s>=qs&&e<=qe) return st[i];   int mid=(s+e)/2;   long l=query(2*i,s,mid,qs,qe);   long r=query(2*i+1,mid+1,e,qs,qe);   return Math.max(l,r);  }  void pointupdate(int i,int s,int e,int qi,long [] a){   if(s==e){    st[i]=a[s];return;   }   int mid=(s+e)/2;   if(qi<=mid) pointupdate(2*i,s,mid,qi,a);   else pointupdate(2*(i)+1,mid+1,e,qi,a);   st[i]=Math.max(st[2*i],st[2*i+1]);  }  public void arr(long[] a,int n) throws IOException{     String[] s2=s();   for(int i=0;i<n;i++){    a[i]=i(s2[i]);   }  }  public void sort(int[] a,int l,int h){   if(l==h) return;   int mid=(l+h)/2;   sort(a,l,mid);   sort(a,mid+1,h);   merge(a,l,(l+h)/2,h);  }  void merge(int arr[], int l, int m, int r)  {   int n1 = m - l + 1;   int n2 = r - m;   int L[] = new int[n1];   int R[] = new int[n2];   for (int i = 0; i < n1; ++i)    L[i] = arr[l + i];   for (int j = 0; j < n2; ++j)    R[j] = arr[m + 1 + j];   int i = 0, j = 0;   int k = l;   while (i < n1 && j < n2) {    if (L[i] <= R[j]) {     arr[k] = L[i];     i++;    }    else {     arr[k] = R[j];     j++;    }    k++;   }   while (i < n1) {    arr[k] = L[i];    i++;    k++;   }   while (j < n2) {    arr[k] = R[j];    j++;    k++;   }  }   static long gcd(long a, long b) {   if (b == 0)    return a;   return gcd(b, a % b);  }  static String[] s() throws IOException {   return s.readLine().trim().split("\\s+");  }  static int i(String ss) {   return Integer.parseInt(ss);  }  static long l(String ss) {   return Long.parseLong(ss);  } } class Student {  long a;int b;int c;  public Student(int a,int b) {   this.a=a;this.c=c;this.b=b;  } } class Pair {  int a,b,c;  public Pair(int a,int b){   this.a=a;this.b=b;this.c=c;} } class Sortbyroll implements Comparator<Student> {  public int compare(Student a, Student b){   if(a.b==b.b) return (int)b.a-(int)a.a;   return a.b-b.b;} }
4	public class GivenString {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   String line = sc.nextLine();   String sub = "";   int count = 0;   int max = 0;   for (int i = 0; i < line.length() - 1; i++) {    sub = line.substring(i, i + 1);    int q = i + 1;    int p;    int r = i;    while (q < line.length() && q > 0) {     p = q;     r = i;     int ind = line.indexOf(sub, p);     count = 0;     if (ind != -1) {      for (int j = ind; j < line.length(); j++) {       if (line.substring(j, j + 1).equalsIgnoreCase(line.substring(r, r + 1))) {        r++;        count++;       } else {        break;       }      }      if (count > max) {       max = count;      }     }     q = ind + 1;        }   }   System.out.println(max);  } }
5	public class ProblemA_15 {   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_15().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();   int t=readInt();   Point[] a=new Point[n];   for (int i=0; i<n; i++){    a[i]=new Point(readInt(), readInt());   }   int count=2;   Arrays.sort(a, new Comparator<Point>(){    @Override    public int compare(Point p1, Point p2) {     return p1.x-p2.x;    }      });   for (int i=1; i<n; i++){    double li=a[i-1].x+(double)a[i-1].y/2;    double ri=a[i].x-(double)a[i].y/2;    if (ri-li>t){     count+=2;    }    if (ri-li==t){     count++;    }   }   out.print(count);  }   }
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 class BIT{  int n;  int[] bit;  public BIT(int n){  this.n = n;  bit = new int[n+1];  }  void add(int idx, int val){  for(int i = idx+1; i <= n; i += i&(-i)) bit[i-1] += val;  }  int sum(int idx){  int res = 0;  for(int i = idx+1; i > 0; i -= i&(-i)) res += bit[i-1];  return res;  }  int sum(int begin, int end){  if(begin == 0) return sum(end);  return sum(end)-sum(begin-1);  } } static class Pair implements Comparable<Pair>{  int first, second;  Pair(int a, int b){   first = a;   second = b;  }  @Override  public boolean equals(Object o){   if (this == o) return true;   if (!(o instanceof Pair)) return false;   Pair p = (Pair) o;   return first == p.first && second == p.second;  }  @Override  public int compareTo(Pair p){   return first == p.first ? second - p.second : first - p.first;                              } }  private static class FastScanner {  private final InputStream in = System.in;  private final byte[] buffer = new byte[1024];  private int ptr = 0;  private int buflen = 0;  private boolean hasNextByte() {   if (ptr < buflen) {    return true;   }else{    ptr = 0;    try {     buflen = in.read(buffer);    } catch (IOException e) {     e.printStackTrace();    }    if (buflen <= 0) {     return false;    }   }   return true;  }  private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}  private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}  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;  }  public double nextDouble() { return Double.parseDouble(next());} } }
4	public class Main {  static class Point {   int x;   int y;   Point(int a, int b) {    x = a;    y = b;   }   @Override   public String toString() {    return "Point{" +      "x=" + x +      ", y=" + y +      '}';   }  }  public static void main(String[] args) throws IOException {   File f = new File("input.txt");   Scanner sc = new Scanner(f);   BufferedWriter bw = new BufferedWriter(new FileWriter(new File("output.txt")));   int n = sc.nextInt();   int m = sc.nextInt();   boolean[][] board = new boolean[n][m];   int count = sc.nextInt();   Point[] burningTrees = new Point[count];   for (int i=0; i<count; i++) {    burningTrees[i] = new Point(sc.nextInt() - 1,sc.nextInt() - 1);   }   Point last = findLastPoint(board,burningTrees);   bw.append((last.x + 1) + " " + (last.y + 1) + "\n");   bw.flush();   bw.close();   sc.close();  }   public static Point findLastPoint(boolean[][] board, Point[] burningTree){   Queue<Point> queue = new LinkedList<Point>();   for(int i = 0; i <burningTree.length; i++ ) {    queue.add(burningTree[i]);    board[burningTree[i].x][burningTree[i].y] = true;   }   Point lastPoint = new Point(-1,-1);   while (!queue.isEmpty()) {    Point p = queue.poll();    lastPoint = p;    ArrayList<Point> neighbours = getNeighbours(p,board);    for(int i = 0; i <neighbours.size(); i++ ) {     queue.add(neighbours.get(i));     board[neighbours.get(i).x][neighbours.get(i).y] = true;    }   }   return lastPoint;  }  public static ArrayList<Point> getNeighbours(Point p, boolean[][] board){   ArrayList<Point> neighbours = new ArrayList<>();   for(int i = -1; i <=1; i++ ){    for(int j = -1; j <= 1; j++ ){     if(Math.abs(i) != Math.abs(j)) {      int x = p.x + i;      int y = p.y + j;      if (x >= 0 && x < board.length && y >= 0 && y < board[0].length) {       if (board[x][y] == false) {        neighbours.add(new Point(x,y));       }      }     }    }   }   return neighbours;  } }
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 void solve() {   int n = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }   Stack<Integer> st = new Stack<>();   for (int i = 0; i < n; i++) {    if (a[i] != 1) {     while (!st.empty() && st.peek() + 1 != a[i])      st.pop();     st.pop();    }    st.push(a[i]);    for (int j = 0; j < st.size(); j++) {     out.print(st.get(j));     if (j < st.size() - 1)      out.print('.');    }    out.println();   }  }  public static void main(String[] args) {   in = new FastReader();   out = new PrintWriter(System.out);   int t = 1;   t = in.nextInt();   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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(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;   }  } }
0	public class sub { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int num = in.nextInt();  while(num-->0) {  int a = in.nextInt();  int b = in.nextInt();   int res = 0;   while(a!=0 && b!=0) {   if(a>=b) {   res += a/b;   a %= b;   } else {   res += b/a;   b %= a;   }  }  System.out.println(res);  } } }
4	public class CodeForces {  public void solve() throws IOException {   String s = nextToken();     Set<String> set = new HashSet<String>();   int counter = 0;   for (int i = 0, l = s.length(); i < l; i++) {    for (int j = i + 1; j < l; j++) {     String subst = s.substring(i, j);     if (!set.contains(subst)) {      set.add(subst);      if (counts(s.toCharArray(), subst.toCharArray()) > 1) {       counter = Math.max(counter, subst.length());      }     }    }   }    writer.print(counter);  }  private int counts(char[] s, char[] r) {   int l = s.length;   int rl = r.length;   int arr[] = new int[26];   Arrays.fill(arr, rl);   for (int i = rl - 2; i > -1; i--) {    int margin = (r[i] - 'a');    if (arr[margin] == rl) {     arr[margin] = rl - i - 1;    }   }     int sp = 0;   int counter = 0;   while (sp <= l - rl) {    int oldsp = sp;    for (int i = rl - 1; i > -1; i--) {     if (r[i] != s[sp + i]) {      if (i == rl - 1) {       sp += arr[s[sp + i] - 'a'];      } else {       sp++;      }      break;     }    }    if (oldsp == sp) {     counter++;     sp++;    }   }   return counter;  }   public static void main(String[] args) {   new CodeForces().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();  } }
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));    }   }  } }
4	public class Main { public static int n,m; public static void main(String[] arg) {  FastScanner scan = null;  PrintWriter out = null;  try{  scan = new FastScanner(new FileInputStream("input.txt"));  out = new PrintWriter(new FileOutputStream("output.txt"));  }catch(FileNotFoundException e){  scan = new FastScanner(System.in);  out = new PrintWriter(System.out);  }    n = scan.nextInt();  m = scan.nextInt();  int k = scan.nextInt();  int[][] board = new int[n+1][m+1];  String[] ins = scan.nextLine().split(" ",-1);  List<Integer> ps = new ArrayList<Integer>();  for(int i = 0; i < 2 * k; i += 2){  int a = Integer.parseInt(ins[i]);  int b = Integer.parseInt(ins[i+1]);  board[a][b] = 1;  ps.add(a * 2001 + b);  }   int retx = 1, rety = 1;  int[] dx = {0,1,0,-1};  int[] dy = {1,0,-1,0};  while(true){  boolean find = false;  List<Integer> ps2 = new ArrayList<Integer>();  for(Integer p : ps){   int i = p / 2001;   int j = p % 2001;   for(int q = 0; q < 4; q++){   int nx = i + dx[q];   int ny = j + dy[q];   if(in(nx,ny) && board[nx][ny] == 0){    board[nx][ny] = 1;    retx = nx;    rety = ny;    find = true;    ps2.add(nx * 2001 + ny);   }   }   board[i][j] = 2;  }  ps = ps2;  if(!find) break;  }  out.println(retx + " " + rety);  out.close(); } public static boolean in(int i, int j){  return (1 <= i && i <= n) && (1 <= j && j <= m); } 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();  }    String nextLine() {   try {    return br.readLine();   }   catch (Exception e) {    return null;   }  }  int nextInt() {  return Integer.parseInt(next());  }   long nextLong() {  return Long.parseLong(next());  }   double nextDouble() {  return Double.valueOf(next());  } } }
0	public class two_squares {  public static void main(String[] args) throws Exception {  new two_squares().run(); }  public void run() throws Exception {  FastIO file = new FastIO();  double x1 = file.nextInt();  double y1 = file.nextInt();  double x2 = file.nextInt();  double y2 = file.nextInt();  double x3 = file.nextInt();  double y3 = file.nextInt();  double x4 = file.nextInt();  double y4 = file.nextInt();  double minx1, maxx1, miny1, maxy1;  minx1 = Math.min(x1, Math.min(x2, Math.min(x3, x4)));  maxx1 = Math.max(x1, Math.max(x2, Math.max(x3, x4)));  miny1 = Math.min(y1, Math.min(y2, Math.min(y3, y4)));  maxy1 = Math.max(y1, Math.max(y2, Math.max(y3, y4)));  double x5 = file.nextInt();  double y5 = file.nextInt();  double x6 = file.nextInt();  double y6 = file.nextInt();  double x7 = file.nextInt();  double y7 = file.nextInt();  double x8 = file.nextInt();  double y8 = file.nextInt();  double minx2, maxx2, miny2, maxy2;  minx2 = Math.min(x5, Math.min(x6, Math.min(x7, x8)));  maxx2 = Math.max(x5, Math.max(x6, Math.max(x7, x8)));  miny2 = Math.min(y5, Math.min(y6, Math.min(y7, y8)));  maxy2 = Math.max(y5, Math.max(y6, Math.max(y7, y8)));  Point _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16;  _1 = new Point(x1, y1);  _2 = new Point(x2, y2);  _3 = new Point(x3, y3);  _4 = new Point(x4, y4);  _5 = new Point(x5, y5);  _6 = new Point(x6, y6);  _7 = new Point(x7, y7);  _8 = new Point(x8, y8);  _9 = new Point(minx1, maxy1);  _10 = new Point(minx1, miny1);  _11 = new Point(maxx1, maxy1);  _12 = new Point(maxx1, miny1);  double m1 = (minx2 + maxx2) / 2;  double m2 = (miny2 + maxy2) / 2;  _13 = new Point(minx2, m2);  _14 = new Point(m1, miny2);  _15 = new Point(maxx2, m2);  _16 = new Point(m1, maxy2);  Point[] a = {_1, _2, _3, _4};  Point[] b = {_5, _6, _7, _8};  boolean works = false;  Line[] aa = {new Line(_9,_10), new Line(_10, _12), new Line(_12, _11), new Line(_11, _9)};  Line[] bb = {new Line(_13, _14), new Line(_14, _15), new Line(_15, _16), new Line(_16, _13)};  for (int i = 0; i < 4; i++) {  for (int j = 0; j < 4; j++) {   if (aa[i].intersection(bb[i]) != null) {   works = true;   }  }  }  for (Point p : b) {  if (p.x >= minx1 && p.x <= maxx1 && p.y >= miny1 && p.y <= maxy1) {   works = true;  }  }  for (Point p : a) {  boolean result = false;   for (int i = 0, j = b.length - 1; i < b.length; j = i++) {    if ((b[i].y > p.y) != (b[j].y > p.y) &&     (p.x < (b[j].x - b[i].x) * (p.y - b[i].y) / (b[j].y-b[i].y) + b[i].x)) {    result = !result;    }   }   if (result) works = true;  }  System.out.println(works ? "YES" : "NO"); } public static class Point {  double x, y;  public Point(double a, double b) {  x = a;  y = b;  } } public static class Line {  Point a, b;  public Line(Point x, Point y) {  a = x;  b = y;  }  public Point intersection(Line o) {  double x1 = a.x;  double y1 = a.y;  double x2 = b.x;  double y2 = b.y;  double x3 = o.a.x;  double y3 = o.a.y;  double x4 = o.b.x;  double y4 = o.b.y;  double denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);   double ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3))/denom;   double ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3))/denom;   if (ua >= 0.0f && ua <= 1.0f && ub >= 0.0f && ub <= 1.0f) {    return new Point((int) (x1 + ua*(x2 - x1)), (int) (y1 + ua*(y2 - y1)));   }   return null;  } } public static class FastIO {  BufferedReader br;  StringTokenizer st;  public FastIO() {  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());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  } }  public static long pow(long n, long p, long mod) {  if (p == 0)  return 1;  if (p == 1)  return n % mod;  if (p % 2 == 0) {  long temp = pow(n, p / 2, mod);  return (temp * temp) % mod;  } else {  long temp = pow(n, p / 2, mod);  temp = (temp * temp) % mod;  return (temp * n) % mod;  } }  public static long pow(long n, long p) {  if (p == 0)  return 1;  if (p == 1)  return n;  if (p % 2 == 0) {  long temp = pow(n, p / 2);  return (temp * temp);  } else {  long temp = pow(n, p / 2);  temp = (temp * temp);  return (temp * n);  } }  public static long gcd(long x, long y) {  if (x == 0)  return y;  else  return gcd(y % x, x); }  public static boolean isPrime(int n) {  if (n <= 1)  return false;  if (n <= 3)  return true;  if (n % 2 == 0 || n % 3 == 0)  return false;  for (int i = 5; i * i <= n; i = i + 6)  if (n % i == 0 || n % (i + 2) == 0)   return false;  return true; } }
0	public class RationalResistance { 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());  long a=Long.parseLong(st.nextToken());  long b=Long.parseLong(st.nextToken());  long sum = 0;  while(a!= 0 && b!= 0){  if (a > b){   long val = a / b;   sum += val;   a -= val * b;  }  else{   long val = b / a;   sum += val;   b -= val * a;  }  }   out.println(sum);  out.close();  System.exit(0); }  }
0	public class D5 implements Runnable {  final double eps = 1e-9;  private void Solution() throws IOException {  double a = nextDouble(), v = nextDouble();  double l = nextDouble(), d = nextDouble(), w = nextDouble();  double t = 0;  if (w + eps > v) {  double s = v * v / (2 * a);  if (s + eps > l)   t = Math.sqrt(2 * l / a);  else {   double ta = v / a;   double sa = a * ta * ta / 2;   t = ta + (l - sa) / v;  }  } else {  double sv = v * v / (2 * a);  double sw = w * w / (2 * a);  if (sw + eps > d) {   if (sv + eps > l)   t = Math.sqrt(2 * l / a);   else {   double ta = v / a;   double sa = a * ta * ta / 2;   t = ta + (l - sa) / v;   }  } else {   double sd = (w * w - v * v) / (-2 * a);   if (sv + sd < eps + d)   t = v / a + (d - sv - sd) / v + (v - w) / a;   else {   double f = Math.sqrt(d * a + w * w / 2);   t = f / a + (f - w) / a;   }   if (sd + eps > l - d) {   double lv = Math.sqrt((l - d) * 2 * a + w * w);   t += (lv - w) / a;   } else {   t += (v - w) / a + (l - d - sd) / v;   }  }  }  out.printf("%.12f", t); }  public static void main(String[] args) {  new D5().run(); }  BufferedReader in; PrintWriter out; StringTokenizer tokenizer;  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  Solution();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(0);  } }  void print(Object... obj) {  for (int i = 0; i < obj.length; i++) {  if (i != 0)   out.print(" ");  out.print(obj[i]);  } }  void println(Object... obj) {  print(obj);  print("\n"); }  int nextInt() throws IOException {  return Integer.parseInt(next()); }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next()); }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(next()); }  String nextLine() throws IOException {  return in.readLine(); }  String next() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens())  tokenizer = new StringTokenizer(nextLine());  return tokenizer.nextToken(); } }
4	public class Main {    public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   String s = sc.next(),c;   int n = s.length(),a,b;     for(int sz = n ; sz >= 1 ; sz--) {    for(int i = 0 ; i+sz <= n ; i++) {     c = s.substring(i, i+sz);     a = s.indexOf(c,0);     if(a < 0) continue;     b = s.indexOf(c,a+1);     if(b < 0) continue;     System.out.println(sz);     return;        }   }   System.out.println(0);  } }
0	public class Main {  public static void main(String args[])  {   Scanner scan=new Scanner(System.in);   int n=scan.nextInt();   System.out.println((n%4==0||n%7==0||n%47==0||n%74==0||n%447==0||n%474==0||n%477==0||n%744==0||n%747==0||n%774==0)?"YES":"NO");  } }
5	public class village {  static int[] X, A;  public void solve()  {   Scanner in = new Scanner(System.in);   int N = in.nextInt(), T = in.nextInt();   X = new int[N];   A = new int[N];   for(int i = 0; i < N; i++) {    X[i] = in.nextInt(); A[i] = in.nextInt();   }   if(N == 1) {    System.out.println("2");    return;   }   List<Integer> x = new ArrayList<Integer>();   for(int i = 0; i < N; i++) {    x.add(i);   }   Collections.sort(x, new Comp());   int places = 0;   for(int i = 0; i < N-1; i++) {    double space = (X[x.get(i+1)]-X[x.get(i)]-A[x.get(i+1)]/2.0-A[x.get(i)]/2.0);    if(space < T) {     continue;    } if(space - T < 1e-9) {     places++;    } else if(space > T) {     places+=2;    }   }   System.out.println(places+2);  }  public class Comp implements Comparator<Integer> {    public int compare(Integer i1, Integer i2) {     return X[i1]-X[i2];    }  }  public static void main(String[] args)  {   new village().solve();  } }
5	public class A2 { static Scanner in; static int next() throws Exception {return in.nextInt();};  static PrintWriter out;  public static void main(String[] args) throws Exception {  in = new Scanner(System.in);   out = new PrintWriter(System.out);   int n = next(), k = next()-1;   int x[] = new int[n];   for (int i = 0;i < n;i++) x[i] = (100-next())*100+next();   Arrays.sort(x);   int res = 0, t = x[k];   for (int i = 0;i < n;i++) if (t == x[i]) res++;   out.println(res);    out.println();  out.close(); } }
4	public class q3 {  public static void main(String[] args) throws Exception {          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int tests = Integer.parseInt(br.readLine());   for (int test = 1;test <= tests;test++) {    String[] parts = br.readLine().split(" ");    int n = Integer.parseInt(parts[0]);       StringBuilder temp = new StringBuilder();    int curr = Integer.parseInt(br.readLine());    temp.append("1");    System.out.println(1);    for(int i = 0;i < n - 1;i++){     curr = Integer.parseInt(br.readLine());     if(curr == 1){      temp.append('.').append('1');      System.out.println(temp);     }else{      while(temp.length() > 0){       int idx = temp.length() - 1;       while(idx >= 0 && temp.charAt(idx) != '.') idx--;       idx++;       int val = Integer.parseInt(temp.substring(idx));       temp.delete(idx,temp.length());       if(curr == val + 1){        temp.append(String.valueOf(curr));        break;       }       temp.deleteCharAt(temp.length() - 1);      }      System.out.println(temp);     }    }   }  } }
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");   }  } }
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; }  }
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);   APaintTheNumbers solver = new APaintTheNumbers();   solver.solve(1, in, out);   out.close();  }  static class APaintTheNumbers {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int[] a = in.readIntArray(n);    Arrays.sort(a);    int answer = 0;    for (int i = 0; i < n; i++) {     if (a[i] == 0)      continue;     answer++;     for (int j = 0; j < n; j++) {      if (j == i)       continue;      if (a[j] % a[i] == 0) {       a[j] = 0;      }     }     a[i] = 0;    }    out.println(answer);   }  }  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 int[] readIntArray(int n) {    int[] x = new int[n];    for (int i = 0; i < n; i++) {     x[i] = nextInt();    }    return x;   }  } }
6	public class B {  static int n,t[],g[],MOD=(int)1e9+7; static int [][]memo; static int dp(int msk,int rem,int lastG) {  if(rem==0)  return 1;  if(memo[lastG][msk]!=-1)  return memo[lastG][msk];  int ans=0;  for(int i=0;i<n;i++) {  if((msk & (1<<i))==0 && rem>=t[i] && g[i]!=lastG)   ans+=dp(msk|1<<i,rem-t[i],g[i]);   if(ans>=MOD)   ans-=MOD;  }  return memo[lastG][msk]=ans; } public static void main(String[] args) throws IOException {  Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out);  n=sc.nextInt();  int T=sc.nextInt();  t=new int [n];  g=new int [n];   for(int i=0;i<n;i++) {  t[i]=sc.nextInt();  g[i]=sc.nextInt()-1;  }  memo=new int [4][1<<n];  for(int []x:memo)  Arrays.fill(x, -1);  out.println(dp(0, T, 3));  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();  }  String nextLine() throws IOException {  return br.readLine();  }  int nextInt() throws IOException {  return Integer.parseInt(next());  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(next());  }  boolean ready() throws IOException {  return br.ready();  }  } }
0	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()); }  double nextDouble(){ return Double.parseDouble(next()); }  float nextFloat() { return Float.parseFloat(next()); }  boolean nextBoolean() { return Boolean.parseBoolean(next()); }  String nextLine()  {  String str = "";  try  {   str = br.readLine();  }  catch (IOException e)  {   e.printStackTrace();  }  return str;  } } static long modExp(long x, long n, long mod)  {  long result = 1;  while(n > 0)  {   if(n % 2 == 1)    result = (result%mod * x%mod)%mod;   x = (x%mod * x%mod)%mod;   n=n/2;  }  return result; } 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();  long n = fr.nextLong();  long x = fr.nextLong();  long y = fr.nextLong();  long w = Long.min(x,y) - 1 + (x - Long.min(x,y)) + (y - Long.min(x,y));  long b = n - Long.max(x,y) + (Long.max(x,y) - x) + (Long.max(x,y) - y);  if(w <= b) System.out.println("White");  else System.out.println("Black");  } } class Pair<U, V> {  public final U first;    public final V second;    private Pair(U first, V second)  {  this.first = first;  this.second = second;  }  @Override  public boolean equals(Object o)  {  if (this == o) return true;   if (o == null || getClass() != o.getClass()) return false;   Pair<?, ?> pair = (Pair<?, ?>) o;   if (!first.equals(pair.first)) return false;  return second.equals(pair.second);  }  @Override  public int hashCode()  {  return 31 * first.hashCode() + second.hashCode();  }  public static <U, V> Pair <U, V> of(U a, V b)  {  return new Pair<>(a, b);  } } class myComp implements Comparator<Pair> { public int compare(Pair a,Pair b) {  if(a.first != b.first) return ((int)a.first - (int)b.first);  if(a.second != b.second) return ((int)a.second - (int)b.second);  return 0; } } class BIT   { public long[] m_array;  public BIT(long[] dat) {  m_array = new long[dat.length + 1];  Arrays.fill(m_array,0);  for(int i = 0; i < dat.length; i++)  {  m_array[i + 1] = dat[i];  }  for(int i = 1; i < m_array.length; i++)  {  int j = i + (i & -i);  if(j < m_array.length)  {   m_array[j] = m_array[j] + m_array[i];  }  } }  public final long prefix_query(int i) {  long result = 0;  for(++i; i > 0; i = i - (i & -i))  {  result = result + m_array[i];  }  return result; }  public final long range_query(int fro, int to) {  if(fro == 0)  {  return prefix_query(to);  }  else  {  return (prefix_query(to) - prefix_query(fro - 1));  } }  public void update(int i, long add) {  for(++i; i < m_array.length; i = i + (i & -i))  {  m_array[i] = m_array[i] + add;  } } }
1	public class Main {  public static void main(String[] args) { Scanner input = new Scanner(System.in); Pattern rc_style = Pattern.compile("R[0-9]+C[0-9]+"); int n = input.nextInt();  while(n-- > 0) {  String str = input.next();  Matcher m = rc_style.matcher(str);   if(m.matches()) {  String nums[] = str.split("[RC]");  String row = nums[1];  String col = nums[2];   String buffer = "";  int col_num = Integer.valueOf(col);  while(col_num > 0) {   if(col_num % 26 > 0) {  buffer += (char)(col_num % 26 + 'A' - 1);  col_num /= 26;   } else {  buffer += 'Z';  col_num /= 26;  col_num--;   }  }  for(int i = buffer.length() - 1; i >= 0; i--)   System.out.print(buffer.charAt(i));   System.out.println(row);   } else {  String col = str.split("[0-9]+")[0];  String row = str.split("[A-Z]+")[1];  int col_num = 0;  int shift = 1;  for(int i = col.length() - 1; i >= 0; i--) {   col_num += (int) (col.charAt(i) - 'A' + 1) * shift;   shift *= 26;  }  System.out.println("R" + row + "C" + col_num);  } }  } }
5	public class Solution implements Runnable {        public void solve() throws Exception {     int n = sc.nextInt();   int a = sc.nextInt();   int b = sc.nextInt();   long h[] = new long[n];     for (int i = 0;i < n; ++ i) {    h[i] = sc.nextLong();   }   Arrays.sort(h);   long l = h[n - a];   long r = h[n - a - 1];   out.println(l - r);  }           static String filename = "";  static boolean fromFile = false;   BufferedReader in;  PrintWriter out;  FastScanner sc;   public static void main(String[] args) {   new Thread(null, new Solution(), "", 1 << 25).start();  }   public void run() {   try {    init();    solve();   } catch (Exception e) {    throw new RuntimeException(e);   } finally {    out.close();   }  }   void init() throws Exception {   if (fromFile) {    in = new BufferedReader(new FileReader(filename+".in"));    out = new PrintWriter(new FileWriter(filename+".out"));   } else {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);   }   sc = new FastScanner(in);  } } class FastScanner {   BufferedReader reader;  StringTokenizer strTok;   public FastScanner(BufferedReader reader) {   this.reader = reader;  }   public String nextToken() throws IOException {   while (strTok == null || !strTok.hasMoreTokens()) {    strTok = new StringTokenizer(reader.readLine());   }     return strTok.nextToken();  }   public int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }   public long nextLong() throws IOException {   return Long.parseLong(nextToken());  }   public double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }   public BigInteger nextBigInteger() throws IOException {   return new BigInteger(nextToken());  }   public BigDecimal nextBigDecimal() throws IOException {   return new BigDecimal(nextToken());  } }
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();  }  } class ArrayUtils {   public static List<Long> asList(long[] array) {   return new LongList(array);  }  private static class LongList extends AbstractList<Long> implements RandomAccess {   long[] array;   private LongList(long[] array) {    this.array = array;   }   public Long set(int index, Long element) {    long result = array[index];    array[index] = element;    return result;   }   public Long get(int index) {    return array[index];   }   public int size() {    return array.length;   }  }  public static void safeSort(long[] array) {   Collections.shuffle(asList(array));   Arrays.sort(array);  }  } class NumberUtils {  public static int upDiv(int a, int b) {   return a % b == 0 ? (a / b) : (a / b + 1);  }  }
5	public class a {   public static void main(String[] args) throws IOException {      BufferedReader input = new BufferedReader(new InputStreamReader(System.in));  BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out));  StreamTokenizer in = new StreamTokenizer(input);   in.nextToken();  int n = (int)in.nval;  int[] mas = new int[n];   for (int i = 0; i < n; i++) {  in.nextToken();  mas[i] = (int)in.nval;  }   Arrays.sort(mas);  int min = mas[0];  int i = 1;   while ((i < n)&&(min == mas[i])) {  i++;  }   if (i < n) {  output.write(Integer.toString(mas[i]));  }  else {  output.write("NO");  }  input.close();  output.close(); } }
4	public class SolutionD extends Thread {  static class FastReader {   BufferedReader br;   StringTokenizer st;   public FastReader() {    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 parseInt(next());   }   long nextLong() {    return parseLong(next());   }   double nextDouble() {    return parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  }  private static final FastReader scanner = new FastReader();  private static final PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) {   solve();   out.close();  }  private static void solve() {   int n = scanner.nextInt();   int m = scanner.nextInt();   int k = scanner.nextInt();   int[][] hori = new int[n][m-1];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m-1; j++) {     int xij = scanner.nextInt();     hori[i][j] = xij;    }   }   int[][] vert = new int[n-1][m];   for (int i = 0; i < n-1; i++) {    for (int j = 0; j < m; j++) {     int xij = scanner.nextInt();     vert[i][j] = xij;    }   }   if (k % 2 != 0) {    for (int i = 0; i < n; i++) {     StringBuilder s = new StringBuilder();     for (int j = 0; j < m; j++) {      s.append("-1 ");     }     out.println(s);    }    return;   }   k /= 2;   long[][][] dp = new long[n][m][k+1];   for (int kTmp = 1; kTmp <= k; kTmp++) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      dp[i][j][kTmp] = Integer.MAX_VALUE;      if (i > 0) {       dp[i][j][kTmp] = Math.min(dp[i][j][kTmp], dp[i-1][j][kTmp-1] + 2L * vert[i - 1][j]);      }      if (j > 0) {       dp[i][j][kTmp] = Math.min(dp[i][j][kTmp], dp[i][j-1][kTmp-1] + 2L * hori[i][j - 1]);      }      if (i + 1 < n) {       dp[i][j][kTmp] = Math.min(dp[i][j][kTmp], dp[i+1][j][kTmp-1] + 2L * vert[i][j]);      }      if (j + 1 < m) {       dp[i][j][kTmp] = Math.min(dp[i][j][kTmp], dp[i][j+1][kTmp-1] + 2L * hori[i][j]);      }     }    }   }   for (int i = 0; i < n; i++) {    StringBuilder s = new StringBuilder();    for (int j = 0; j < m; j++) {     s.append(dp[i][j][k]).append(" ");    }    out.println(s);   }  } }
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();  } }
3	public class A { public void run() throws Exception {  FastScanner sc = new FastScanner();   int n = sc.nextInt();  int[] arr = new int[n];  int[] color = new int[n];  for (int i = 0; i<n; i++) {  arr[i] =sc.nextInt();  }  Arrays.sort(arr);  int counter = 1;  for (int i = 0; i<n; i++) {  if (color[i]!= 0) continue;  for (int j = i;j<n; j++) {   if (color[j]!= 0) continue;   else if (arr[j]%arr[i] == 0) color[j] = counter;  }  counter++;  }   int max = 0;  for (int i = 0; i<n; i++) {  max = Math.max(max, color[i]);  }  System.out.println(max); } 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 long nextLong() {  return Long.parseLong(next());  }  public double nextDouble() {  return Double.parseDouble(next());  }  public String nextLine() {  try {   return reader.readLine();  } catch (IOException e) {   throw new RuntimeException(e);  }  }  } public static void main (String[] args) throws Exception {  new A().run(); } }
5	public class test1 {  public static void main(String[] args)  {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int a[]=new int[n];   int b[]=new int[n];   for(int i=0;i<n;i++)   {    a[i]=in.nextInt();    b[i]=a[i];   }   Arrays.sort(b);   int count=0;   for(int i=0;i<n;i++)    if(a[i]!=b[i])     count++;   if(count<=2)    System.out.println("YES");   else    System.out.println("NO");  }   }
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);   TaskF2 solver = new TaskF2();   solver.solve(1, in, out);   out.close();  }  static class TaskF2 {   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] = in.nextInt();    }    HashMap<Integer, Stack<Interval>> map = new HashMap<>();    for (int i = 0; i < n; i++) {     int sum = 0;     for (int j = i; j < n; j++) {      sum += a[j];      if (map.containsKey(sum) == false) {       map.put(sum, new Stack<>());      }      Stack<Interval> stack = map.get(sum);      if (stack.isEmpty() || stack.get(stack.size() - 1).r < i) {       stack.push(new Interval(i, j));      } else if (stack.get(stack.size() - 1).r >= j) {       stack.pop();       stack.push(new Interval(i, j));      }     }    }    Stack<Interval> best = new Stack<>();    for (Stack<Interval> stack : map.values()) {     if (best.size() < stack.size()) {      best = stack;     }    }    out.println(best.size());    for (Interval i : best) {     out.println((i.l + 1) + " " + (i.r + 1));    }   }   class Interval {    int l;    int r;    Interval(int l, int r) {     this.l = l;     this.r = r;    }   }  }  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;   }  } }
1	public class Main { private static boolean _READ_FROM_FILE = System.getProperty("ONLINE_JUDGE") == null; private static Scanner in; private static void core() {  int n = in.nextInt();  ArrayList<Character> all = new ArrayList<Character>();  for (char ch : in.next().toCharArray()) {  all.add(ch);  }   int res = Integer.MAX_VALUE;  for (int i = 0; i < n; i++) {  int now = calc(all);  res = Math.min(res, now);  all.add(all.get(0));  all.remove(0);  }  System.out.println(res); } private static int calc(ArrayList<Character> all) {  int nh = 0;  for (char ch: all) {  if (ch == 'H')   ++nh;  }  int r1 = 0;  for (int i = 0; i < nh; i++) {  if (all.get(i) != 'H')   ++r1;  }   int nt = all.size() - nh;  int r2 = 0;  for (int i = 0; i < nt; i++) {  if (all.get(i) != 'T')   ++r2;  }  return Math.min(r1, r2); } static void debug(Object...os) {  System.out.println(Arrays.deepToString(os)); } public static void main(String[] args) throws FileNotFoundException {  if (_READ_FROM_FILE)  System.setIn(new FileInputStream("in.in"));  in = new Scanner(System.in);  core(); } }
5	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);   CGlassCarving solver = new CGlassCarving();   solver.solve(1, in, out);   out.close();  }  static class CGlassCarving {   public void solve(int testNumber, FastReader s, PrintWriter out) {    TreeMap<Long, Integer> mapH = new TreeMap<>();    TreeMap<Long, Integer> mapV = new TreeMap<>();    TreeMap<Long, Integer> hDiff = new TreeMap<>();    TreeMap<Long, Integer> vDiff = new TreeMap<>();    long width = s.nextInt();    long height = s.nextInt();    mapH.put(0L, 1);    mapV.put(0L, 1);    mapV.put(width, 1);    mapH.put(height, 1);    vDiff.put(width, 1);    hDiff.put(height, 1);    long maxV = height;    long maxH = width;    int n = s.nextInt();    for (int i = 0; i < n; i++) {     char ch = s.nextCharacter();     long cut = s.nextInt();     if (ch == 'H') {      Long next = mapH.higherKey(cut);      Long prev = mapH.lowerKey(cut);      Long diff = next - prev;      int freq = hDiff.get(diff);      if (freq == 1) {       hDiff.remove(diff);      } else {       hDiff.put(diff, freq - 1);      }      hDiff.put(next - cut, hDiff.getOrDefault(next - cut, 0) + 1);      hDiff.put(cut - prev, hDiff.getOrDefault(cut - prev, 0) + 1);      mapH.put(cut, mapH.getOrDefault(cut, 0) + 1);     } else {      Long next = mapV.higherKey(cut);      Long prev = mapV.lowerKey(cut);      Long diff = next - prev;      int freq = vDiff.get(diff);      if (freq == 1) {       vDiff.remove(diff);      } else {       vDiff.put(diff, freq - 1);      }      vDiff.put(next - cut, vDiff.getOrDefault(next - cut, 0) + 1);      vDiff.put(cut - prev, vDiff.getOrDefault(cut - prev, 0) + 1);      mapV.put(cut, mapV.getOrDefault(cut, 0) + 1);     }     out.println(hDiff.lastKey() * vDiff.lastKey());    }   }  }  static class FastReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private FastReader.SpaceCharFilter filter;   public FastReader(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 char nextCharacter() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    return (char) c;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
0	public class HexadecimalTheorem {  public static void main(String[] args) {   Scanner read = new Scanner(System.in);   int num = read.nextInt();   int zero, one, two, three;   zero = 0;   one = 1;   two = 1;   three = 2;   if(num == 0)    System.out.println("0 0 0");   else if(num == 1)    System.out.println("0 0 1");   else{    while(num != three){     zero = one;     one = two;     two = three;     three = three + one;    }    System.out.println(zero + " " + one + " " + one);   }  } }
3	public class PythonIndentation { public static void main(String args[]) {  Scanner in = new Scanner(System.in) ;  int n = in.nextInt() ;  boolean[] lst = new boolean[n] ;  for(int i=0;i<n;i++)  {  lst[i] = (in.next().equals("s"))?false:true ;  }  System.out.println(dp(lst)) ; } static void arrayPrinter(int[][] dp) {  System.out.println(":::") ;  for(int i=0;i<dp.length;i++)  {  for(int j=0;j<dp[0].length;j++)  {   System.out.print(dp[i][j]+" ") ;  }  System.out.println() ;  } } static int dp(boolean[] lst) {  int[][] dp = new int[2][lst.length] ;  dp[0][0] = 1 ;  for(int i=1;i<lst.length;i++)  {    for(int j=0;j<lst.length;j++)  {   if(lst[i-1])   {   if(j==0)    dp[i%2][j] = 0 ;   else    dp[i%2][j] = dp[(i-1)%2][j-1] ;   }     else   {   if(j==0)   {    int temp = 0 ;    for(int k=0;k<lst.length;k++)    temp = (temp+dp[(i-1)%2][k])%1000000007 ;    dp[i%2][j] = temp ;   }   else    dp[i%2][j] = (dp[i%2][j-1]-dp[(i-1)%2][j-1])%1000000007 ;   }  }  }  int ans = 0 ;  for(int i=0;i<lst.length;i++)  {  ans = (ans + dp[(lst.length-1)%2][i])%1000000007 ;  }  if(ans<0)  ans = ans + 1000000007 ;   return ans ; } }
3	public class Main { static final long MOD = 998244353;  static boolean[] visited;  public static void main(String[] args) throws IOException {   FastScanner sc = new FastScanner();   int N = sc.nextInt();   int[] nums = new int[N];   for (int i = 0; i < N; i++) {   nums[i] = sc.nextInt();   }   Arrays.sort(nums);   boolean[] hit = new boolean[N];   int colors = 0;   int index = 0;   while (index < N) {   if (hit[index] == false) {    colors++;    int div = nums[index];    for (int i = index; i < N; i++) {    if (nums[i] % div == 0) {     hit[i] = true;    }    }   }   index++;   }   System.out.println(colors);  }   public static int[][] sort(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;  }  Arrays.sort(array, new Comparator<int[]>() {   @Override   public int compare(int[] arr1, int[] arr2) {      if (arr1[0] != arr2[0])    return arr1[0]-arr2[0];   else    return arr2[1]-arr1[1];   }  });  return array; }   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();   }    int nextInt() {    return Integer.parseInt(next());   }    long nextLong() {    return Long.parseLong(next());   }    double nextDouble() {    return Double.parseDouble(next());   }    String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } } class Node { public HashSet<Node> children; public int n;  public Node(int n) {  this.n = n;  children = new HashSet<Node>(); }  public void addChild(Node node) {  children.add(node); }  public void removeChild(Node node) {  children.remove(node); }   @Override public int hashCode() {  return n; }  @Override public boolean equals(Object obj) {  if (! (obj instanceof Node)) {  return false;  } else {  Node node = (Node) obj;  return (n == node.n);  } }  public String toString() {  return (this.n+1)+""; } }
5	public class A implements Runnable {  String file = "input";   boolean TEST = System.getProperty("ONLINE_JUDGE") == null;   void solve() throws IOException  {   int n = nextInt();   int[] a = new int[n];   for(int i = 0; i < n; i++) a[i] = nextInt();   int[] b = a.clone();   qsort(b);     int count = 0;   for(int i = 0; i < a.length; i++)    if(a[i] != b[i]) count++;   if(count == 0 || count == 2) out.println("YES");   else out.println("NO");  }   void qsort(int[] a)  {   List<Integer> as = new ArrayList<Integer>();   for(int x : a) as.add(x);   Collections.shuffle(as);   for(int i = 0; i < a.length; i++) a[i] = as.get(i);   sort(a);  }   Random rnd = new Random();   void sortInt(int[] a)  {   sortInt(a, 0, a.length - 1);  }   void sortInt(int[] a, int from, int to)  {   if(from >= to) return;   int i = from - 1;   int p = rnd.nextInt(to - from + 1) + from;   int t = a[p]; a[p] = a[to]; a[to] = t;   for(int j = from; j < to; j++)    if(a[j] <= a[to])    {     i++;     t = a[i]; a[i] = a[j]; a[j] = t;    }   t = a[i + 1]; a[i + 1] = a[to]; a[to] = t;   sortInt(a, i + 2, to);   while(i >= 0 && a[i] == a[i + 1]) i--;   sortInt(a, from, i);    }   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());  }   long nextLong() throws IOException  {   return Long.parseLong(next());  }   double nextDouble() throws IOException  {   return Double.parseDouble(next());  }   void print(Object... o)  {   System.out.println(deepToString(o));  }   void gcj(Object o)  {   String s = String.valueOf(o);   out.println("Case #" + test + ": " + s);   System.out.println("Case #" + test + ": " + s);  }   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 A(), "", 1 << 22).start();  }   public void run()  {   try   {    init();    if(TEST)    {     int runs = nextInt();     for(int i = 0; i < runs; i++) solve();    }    else solve();    out.close();     }   catch(Exception e)   {    e.printStackTrace();    System.exit(1);   }  } }
5	public class Main{ public static void main(String []args){  Scanner cin = new Scanner( System.in );  int n = cin.nextInt();  int [] num = new int [ n ];   for (int i=0; i<n; i++)  num[i] = cin.nextInt();   Arrays.sort( num );   int i = 0;  while ( i < n ){  if ( num[i] != num[0] ) break;  i++;  }   if ( i == n ) System.out.println("NO");  else System.out.println(num[i]); } }
1	public class Main implements Runnable { private BufferedReader in; private PrintWriter out; private StringTokenizer st;  private void eat(String line) {  st = new StringTokenizer(line); }  private String next() throws IOException {  while(!st.hasMoreTokens()) {  String line = in.readLine();  if(line == null)   return null;  eat(line);  }  return st.nextToken(); }  private int nextInt() throws IOException {  return Integer.parseInt(next()); }  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new OutputStreamWriter(System.out));  eat("");    go();    out.close();  } catch(Exception e) {  e.printStackTrace();  System.exit(-1);  } }  public static void main(String[] args) {  new Thread(new Main()).start(); }  public void go() throws IOException {  int n = nextInt();  int[] v = new int[n], count = new int[2];  for(int i = 0; i < n; ++i) {  v[i] = nextInt();  ++count[v[i] % 2];  }  int residue = count[0] == 1 ? 0 : 1;  for(int i = 0; i < n; ++i)  if(v[i] % 2 == residue)   out.println(i + 1); } }
2	public class taskB {  StringTokenizer st;  BufferedReader in;  PrintWriter out;  public static void main(String[] args) throws NumberFormatException,    IOException {   taskB solver = new taskB();   solver.open();   long time = System.currentTimeMillis();   solver.solve();   if (!"true".equals(System.getProperty("ONLINE_JUDGE"))) {    System.out.println("Spent time: "      + (System.currentTimeMillis() - time));    System.out.println("Memory: "      + (Runtime.getRuntime().totalMemory() - Runtime      .getRuntime().freeMemory()));   }   solver.close();  }  public void open() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);  }  public 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();  }  public int nextInt() throws NumberFormatException, IOException {   return Integer.parseInt(nextToken());  }  public long nextLong() throws NumberFormatException, IOException {   return Long.parseLong(nextToken());  }  public double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextToken());  }  long n, x, y, c;  long sq(long n) {   if (n <= 0) return 0;   return n * n;  }  long lrsp(long len, long max) {   long cnt = Math.min(len, max);   long arpr = (1 + cnt) * cnt / 2;   if (len > max) arpr += (len - max) * max;   return arpr;  }  long onn(long len) {   long up, down, left, right;   long toup = x - 1, todown = n - x, toleft = y - 1, toright = n - y;   left = Math.min(toleft, len);   right = Math.min(toright, len);   down = up = sq(len);   up -= sq(len - toup);   down -= sq(len - todown);   len--;   if (toright < len) {    up -= lrsp(len - toright, toup);    down -= lrsp(len - toright, todown);   }   if (toleft < len) {    up -= lrsp(len - toleft, toup);    down -= lrsp(len - toleft, todown);   }   return 1 + up + down + left + right;  }  public void solve() throws NumberFormatException, IOException {   n = nextInt();   x = nextInt();   y = nextInt();   c = nextInt();   long down = 0, up = 2 * n + 13;   while (up - down > 2) {    long tmp = (up + down) / 2;    if (onn(tmp) >= c) up = tmp;    else down = tmp;   }   if (onn(down) >= c) out.println(down);   else if (onn(down + 1) >= c) out.println(down + 1);   else if (onn(down + 2) >= c) out.println(down + 2);   else out.println(down + 3);  }  public void close() {   out.flush();   out.close();  } }
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 Pair implements Comparable<Pair>{   int a;   int b;   Pair(int a, int b) {    this.a = a;    this.b = b;   }   public int compareTo(Pair p) {    if (a != p.a)     return Integer.compare(a, p.a);    else     return Integer.compare(b, p.b);   }  }  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());   }   long nextLong() throws NumberFormatException, IOException {    return Long.valueOf(next());   }   double nextDouble() throws NumberFormatException, IOException {    return Double.valueOf(next());   }    String nextLine() throws IOException {    return br.readLine();   }  }  static class InputReader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;   public InputReader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public InputReader(String file_name) throws IOException   {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public String readLine() throws IOException   {    byte[] buf = new byte[64];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }   public int nextInt() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do    {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (c == '.')    {     while ((c = read()) >= '0' && c <= '9')     {      ret += (c - '0') / (div *= 10);     }    }    if (neg)     return -ret;    return ret;   }   private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }   private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }   public void close() throws IOException   {    if (din == null)     return;    din.close();   }  } }
3	public class Codeforces{  static class MyScanner{  BufferedReader br;  StringTokenizer st;   MyScanner(FileReader fileReader){  br = new BufferedReader(fileReader);  }   MyScanner(){  br = new BufferedReader(new InputStreamReader(System.in));  }   String nn(){  while(st == null || !st.hasMoreElements()){   try{   st = new StringTokenizer(br.readLine());   }catch(IOException e){   e.printStackTrace();   }  }  return st.nextToken();  }   char nc(){  return nn().charAt(0);  }   int ni(){  return Integer.parseInt(nn());  }   long nl(){  return Long.parseLong(nn());  }   double nd(){  return Double.parseDouble(nn());  }   int[] niArr0(int n){  int[] ar = new int[n];  for(int i = 0; i < n; i++) ar[i] = ni();  return ar;  }   int[] niArr1(int n){  int[] ar = new int[n + 1];  for(int i = 1; i <= n; i++) ar[i] = ni();  return ar;  }   long[] nlArr0(int n){  long[] ar = new long[n];  for(int i = 0; i < n; i++) ar[i] = nl();  return ar;  } }  public static <T> void mprintln(T ... ar){  for(T i: ar) out.print(i + " ");  out.println(); }  private static PrintWriter out;  public static void main(String[] args) throws FileNotFoundException{             MyScanner sc = new MyScanner();     out = new PrintWriter(new BufferedOutputStream(System.out));     getAns(sc);   out.close(); }  private static void getAns(MyScanner sc){  int n = sc.ni();  long[] ar = sc.nlArr0(n);   HashMap<Long, ArrayList<int[]>> map = new HashMap();   for(int i = 0; i < n; i++){  long cur = 0;  for(int j = i; j >= 0; j--){   cur += ar[j];   if(!map.containsKey(cur)) map.put(cur, new ArrayList());   map.get(cur).add(new int[]{j + 1, i + 1});  }  }      Set<Long> set = map.keySet();   ArrayList<int[]> ans = new ArrayList();   for(Long l: set){  ArrayList<int[]> cur = new ArrayList();  int right = -1;  for(int[] arc: map.get(l)) if(arc[0] > right){   right = arc[1];   cur.add(arc);  }    if(cur.size() > ans.size()) ans = cur;  }   out.println(ans.size());  for(int[] arc: ans) mprintln(arc[0], arc[1]); } }
5	public class A implements Runnable{   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());  }   long readLong() throws IOException{   return Long.parseLong(readString());  }   double readDouble() throws IOException{   return Double.parseDouble(readString());  }   public static void main(String[] args){   new Thread(null, new A(), "", 256 * (1L << 20)).start();  }   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();   int[] a = new int[n];   for (int i = 0; i < n; i++){    a[i] = readInt();   }   Arrays.sort(a);   a[n-1] = a[n-1] == 1? 2:1;   Arrays.sort(a);   for (int i = 0; i < n; i++){    out.print(a[i] + " ");   }  } }
1	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 {  public void solve(int testNumber, InputReader in, PrintWriter out) {   int n = in.nextInt();   int a = in.nextInt();   int b = in.nextInt();   int[] p = new int[n];   for (int i = 0; i < n; ++i)    p[i] = in.nextInt();   Map<Integer, Integer> position = new HashMap<>(n);   for (int i = 0; i < n; ++i)    position.put(p[i], i);   DisjointSet sets = new DisjointSet(n);   for (int i = 0; i < n; ++i) {    if (position.containsKey(a - p[i]))     sets.joinSet(i, position.get(a - p[i]));    if (position.containsKey(b - p[i]))     sets.joinSet(i, position.get(b - p[i]));   }   Group[] groups = new Group[n];   for (int i = 0; i < n; ++i)    if (sets.getSet(i) == i)     groups[i] = new Group();   for (int i = 0; i < n; ++i)    groups[sets.getSet(i)].value.add(p[i]);   int[] answer = new int[n];   for (Group group : groups) if (group != null) {    if (group.check(a)) {     for (int key : group.value)      answer[position.get(key)] = 0;    } else if (group.check(b)) {     for (int key : group.value)      answer[position.get(key)] = 1;    } else {     out.println("NO");     return;    }   }   out.println("YES");   for (int i = 0; i < n; ++i) {    if (i > 0) out.print(' ');    out.print(answer[i]);   }   out.println();  }  class Group {   Set<Integer> value = new HashSet<>();   boolean check(int sum) {    for (int key : value)     if (!value.contains(sum - key))      return false;    return true;   }  } } class InputReader {  private BufferedReader reader;  private 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());  } } class DisjointSet {  private final int[] label;  private int numSets;  private Listener listener;  public DisjointSet(int n, Listener listener) {   label = new int[n];   Arrays.fill(label, -1);   numSets = n;   this.listener = listener;  }  public DisjointSet(int n) {   this(n, null);  }  public int getSet(int at) {   if (label[at] < 0) return at;   return label[at] = getSet(label[at]);  }  public boolean sameSet(int u, int v) {   return getSet(u) == getSet(v);  }  public boolean joinSet(int u, int v) {   if (sameSet(u, v)) return false;   u = getSet(u);   v = getSet(v);   if (label[u] < label[v]) {    int tmp = u;    u = v;    v = tmp;   }   label[v] += label[u];   label[u] = v;   --numSets;   if (listener != null) listener.joined(u, v);   return true;  }  public static interface Listener {   public void joined(int joinedRoot, int root);  } }
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 t = in.readInt();    while (t-- > 0) {     int[] a = new int[]{in.readInt(), in.readInt()};     Arrays.sort(a);     int ans = 0;     while (a[0] > 0) {      int x = a[1] / a[0];      ans += x;      a[1] -= a[0] * x;      Arrays.sort(a);     }     out.println(ans);    }   }  }  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);   }  } }
1	public class C43 {  static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  static PrintWriter out = new PrintWriter(System.out);   static int nextInt() throws IOException {   in.nextToken();   return Integer.valueOf(in.sval);  }   static double nextDouble() throws IOException {   in.nextToken();   return Double.valueOf(in.sval);  }   static String nextString() throws IOException {   in.nextToken();   return in.sval;  }   static {   in.ordinaryChars('0', '9');   in.wordChars('0', '9');     in.ordinaryChars('.', '.');   in.wordChars('.', '.');     in.ordinaryChars('-', '-');   in.wordChars('-', '-');  }  public static void main(String[] args) throws IOException {   int n = nextInt();   char[] s = nextString().toCharArray();   int h = 0;   for (int i = 0; i < n; i++)    if (s[i] == 'H')     h++;     int ans = Integer.MAX_VALUE;   for (int i = 0; i < n; i++) {    int p = i, t = 0;    for (int j = 0; j < h; j++, p = (p+1)%n)     if (s[p] == 'T')      t++;    ans = Math.min(ans, t);   }     out.println(ans);   out.flush();  } }
6	public class D11 {  static StreamTokenizer in; static PrintWriter out;  static int nextInt() throws IOException {  in.nextToken();  return (int)in.nval; }  static String nextString() throws IOException {  in.nextToken();  return in.sval; }  public static void main(String[] args) throws IOException {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(System.out);  n = nextInt();  m = nextInt();   g = new boolean[n][n];  for (int i = 0; i < m; i++) {  int a = nextInt()-1, b = nextInt()-1;  g[a][b] = g[b][a] = true;  }   long ans = 0;  for (int i = n-1; i >= 0; i--) {  long cur = solve(i);  ans += cur;  }   out.println(ans/2);   out.flush(); }  static int n, m; static boolean[][] g;  static long solve(int v) {  long[][] memo = new long[v][1 << v];   for (int i = 0; i < v; i++)  if (g[v][i])   memo[i][1 << i] = 1;   for (int mask = 1; mask < (1 << v); mask++)  for (int i = 0; i < v; i++) if ((mask&(1 << i)) != 0)   for (int j = 0; j < v; j++) if (g[i][j] && (mask&(1 << j)) == 0)   memo[j][mask|(1 << j)] += memo[i][mask];   long res = 0;  for (int mask = 1; mask < (1 << v); mask++)  for (int i = 0; i < v; i++)   if (Integer.bitCount(mask) > 1 && g[v][i]) res += memo[i][mask];  return res; } }
1	public class Main {  Scanner in; PrintWriter out;  boolean isFirst(String line){  int pos = 0;  while( pos<line.length() && Character.isLetter(line.charAt(pos))){  pos++;  }  while( pos<line.length() && Character.isDigit(line.charAt(pos))){  pos++;  }  return pos!=line.length();   }  void solve() {  int n = in.nextInt();  in.nextLine();  for (int i = 1; i<=n; i++){  String line = in.nextLine();  line = line.toUpperCase();  if (isFirst(line)){   int pos = 1;   long row = 0;   while(Character.isDigit(line.charAt(pos))){   row*=10;   row+=line.charAt(pos)-'0';   pos++;   }   pos++;   long col = 0;   while(pos<line.length() && Character.isDigit(line.charAt(pos))){   col*=10;   col+=line.charAt(pos)-'0';   pos++;   }   StringBuilder sb = new StringBuilder();   while(col>0){   sb.append((char)('A'+((col-1)%26)));   col--;   col/=26;   }   sb = sb.reverse();   out.print(sb);   out.println(row);     }else{     int pos = 0;   long col = 0;   while( pos<line.length() && Character.isLetter(line.charAt(pos))){   col*=26;   col+=line.charAt(pos)-'A'+1;   pos++;   }   long row = 0;   while(pos<line.length() && Character.isDigit(line.charAt(pos))){   row*=10;   row+=line.charAt(pos)-'0';   pos++;   }   out.println("R"+row+"C"+col);  }  }  }  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();  } }
5	public class D {  static HashMap<Long, Integer> comp = new HashMap<Long, Integer>(); static HashMap<Integer, Long> rev = new HashMap<Integer, Long>(); static long freq[]; public static void main(String[] args) {  FastScanner in = new FastScanner();  int n = in.nextInt();  long a[] = new long[n];  long copy[] = new long[n];  long sum = 0;  for(int i = 0; i < n; i++){  a[i] = in.nextLong();  copy[i] = a[i];  sum+=a[i];  }  Arrays.sort(copy);  for(int i = 0; i < n; i++)   if(!comp.containsKey(copy[i])){   comp.put(copy[i], (comp.size()+1));     }      freq = new long[n+1];  Arrays.fill(freq, 0);  for(int i = 0; i < n; i++){  int v = comp.get(a[i]);  freq[v]++;  }   long res = 0;  BigInteger res2 = new BigInteger("0");  for(int i = 0; i < n; i++){   long x = a[i];      long below = getFreq(x-1);  long eq = getFreq(x);  long above = getFreq(x+1);  long other = (n-i)-below-eq-above;        long leaveOut = below*(x-1) + eq*(x) + above*(x+1);  long cur = (sum-leaveOut)-(x*other);    res2 = res2.add(new BigInteger(""+cur));  res += cur;  sum -= x;  freq[comp.get(x)]--;    }  System.out.println(res2); }  static long getFreq(long n){  if(!comp.containsKey(n)) return 0;  else return freq[comp.get(n)]; }     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());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  }  String next() {  return nextToken();  }   }   }
3	public class d {   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 perm[] = new int[n];  for(int i = 0; i < n; i++) {  perm[i] = in.nextInt();  }  int q = in.nextInt();   int inv[] = new int[n];  inv[0] = 0;  for(int i = 1; i < n; i++) {  inv[i] = inv[i-1];  for(int j = i - 1; j >= 0; j--) {   if(perm[i] < perm[j]) inv[i]++;  }  }  boolean parity = inv[n-1] % 2 == 0;   for(int i = 0; i < q; i++) {  int l = in.nextInt() - 1;  int r = in.nextInt() -1;   if(l == r) {   System.out.println(parity?"even":"odd");   continue;  }   int s = r - l + 1;  s = s * (s-1)/ 2;  if(s % 2 != 0) {   parity = !parity;  }  System.out.println(parity?"even":"odd");  }  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 String nextLine() throws IOException {  if (st == null) {   st = new StringTokenizer(br.readLine());  }  String line = st.nextToken("\n");  st = null;  return line;  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static class combinatorics {  static long modInv(long a, long b) {  return 1 < a ? b - modInv(b % a, a) * b / a : 1;  }  static long factorial[], mod;  combinatorics(int n, long MOD) {  mod = MOD;  factorial = new long[n + 1];  factorial[0] = 1;  for (int i = 1; i <= n; i++) {   factorial[i] = i * factorial[i - 1];   factorial[i] %= mod;  }  }  static long nCr(int n, int r) {  if (r > n)   return 0;  return (factorial[n] * modInv((factorial[n - r] * factorial[r]) % mod, mod)) % mod;  } }  public static class DisjointSet {  int p[], r[], s[];  int numDisjoint;  DisjointSet(int N) {  numDisjoint = N;  r = new int[N];  s = new int[N];  p = new int[N];  for (int i = 0; i < N; i++)   p[i] = i;  }  int findSet(int i) {  return (p[i] == i) ? i : (p[i] = findSet(p[i]));  }  boolean isSameSet(int i, int j) {  return findSet(i) == findSet(j);  }  void unionSet(int i, int j) {  if (!isSameSet(i, j))   {   numDisjoint--;   int x = findSet(i), y = findSet(j);   if (r[x] > r[y]) {   p[y] = x;    s[x] += s[y];   } else {   p[x] = y;   if (r[x] == r[y])    r[y]++;   s[y] += s[x];   }  }  }  int sizeOfSet(int i) {  return s[findSet(i)];  } }; }
2	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);   C489 solver = new C489();   solver.solve(1, in, out);   out.close();  }  static class C489 {   int mod = 1000000007;   public void solve(int testNumber, ScanReader in, PrintWriter out) {    long x = in.scanLong();    long k = in.scanLong();    if (x == 0) {     out.println(0);     return;    }    long p = CodeX.power(2, k, mod);    long ans = (2 * p * (x % mod)) % mod;    ans = (ans + 1) % mod;    ans = (ans - p + mod) % mod;    out.println(ans);   }  }  static class CodeX {   public static long power(long x, long y, long p) {    long res = 1;    x = x % p;    while (y > 0) {     if ((y & 1) != 0)      res = (res * x) % p;     y = y >> 1;     x = (x * x) % p;    }    return res;   }  }  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++];   }   private boolean isWhiteSpace(int n) {    if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;    else return false;   }   public long scanLong() {    long 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;   }  } }
4	public class GivenString {  public static void main(String[] args) {   Scanner input = new Scanner(System.in);     String s = input.nextLine();     int max = 0;     for(int i = 0; i < s.length(); i++) {    for(int j = i + 1; j <= s.length(); j++) {     String tmp = s.substring(i, j);     int match = 0;     for(int k = 0; k + tmp.length() <= s.length(); k++) {      if(tmp.equals(s.substring(k, k + tmp.length()))) {       match++;            }     }     if(match >= 2) {      max = Math.max(max, tmp.length());     }    }   }   System.out.println(max);   System.exit(0);  } }
1	public class D909 {  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   char[] line = br.readLine().toCharArray();   int n = line.length;   int l = 0;   ArrayList<Node> groups = new ArrayList<>();   Node node = new Node(line[0], 1);   groups.add(node);   for (int i = 1; i < n; i++) {    if (line[i] == groups.get(l).letter) {     groups.get(l).count++;    } else {     node = new Node(line[i], 1);     groups.add(node);     l++;    }   }   int moves = 0;   ArrayList<Node> temp = new ArrayList<>();   while (groups.size() > 1) {    moves++;    l = groups.size();    groups.get(0).count--;    groups.get(l - 1).count--;    for (int i = 1; i < l - 1; i++) {     groups.get(i).count -= 2;    }    int p;    for (p = 0; p < l; p++) {     if (groups.get(p).count > 0) {      temp.add(groups.get(p));      break;     }    }    int lTemp = temp.size();    for (p++; p < l; p++) {     if (groups.get(p).count <= 0) {      continue;     }     if (groups.get(p).letter == temp.get(lTemp - 1).letter) {      temp.get(lTemp - 1).count += groups.get(p).count;     } else {      temp.add(groups.get(p));      lTemp++;     }    }    groups.clear();    groups.addAll(temp);    temp.clear();   }   System.out.println(moves);  }  private static class Node {   char letter;   int count;   Node(char letter, int count) {    this.letter = letter;    this.count = count;   }  } }
4	public class Main { public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader(new FileReader(new File("input.txt")));  PrintWriter pw = new PrintWriter(new File("output.txt"));  StringTokenizer st;  st = new StringTokenizer(in.readLine());   int n = Integer.parseInt(st.nextToken()),  m = Integer.parseInt(st.nextToken()),  k = Integer.parseInt(in.readLine());   int[][] A = new int[n][m];   st = new StringTokenizer(in.readLine());  for (int i = 0 ; i < k ; i++) {  int x1 = Integer.parseInt(st.nextToken()) - 1,   y1 = Integer.parseInt(st.nextToken()) - 1;    A[x1][y1] = -10000000;    for (int j = 0 ; j < n ; j++) {   for (int g = 0 ; g < m ; g++) {   if (A[j][g] == 0 || (A[j][g] > (Math.abs(y1 - g) + Math.abs(x1 - j)))) {    A[j][g] = (Math.abs(y1 - g) + Math.abs(x1 - j));   }   }  }  }   int f = 0, h = 0;   for (int i = 0 ; i < n ; i++) {  for (int j = 0 ; j < m ; j++) {   if (A[i][j] != -10000000) {   f = i;   h = j;   }  }  }   for (int i = 0 ; i < n ; i++) {  for (int j = 0 ; j < m ; j++) {   if (A[i][j] > A[f][h] && A[i][j] != -10000000) {   f = i;   h = j;   }  }  }   pw.println((f + 1) + " " + (h + 1));  pw.close(); } }
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 fuck { public static int[] a;  public static void main(String[] args) {  Scanner input = new Scanner(System.in);  long r = input.nextLong();  long l = input.nextLong();  if((l - r + 1) < 3){  System.out.println(-1);  }  else  {  if(r % 2 == 0)   System.out.println(r + " " + (r +1)+ " " + (r+2) );  else{   if(l -r + 1 >3){   ++r;   System.out.println(r + " " + (r +1)+ " " + (r+2) );   }   else   System.out.println(-1);   }  } } }
1	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 {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int numTests = in.nextInt();    for (int test = 0; test < numTests; test++) {     int n = in.nextInt();     boolean can = false;     if (n % 2 == 0 && isSquare(n / 2)) {      can = true;     }     if (n % 4 == 0 && isSquare(n / 4)) {      can = true;     }     out.println(can ? "YES" : "NO");    }   }   private boolean isSquare(int n) {    int x = (int) Math.sqrt(n);    while (x * x > n) {     --x;    }    while (x * x < n) {     ++x;    }    return x * x == n;   }  }  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 R113A {  public static void main(String[] args){   Scanner in = new Scanner(System.in);   int n = in.nextInt(), k = in.nextInt();   int[] ind = new int[n];   int[] p = new int[n];   int[] t = new int[n];   for (int i = 0; i < n; i++){    ind[i] = i;    p[i] = in.nextInt();    t[i] = in.nextInt();   }     for (int i = 0; i < n - 1; i++)   for (int j = i + 1; j < n; j++){    if (p[i] < p[j] || (p[i] == p[j] && t[i] > t[j])){     int tmp = p[i];     p[i] = p[j];     p[j] = tmp;     tmp = t[i];     t[i] = t[j];     t[j] = tmp;    }   }     int i = k - 1;   while (i > 0 && p[i] == p[i - 1] && t[i] == t[i - 1]) i--;    int j = 0;   while (i < n - 1 && p[i] == p[i + 1] && t[i] == t[i + 1]) {    i++;    j++;   }   System.out.println(j + 1);       } }
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;   }  }  private static 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());   }   String nextLine() throws IOException {    return reader.readLine();   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }  } }
6	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++){    int n=Int();int m=Int();    int A[][]=new int[n][m];    for(int i=0;i<n;i++){     for(int j=0;j<m;j++){      A[i][j]=Int();     }    }    Sol sol=new Sol();    sol.solution(out,A);   }   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 dif[][];  int dp[][][];  public void solution(PrintWriter out,int A[][]){   int n=A.length;int m=A[0].length;   int res=0;   dif=new int[n][n];   for(int i=0;i<n;i++){    for(int j=i+1;j<A.length;j++){     int mn=Integer.MAX_VALUE;     for(int k=0;k<m;k++){      mn=Math.min(mn,Math.abs(A[i][k]-A[j][k]));     }     dif[i][j]=mn;     dif[j][i]=mn;        }   }   int state=(1<<n)-1;   dp=new int[state+5][n+1][n+1];   for(int i=0;i<dp.length;i++){    for(int j=0;j<dp[0].length;j++){     Arrays.fill(dp[i][j],-1);    }   }   for(int i=0;i<n;i++){    res=Math.max(res,dfs(A,state^(1<<i),i,i));   }   out.println(res);  }  public int dfs(int A[][],int state,int pre,int start){   if(state==0){    int mn=Integer.MAX_VALUE;    for(int i=1;i<A[0].length;i++){     mn=Math.min(mn,Math.abs(A[start][i]-A[pre][i-1]));    }    return mn;   }    if(dp[state][pre][start]!=-1){    return dp[state][pre][start];   }   int res=0;   for(int i=0;i<A.length;i++){    if((state&(1<<i))!=0){     int di=dif[pre][i];     res=Math.max(res,Math.min(di,dfs(A,state^(1<<i),i,start)));    }   }      dp[state][pre][start]=res;   return res;  }     }
1	public class A {  public static long Mod = (long) (1e9 + 7);  public static long[][] dp;  public static void main(String[] args) throws FileNotFoundException {   PrintWriter out = new PrintWriter(System.out);   Scanner in = new Scanner();   int n = in.nextInt();   int a = in.nextInt();   int b = in.nextInt();   int[] data = new int[n];   int[]u = new int[n];   int[]s = new int[n];   HashMap<Integer, Integer> map = new HashMap();     for(int i = 0; i < n; i++){    u[i] = i;    data[i] = in.nextInt();    map.put(data[i], i);   }     boolean ok = true;   boolean[]check = new boolean[n];   for(int i = 0; i < n; i++){    if(map.containsKey(a - data[i])){     u[find(i, u)]= u[find(map.get(a- data[i]), u)];     s[i] |= 1;    }    if(map.containsKey(b - data[i])){     u[find(i, u)]= u[find(map.get(b- data[i]), u)];     s[i] |= 2;    }      }   int[]g = new int[n];   Arrays.fill(g,3);   for(int i = 0; i< n; i++){    if(s[i] == 0){     ok = false;     break;    }    g[find(i, u)] &= s[i];    if(g[find(i,u)] == 0){     ok = false;     break;    }   }     if(ok){    out.println("YES");    for(int i = 0; i < n; i++){     if((g[find(i,u)] & 1) == 0){      out.print(1 + " ");     }else{      out.print(0 + " ");     }    }   }else{    out.println("NO");   }   out.close();  }   static int find(int index, int[]u){   if(index != u[index]){    return u[index] = find(u[index], u);   }   return index;  }  public static long pow(int a, int b, long mod) {   if (b == 0) {    return 1;   }   if (b == 1) {    return a;   }   long v = pow(a, b / 2, mod);   if (b % 2 == 0) {    return (v * v) % mod;   } else {    return (((v * v) % mod) * a) % mod;   }  }  public static int[][] powSquareMatrix(int[][] A, long p) {   int[][] unit = new int[A.length][A.length];   for (int i = 0; i < unit.length; i++) {    unit[i][i] = 1;   }   if (p == 0) {    return unit;   }   int[][] val = powSquareMatrix(A, p / 2);   if (p % 2 == 0) {    return mulMatrix(val, val);   } else {    return mulMatrix(A, mulMatrix(val, val));   }  }  public static int[][] mulMatrix(int[][] A, int[][] B) {   int[][] result = new int[A.length][B[0].length];   for (int i = 0; i < result.length; i++) {    for (int j = 0; j < result[0].length; j++) {     long temp = 0;     for (int k = 0; k < A[0].length; k++) {      temp += ((long) A[i][k] * B[k][j] % Mod);      temp %= Mod;     }     temp %= Mod;     result[i][j] = (int) temp;    }   }   return result;  }  public static boolean nextPer(int[] data) {   int i = data.length - 1;   while (i > 0 && data[i] < data[i - 1]) {    i--;   }   if (i == 0) {    return false;   }   int j = data.length - 1;   while (data[j] < data[i - 1]) {    j--;   }   int temp = data[i - 1];   data[i - 1] = data[j];   data[j] = temp;   Arrays.sort(data, i, data.length);   return true;    }  static class FT {   int[] data;   FT(int n) {    data = new int[n];   }   void update(int index, int val) {       while (index < data.length) {     data[index] += val;     index += index & (-index);         }   }   int get(int index) {       int result = 0;    while (index > 0) {     result += data[index];     index -= index & (-index);        }    return result;   }  }  static long gcd(long a, long b) {   if (b == 0) {    return a;   } else {    return gcd(b, a % b);   }  }  static long pow(long a, int b) {   if (b == 0) {    return 1;   }   if (b == 1) {    return a;   }   long val = pow(a, b / 2);   if (b % 2 == 0) {    return val * val % Mod;   } else {    return (val * val % Mod) * a % Mod;   }  }         static Point minus(Point a, Point b) {   return new Point(a.x - b.x, a.y - b.y);  }      static double cross(Point a, Point b, Point c) {   Point ab = new Point(b.x - a.x, b.y - a.y);   Point ac = new Point(c.x - a.x, c.y - a.y);   return cross(ab, ac);  }  static double cross(Point a, Point b) {   return a.x * b.y - a.y * b.x;  }    static long dot(Point a, Point b, Point c) {   Point ab = new Point(b.x - a.x, b.y - a.y);   Point ac = new Point(c.x - a.x, c.y - a.y);   return dot(ab, ac);  }  static long dot(Point a, Point b) {   long total = a.x * b.x;   total += a.y * b.y;   return total;  }  static double dist(Point a, Point b) {   long total = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);   return Math.sqrt(total);  }  static long norm(Point a) {   long result = a.x * a.x;   result += a.y * a.y;   return result;  }  static double dist(Point a, Point b, Point x, boolean isSegment) {   double dist = cross(a, b, x) / dist(a, b);      if (isSegment) {    Point ab = new Point(b.x - a.x, b.y - a.y);    long dot1 = dot(a, b, x);    long norm = norm(ab);    double u = (double) dot1 / norm;    if (u < 0) {     return dist(a, x);    }    if (u > 1) {     return dist(b, x);    }   }   return Math.abs(dist);    }  static long squareDist(Point a, Point b) {   long x = a.x - b.x;   long y = a.y - b.y;   return x * x + y * y;  }  static class Point {   int x, y;   public Point(int x, int y) {    this.x = x;    this.y = y;   }   @Override   public String toString() {    return "Point{" + "x=" + x + ", y=" + y + '}';   }  }  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 long nextLong() {    return Long.parseLong(next());   }   public int nextInt() {    return Integer.parseInt(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    st = null;    try {     return br.readLine();    } catch (Exception e) {     throw new RuntimeException();    }   }   public boolean endLine() {    try {     String next = br.readLine();     while (next != null && next.trim().isEmpty()) {      next = br.readLine();     }     if (next == null) {      return true;     }     st = new StringTokenizer(next);     return st.hasMoreTokens();    } catch (Exception e) {     throw new RuntimeException();    }   }  } }
5	public class A {  public static void main(String[] args) {   A problem = new A();   problem.solve();  }  private void solve() {   Scanner sc = new Scanner(System.in);      int n = sc.nextInt();     int p = sc.nextInt();   int v = sc.nextInt();     long a[] = new long[n];     for (int i = 0; i < n; i++) {    a[i] = sc.nextLong();   }     long aux;   for(int i = 0; i < n -1; i++){    for(int j = i + 1; j < n; j++){      if((a[i]) > (a[j])){      aux = a[j];      a[j] = a[i];      a[i] = aux;     }    }   }     System.out.println(a[v]-a[v-1]);       } }
5	public class A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int a = sc.nextInt();   int b = sc.nextInt();   int[] ar = new int[n];   for (int i = 0; i < n; i++) {    ar[i] = sc.nextInt();   }   Arrays.sort(ar);   if (ar[b-1] == ar[b ]) {    System.out.println(0);   } else {    System.out.println(ar[b ] - ar[b-1]);   }  } }
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);  } }
4	public class Main {   public static void main(String[] args) throws NumberFormatException, IOException  {   Scanner sc = new Scanner(new File("input.txt"));     int n = sc.nextInt();   int m =sc.nextInt();   sc.nextLine();   int k =sc.nextInt();   int les[][] = new int[n][m];   PrintWriter out = new PrintWriter(new FileWriter("output.txt"));      ArrayList<Integer[]> list = new ArrayList();   sc.nextLine();   for(int i = 0;i<k;i++)   {       Integer[] ii = new Integer[2];    ii[0] = sc.nextInt()-1;    ii[1] = sc.nextInt()-1;    list.add(ii);      }   sc.close();   int maxr = 0;   int maxi = 0;   int maxj = 0;   for(int i = 0;i<n;i++)   {    for(int j = 0;j<m;j++)    {     int minr = 100000;     int mini = 0;     int minj = 0;     for(int f = 0;f<k;f++)     {      Integer[] ii = list.get(f);      int ww = Math.abs(ii[0] - i);      int hh = Math.abs(ii[1] - j);      int r = ww+hh;      if(r<minr)      {       minr = r;       mini=i;       minj=j;      }          }     if(maxr<minr&&minr<100000)     {      maxi = mini;      maxj = minj;      maxr = minr;     }    }   }     out.print((maxi+1)+" "+(maxj+1));   out.close();    }        }
5	public class A113 {  public static void main(String[] args) {   new A113().run();  }   public void run() {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int k = in.nextInt();   Team[] teams = new Team[n];   for (int i = 0; i < teams.length; i++) {    teams[i] = new Team(in.nextInt(), in.nextInt());   }   Arrays.sort(teams);   int counter = 1;   int index = k-2;   while (index >= 0 && teams[index].p == teams[k-1].p && teams[index].t == teams[k-1].t) {    index--;    counter++;   }   index = k;   while (index < n && teams[index].p == teams[k-1].p && teams[index].t == teams[k-1].t) {    index++;    counter++;   }   System.out.println(counter);  }   private class Team implements Comparable<Team> {   int p;   int t;     public Team(int pp, int tt) {    p = pp; t = tt;   }   @Override   public int compareTo(Team o) {    if (o.p - this.p == 0)     return this.t - o.t;    return o.p - this.p;   }  } }
0	public class D {  BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof;  double f(int dist, double initSp, int a, int maxSp) {  double distToReachMaxSpeed = 0.5 * (maxSp * maxSp - initSp * initSp)   / a;  if (dist > distToReachMaxSpeed)  return 1d * (maxSp - initSp) / a + (dist - distToReachMaxSpeed)   / maxSp;  return (Math.sqrt(initSp * initSp + 2 * a * dist) - initSp) / a; }  void solve() throws IOException {  int a = nextInt();  int maxSp = nextInt();  int len = nextInt();  int signX = nextInt();  int signSp = nextInt();  if (maxSp <= signSp) {  out.printf("%.9f\n", f(len, 0, a, maxSp));  return;  }  double distToReachSignSp = 0.5 * signSp * signSp / a;  if (distToReachSignSp >= signX) {  out.printf("%.9f\n", f(len, 0, a, maxSp));  return;  }  double distToReachMaxThenSign = 0.5   * (maxSp * maxSp + maxSp * maxSp - signSp * signSp) / a;  if (distToReachMaxThenSign <= signX) {  double t = 1d * (2 * maxSp - signSp) / a   + (signX - distToReachMaxThenSign) / maxSp   + f(len - signX, signSp, a, maxSp);  out.printf("%.9f\n", t);  return;  }   double xSp = Math.sqrt(a * signX + signSp * signSp * 0.5);  double xTime = (2 * xSp - signSp) / a;  out.printf("%.9f\n", xTime + f(len - signX, signSp, a, maxSp)); }  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 D().inp(); }  String nextToken() {  while (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(br.readLine());  } catch (Exception e) {   eof = true;   return null;  }  }  return st.nextToken(); }  String nextString() {  try {  return br.readLine();  } catch (IOException e) {  eof = true;  return null;  } }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
3	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();   }   static int INF = (int)1e9;  static int maxn = (int)2e5+5;  static int mod= 998244353 ;  static int n,m,k,t,q,d,cnt=2;   void solve(PrintWriter out, Reader in) throws IOException{   n = in.nextInt();     Integer[] arr = new Integer[n];   for(int i=0;i<n;i++) arr[i] = in.nextInt();     boolean[] vis = new boolean[n];     Arrays.sort(arr);   int cnt=0;   for(int i=0;i<n;i++){    if(vis[i]) continue;    cnt++;    vis[i]=true;    for(int j=i+1;j<n;j++){     if(!vis[j]){      if(arr[j]%arr[i]==0){       vis[j]=true;      }     }    }   }        out.println(cnt);    }      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 nextLine() {   int c = read();   while (isSpaceChar(c)) {    c = read();   }   StringBuilder res = new StringBuilder();   do {    res.appendCodePoint(c);    c = read();   } while (!isEndOfLine(c));   return res.toString();  }  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();  }  double nextDouble()  {   return Double.parseDouble(next());  }  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 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;  }  } }
5	public class Main {  protected static final double EPS = 1e-11;  private static StreamTokenizer in;  private static Scanner ins;  private static PrintWriter out;  protected static final Double[] BAD = new Double[]{null, null};  private boolean[][] layouts;  private int c;  private int b;  private int a;  private String word;  public static void main(String[] args) {   try {    in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));    ins = new Scanner(new BufferedReader(new InputStreamReader(System.in)));    out = new PrintWriter(System.out);    try {     if (System.getProperty("xDx") != null) {      in = new StreamTokenizer(new BufferedReader(new FileReader("input.txt")));      ins = new Scanner(new FileReader("input.txt"));      out = new PrintWriter(new FileWriter("output.txt"));     }    } catch (Exception e) {     in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));     ins = new Scanner(new BufferedReader(new InputStreamReader(System.in)));     out = new PrintWriter(System.out);    }    new Main().run();   } catch (Throwable e) {    throw new RuntimeException(e);   } finally {    out.close();   }  }  private int nextInt() throws IOException {   in.nextToken();   return (int) in.nval;  }  private long nextLong() throws IOException {   in.nextToken();   return (long) in.nval;  }  private double nextDouble() throws IOException {   in.nextToken();   return in.nval;  }  private String nextString() throws IOException {   in.nextToken();   return in.sval;  }  private char nextChar() throws IOException {   in.nextToken();   return (char) in.ttype;  }  private void run() throws Exception {     solve();  }  private void solve() throws IOException {   int n = nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = nextInt();   }   Map<Long, Integer> map = new HashMap<>();   BigInteger res = BigInteger.ZERO;   long sum = 0;   long amount = 0;   for (int i = n - 1; i >= 0; i--) {    long cur = a[i];    Pair same = getZeroAmount(cur, map);    res = res.add(BigInteger.valueOf((sum - same.sum) - cur * (amount - same.amount)));    amount++;    sum += cur;    map.put(cur, map.getOrDefault(cur, 0) + 1);   }   out.println(res);  }  class Pair {   long amount;   long sum;   public Pair(long amount, long sum) {    this.amount = amount;    this.sum = sum;   }  }  private Pair getZeroAmount(long cur, Map<Long, Integer> map) {   long amount = 0;   long sum = 0;   for (long i = cur - 1; i <= cur + 1; i++) {    long amountI = map.getOrDefault(i, 0);    amount += amountI;    sum += amountI * i;   }   return new Pair(amount, sum);  }  private List<Integer> iterate(List<Integer> a) {   ArrayList<Integer> b = new ArrayList<>();   int prev = -1;   for (int x : a) {    if (x == prev) {     b.add(x);    } else {     prev = x;    }   }   return b;  }  private long gcd(long a, long b) {   while (a > 0 && b > 0) {    long k = a % b;    a = b;    b = k;   }   return a | b;  } }
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 String nextLine() throws IOException {    return br.readLine();   }   public int nextInt() throws IOException {    return Integer.parseInt(next());   }   public double nextDouble() throws IOException {    return Double.parseDouble(next());   }   public char nextChar() throws IOException {    return next().charAt(0);   }   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;   }   public long[] nextLongArray(int n) throws IOException {    long[] a = new long[n];    for (int i = 0; i < n; i++)     a[i] = nextLong();    return a;   }    public Integer[] nextIntegerArray(int n) throws IOException {    Integer[] a = new Integer[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }   public double[] nextDoubleArray(int n) throws IOException {    double[] ans = new double[n];    for (int i = 0; i < n; i++)     ans[i] = nextDouble();    return ans;   }   public short nextShort() throws IOException {    return Short.parseShort(next());   }  } }
5	public class A { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni(), k = ni();  int[][] d = new int[n][2];  for(int i = 0;i < n;i++){  d[i][0] = ni();  d[i][1] = ni();  }   Arrays.sort(d, new Comparator<int[]>() {  public int compare(int[] a, int[] b) {   if(a[0] - b[0] != 0)return -(a[0] - b[0]);   return a[1] - b[1];  }  });   int b;  for(b = k-1;b >= 0 && d[k-1][0] == d[b][0] && d[k-1][1] == d[b][1];b--);  b++;  int a;  for(a = k-1;a < n && d[k-1][0] == d[a][0] && d[k-1][1] == d[a][1];a++);  a--;  out.println(a-b+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 A().run(); }  public int ni() {  try {  int num = 0;  boolean minus = false;  while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));  if(num == '-'){   num = 0;   minus = true;  }else{   num -= '0';  }    while(true){   int b = is.read();   if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');   }else{   return minus ? -num : num;   }  }  } catch (IOException e) {  }  return -1; }  public long nl() {  try {  long num = 0;  boolean minus = false;  while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));  if(num == '-'){   num = 0;   minus = true;  }else{   num -= '0';  }    while(true){   int b = is.read();   if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');   }else{   return minus ? -num : num;   }  }  } catch (IOException e) {  }  return -1; }  public String ns() {  try{  int b = 0;  StringBuilder sb = new StringBuilder();  while((b = is.read()) != -1 && (b == '\r' || b == '\n' || b == ' '));  if(b == -1)return "";  sb.append((char)b);  while(true){   b = is.read();   if(b == -1)return sb.toString();   if(b == '\r' || b == '\n' || b == ' ')return sb.toString();   sb.append((char)b);  }  } catch (IOException e) {  }  return ""; }  public char[] ns(int n) {  char[] buf = new char[n];  try{  int b = 0, p = 0;  while((b = is.read()) != -1 && (b == ' ' || b == '\r' || b == '\n'));  if(b == -1)return null;  buf[p++] = (char)b;  while(p < n){   b = is.read();   if(b == -1 || b == ' ' || b == '\r' || b == '\n')break;   buf[p++] = (char)b;  }  return Arrays.copyOf(buf, p);  } catch (IOException e) {  }  return null; }   double nd() { return Double.parseDouble(ns()); } boolean oj = System.getProperty("ONLINE_JUDGE") != null; void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
3	public class A {  public static void main(String[] args) throws Exception {   Scanner in = new Scanner(System.in);   PrintWriter pw = new PrintWriter(System.out);   int n = in.nextInt();   int a[] = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }   Arrays.sort(a);   int vis[] = new int[n];   Arrays.fill(vis, -1);   int c = 0;   for (int i = 0; i < n; i++) {    if (vis[i] != -1) continue;    c++;    for (int j = i; j < n; j++) {     if (vis[j] == -1 && a[j] % a[i] == 0) {      vis[j] = c;     }    }   }     pw.println(c);   pw.close();  }  static void debug(Object... obj) {   System.err.println(Arrays.deepToString(obj));  } }
0	public class Main{  void solve(){   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int n1 = n/10;   int n2 = n/100*10 + n%10;   int ans = n;   ans = Math.max(ans, n1);   ans = Math.max(ans, n2);   System.out.println(ans);  }  public static void main(String[] args){   new Main().solve();  } }
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;   }  }  }
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);  A solver = new A();  solver.solve(1, in, out);  out.close(); } } class A { public void solve(int testNumber, InputReader in, PrintWriter out) {   int n = in.readInt();   int a = in.readInt();   int b = in.readInt();   int[] hs = new int[n];   for (int i=0;i<n;i++){    hs[i]=in.readInt();   }   Arrays.sort(hs);   out.println(hs[b]-hs[b-1]); } } class InputReader {  BufferedReader in;  public InputReader(InputStream stream) {   in = new BufferedReader(new InputStreamReader(stream));  }  public int skipSpace() {   int c;   try {    while (true) {     c = in.read();     if (c < 0) {      throw new InputMismatchException();     }     if (c > 32) {      break;     }    }   } catch (IOException e) {    throw new InputMismatchException();   }   return c;  }  public int readInt() {   int res = 0;   boolean sign = false;   int c = skipSpace();   try {    if (c == '-') {     sign = true;     c = in.read();    }    while (true) {     if (c >= '0' && c <= '9') {      res = res * 10 + c - '0';     } else {      throw new InputMismatchException();     }     c = in.read();     if (c <= 32) {      break;     }    }    if (sign) {     res = -res;    }    return res;   } catch (IOException e) {    throw new InputMismatchException();   }  }  }
5	public class VtoraiaStat implements Runnable {  boolean isLocalMode = false;   private void doJob() throws Exception {   int n = nextInt();   int[] r = new int[n];   for(int i =0;i<n;i++){    r[i]=nextInt();   }   Arrays.sort(r);   int m = r[0];   for(int i=0;i<n;i++){    if(r[i]!=m){     writer.write(""+r[i]);     return;    }   }   writer.write("NO");  }   public static void main(String[] args) {   new VtoraiaStat().run();  }  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter writer;  public void run() {   try {    reader = new BufferedReader(getReader());    tokenizer = null;    writer = new PrintWriter(System.out);       doJob();    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();  }  public Reader getReader() throws FileNotFoundException {   if (isLocalMode) {    return new FileReader("input.txt");   } else {    return new InputStreamReader(System.in);   }  } }
0	public class Main {  static long mod=((long)1e9)+7;  public static int gcd(int a,int b){if(b==0)return a;else return gcd(b,a%b);}  public static long pow_mod(long x,long y){long res=1;x=x%mod;while(y > 0){if((y & 1)==1)res=(res * x)%mod;y=y>>1;x =(x * x)%mod;}return res;}  public static int lower_bound(int[]arr,int val){int lo=0;int hi=arr.length-1;while(lo<hi){int mid=lo+((hi-lo+1)/2);if(arr[mid]==val){return mid;}else if(arr[mid]>val){hi=mid-1;}else lo=mid;}if(arr[lo]<=val)return lo;else return -1;}  public static int upper_bound(int[]arr,int val){int lo=0;int hi=arr.length-1;while(lo<hi){int mid=lo+((hi-lo)/2);if(arr[mid]==val){return mid;}else if(arr[mid]>val){hi=mid;;}else lo=mid+1;}if(arr[lo]>=val)return lo;else return -1;}   public static void main (String[] args) throws java.lang.Exception  {   Reader sn = new Reader();   Print p = new Print();   int n = sn.nextInt();   while((n--) > 0){    int a = sn.nextInt();    int b = sn.nextInt();    int small = Math.min(a , b);    int large = Math.max(a , b);    long steps = 0;    while(small != 0){     steps += (long)(large/small);     int large1 = small;     small = large % small;     large = large1;    }    p.printLine(Long.toString(steps));   }   p.close();  } } class Pair implements Comparable<Pair> {  int val;  int in;  Pair(int a, int b){  val=a;   in=b;  }  @Override  public int compareTo(Pair o) {  if(val==o.val)  return Integer.compare(in,o.in);  else  return Integer.compare(val,o.val);  }} class Reader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;   public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }   public Reader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public Reader(String file_name) throws IOException   {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public String readLine() throws IOException   {    byte[] buf = new byte[64];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }     public String readWord()throws IOException   {  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() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do    {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');     if (neg)     return -ret;    return ret;   }    public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }    public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();     do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');     if (c == '.')    {     while ((c = read()) >= '0' && c <= '9')     {      ret += (c - '0') / (div *= 10);     }    }     if (neg)     return -ret;    return ret;   }    private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }    private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }    public void close() throws IOException   {    if (din == null)     return;    din.close();   }  } class Print {  private final BufferedWriter bw;  public Print()  {   bw=new BufferedWriter(new OutputStreamWriter(System.out));  }  public void print(String str)throws IOException  {   bw.append(str);  }  public void printLine(String str)throws IOException  {   print(str);   bw.append("\n");  }  public void close()throws IOException  {   bw.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);   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 {   private static BufferedReader in;   private static 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();   }  } }
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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
6	public class C {  public static void main(String[] args)  {  new C(new Scanner(System.in));  }  vect[] vs;  int N;  int oo = 987654321;  ArrayList<choice> cs;  choice[][] cg;  int MF;  int[] memo;  int[] next;  int go(int m)  {  if (m == MF)   return 0;  if (memo[m] != -1)   return memo[m];     int res = oo;  int nxt = -1;   int i=0;  for (i=0; i<N; i++)  {   if (((1<<i)&m) == 0)    break;  }   for (int j=0; j<N; j++)  {   choice cc = cg[i][j];   if ((m&cc.m) > 0)    continue;    int r2 = cc.cost+go(m|cc.m);   if (r2 < res)   {    res = r2;    nxt = cc.index;   }  }   memo[m] = res;  next[m] = nxt;  return res;  }  public C(Scanner in)  {  vect vt = new vect(in.nextInt(), in.nextInt());  N = in.nextInt();  vs = new vect[N+1];  vs[N] = vt;  for (int i=0; i<N; i++)   vs[i] = new vect(in.nextInt(), in.nextInt());     cs = new ArrayList<choice>();  cg = new choice[N][N];  for (int i=0; i<N; i++)  {   choice cc = new choice(cs.size(), 2*vs[i].dist(vt), 1<<i);   cc.add(i);   cs.add(cc);   cg[i][i] = cc;  }   for (int i=0; i<N; i++)  {   for (int j=i+1; j<N; j++)   {    int dist = vs[i].dist(vt);    dist += vs[i].dist(vs[j]);    dist += vs[j].dist(vt);    choice cc = new choice(cs.size(), dist, (1<<i)|(1<<j));    cc.add(i); cc.add(j);    cs.add(cc);    cg[i][j] = cc;    cg[j][i] = cc;   }  }   MF = (1<<N)-1;  next = new int[MF+1];  memo = new int[MF+1];   Arrays.fill(next, -1);  Arrays.fill(memo, -1);   int res = go(0);  System.out.println(res);   int m = 0;  StringBuilder sb = new StringBuilder();  while (m != -1)  {      sb.append(0);   sb.append(' ');   int i = next[m];   if (i == -1)    break;   choice cc = cs.get(i);   for (int j : cc.iv)   {    sb.append(f(j));    sb.append(' ');   }   m = m|cc.m;  }  System.out.println(sb.toString().trim());  }  int f(int i)  {  if (i == N)   return 0;  return i+1;  } }  class choice {  int cost;  int m;  int index;  ArrayList<Integer> iv;  public choice(int ii, int c, int mm)  {  index = ii;  cost = c;  m = mm;  iv = new ArrayList<Integer>(2);  }  void add(int i)  {  iv.add(i);  } }  class vect {  int x, y;  public vect(int i, int j)  {  x=i; y=j;  }  int dist(vect rhs)  {  int xx = x-rhs.x;  int yy = y-rhs.y;  return xx*xx+yy*yy;  } }
1	public class CF495A {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   int n = s.nextInt();   long d = s.nextLong();   long[] arr = new long[n];   for (int i = 0; i < n; i++) {    arr[i] = s.nextLong();   }   Arrays.sort(arr);   long ans = 2;   for (int i = 0; i < n - 1; i++) {    if(arr[i + 1] - arr[i] > 2 * d){     ans += 2;    }else if(arr[i + 1] - arr[i] == 2 * d){     ans += 1;    }   }   System.out.println(ans);  } }
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 CottageVillage {  static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st;  static String LINE() throws Exception { return stdin.readLine(); } static String TOKEN() throws Exception {  while (st == null || !st.hasMoreTokens())st = new StringTokenizer(LINE());  return st.nextToken(); } static int INT() throws Exception {return Integer.parseInt(TOKEN());} static long LONG() throws Exception {return Long.parseLong(TOKEN());} static double DOUBLE() throws Exception {return Double.parseDouble(TOKEN());}  static DecimalFormat DF = new DecimalFormat("0.000",new DecimalFormatSymbols(Locale.ENGLISH));  public static final double EPSILON = 1E-9;  public static void main(String[] args) throws Exception {  int N = INT(), T = INT();  House[] list = new House[N];  for(int i = 0;i<N;i++) {  list[i] = new House(INT(),INT());  }  Arrays.sort(list);  int cnt = 2;  for(int i = 1;i<N;i++) {  int room = list[i].center-list[i-1].center;  if(2*T<2*room-list[i].side-list[i-1].side)cnt += 2;  else if(2*T==2*room-list[i].side-list[i-1].side)cnt++;  }  System.out.println(cnt);   }  private static class House implements Comparable<House> {  int center, side;  House(int c, int s) {  this.center = c;  this.side = s;  }  public int compareTo(House h) {  return this.center-h.center;  } } }
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 logWln(Object X){if (verb) System.err.print(X);} static void info(Object o){ System.out.println(o);} static void output(Object o){outputWln(""+o+"\n"); } static void outputWln(Object o){try {out.write(""+ o);} catch (Exception e) {}}  static long mod=1000000007;   static BufferedWriter out; static InputReader reader;  static class Composite implements Comparable<Composite>{  int idx;  int v;  public int compareTo(Composite X) {  if (v!=X.v)   return v-X.v;  return idx-X.idx;   }  public Composite(int idx, int v) {  this.idx = idx;  this.v = v;  }   }  static void test() {  log("testing");  log("done");  }  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 String readString() throws IOException {  int c = read();  while (isSpaceChar(c)) {   c = read();  }  StringBuilder res = new StringBuilder();  do {   res.append((char) c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  public final int readInt() throws IOException {  int c = read();  boolean neg = false;  while (isSpaceChar(c)) {   c = read();  }  char d = (char) c;    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;  } } }
5	public class Solution {    private static StringTokenizer st;  private static java.io.BufferedReader reader;  private static java.io.BufferedWriter writer;  private static long nextLong() {   return Long.parseLong(st.nextToken());  }  private static int nextInt() {   return Integer.parseInt(st.nextToken());  }  private static double nextDouble() {   return Double.parseDouble(st.nextToken());  }  private static short nextShort() {   return Short.parseShort(st.nextToken());  }  private static byte nextByte() {   return Byte.parseByte(st.nextToken());  }  private static void initTokenizer() throws Exception {   st = new StringTokenizer(reader.readLine());  }      public static void main(String[] args) throws Exception { reader = new java.io.BufferedReader(new java.io.InputStreamReader(System.in), 1 << 20); writer = new java.io.BufferedWriter(new java.io.OutputStreamWriter(System.out));    initTokenizer(); int n = nextInt(); int m = nextInt(); int k = nextInt();  initTokenizer(); int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt(); }  Arrays.sort(a);  int total = k; int cnt = 0;  while (total < m && cnt < a.length) {  total += a[a.length - 1 - cnt] - 1;  cnt++; }  if (total >= m) System.out.println(cnt); else System.out.println(-1);  } }
2	public class ProblemB { public static void main(String[] args) throws IOException {   ProblemB solver = new ProblemB();  solver.init();  solver.solve(); }  private void init() {   }  private void solve() throws IOException {    Reader in = new Reader(System.in);  PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));   int n = in.nextInt();  int x = in.nextInt();  int y = in.nextInt();  int c = in.nextInt();   long lo = 0;  long hi = 2 * n;   while (lo < hi) {  long mid = (lo + hi)/2;  long r = count(n, x , y, mid);  if (r < c) {   lo = mid + 1;  } else {   hi = mid;;  }  }  out.println(lo);  out.flush();  out.close(); }  private long count(int n, int x, int y, long steps) {  long r = 1 + 2 * steps * (1 + steps);  r -= countWall(x - 1 - steps);  r -= countWall(y - 1 - steps);  r -= countWall(n - (x + steps));  r -= countWall(n - (y + steps));  r += countCorner(steps - (x - 1) - (y - 1) - 1);  r += countCorner(steps - (y - 1) - (n - x) - 1);  r += countCorner(steps - (n - x) - (n - y) - 1);  r += countCorner(steps - (x - 1) - (n - y) - 1);   return r; }  private long countCorner(long x) {  if (x <= 0) return 0;  return x * ( x + 1) / 2; }  private long countWall(long x) {  if (x >= 0) return 0;  return x * x; }  private static class Reader {  BufferedReader reader;  StringTokenizer tokenizer;     Reader(InputStream input) {   reader = new BufferedReader(       new InputStreamReader(input) );   tokenizer = new StringTokenizer("");  }     public String next() throws IOException {   while ( ! tokenizer.hasMoreTokens() ) {        tokenizer = new StringTokenizer(      reader.readLine() );   }   return tokenizer.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());  } } }
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());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   } }
5	public class a111 {  public static void debug(Object... obs) {   System.out.println(Arrays.deepToString(obs));  }  public static void main(String[] args) throws Exception {   Scanner sc = new Scanner(System.in);     int n=sc.nextInt();   int[]a=new int[n];     int su=0;   for(int i=0;i<n;i++)   {    a[i]=-sc.nextInt();    su+=-1*a[i];   }   Arrays.sort(a);        int ss=0;   for(int i=0;i<n;i++)   {    ss+=-1*a[i];    su-=-1*a[i];    if(ss > su)    {     System.out.println(i+1);     return;    }   }    } }
0	public class TwentyFive {  public static void main(String[] args) {  System.out.println("25"); } }
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;   }    double nextDouble() {    boolean neg = false;    if (c == NC) c = getChar();    for (; (c < '0' || c > '9'); c = getChar()) {     if (c == '-') neg = true;    }    double cur = nextLong();    if (c != '.') {     return neg ? -cur : cur;    } else {     double frac = nextLong() / cnt;     return neg ? -cur - frac : cur + frac;    }   }    String next() {    StringBuilder res = new StringBuilder();    while (c <= 32) c = getChar();    while (c > 32) {     res.append(c);     c = getChar();    }    return res.toString();   }    String nextLine() {    StringBuilder res = new StringBuilder();    while (c <= 32) c = getChar();    while (c != '\n') {     res.append(c);     c = getChar();    }    return res.toString();   }    boolean hasNext() {    if (c > 32) return true;    while (true) {     c = getChar();     if (c == NC) return false;     else if (c > 32) return true;    }   }  }   static void ASSERT(boolean assertion, String message) {   if (!assertion) throw new AssertionError(message);  }   static void ASSERT(boolean assertion) {   if (!assertion) throw new AssertionError();  } }
4	public class A0023 {  public static void main(String args[]) throws Exception {   new A0023();  }  A0023() throws Exception {   PandaScanner sc = null;   PrintWriter out = null;   try {    sc = new PandaScanner(System.in);    out = new PrintWriter(System.out);   } catch (Exception ignored) {   }   String s = sc.next();   int i = s.length() - 1;   Test: for (; i > 0; i--) {    HashSet<String> set = new HashSet<String>();    for (int j = 0; j + i <= s.length(); j++) {     String ss = s.substring(j, j + i);     if (set.contains(ss)) {      break Test;     }     set.add(ss);    }   }   out.println(i);   out.close();   System.exit(0);  }    public class PandaScanner {   BufferedReader br;   StringTokenizer st;   InputStream in;   PandaScanner(InputStream in) throws Exception {    br = new BufferedReader(new InputStreamReader(this.in = in));   }   public String next() throws Exception {    if (st == null || !st.hasMoreTokens()) {     st = new StringTokenizer(br.readLine().trim());     return next();    }    return st.nextToken();   }   public boolean hasNext() throws Exception {    return (st != null && st.hasMoreTokens()) || in.available() > 0;   }   public long nextLong() throws Exception {    return Long.parseLong(next());   }   public int nextInt() throws Exception {    return Integer.parseInt(next());   }  } }
5	public class Solution implements Runnable {  BufferedReader in; PrintWriter out; StringTokenizer st;  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()); }  long nextLong() throws Exception {  return Long.parseLong(nextToken()); }  double nextDouble() throws Exception {  return Double.parseDouble(nextToken()); }  void solve() throws Exception {  int n = nextInt();  Integer[] a = new Integer[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  Integer[] b = a.clone();  Arrays.sort(b);  int d = 0;  for (int i = 0; i < n; i++) {  if (!a[i].equals(b[i])) d++;  }  out.println(d > 2? "NO" : "YES"); }  public void run() {  try {  Locale.setDefault(Locale.UK);  in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } finally {  out.close();  } }  public static void main(String[] args) {   (new Solution()).run(); } }
5	public class Solution {  static class Team implements Comparable<Team> {   int pr;   int time;   int id;   public Team(int P, int T, int I) {    pr = P;    time = T;    id = I;   }   @Override   public int compareTo(Team t) {    return pr != t.pr ? t.pr - pr : time != t.time ? time - t.time : id - t.id;   }  }  public static void main(String[] args) throws Exception {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(System.out);   StringTokenizer st = new StringTokenizer(in.readLine());   int n = Integer.parseInt(st.nextToken());   int k = Integer.parseInt(st.nextToken());   Team[] a = new Team[n];   int[] c = new int[n + 1];   for (int i = 0; i < n; i++) {    st = new StringTokenizer(in.readLine());    int p = Integer.parseInt(st.nextToken());    int t = Integer.parseInt(st.nextToken());    a[i] = new Team(p, t, i);   }   Arrays.sort(a);   int prev = 1;   c[1]++;   for (int i = 1; i < n; i++) {    if (a[i].pr == a[i - 1].pr && a[i].time == a[i - 1].time)     for (int j = i + 1; j >= prev; j--)      c[j] = i + 2 - prev;    else {     prev = i + 1;     c[prev] = 1;    }   }   out.println(c[k]);   out.close();  } }
0	public class Solve4 {  public static void main(String[] args) throws IOException {  FastReader sc = new FastReader();  int x= sc.nextInt();  int y= sc.nextInt();  int z= sc.nextInt();  int t1= sc.nextInt();  int t2= sc.nextInt();  int t3= sc.nextInt();  if(Math.abs(x-y)*t1 < (Math.abs(x-z)+Math.abs(x-y))*t2+3*t3 ) System.out.println("NO");  else System.out.println("YES");  }  static class FastReader {   BufferedReader br;   StringTokenizer st;   public FastReader() {    br = new BufferedReader(new InputStreamReader(System.in));   }   public String next() throws IOException {    if (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 double nextDouble() throws IOException {    return Double.parseDouble(next());   }   public String nextLine() {    String s = "";    try {     s = br.readLine();    } catch (IOException ex) {    }    return s;   }  } }
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 >= 0)    out.println(N);   else {    N = Math.abs(N);    int v1 = - (N / 10);    int v2 = - (N / 100 * 10 + (N % 10));    out.println(Math.max(v1, v2));   }  } } 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() {   return Integer.parseInt(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;  }  }
4	public class P23A {  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  String s = in.nextLine();  int max = 0;  for(int i = 0; i < s.length(); i++)  for(int k = s.length(); k > max + i; k--)   if(s.substring(i + 1).contains(s.substring(i,k)))   max = k - i;  System.out.println(max); } }
2	public class Main{ public static void main(String[]args){  Scanner cin=new Scanner(System.in);  long z=cin.nextLong()-1<<1,n=cin.nextInt(),l=-1,r=1+n,m;  while(l<(m=l+r>>1)) if(z>(m+n-1)*(n-m)) r=m;else l=m;  if(0<l) l=n-l;  System.out.print(l); } }
5	public class a { public static void main(String[] args) throws Exception {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int t = sc.nextInt();  int[][] xa = new int[n][2];  for(int i=0; i<n; ++i) {  xa[i][0] = sc.nextInt();  xa[i][1] = sc.nextInt();  }  Arrays.sort(xa, new Comparator<int[]>(){    @Override    public int compare(int[] a0, int[] a1){     return a0[0]-a1[0];    }   });  int ans=2;   for(int i=0; i<n-1; i++){    int s=(xa[i+1][0]*2-xa[i+1][1])-(xa[i][0]*2+xa[i][1]);    if(s>t*2){     ans+=2;    }else if(s==t*2){     ans++;    }   }   System.out.println(ans+""); } }
3	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 ArrayList<Long> factorial;  static HashSet<Integer> graph[];  public static void main (String[] args) throws Exception {   String st[]=br.readLine().split(" ");   int n=Integer.parseInt(st[0]);   long input[]=new long[n];   st=br.readLine().split(" ");   for(int i=0;i<n;i++){    input[i]=Long.parseLong(st[i]);   }   HashMap<Long,ArrayList<Pair>> map=new HashMap<>();   long pref[]=new long[n+1];   pref[1]=input[0];   for(int i=1;i<n;i++){    pref[i+1]=pref[i]+input[i];   }   for(int i=0;i<n;i++){    for(int j=i;j<n;j++){     long sum=pref[j+1]-pref[i];     if(!map.containsKey(sum)){      ArrayList<Pair> list=new ArrayList<>();      list.add(new Pair(i,j));      map.put(sum,list);     }     else{      ArrayList<Pair> list=map.get(sum);      list.add(new Pair(i,j));     }    }   }   ArrayList<Pair> ans=new ArrayList<>();     for(long keys:map.keySet()){    ArrayList<Pair> list=map.get(keys);    Collections.sort(list,new PairComp());    int nn=list.size();    for(int j=0;j<=0;j++){     ArrayList<Pair> cur=new ArrayList<>();     cur.add(list.get(j));     int lim=list.get(j).v;     int i=j;     while(i<nn){      if(list.get(i).u<=lim){       i++;      }      else{       cur.add(list.get(i));       lim=list.get(i).v;       i++;      }     }     if(ans.size()<cur.size()){      ans=cur;     }    }   }   out.println(ans.size());   for(Pair p:ans){    out.println(++p.u+" "+ ++p.v);   }   out.flush();   out.close();  }   static void printPrecision(double d){   DecimalFormat ft = new DecimalFormat("0.00000000000000000");   out.println(ft.format(d));  }  static void Makegraph(int n){   graph=new HashSet[n];   for(int i=0;i<n;i++){    graph[i]=new HashSet<>();   }  }  static void addEdge(int a,int b){   graph[a].add(b);  }   static class PairComp implements Comparator<Pair>{   public int compare(Pair p1,Pair p2){    if(p1.v>p2.v){     return 1;    }    else if(p1.v<p2.v){     return -1;    }    else{     return p1.u-p2.u;    }   }  }  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;   }    public int hashCode() {    int hu = (int) (u ^ (u >>> 32));    int hv = (int) (v ^ (v >>> 32));    return 31 * hu + hv;   }    public boolean equals(Object o) {    Pair other = (Pair) o;    return u == other.u && v == other.v;   }    public int compareTo(Pair other) {    if(index!=other.index)     return Long.compare(index, other.index);    return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);   }    public String toString() {    return "[u=" + u + ", v=" + v + "]";   }  }  static class PairCompL implements Comparator<Pairl>{   public int compare(Pairl p1,Pairl p2){    if(p1.v>p2.v){     return -1;    }    else if(p1.v<p2.v){     return 1;    }    else{     return 0;    }   }  }  static class Pairl implements Comparable<Pair> {    long u;    long v;    int index=-1;    public Pairl(long u, long v) {     this.u = u;     this.v = v;    }     public int hashCode() {     int hu = (int) (u ^ (u >>> 32));     int hv = (int) (v ^ (v >>> 32));     return 31 * hu + hv;    }     public boolean equals(Object o) {     Pair other = (Pair) o;     return u == other.u && v == other.v;    }     public int compareTo(Pair other) {     if(index!=other.index)      return Long.compare(index, other.index);     return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);    }     public String toString() {     return "[u=" + u + ", v=" + v + "]";    }   }  public static void debug(Object... o) {   System.out.println(Arrays.deepToString(o));  }  static long modulo(long a,long b,long c) {   long x=1;   long y=a;   while(b > 0){    if(b%2 == 1){     x=(x*y)%c;    }    y = (y*y)%c;    b /= 2;   }   return x%c;  }  static long gcd(long x, long y)  {   if(x==0)    return y;   if(y==0)    return x;   long r=0, a, b;   a = (x > y) ? x : y;   b = (x < y) ? x : y;   r = b;   while(a % b != 0)   {    r = a % b;    a = b;    b = r;   }   return r;  }  static void sieveMake(int n){   sieve=new boolean[n];   Arrays.fill(sieve,true);   sieve[0]=false;   sieve[1]=false;   for(int i=2;i*i<n;i++){    if(sieve[i]){     for(int j=i*i;j<n;j+=i){      sieve[j]=false;     }    }   }   primes=new ArrayList<Integer>();   for(int i=0;i<n;i++){    if(sieve[i]){     primes.add(i);    }   }    } }
3	public class Main {  private final static long mod = 1000000007;  private final static int MAXN = 100001;  private static long power(long x, long y, long m) {   long temp;   if (y == 0)    return 1;   temp = power(x, y / 2, m);   temp = (temp * temp) % m;   if (y % 2 == 0)    return temp;   else    return ((x % m) * temp) % m;  }  private static long power(long x, long y) {   return power(x, y, mod);  }  private static long gcd(long a, long b) {   if (b == 0) return a;   return gcd(b, a % b);  }  static int nextPowerOf2(int a) {   return 1 << nextLog2(a);  }  static int nextLog2(int a) {   return (a == 0 ? 0 : 32 - Integer.numberOfLeadingZeros(a - 1));  }  private static long modInverse(long a, long m) {   long m0 = m;   long y = 0, x = 1;   if (m == 1)    return 0;   while (a > 1) {    long q = a / m;    long t = m;    m = a % m;    a = t;    t = y;    y = x - q * y;    x = t;   }   if (x < 0)    x += m0;   return x;  }  private static int[] getLogArr(int n) {   int arr[] = new int[n + 1];   for (int i = 1; i < n + 1; i++) {    arr[i] = (int) (Math.log(i) / Math.log(2) + 1e-10);   }   return arr;  }  private static int log[] = getLogArr(MAXN);  private static int getLRMax(int st[][], int L, int R) {   int j = log[R - L + 1];   return Math.max(st[L][j], st[R - (1 << j) + 1][j]);  }  private static int[][] getSparseTable(int array[]) {   int k = log[MAXN] + 1;   int st[][] = new int[MAXN][k + 1];   for (int i = 0; i < array.length; i++)    st[i][0] = array[i];   for (int j = 1; j <= k; j++) {    for (int i = 0; i + (1 << j) <= array.length; i++) {     st[i][j] = Math.max(st[i][j - 1], st[i + (1 << (j - 1))][j - 1]);    }   }   return st;  }  static class Subset {   int parent;   int rank;   @Override   public String toString() {    return "" + parent;   }  }  static int find(Subset[] Subsets, int i) {   if (Subsets[i].parent != i)    Subsets[i].parent = find(Subsets, Subsets[i].parent);   return Subsets[i].parent;  }  static void union(Subset[] Subsets, int x, int y) {   int xroot = find(Subsets, x);   int yroot = find(Subsets, y);   if (Subsets[xroot].rank < Subsets[yroot].rank)    Subsets[xroot].parent = yroot;   else if (Subsets[yroot].rank < Subsets[xroot].rank)    Subsets[yroot].parent = xroot;   else {    Subsets[xroot].parent = yroot;    Subsets[yroot].rank++;   }  }   private static int maxx(Integer... a) {   return Collections.max(Arrays.asList(a));  }   private static class Pair<T, U> {   T a;   U b;   public Pair(T a, U b) {    this.a = a;    this.b = b;   }   @Override   public boolean equals(Object o) {    if (this == o) return true;    if (o == null || getClass() != o.getClass()) return false;    Pair pair = (Pair) o;    return a.equals(pair.a) &&      b.equals(pair.b);   }   @Override   public int hashCode() {    return Objects.hash(a, b);   }   @Override   public String toString() {    return "(" + a +      "," + b +      ')';   }  }   public static void main(String[] args) throws Exception {   try (FastReader in = new FastReader();    FastWriter out = new FastWriter()) {    int t, i, j, n, k, l, r, m, c, p, q, ti, tidx;    long x, y, z;        {         n=in.nextInt();     int a[]=new int[101];     for (i=0;i<n;i++){      a[in.nextInt()]++;     }     m=0;     for(i=1;i<101;i++){      if(a[i]>0){       m++;       for(j=i;j<=100;j+=i){        a[j]=0;       }      }     }     out.println(m);    }    out.commit();   }  }   static class FastReader implements Closeable {   private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   private StringTokenizer st;   String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (Exception e) {      e.printStackTrace();     }    }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   int[] nextIntArr(int n) {    int[] arr = new int[n];    for (int i = 0; i < n; i++) {     arr[i] = nextInt();    }    return arr;   }   double[] nextDoubleArr(int n) {    double[] arr = new double[n];    for (int i = 0; i < n; i++) {     arr[i] = nextDouble();    }    return arr;   }   long[] nextLongArr(int n) {    long[] arr = new long[n];    for (int i = 0; i < n; i++) {     arr[i] = nextLong();    }    return arr;   }   String[] nextStrArr(int n) {    String[] arr = new String[n];    for (int i = 0; i < n; i++) {     arr[i] = next();    }    return arr;   }   int[][] nextIntArr2(int n, int m) {    int[][] arr = new int[n][m];    for (int i = 0; i < n; i++) {     arr[i] = nextIntArr(m);    }    return arr;   }   long[][] nextLongArr2(int n, int m) {    long[][] arr = new long[n][m];    for (int i = 0; i < n; i++) {     arr[i] = nextLongArr(m);    }    return arr;   }   @Override   public void close() throws IOException {    br.close();   }  }   static class FastWriter implements Closeable {   BufferedWriter bw;   StringBuilder sb = new StringBuilder();   List<String> list = new ArrayList<>();   Set<String> set = new HashSet<>();   FastWriter() {    bw = new BufferedWriter(new OutputStreamWriter(System.out));   }   <T> void commit() throws IOException {    bw.write(sb.toString());    bw.flush();    sb = new StringBuilder();   }   <T> void print(T obj) {    sb.append(obj.toString());   }   void println() throws IOException {    print("\n");   }   <T> void println(T obj) throws IOException {    print(obj.toString() + "\n");   }   <T> void printArrLn(T[] arr) throws IOException {    for (int i = 0; i < arr.length - 1; i++) {     print(arr[i] + " ");    }    println(arr[arr.length - 1]);   }   <T> void printArr2(T[][] arr) throws IOException {    for (int j = 0; j < arr.length; j++) {     for (int i = 0; i < arr[j].length - 1; i++) {      print(arr[j][i] + " ");     }     println(arr[j][arr.length - 1]);    }   }   <T> void printColl(Collection<T> coll) throws IOException {    for (T e : coll) {     print(e + " ");    }    println();   }   void printCharN(char c, int n) throws IOException {    for (int i = 0; i < n; i++) {     print(c);    }   }   void printIntArr2(int[][] arr) throws IOException {    for (int j = 0; j < arr.length; j++) {     for (int i = 0; i < arr[j].length - 1; i++) {      print(arr[j][i] + " ");     }     println(arr[j][arr.length - 1]);    }   }   @Override   public void close() throws IOException {    bw.close();   }  } }
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());   }  } }
5	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);   D903 solver = new D903();   solver.solve(1, in, out);   out.close();  }  static class D903 {   int N;   long ripple;   BigInteger tot;   long[] nums;   BigInteger[] cs;   public void solve(int testNumber, FastScanner s, PrintWriter out) {    N = s.nextInt();    nums = s.nextLongArray(N);    tot = new BigInteger("0");    cs = new BigInteger[N + 1];    cs[0] = new BigInteger("0");    ripple = 0;    for (int i = 1; i <= N; i++)     cs[i] = cs[i - 1].add(new BigInteger("" + nums[i - 1]));    for (int i = 1; i <= N; i++) {     long cur = nums[i - 1];     tot = tot.add(cs[N].subtract(cs[i])).subtract(new BigInteger("" + (cur * (N - i))));    }    HashMap<Long, Integer> seen = new HashMap<>();    for (long i : nums) {     Integer lo = seen.get(i - 1);     Integer hi = seen.get(i + 1);     if (lo != null)      tot = tot.subtract(new BigInteger("" + lo));     if (hi != null)      tot = tot.add(new BigInteger("" + hi));     if (!seen.containsKey(i))      seen.put(i, 0);     seen.put(i, seen.get(i) + 1);    }    out.println(tot);   }  }  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 long nextLong() {    return Long.parseLong(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 long[] nextLongArray(int N) {    long[] ret = new long[N];    for (int i = 0; i < N; i++)     ret[i] = this.nextLong();    return ret;   }  } }
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 int nextInt() {  return Integer.parseInt(next());  }  public long nextLong() {  return Long.parseLong(next());  }  public long nextDouble() {  return Long.parseLong(next());  }  } }
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);  } }
5	public class A {  static class Scanner{  BufferedReader br=null;  StringTokenizer tk=null;  public Scanner(){  br=new BufferedReader(new InputStreamReader(System.in));  }  public String next() throws IOException{  while(tk==null || !tk.hasMoreTokens())   tk=new StringTokenizer(br.readLine());  return tk.nextToken();  }  public int nextInt() throws NumberFormatException, IOException{  return Integer.valueOf(next());  }  public double nextDouble() throws NumberFormatException, IOException{  return Double.valueOf(next());  } }  public static void main(String args[]) throws NumberFormatException, IOException{  Scanner sc=new Scanner();  int N=sc.nextInt();  int M=sc.nextInt();  int K=sc.nextInt();  int[] array=new int[N];  for(int i=0;i<N;i++)  array[i]=sc.nextInt();  Arrays.sort(array);  int val=K;  int index=N - 1;  while(index>=0 && val<M){  val--;  val+=array[index];  index--;  }  if (val<M)  System.out.println("-1");  else  System.out.println((N - 1) - index); } }
5	public class test {  public static void main(String[] args) {   Scanner kb = new Scanner(System.in);   int n = kb.nextInt();   int a = kb.nextInt();   int b = kb.nextInt();   int array[] = new int[n];   for (int i = 0; i < n; i++) {    array[i] = kb.nextInt();   }   Arrays.sort(array);   int k = 0;   int t1 = 0;   int t2 = 0;   for (int i = 0; i < b; i++) {    t1= array[i];    if(i<n-1){     t2=array[i+1];     k=t2-t1;    }    else k=0;   }   System.out.println(k);  } }
6	public class Solution implements Runnable {  BufferedReader in;  PrintWriter out;  StringTokenizer st;  int[] x;  int[] y;  int n;  int X, Y;  int[] d;  int[][] dist;  int sqr(int a) {   return a * a;  }  int dist(int X, int Y, int i) {   return sqr(X - x[i]) + sqr(Y - y[i]);  }  int[] dp;  byte[][] pred;  int rec(int mask) {   if (dp[mask] == -1) {    int res = 1 << 29;    boolean ok = false;    for (int i = 0; i < n; ++i)     if ((mask & (1 << i)) > 0) {      ok = true;      int mm = mask & ~(1 << i);      for (int j = i; j < n; j++)       if ((mask & (1 << j)) > 0) {        int nmask = mm & ~(1 << j);        int a = rec(nmask) + d[i] + d[j] + dist[i][j];        if (a < res) {         res = a;         pred[0][mask] = (byte) (i);         pred[1][mask] = (byte) (j);        }       }      break;     }    if (!ok)     res = 0;    dp[mask] = res;   }   return dp[mask];  }  void solve() throws IOException {   X = ni();   Y = ni();   n = ni();        x = new int[n];   y = new int[n];   for (int i = 0; i < n; i++) {    x[i] = ni();    y[i] = ni();   }   d = new int[n];   dist = new int[n][n];   for (int i = 0; i < n; ++i)    d[i] = dist(X, Y, i);   for (int i = 0; i < n; ++i)    for (int j = 0; j < n; j++) {     dist[i][j] = dist(x[i], y[i], j);    }   pred = new byte[2][1 << n];   dp = new int[1 << n];   Arrays.fill(dp, -1);   out.println(rec((1 << n) - 1));   int a = (1 << n) - 1;   while (a > 0) {    if (pred[0][a] != pred[1][a])     out.print(0 + " " + (pred[0][a] + 1) + " " + (pred[1][a] + 1)       + " ");    else     out.print(0 + " " + (pred[0][a] + 1) + " ");    int na = a & ~(1 << pred[0][a]);    na &= ~(1 << pred[1][a]);    a = na;   }   out.println(0);  }  public Solution() throws IOException {   Locale.setDefault(Locale.US);   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   solve();   in.close();   out.close();  }  String ns() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int ni() throws IOException {   return Integer.valueOf(ns());  }  long nl() throws IOException {   return Long.valueOf(ns());  }  double nd() throws IOException {   return Double.valueOf(ns());  }  public static void main(String[] args) throws IOException,    InterruptedException {   Thread th = new Thread(null, new Solution(), "", 536870912);   th.start();   th.join();  }  @Override  public void run() {   try {    Locale.setDefault(Locale.US);    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();    in.close();    out.close();   } catch (Exception e) {      }  } }
6	public class ProblemD {    static int N; static boolean[][] graph;  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]);  N = n;  int m = Integer.valueOf(data[1]);  graph = new boolean[n][n];  for (int i = 0 ; i < m ; i++) {  String[] line = s.readLine().split(" ");  int a = Integer.valueOf(line[0])-1;  int b = Integer.valueOf(line[1])-1;  graph[a][b] = true;  graph[b][a] = true;  }   long ans = 0;  for (int i = 0 ; i < n ; i++) {  ans += doit(i);  }  ans /= 2;   out.println(ans);  out.flush(); }  static long doit(int n) {  long[][] dp = new long[1<<n][n];  for (int i = 0 ; i < n ; i++) {  if (graph[i][n]) {   dp[1<<i][i] = 1;  }  }   for (int i = 0 ; i < (1<<n) ; i++) {  for (int j = 0 ; j < n ; j++) {   if (dp[i][j] >= 1) {   for (int k = 0 ; k < n ; k++) {    if (graph[j][k] && (i & (1<<k)) == 0) {    dp[i|1<<k][k] += dp[i][j];    }   }   }  }  }   long ret = 0;  for (int i = 0 ; i < (1<<n) ; i++) {  if (Integer.bitCount(i) >= 2) {   for (int j = 0 ; j < n ; j++) {   if (graph[j][n]) {    ret += dp[i][j];   }   }  }  }  return ret; }   static void generateLarge() {  System.out.println("19 171");  for (int i = 1 ; i <= 19 ; i++) {  for (int j = i+1 ; j <= 19 ; j++) {   System.out.println(i + " " + j);  }  } }  public static void debug(Object... os){  System.err.println(Arrays.deepToString(os)); } }
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); } }
6	public class C {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int xs = sc.nextInt();  int ys = sc.nextInt();  int n = sc.nextInt();  int[]x = new int[n], y = new int[n];  for (int i = 0; i < n; i++) {  x[i] = sc.nextInt();  y[i] = sc.nextInt();  }  int[]single = new int[n];  int[][]pair = new int[n][n];  for (int i = 0; i < n; i++) {  single[i] = 2*((x[i]-xs)*(x[i]-xs)+(y[i]-ys)*(y[i]-ys));  }  for (int i = 0; i < n; i++) {  for (int j = i+1; j < n; j++) {   pair[i][j] = (x[i]-xs)*(x[i]-xs)+(y[i]-ys)*(y[i]-ys)+(x[j]-xs)*(x[j]-xs)+(y[j]-ys)*(y[j]-ys)+(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]);  }  }  int[]best = new int[1 << n], prev = new int[1 << n];  for (int mask = 1; mask < (1 << n); mask++) {  int i = 0;  while ((mask & (1 << i))==0)   i++;  best[mask] = best[mask ^ (1 << i)]+single[i];  prev[mask] = i+1;  for (int j = i+1; j < n; j++) {   if ((mask & (1 << j)) != 0) {   int temp = best[mask ^ (1 << i) ^ (1 << j)]+pair[i][j];   if (temp < best[mask]) {    best[mask] = temp;    prev[mask] = (i+1)*100+(j+1);   }   }  }  }  System.out.println(best[(1 << n) - 1]);  System.out.print("0 ");  int cur = (1 << n) - 1;  while (cur > 0) {  int a = prev[cur] % 100;  int b = prev[cur] / 100;  if (a > 0) {   System.out.print(a+" ");   cur ^= 1 << (a-1);  }  if (b > 0) {   System.out.print(b+" ");   cur ^= 1 << (b-1);  }  System.out.print(0+" ");  } } }
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 minof(int a, int b, int c) {return min(a, min(b, c));}  static int minof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); int min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static long minof(long a, long b, long c) {return min(a, min(b, c));}  static long minof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); long min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static int maxof(int a, int b, int c) {return max(a, max(b, c));}  static int maxof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); int max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static long maxof(long a, long b, long c) {return max(a, max(b, c));}  static long maxof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); long max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static int powi(int a, int b) {if (a == 0) return 0; int ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static long powl(long a, int b) {if (a == 0) return 0; long ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static int fli(double d) {return (int) d;}  static int cei(double d) {return (int) ceil(d);}  static long fll(double d) {return (long) d;}  static long cel(double d) {return (long) ceil(d);}  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 lcm(int a, int b) {return a * b / gcf(a, b);}  static long lcm(long a, long b) {return a * b / gcf(a, b);}  static int randInt(int min, int max) {return __rand.nextInt(max - min + 1) + min;}  static long mix(long x) {x += 0x9e3779b97f4a7c15L; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9L; x = (x ^ (x >> 27)) * 0x94d049bb133111ebL; return x ^ (x >> 31);}   static void reverse(int[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {int swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(long[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {long swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(double[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {double swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(char[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {char swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  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 void rsort(int[] a) {shuffle(a); sort(a);}  static void rsort(long[] a) {shuffle(a); sort(a);}  static void rsort(double[] a) {shuffle(a); sort(a);}  static int[] copy(int[] a) {int[] ans = new int[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static long[] copy(long[] a) {long[] ans = new long[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static double[] copy(double[] a) {double[] ans = new double[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static char[] copy(char[] a) {char[] ans = new char[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}   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 dc(List<? extends Collection<Integer>> g, int u, int v) {g.get(u).remove(v); g.get(v).remove(u);}  static void dcto(List<? extends Collection<Integer>> g, int u, int v) {g.get(u).remove(v);}   static void r() throws IOException {input = new StringTokenizer(rline());}  static int ri() throws IOException {return Integer.parseInt(rline());}  static long rl() throws IOException {return Long.parseLong(rline());}  static double rd() throws IOException {return Double.parseDouble(rline());}  static int[] ria(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni(); return a;}  static int[] riam1(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni() - 1; return a;}  static long[] rla(int n) throws IOException {long[] a = new long[n]; r(); for (int i = 0; i < n; ++i) a[i] = nl(); return a;}  static double[] rda(int n) throws IOException {double[] a = new double[n]; r(); for (int i = 0; i < n; ++i) a[i] = nd(); return a;}  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 rnl() throws IOException {r(); return nl();}  static long nl() {return Long.parseLong(n());}  static double rnd() throws IOException {r(); return nd();}  static double nd() {return Double.parseDouble(n());}  static List<List<Integer>> rg(int n, int m) throws IOException {List<List<Integer>> g = g(n); for (int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1); return g;}  static void rg(List<List<Integer>> g, int m) throws IOException {for (int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1);}  static List<List<Integer>> rdg(int n, int m) throws IOException {List<List<Integer>> g = g(n); for (int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1); return g;}  static void rdg(List<List<Integer>> g, int m) throws IOException {for (int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1);}  static List<Set<Integer>> rsg(int n, int m) throws IOException {List<Set<Integer>> g = sg(n); for (int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1); return g;}  static void rsg(List<Set<Integer>> g, int m) throws IOException {for (int i = 0; i < m; ++i) c(g, rni() - 1, ni() - 1);}  static List<Set<Integer>> rdsg(int n, int m) throws IOException {List<Set<Integer>> g = sg(n); for (int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1); return g;}  static void rdsg(List<Set<Integer>> g, int m) throws IOException {for (int i = 0; i < m; ++i) cto(g, rni() - 1, ni() - 1);}   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 pryes() {prln("yes");}  static void pry() {prln("Yes");}  static void prY() {prln("YES");}  static void prno() {prln("no");}  static void prn() {prln("No");}  static void prN() {prln("NO");}  static void pryesno(boolean b) {prln(b ? "yes" : "no");};  static void pryn(boolean b) {prln(b ? "Yes" : "No");}  static void prYN(boolean b) {prln(b ? "YES" : "NO");}  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 h() {prln("hlfd"); flush();}  static void flush() {__out.flush();}  static void close() {__out.close();}}
5	public class Solution{   void solve()throws Exception  {   int n=nextInt();   int[]a=new int[n];   for(int i=0;i<n;i++)    a[i]=nextInt();   int[]b=a.clone();   mySort(b);   int cnt=0;   for(int i=0;i<n;i++)    if(a[i]!=b[i])     cnt++;   if(cnt<=2)    System.out.println("YES");   else    System.out.println("NO");  }  private void mySort(int[] a) {   if(a.length<=1)    return;   int n=a.length;   int[]left=new int[n/2];   int[]right=new int[n-n/2];   for(int i=0;i<n;i++)    if(i<left.length)     left[i]=a[i];    else     right[i-left.length]=a[i];   mySort(left);   mySort(right);   int i=0;   int j=0;   while (i<left.length || j<right.length)   {    if(i==left.length)     a[i+j]=right[j++];    else if(j==right.length)     a[i+j]=left[i++];    else if(left[i]<right[j])     a[i+j]=left[i++];    else     a[i+j]=right[j++];   }  }    BufferedReader reader;  PrintWriter writer;  StringTokenizer stk;  void run()throws Exception  {   reader=new BufferedReader(new InputStreamReader(System.in));     stk=null;        solve();   reader.close();    }  int nextInt()throws Exception  {   return Integer.parseInt(nextToken());  }  long nextLong()throws Exception  {   return Long.parseLong(nextToken());  }  double nextDouble()throws Exception  {   return Double.parseDouble(nextToken());   }  String nextString()throws Exception  {   return nextToken();  }  String nextLine()throws Exception  {   return reader.readLine();  }  String nextToken()throws Exception  {   if(stk==null || !stk.hasMoreTokens())   {    stk=new StringTokenizer(nextLine());    return nextToken();   }   return stk.nextToken();  }  public static void main(String[]args) throws Exception  {   new Solution().run();  }     }
5	public class A { 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);  }  catch (NullPointerException e)  {  line=null;    }   }  int NextInt() {  String n = inputParser.nextToken();  int val = Integer.parseInt(n);     return val; }  long NextLong() {  String n = inputParser.nextToken();  long val = Long.parseLong(n);     return val; }  String NextString() {  String n = inputParser.nextToken();  return n; }  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 A(filePath); }  public void readFInput() {  for(;;)  {  try  {   readNextLine();   FInput+=line+" ";  }  catch(Exception e)  {   break;  }  }  inputParser = new StringTokenizer(FInput, " "); }   public A(String inputFile) {  openInput(inputFile);   readNextLine();  int n=NextInt();  int a=NextInt();  int b=NextInt();  int ret=0;  readNextLine();  int [] p = new int[n];  for(int i=0; i<n; i++)  {  p[i]=NextInt();  }  Arrays.sort(p);  int id=0,cnt=0;  while(id<n&&cnt<b)  {  cnt++;  id++;  }  if(id<n)  {  ret=p[id]-p[id-1];  }   System.out.print(ret);   closeInput();  }  }
6	public class Bag implements Runnable {  private void solve() throws IOException {   int xs = nextInt();   int ys = nextInt();   int n = nextInt();   int[] x = new int[n];   int[] y = new int[n];   for (int i = 0; i < n; ++i) {    x[i] = nextInt();    y[i] = nextInt();   }   int[][] pair = new int[n][n];   for (int i = 0; i < n; ++i)    for (int j = i + 1; j < n; ++j)     pair[i][j] = (x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys) + (x[j] - xs) * (x[j] - xs) + (y[j] - ys) * (y[j] - ys) + (x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i]);   int[] single = new int[n];   for (int i = 0; i < n; ++i) {    single[i] = 2 * ((x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys));   }   int[] best = new int[1 << n];   int[] prev = new int[1 << n];   for (int set = 1; set < (1 << n); ++set) {    int i;    for (i = 0; i < n; ++i)     if ((set & (1 << i)) != 0)      break;    best[set] = best[set ^ (1 << i)] + single[i];    prev[set] = i + 1;    for (int j = i + 1; j < n; ++j)     if ((set & (1 << j)) != 0) {      int cur = best[set ^ (1 << i) ^ (1 << j)] + pair[i][j];      if (cur < best[set]) {       best[set] = cur;       prev[set] = (i + 1) * 100 + (j + 1);      }     }   }   writer.println(best[(1 << n) - 1]);   int now = (1 << n) - 1;   writer.print("0");   while (now > 0) {    int what = prev[now];    int wa = what % 100 - 1;    int wb = what / 100 - 1;    if (wa >= 0) {     writer.print(" ");     writer.print(wa + 1);     now ^= 1 << wa;    }    if (wb >= 0) {     writer.print(" ");     writer.print(wb + 1);     now ^= 1 << wb;    }    writer.print(" ");    writer.print("0");   }   writer.println();  }   public static void main(String[] args) {   new Bag().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();  } }
0	public class Main {  public static void main(String[] args) {   new TaskA().solve(); } } class TaskA extends Base {  public static void solve () {  long l = in.nextLong();  long r = in.nextLong();    if (r - l < 2) {  System.out.println(-1);  return;  }   if (l % 2 == 0) {  System.out.println(l + " " + (l + 1) + " " + (l + 2));  return;  }   if (r - l > 2) {  System.out.println((l + 1) + " " + (l + 2) + " " + (l + 3));  return;  }   System.out.println(-1);  } } class Base { public static InputReader in = new InputReader(System.in); } 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());  } catch (IOException e) {    e.printStackTrace();  }  }  return tokenizer.nextToken(); }  public int nextInt() {  return Integer.parseInt(next()); }  public long nextLong() {  return Long.parseLong(next()); } }
0	public class Main { public static void main(String args[]) throws IOException {  BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));  String line = stdin.readLine();  int n = Integer.parseInt(line);   if (n >= 0) {  System.out.println(n);  } else if (n > -10) {  System.out.println(0);  } else {  String sa = line.substring(0, line.length() - 1);  int a = Integer.parseInt(sa);  String sb = line.substring(0, line.length() - 2) + line.charAt(line.length() - 1);  int b = Integer.parseInt(sb);  System.out.println(Math.max(a, b));  } } }
4	public class Main {  static public void main(String args[]) throws Exception {   Scanner s = new Scanner(System.in);   int n = s.nextInt(), m = s.nextInt(), K = s.nextInt();   int[][] p = new int[n][m - 1];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m - 1; j++) {     p[i][j] = s.nextInt();    }   }   int[][] v = new int[n - 1][m];   for (int i = 0; i < n - 1; i++) {    for (int j = 0; j < m; j++) {     v[i][j] = s.nextInt();    }   }   if (K % 2 == 1){    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      System.out.print("-1 ");     }     System.out.println();    }    return;   }   long[][][] dp = new long[K + 1][n][m];   for (int k = 2; k <= K; k += 2) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      long res = Long.MAX_VALUE;      if (i + 1 < n) {       res = Math.min(res, dp[k - 2][i + 1][j] + v[i][j] * 2);      }      if (i - 1 >= 0) {       res = Math.min(res, dp[k - 2][i - 1][j] + v[i - 1][j] * 2);      }      if (j + 1 < m) {       res = Math.min(res, dp[k - 2][i][j + 1] + p[i][j] * 2);      }      if (j - 1 >= 0) {       res = Math.min(res, dp[k - 2][i][j - 1] + p[i][j - 1] * 2);      }      dp[k][i][j] = res;     }    }   }   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     System.out.print(dp[K][i][j] + " ");    }    System.out.println();   }  } }
4	public class FireAgain {  static int n, m, k;  static int inf = (int) 1e9;  static class Pair {   int x, y;   Pair(int a, int b) {    x = a; y = b;   }  }  static int[] dx = {1, -1, 0, 0}, dy = {0, 0, 1, -1};  static boolean valid(int x, int y) {   return x >= 0 && x < n && y >= 0 && y < m;  }  static int[][] bfs(int[] xs, int[] ys) {   int[][] dist = new int[n][m];   for(int i = 0; i < n; i++)    Arrays.fill(dist[i], inf);   Queue<Pair> q = new LinkedList<>();   for(int i = 0; i < k; i++) {    dist[xs[i]][ys[i]] = 0;    q.add(new Pair(xs[i], ys[i]));   }   while(!q.isEmpty()) {    Pair p = q.remove();    for(int d = 0; d < 4; d++) {     int nx = p.x + dx[d], ny = p.y + dy[d];     if(valid(nx, ny) && dist[nx][ny] == inf) {      dist[nx][ny] = dist[p.x][p.y] + 1;      q.add(new Pair(nx, ny));     }    }   }   return dist;  }  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner();   n = sc.nextInt(); m = sc.nextInt(); k = sc.nextInt();   int[] xs = new int[k], ys = new int[k];   for(int i = 0; i < k; i++) {    xs[i] = sc.nextInt() - 1; ys[i] = sc.nextInt() - 1;   }   int[][] dist = bfs(xs, ys);   int x = 0, y = 0;   for(int i = 0; i < n; i++)    for(int j = 0; j < m; j++)     if(dist[i][j] > dist[x][y]) {      x = i; y = j;     }   x++; y++;   PrintWriter out = new PrintWriter("output.txt");   out.println(x + " " + y);   out.flush();   out.close();  }  static class Scanner {   BufferedReader br;   StringTokenizer st;   Scanner() throws FileNotFoundException {    br = new BufferedReader(new FileReader("input.txt"));   }   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());   }  } }
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 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 String nextLine() {    String str = "";    try {     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }   public int nextInt() {    int c = read();       while(isSpaceChar(c))     c = read();       int sgn = 1;       if (c == '-') {     sgn = -1;     c = read();    }       int res = 0;    do {     if(c<'0'||c>'9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));        return res * sgn;   }     public long nextLong() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;       do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));     return res * sgn;   }     public double nextDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, nextInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, nextInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }     public String readString() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    }    while (!isSpaceChar(c));       return res.toString();   }     public boolean isSpaceChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }     public String next() {    return readString();   }     public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } static int mod = (int)1e9+7; public static long fastexpo(long pow) {  long expo = 2;  long ans = 1;  while(pow!=0)  {  if((pow&1)==1)  {   ans = (ans*expo)%mod;  }  expo = (expo*expo)%mod;  pow = pow>>1;  }  return ans; } public static void main(String args[]) throws Exception {   new Thread(null, new solution(),"Main",1<<26).start();  } public void run() {   InputReader sc = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out);  long x = sc.nextLong();  if(x==0)  {  out.println(0);  out.close();  return;  }  long k = sc.nextLong();  long a = ((fastexpo(k+1)%mod)*(x%mod))%mod;  long b = (-1*fastexpo(k)%mod+mod)%mod;  long ans = (a+b+1)%mod;  out.println(ans);  out.close();  } }
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[center][center]) ? 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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   String nextLine() {    String str = "";    try { str = br.readLine(); }    catch (IOException e) { e.printStackTrace(); }    return str;   }  } }
5	public class Main {  static double eps = 1e-8;  public static void main(String[] args) {   Scanner r = new Scanner(System.in);     int n = r.nextInt();   int t = r.nextInt();     House[] a = new House[n];   for(int i = 0; i < n; i++){    double c = r.nextInt();    double l = r.nextInt();    a[i] = new House(c-l/2, l);   }     Arrays.sort(a);     int res = 0;   for(int i = 0; i < n-1; i++){    double dist = a[i+1].s - (a[i].s+a[i].l);       if(Math.abs(dist - t) < eps)res++;    else if(dist > t)res += 2;   }     System.out.println(res+2);  } } class House implements Comparable<House>{  double s, l;  public House(double si, double li){   s = si;   l = li;  }  @Override  public int compareTo(House b) {   if(s < b.s)return -1;   else return 1;  } }
5	public class CF159DIV2 { FastScanner in; PrintWriter out;  void solve() {  int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = in.nextInt();  Arrays.sort(a);  for (int i = 0; i < a.length / 2; i++) {  int tmp = a[i];  a[i] = a[n - i - 1];  a[n - i - 1] = tmp;  }  int need = m;  int have = k;  int ans = 0;  int it = 0;  while (have < need) {  have += a[it++] - 1;  ans++;  if (it >= n) break;  }  if (have >= need) {  out.println(ans);  } else {  out.println(-1);  } }  void run() {  try {  in = new FastScanner(new File("object.in"));  out = new PrintWriter(new File("object.out"));   solve();   out.close();  } catch (FileNotFoundException e) {  e.printStackTrace();  } }  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;  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }   double nextDouble() {  return Double.parseDouble(next());  } }  public static void main(String[] args) {  new CF159DIV2().runIO(); } }
1	public class Main { static Graph graph[]; public static void add_edge(int u,int v) {  graph[u].adj.add(graph[v]);  graph[v].adj.add(graph[u]); } 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());   }    double nextDouble()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  }   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 mycomparator implements Comparator<Graph> { public int compare(Graph a, Graph b) {  return b.dist-a.dist; } } class Graph { int vis,col,val;int parent;int deg;int dist; ArrayList<Graph> adj; Graph(int val) {  vis=0;  col=-1;  adj=new ArrayList<>();  parent=-1;  this.val=val;  deg=0;  dist=-1; } } class Pair { long x,y; Pair( long x, long y) {  this.x=x;  this.y=y; } }
4	public class P1517D {    private static int n, m, k; private static int[][] hor, ver, a, b; private static long ans; private static int[][] id; private static Integer[][][] dp; private static int idf; private static String s, t; private static HashMap<Integer, ArrayList<Integer>> g;   private static final int MOD = (int) 1e9 + 7;  public static void main(String[] args) {  n = ini();  m = ini();  k = ini();   if (k%2!=0) {  for(int i=0; i<n; i++) {   for(int j=0; j<m; j++) {   print(-1+" ");   }   println();  }  out.flush();  return;  }  hor = new int[n][m-1];  ver = new int[n-1][m];   for(int i=0; i<n; i++) {  for(int j=0; j<m-1; j++) {   hor[i][j] = ini();  }  }  for(int i=0; i<n-1; i++) {  for(int j=0; j<m; j++) {   ver[i][j] = ini();  }  }   dp = new Integer[n][m][k+1];   for(int i=0; i<n; i++) {  for(int j=0; j<m; j++) {   print(2*solve(i, j, k/2)+" ");  }  println();  }   out.flush();  out.close();  }  private static int solve(int i, int j, int kLeft) {  if (i<0 || i>=n || j<0 || j>=m) {  return (int)1e9;  } else if (kLeft==0) {  return 0;  }   if (dp[i][j][kLeft]!=null) {  return dp[i][j][kLeft];  }   int ans = (int)1e9;   final int[] dx = {-1, 1, 0, 0};  final int[] dy = {0, 0, -1, 1};   for(int type=0; type<4; type++) {  int ni = i+dx[type];  int nj = j+dy[type];  if (ni<0 || ni>=n || nj<0 || nj>=m) continue;    int inhibit = 0;  if (type==0) {   inhibit = ver[ni][nj];  } else if (type==1) {   inhibit = ver[i][j];  } else if (type==2) {   inhibit = hor[ni][nj];  } else {   inhibit = hor[i][j];  }    ans = Math.min(ans, inhibit+solve(ni, nj, kLeft-1));  }   return dp[i][j][kLeft]=ans; }   private static void initCase(int z) {  idf = z;  ans = 0; }   private static void printAns(Object o) {  out.println(o); }  private static void printAns(Object o, int testCaseNo) {  out.println("Case #" + testCaseNo + ": " + o); }  private static void printArray(Object[] a) {  for (int i = 0; i < a.length; i++) {  out.print(a[i] + " ");  }  out.println(); }   private static void sort(int[] a) {  int n = a.length;  Integer[] b = new Integer[n];  for (int i = 0; i < n; i++) {  b[i] = a[i];  }  Arrays.sort(b);  for (int i = 0; i < n; i++) {  a[i] = b[i];  } }  private static void sort(long[] a) {  int n = a.length;  Long[] b = new Long[n];  for (int i = 0; i < n; i++) {  b[i] = a[i];  }  Arrays.sort(b);  for (int i = 0; i < n; i++) {  a[i] = b[i];  } }   private static int[] ina(int n) {  int[] temp = new int[n];  for (int i = 0; i < n; i++) {  temp[i] = in.nextInt();  }  return temp; }  private static int[][] ina2d(int n, int m) {  int[][] temp = new int[n][m];  for (int i = 0; i < n; i++) {  temp[i] = ina(m);  }  return temp; }  private static int ini() {  return in.nextInt(); }  private static long inl() {  return in.nextLong(); }  private static double ind() {  return Double.parseDouble(ins()); }  private static String ins() {  return in.readString(); }   private static void println(Object... o) {  for (Object x : o) {  out.write(x + "");  }  out.write("\n"); }  private static void pd(Object... o) {  for (Object x : o) {  out.write(x + "");  }  out.flush();  out.write("\n"); }  private static void print(Object... o) {  for (Object x : o) {  out.write(x + "");  } }   private static HashMap<Integer, ArrayList<Integer>> intree(int n) {  HashMap<Integer, ArrayList<Integer>> g = new HashMap<>();  for (int i = 0; i < n; i++) {  g.put(i, new ArrayList<>());  }  for (int i = 0; i < n - 1; i++) {  int u = ini() - 1;  int v = ini() - 1;  g.get(u).add(v);  g.get(v).add(u);  }  return g; }  private static HashMap<Integer, ArrayList<Integer>> ingraph(int n, int m) {  HashMap<Integer, ArrayList<Integer>> g = new HashMap<>();  for (int i = 0; i < n; i++) {  g.put(i, new ArrayList<>());  }  for (int i = 0; i < m; i++) {  int u = ini() - 1;  int v = ini() - 1;  g.get(u).add(v);  g.get(v).add(u);  }  return g;  }  private static HashMap<Integer, ArrayList<Integer>> indirectedgraph(int n, int m) {  HashMap<Integer, ArrayList<Integer>> g = new HashMap<>();  for (int i = 0; i < n; i++) {  g.put(i, new ArrayList<>());  }  for (int i = 0; i < m; i++) {  int u = ini() - 1;  int v = ini() - 1;  g.get(u).add(v);  }  return g;  }  private static HashMap<Integer, ArrayList<Edge>> inweightedgraph(int n, int m) {  HashMap<Integer, ArrayList<Edge>> g = new HashMap<>();  for (int i = 0; i < n; i++) {  g.put(i, new ArrayList<>());  }  for (int i = 0; i < m; i++) {  int u = ini() - 1;  int v = ini() - 1;  int w = ini();  Edge edge = new Edge(u, v, w);  g.get(u).add(edge);  g.get(v).add(edge);  }  return g;  }  private static class Edge implements Comparable<Edge> {  private int u, v;  private long w;  public Edge(int a, int b, long c) {  u = a;  v = b;  w = c;  }  public int other(int x) {  return (x == u ? v : u);  }  public int compareTo(Edge edge) {  return Long.compare(w, edge.w);  } }  private static class Pair {  private int u, v;  public Pair(int a, int b) {  u = a;  v = b;  }  public int hashCode() {  return u + v + u * v;  }  public boolean equals(Object object) {  Pair pair = (Pair) object;  return u == pair.u && v == pair.v;  } }  private static class Node implements Comparable<Node> {  private int u;  private long dist;  public Node(int a, long b) {  u = a;  dist = b;  }  public int compareTo(Node node) {  return Long.compare(dist, node.dist);  } }   private static int gcd(int a, int b) {   if (b == 0)  return a;  return gcd(b, a % b); }  private static long modExp(long a, long b) {  if (b == 0)  return 1;  a %= MOD;  long exp = modExp(a, b / 2);  if (b % 2 == 0) {  return (exp * exp) % MOD;  } else {  return (a * ((exp * exp) % MOD)) % MOD;  } }  private long mul(int a, int b) {  return a * 1L * b; }   private static class SegmentTree<T extends Comparable<T>> {  private int n, m;  private T[] a;  private T[] seg;  private T NULLVALUE;  public SegmentTree(int n, T NULLVALUE) {  this.NULLVALUE = NULLVALUE;  this.n = n;  m = 4 * n;  seg = (T[]) new Object[m];  }  public SegmentTree(T[] a, int n, T NULLVALUE) {  this.NULLVALUE = NULLVALUE;  this.a = a;  this.n = n;  m = 4 * n;  seg = (T[]) new Object[m];  construct(0, n - 1, 0);  }  private void update(int pos) {         if (seg[2 * pos + 1].compareTo(seg[2 * pos + 2]) <= 0) {   seg[pos] = seg[2 * pos + 1];  } else {   seg[pos] = seg[2 * pos + 2];  }  }  private T optimum(T leftValue, T rightValue) {         if (leftValue.compareTo(rightValue) <= 0) {   return leftValue;  } else {   return rightValue;  }  }  public void construct(int low, int high, int pos) {  if (low == high) {   seg[pos] = a[low];   return;  }   int mid = (low + high) / 2;   construct(low, mid, 2 * pos + 1);  construct(mid + 1, high, 2 * pos + 2);  update(pos);  }  public void add(int index, T value) {  add(index, value, 0, n - 1, 0);  }  private void add(int index, T value, int low, int high, int pos) {  if (low == high) {   seg[pos] = value;   return;  }   int mid = (low + high) / 2;   if (index <= mid) {   add(index, value, low, mid, 2 * pos + 1);  } else {   add(index, value, mid + 1, high, 2 * pos + 2);  }  update(pos);  }  public T get(int qlow, int qhigh) {  return get(qlow, qhigh, 0, n - 1, 0);  }  public T get(int qlow, int qhigh, int low, int high, int pos) {  if (qlow > low || low > qhigh) {   return NULLVALUE;  } else if (qlow <= low || qhigh >= high) {   return seg[pos];  } else {   int mid = (low + high) / 2;   T leftValue = get(qlow, qhigh, low, mid, 2 * pos + 1);   T rightValue = get(qlow, qhigh, mid + 1, high, 2 * pos + 2);   return optimum(leftValue, rightValue);  }  } }   private static class DSU {  private int[] id;  private int[] size;  private int n;  public DSU(int n) {  this.n = n;   id = new int[n];  for (int i = 0; i < n; i++) {   id[i] = i;  }   size = new int[n];  Arrays.fill(size, 1);  }  private int root(int u) {  while (u != id[u]) {   id[u] = id[id[u]];   u = id[u];  }  return u;  }  public boolean connected(int u, int v) {  return root(u) == root(v);  }  public void union(int u, int v) {  int p = root(u);  int q = root(v);   if (size[p] >= size[q]) {   id[q] = p;   size[p] += size[q];  } else {   id[p] = q;   size[q] += size[p];  }  } }   private static int countSearch(String s, String p) {  int n = s.length();  int m = p.length();  int[] b = backTable(p);  int j = 0;  int count = 0;  for (int i = 0; i < n; i++) {  if (j == m) {   j = b[j - 1];   count++;  }  while (j != 0 && s.charAt(i) != p.charAt(j)) {   j = b[j - 1];  }  if (s.charAt(i) == p.charAt(j)) {   j++;  }  }  if (j == m)  count++;  return count; }  private static int[] backTable(String p) {  int m = p.length();  int j = 0;  int[] b = new int[m];  for (int i = 1; i < m; i++) {  while (j != 0 && p.charAt(i) != p.charAt(j)) {   j = b[j - 1];  }  if (p.charAt(i) == p.charAt(j)) {   b[i] = ++j;  }  }  return b; }  private static class LCA {  private HashMap<Integer, ArrayList<Integer>> g;  private int[] level;  private int[] a;  private int[][] P;  private int n, m;  private int[] xor;  public LCA(HashMap<Integer, ArrayList<Integer>> g, int[] a) {  this.g = g;  this.a = a;  n = g.size();  m = (int) (Math.log(n) / Math.log(2)) + 5;  P = new int[n][m];  xor = new int[n];  level = new int[n];   preprocess();  }  private void preprocess() {  dfs(0, -1);   for (int j = 1; j < m; j++) {   for (int i = 0; i < n; i++) {   if (P[i][j - 1] != -1) {    P[i][j] = P[P[i][j - 1]][j - 1];   }   }  }  }  private void dfs(int u, int p) {  P[u][0] = p;  xor[u] = a[u] ^ (p == -1 ? 0 : xor[p]);  level[u] = (p == -1 ? 0 : level[p] + 1);   for (int v : g.get(u)) {   if (v == p)   continue;   dfs(v, u);  }  }  public int lca(int u, int v) {  if (level[v] > level[u]) {   int temp = v;   v = u;   u = temp;  }   for (int j = m; j >= 0; j--) {   if (level[u] - (1 << j) < level[v]) {   continue;   } else {   u = P[u][j];   }  }   if (u == v)   return u;   for (int j = m - 1; j >= 0; j--) {   if (P[u][j] == -1 || P[u][j] == P[v][j]) {   continue;   } else {   u = P[u][j];   v = P[v][j];   }  }   return P[u][0];  }  private int xor(int u, int v) {  int l = lca(u, v);   return xor[u] ^ xor[v] ^ a[l];  } }   private static InputReader in = new InputReader(System.in); private static PrintWriter out = new PrintWriter(System.out);  private static class InputReader {  private final InputStream stream;  private final byte[] buf = new byte[8192];  private int curChar, snumChars;  public InputReader(InputStream st) {  this.stream = st;  }  public int read() {  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 = read();  while (isSpaceChar(c)) {   c = read();  }  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  int res = 0;  do {   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 {   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 String nextLine() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do {   res.appendCodePoint(c);   c = read();  } while (!isEndOfLine(c));  return res.toString();  }  public 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;  }  } }
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(); } }
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); } }
2	public class R489C {  static long m = (long)(1e9+7);   public static void main(String[] args) {  JS scan = new JS();  long n = scan.nextLong();  long k = scan.nextLong();  if(n == 0) {  System.out.println(0);  return;  }  if(k == 0) {  long ans = (n%m)*(2%m)%m;  System.out.println(ans%m);  return;  }   long coeff = power(2L, k+1, m);   long r = (coeff%m)*(n%m)%m;   long x = power(2L, k, m)%m-1;  if(x < 0) x += m;  long ans = r-x;  if(ans < 0) ans += m;  System.out.println(ans%m); }  static long power(long x, long y, long p){    long res = 1;            x = x % p;     while (y > 0){           if((y & 1)==1)     res = (res%p * x%p) % p;            y = y >> 1;    x = (x%p * x%p) % p;   }   return res;  }    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;  }  public double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }  public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }  public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  } } }
0	public class Subtractions {  public static void main(String args[]) {   Scanner scan = new Scanner(System.in);   int t = scan.nextInt();   while (t-- > 0) {    int a = scan.nextInt();    int b = scan.nextInt();    int res = 0;    while (a != 0 && b != 0) {     if (a > b) {      res += (a / b);      a %= b;     } else {      res += (b / a);      b %= a;     }    }    System.out.println(res);   }  } }
1	public class SonyaExhibition { static BufferedReader br; static StringTokenizer tokenizer;  public static void main(String[] args) throws Exception {  br = new BufferedReader(new InputStreamReader(System.in));  int n = nextInt();  int[] arr = {0,1};  for(int i = 0; i < n; i++) {  System.out.print(arr[i % 2]);  }  System.out.println(); }  public static String next() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  String line = br.readLine();  if (line == null)   throw new IOException();  tokenizer = new StringTokenizer(line);  }  return tokenizer.nextToken(); }  public static int nextInt() throws IOException {  return Integer.parseInt(next()); } }
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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
1	public class a {  boolean[] isp; ArrayList<Integer> primes;  private void solve() throws Exception {  int n = nextInt();  int k = nextInt();  int cnt = 0;  primes = new ArrayList<Integer>();  isp = new boolean[n + 1];  Arrays.fill(isp, true);  for (int i = 2; i <= n; ++i) {  for (int j = 2; j * j <= i; ++j)   if (i % j == 0)   isp[i] = false;  if (isp[i])   primes.add(i);  }  for (int i = 2; i <= n; ++i)  if (isp[i]) {   boolean can = false;   for (int j = 0; j < primes.size() - 1; ++j) {   int sum = primes.get(j) + primes.get(j + 1) + 1;   if (i == sum)    can = true;   }   if (can)   ++cnt;  }  if (cnt >= k)  out.print("YES");  else  out.print("NO"); }  public void run() {  try {  solve();  } catch (Exception e) {  NOO(e);  } finally {  out.close();  } }  PrintWriter out; BufferedReader in; StringTokenizer St;  void NOO(Exception e) {  e.printStackTrace();  System.exit(1); }  int nextInt() {  return Integer.parseInt(nextToken()); }  long nextLong() {  return Long.parseLong(nextToken()); }  double nextDouble() {  return Double.parseDouble(nextToken()); }  String nextToken() {  while (!St.hasMoreTokens()) {  try {   String line = in.readLine();   St = new StringTokenizer(line);  } catch (Exception e) {   NOO(e);  }  }  return St.nextToken(); }  private a(String name) {  try {  in = new BufferedReader(new FileReader(name + ".in"));  St = new StringTokenizer("");  out = new PrintWriter(new FileWriter(name + ".out"));  } catch (Exception e) {  NOO(e);  } }  private a() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  St = new StringTokenizer("");  out = new PrintWriter(System.out);  } catch (Exception e) {  NOO(e);  } }  public static void main(String[] args) {  Locale.setDefault(Locale.US);  new a().run(); } }
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; }  }
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);  F1SameSumBlocksEasy solver = new F1SameSumBlocksEasy();  solver.solve(1, in, out);  out.close(); }  static class F1SameSumBlocksEasy {  Map<Long, List<IntPair>> sums = new HashMap<>();  public void solve(int testNumber, InputReader in, PrintWriter out) {  int n = in.nextInt();  long[] arr = in.nextLongArray(n);  long[] pref = ArrayUtils.prefixSum(arr);  for (int i = 0; i < n; ++i) {   for (int j = i; j >= 0; --j) {   long sum = pref[i + 1] - pref[j];   if (sums.containsKey(sum)) {    sums.get(sum).add(Factories.makeIntPair(j, i));   } else {    List<IntPair> pairs = new ArrayList<>();    pairs.add(Factories.makeIntPair(j, i));    sums.put(sum, pairs);   }   }  }   int best = 0;  List<IntPair> res = new ArrayList<>();  for (long sum : sums.keySet()) {   List<IntPair> pairs = sums.get(sum);   List<IntPair> temp = new ArrayList<>();   int last = -1;   for (IntPair cur : pairs) {   if (cur.first > last) {    last = cur.second;    temp.add(cur);   }   }   if (temp.size() > best) {   best = temp.size();   res = temp;   }  }  out.println(best);  for (IntPair pair : res) {   out.println((pair.first + 1) + " " + (pair.second + 1));  }  }  }  static class ArrayUtils {  public static long[] prefixSum(long[] arr) {  long[] acc = new long[arr.length + 1];  for (int i = 1; i <= arr.length; ++i) {   acc[i] = acc[i - 1] + arr[i - 1];  }  return acc;  }  }  static interface FastIO {  }  static final class Factories {  private Factories() {  }  public static IntPair makeIntPair(int first, int second) {  return new IntPair(first, second);  }  }  static class IntPair implements Comparable<IntPair> {  public int first;  public int second;  public IntPair() {  first = second = 0;  }  public IntPair(int first, int second) {  this.first = first;  this.second = second;  }  public int compareTo(IntPair a) {  if (first == a.first) {   return Integer.compare(second, a.second);  }  return Integer.compare(first, a.first);  }  public String toString() {  return "<" + first + ", " + second + ">";  }  public boolean equals(Object o) {  if (this == o) {   return true;  }  if (o == null || getClass() != o.getClass()) {   return false;  }   IntPair a = (IntPair) o;   if (first != a.first) {   return false;  }  return second == a.second;  }  public int hashCode() {  int result = first;  result = 31 * result + second;  return result;  }  }  static class InputReader implements FastIO {  private InputStream stream;  private static final int DEFAULT_BUFFER_SIZE = 1 << 16;  private static final int EOF = -1;  private byte[] buf = new byte[DEFAULT_BUFFER_SIZE];  private int curChar;  private int numChars;  public InputReader(InputStream stream) {  this.stream = stream;  }  public int read() {  if (this.numChars == EOF) {   throw new UnknownError();  } else {   if (this.curChar >= this.numChars) {   this.curChar = 0;    try {    this.numChars = this.stream.read(this.buf);   } catch (IOException ex) {    throw new InputMismatchException();   }    if (this.numChars <= 0) {    return EOF;   }   }   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 long nextLong() {  int c;  for (c = this.read(); isSpaceChar(c); c = this.read()) {  }   byte sgn = 1;  if (c == 45) {   sgn = -1;   c = this.read();  }   long res = 0;   while (c >= 48 && c <= 57) {   res *= 10L;   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 == EOF;  }  public long[] nextLongArray(int n) {  long[] arr = new long[n];  for (int i = 0; i < n; i++) {   arr[i] = nextLong();  }  return arr;  }  } }
3	public class CFC {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  final long MOD = 1000L * 1000L * 1000L + 7;  int[] dx = {0, -1, 0, 1};  int[] dy = {1, 0, -1, 0};  void solve() throws IOException {   int n = nextInt();   long[] dp0 = new long[10 + n];   long[] dp1 = new long[10 + n];   long[] pre = new long[10 + n];   dp0[0] = 1;   String[] arr = new String[n];   for (int i = 0; i < n; i++) {    arr[i] = nextString();   }   String s = "s";   for (int i = 0; i < n; i++) {    Arrays.fill(dp1, 0);    if (i == 0) {     dp0[0] = 1;     dp1[0] = 1;    }    else {     if (arr[i - 1].equals(s)) {      for (int j = 0; j <= n + 5; j++) {       dp1[j] = pre[j];      }     }     else {      for (int j = 1; j <= n + 5; j++) {       dp1[j] = dp0[j - 1];      }     }    }    Arrays.fill(pre, 0);    pre[n + 5] = dp1[n + 5];    for (int j = n + 4; j >= 0; j--) {     pre[j] = pre[j + 1] + dp1[j];     pre[j] %= MOD;    }    for (int j = 0; j <= n + 5; j++) {     dp0[j] = dp1[j];    }   }   long res = 0;   for (int j = 0; j <= n + 5; j++) {    res += dp0[j];    res %= MOD;   }   out(res);  }  void shuffle(int[] a) {   int n = a.length;   for(int i = 0; i < n; i++) {    int r = i + (int) (Math.random() * (n - i));    int tmp = a[i];    a[i] = a[r];    a[r] = tmp;   }  }  int gcd(int a, int b) {   while(a != 0 && b != 0) {    int c = b;    b = a % b;    a = c;   }   return a + b;  }  private void outln(Object o) {   out.println(o);  }  private void out(Object o) {   out.print(o);  }  public CFC() 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 CFC();  }  public long[] nextLongArr(int n) throws IOException{   long[] res = new long[n];   for(int i = 0; i < n; i++)    res[i] = nextLong();   return res;  }  public int[] nextIntArr(int n) throws IOException {   int[] res = new int[n];   for(int i = 0; i < n; i++)    res[i] = nextInt();   return res;  }  public String nextToken() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return null;    }   }   return st.nextToken();  }  public String nextString() {   try {    return br.readLine();   } catch (IOException e) {    eof = true;    return null;   }  }  public int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  public long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  public double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
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 logWln(Object X){if (verb) System.err.print(X);} static void info(Object o){ System.out.println(o);} static void output(Object o){outputWln(""+o+"\n"); } static void outputWln(Object o){try {out.write(""+ o);} catch (Exception e) {}}  static long mod=1000000007;   static BufferedWriter out; static InputReader reader;  static class Composite implements Comparable<Composite>{  int idx;  int v;  public int compareTo(Composite X) {  if (v!=X.v)   return v-X.v;  return idx-X.idx;   }  public Composite(int idx, int v) {  this.idx = idx;  this.v = v;  }   }  static void test() {  log("testing");  log("done");  }  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 String readString() throws IOException {  int c = read();  while (isSpaceChar(c)) {   c = read();  }  StringBuilder res = new StringBuilder();  do {   res.append((char) c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  public final int readInt() throws IOException {  int c = read();  boolean neg = false;  while (isSpaceChar(c)) {   c = read();  }  char d = (char) c;    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;  } } }
1	public class Main {  public static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  public static int read() throws IOException {   tokenizer.nextToken();   return (int) tokenizer.nval;  }  public static void main(String[] args) throws IOException {   Scanner scanner=new Scanner(System.in);   int n=scanner.nextInt();   ArrayList<String> list1=new ArrayList<String>();   ArrayList<String> list2=new ArrayList<String>();   for (int i=0; i<n; i++){    String s=scanner.next();    list1.add(s);   }   for (int i=0; i<n; i++){    String s=scanner.next();    list2.add(s);   }   for (int i=0; i<list1.size(); i++){    for (int j=0; j<list2.size(); j++){     if (list1.get(i).equals(list2.get(j))){      list1.remove(i);      list2.remove(j);      i--;      break;     }    }   }   System.out.println(list1.size());  } }
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());   }   double nextDouble() {    return Double.parseDouble(next());   }   String readNextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   int[] readIntArray(int n) {    int[] a = new int[n];    for (int idx = 0; idx < n; idx++) {     a[idx] = nextInt();    }    return a;   }   long[] readLongArray(int n) {    long[] a = new long[n];    for (int idx = 0; idx < n; idx++) {     a[idx] = nextLong();    }    return a;   }  } }
6	public class Main {  public static void main(String[] args) throws IOException {   new Main().run();  }  BufferedReader in;  PrintWriter out;  StringTokenizer st = new StringTokenizer("");   int INF = Integer.MAX_VALUE >> 1;   void run() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);        int x0 = nextInt();   int y0 = nextInt();   int N = nextInt();   int FULL_MASK = (1 << N) - 1;   int[] xs = new int [N];   int[] ys = new int [N];   for (int i = 0; i < N; i++) {    xs[i] = nextInt();    ys[i] = nextInt();   }        int[][] dist = new int [N][N];   for (int i = 0; i < N; i++)    for (int j = 0; j < N; j++)     dist[i][j] = dist(x0, y0, xs[i], ys[i]) + dist(xs[i], ys[i], xs[j], ys[j]) + dist(xs[j], ys[j], x0, y0);        int[] dp = new int [1 << N];   int[] pr = new int [1 << N];   Arrays.fill(dp, INF);   dp[0] = 0;   for (int mask = 0; mask < FULL_MASK; mask++) {    int i = Integer.numberOfTrailingZeros(~mask);    int imask = mask | (1 << i);    for (int j = i; j < N; j++) {     int jmask = mask | (1 << j);     if (jmask == mask) continue;     int ijmask = imask | jmask;     int nval = dp[mask] + dist[i][j];     if (dp[ijmask] > nval) {      dp[ijmask] = nval;      pr[ijmask] = mask;     }    }   }        out.println(dp[FULL_MASK]);   out.print("0");   for (int mask = FULL_MASK; mask != 0; mask = pr[mask]) {    int diff = mask ^ pr[mask];    int i = Integer.numberOfTrailingZeros(diff);    diff &= ~(1 << i);    int j = Integer.numberOfTrailingZeros(diff);    if (i != 32) out.print(" " + (i + 1));    if (j != 32) out.print(" " + (j + 1));    out.print(" 0");   }   out.println();   out.close();  }     int dist(int x1, int y1, int x2, int y2) {   return sqr(x2 - x1) + sqr(y2 - y1);  }  int sqr(int x) {   return x * x;  }    String nextToken() throws IOException {   while (!st.hasMoreTokens())    st = new StringTokenizer(in.readLine());   return st.nextToken();  }   int nextInt() throws IOException {   return Integer.parseInt(nextToken());  } }
4	public class Main {  public static void main(String[] args)  {   InputStream inputStream;   try   {    inputStream = new FileInputStream("input.txt");   } catch (IOException e)   {    throw new RuntimeException(e);   }   OutputStream outputStream;   try   {    outputStream = new FileOutputStream("output.txt");   } catch (IOException e)   {    throw new RuntimeException(e);   }   FastScanner in = new FastScanner(inputStream);   FastPrinter out = new FastPrinter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC  {   private final static int[] dx = {-1, 0, +1, 0};   private final static int[] dy = {0, +1, 0, -1};   private final static int WHITE = 123456789;   public void solve(int testNumber, FastScanner in, FastPrinter out)   {    int n = in.nextInt();    int m = in.nextInt();    int[][] map = new int[n][m];    for (int i = 0; i < n; i++)    {     Arrays.fill(map[i], WHITE);    }    int k = in.nextInt();    int qh = 0;    int qt = 0;    int[] q = new int[((int) 7e6)];    for (int i = 0; i < k; i++)    {     int x = in.nextInt() - 1;     int y = in.nextInt() - 1;     map[x][y] = 0;     q[qh++] = x * m + y;    }    int d = 0;    int X = q[0] / m;    int Y = q[0] % m;    while (qt < qh)    {     int pos = q[qt++];     int x = pos / m;     int y = pos % m;     for (int i = 0; i < 4; i++)     {      int xx = x + dx[i];      int yy = y + dy[i];      if (isValid(xx, n) && isValid(yy, m) && map[xx][yy] == WHITE)      {       map[xx][yy] = map[x][y] + 1;       q[qh++] = (xx * m) + yy;       if (d < map[xx][yy])       {        d = map[xx][yy];        X = xx;        Y = yy;       }      }     }    }        out.println((X + 1) + " " + (Y + 1));   }   private boolean isValid(int x, int X)   {    return x >= 0 && x < X;   }  }  static class FastScanner  {   public BufferedReader br;   public StringTokenizer st;   public FastScanner(InputStream is)   {    br = new BufferedReader(new InputStreamReader(is));   }   public FastScanner(File f)   {    try    {     br = new BufferedReader(new FileReader(f));    } catch (FileNotFoundException e)    {     e.printStackTrace();    }   }   public 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();   }   public int nextInt()   {    return Integer.parseInt(next());   }  }  static class FastPrinter extends PrintWriter  {   public FastPrinter(OutputStream out)   {    super(out);   }   public FastPrinter(Writer out)   {    super(out);   }  } }
5	public class TaskA implements Runnable {  long m = (int)1e9+7;  PrintWriter w;  InputReader c;  public void run() {   c = new InputReader(System.in);   w = new PrintWriter(System.out);   int n = c.nextInt();   int a[] = scanArrayI(n);   int maxtime = Integer.MAX_VALUE,ind = -1;   for(int i=0;i<n;i++){    int time = Integer.MAX_VALUE;    if(a[i]<i+1)     time = i;    else{     time = (int)ceil((a[i] - i)/(double)n) * n + i;    }    if(time<maxtime){     maxtime = time;     ind = i;    }   }   w.println(ind+1);   w.close();  }  static long gcd(long a, long b) {   if (b == 0)    return a;   return gcd(b, a % b);  }  public static void sortbyColumn(int arr[][], int col){   Arrays.sort(arr, new Comparator<int[]>()   {    public int compare(int[] o1, int[] o2){     return(Integer.valueOf(o1[col]).compareTo(o2[col]));    }   });  }  public static class DJSet {   public int[] upper;   public DJSet(int n) {    upper = new int[n];    Arrays.fill(upper, -1);   }   public int root(int x) {    return upper[x] < 0 ? x : (upper[x] = root(upper[x]));   }   public boolean equiv(int x, int y) {    return root(x) == root(y);   }   public boolean union(int x, int y) {    x = root(x);    y = root(y);    if (x != y) {     if (upper[y] < upper[x]) {      int d = x;      x = y;      y = d;     }     upper[x] += upper[y];     upper[y] = x;    }    return x == y;   }  }  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;  }  public void printArray(int[] a){   for(int i=0;i<a.length;i++)    w.print(a[i]+" ");   w.println();  }  public int[] scanArrayI(int n){   int a[] = new int[n];   for(int i=0;i<n;i++)    a[i] = c.nextInt();   return a;  }  public long[] scanArrayL(int n){   long a[] = new long[n];   for(int i=0;i<n;i++)    a[i] = c.nextLong();   return a;  }  public void printArray(long[] a){   for(int i=0;i<a.length;i++)    w.print(a[i]+" ");   w.println();  }  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private SpaceCharFilter filter;   private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   public InputReader(InputStream stream) {    this.stream = stream;   }   public int read() {    if (numChars==-1)     throw new InputMismatchException();    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     }     catch (IOException e) {      throw new InputMismatchException();     }     if(numChars <= 0)      return -1;    }    return buf[curChar++];   }   public String nextLine() {    String str = "";    try {     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }   public int nextInt() {    int c = read();    while(isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     if(c<'0'||c>'9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));    return res * sgn;   }   public long nextLong() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));    return res * sgn;   }   public double nextDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, nextInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, nextInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }   public String readString() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    }    while (!isSpaceChar(c));    return res.toString();   }   public boolean isSpaceChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public String next() {    return readString();   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  public static void main(String args[]) throws Exception {   new Thread(null, new TaskA(),"TaskA",1<<26).start();  } }
5	public class Main implements Runnable {  public void _main() throws IOException {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = nextInt();  Arrays.sort(a);  for (int i = 1; i < n; i++)  if (a[i] != a[0]) {   out.print(a[i]);   return;  }  out.print("NO"); }  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 int nextInt() throws IOException {  return Integer.parseInt(next()); }  private long nextLong() throws IOException {  return Long.parseLong(next()); }  private double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static void main(String[] args) {  new Thread(new Main()).start(); }  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   _main();   out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(202);  } } }
0	public class A {  private static StreamTokenizer in;  private static PrintWriter out;   private static int nextInt() throws Exception{   in.nextToken();   return (int)in.nval;  }   private static String nextString() throws Exception{   in.nextToken();   return in.sval;  }   static{   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();  } }
4	public class Main {  public static void main(String[] args) throws IOException {   Scanner scn = new Scanner(new File("input.txt"));   BufferedWriter out = new BufferedWriter(new FileWriter("output.txt"));      int r = scn.nextInt();   int c = scn.nextInt();     int[][] a = new int[r][c];     for(int[] i: a)    Arrays.fill(i, 1<<30);     int k = scn.nextInt();      Queue<State> q = new LinkedList<State>();   for(int l = 0; l < k; l++){    int i = scn.nextInt()-1;    int j = scn.nextInt()-1;      a[i][j] = 0;    q.add(new State(i, j, 0));   }     while(!q.isEmpty()){    State st = q.poll();       a[st.i][st.j] = st.c;       for(int d = 0; d < 4; d++){     int ii = st.i + di[d];     int jj = st.j + dj[d];         if(ii < 0 || ii >= r || jj < 0 || jj >= c)continue;     if(a[ii][jj] != 1 << 30)continue;         a[ii][jj] = st.c+1;     q.add(new State(ii, jj, st.c+1));    }   }     int max = 0;   for(int i = 0; i < r; i++)    for(int j = 0; j < c; j++)     max = Math.max(max, a[i][j]);     for(int i = 0; i < r; i++)    for(int j = 0; j < c; j++)     if(a[i][j] == max){      out.write((i+1)+" "+(j+1));      out.newLine();           out.close();           return;     }    }  static int[] di = {0, 0, -1, 1};  static int[] dj = {1, -1, 0, 0}; } class State{  int i, j, c;  public State(int ii, int ji, int ci){   i = ii;   j = ji;   c = ci;  } }
4	public class Main {  public static void main(String[] args)throws IOException, URISyntaxException {   Reader.init(new FileInputStream("input.txt"));   StringBuilder s=new StringBuilder();   boolean[][]vis=new boolean[Reader.nextInt()][Reader.nextInt()];   int k=Reader.nextInt(),r,c;   Queue<Point>q=new LinkedList<Point>();   while(k-->0) {    r=Reader.nextInt()-1;    c=Reader.nextInt()-1;    vis[r][c]=true;    q.add(new Point(r,c));   }   Point end=null;   int[]x={0,0,1,-1},y={1,-1,0,0};   int a,b,i;   while(!q.isEmpty()) {    end=q.poll();    for(i=0;i<4;i++) {     a=end.x+x[i];     b=end.y+y[i];     if(a>=0&&b>=0&&a<vis.length&&b<vis[a].length&&!vis[a][b]) {      vis[a][b]=true;      q.add(new Point(a,b));     }    }   }   s.append(end.x+1).append(' ').append(end.y+1);   PrintWriter p=new PrintWriter("output.txt");   p.println(s);   p.close();  } } class Reader {  static BufferedReader reader;  static StringTokenizer tokenizer;    static void init(InputStream input) throws UnsupportedEncodingException {   reader = new BufferedReader(      new InputStreamReader(input, "UTF-8") );   tokenizer = new StringTokenizer("");  }    static String next() throws IOException {   while ( ! tokenizer.hasMoreTokens() ) {       tokenizer = new StringTokenizer(      reader.readLine() );   }   return tokenizer.nextToken();  }   static String nextLine() throws IOException {   return reader.readLine();  }  static int nextInt() throws IOException {   return Integer.parseInt( next() );  }   static double nextDouble() throws IOException {   return Double.parseDouble( next() );  }   static long nextLong() throws IOException {   return Long.parseLong( next() );  } }
1	public class stub implements Runnable {  public static void main(String[] args) {   new stub().run();  }  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  StringTokenizer st;  public String nextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return st.nextToken();  }  public int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  private void solve() throws IOException {   int[] cnt = new int[(int) 1e6];   int n = nextInt();   int k = nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = nextInt();   }   int cur = 0;   int left = 0;   int i = left;   while (i < n && cur != k) {    if (cnt[a[i]] == 0) {     cur++;    }    cnt[a[i]]++;    i++;   }   i--;   if (cur != k) {    out.println("-1 -1");    return;   }   int right = i;   while (cnt[a[left]] > 1) {    cnt[a[left]]--;    left++;   }   out.println((left + 1) + " " + (right + 1));  }  public void run() {   try {    solve();    out.close();    br.close();   } catch (IOException e) {    e.printStackTrace();   }  } }
1	public class A { private Scanner in; private PrintWriter out; private String INPUT = "";  public void solve() {  int n = ni();  int[] u = new int[n];  int fe = -1, fo = -1;  int ne = -1, no = -1;  for(int i = 0;i < n;i++){  u[i] = ni();  if(u[i] % 2 == 0){   if(fe == -1){   fe = i + 1;   }else{   ne = i + 1;   }  }else{   if(fo == -1){   fo = i + 1;   }else{   no = i + 1;   }  }  }  if(ne > 0){  out.println(fo);  }else{  out.println(fe);  } }  public void run() throws Exception {  in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);  out = new PrintWriter(System.out);   solve();  out.flush(); }   public static void main(String[] args) throws Exception {  new A().run(); }  private int ni() { return Integer.parseInt(in.next()); } private static void tr(Object... o) { System.out.println(o.length == 1 ? o[0] : Arrays.toString(o)); } }
1	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) {    int n = in.nextInt();    HashMap<String, Integer> map = new HashMap<>();    for (int i = 0; i < n; i++) {     String next = in.next();     map.put(next, map.getOrDefault(next, 0) + 1);    }    int ct = 0;    for (int i = 0; i < n; i++) {     String next = in.next();     if (map.containsKey(next)) {      map.put(next, map.get(next) - 1);      if (map.get(next) <= 0) {       map.remove(next);      }     }    }    for (Map.Entry<String, Integer> entry : map.entrySet()) {     ct += entry.getValue();    }    out.println(ct);   }  }  static class OutputWriter {   private final PrintWriter writer;   public OutputWriter(OutputStream outputStream) {    writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));   }   public OutputWriter(Writer writer) {    this.writer = new PrintWriter(writer);   }   public void close() {    writer.close();   }   public void println(int i) {    writer.println(i);   }  }  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 String readString() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     if (Character.isValidCodePoint(c)) {      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 String next() {    return readString();   }   public int nextInt() {    return readInt();   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
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);  TaskC solver = new TaskC();  solver.solve(1, in, out);  out.close(); }  static class TaskC {  public void solve(int testNumber, InputReader fi, PrintWriter out) {  long n, k;  n = fi.nextLong();  k = fi.nextLong();  long ans = 2 * n;  long mod = (long) Math.pow(10, 9) + 7;   if (k > 0) {   ans = (modulus(modulus(pow(2, k + 1, mod), mod) * modulus(n, mod), mod));   long temp = modulus(pow(2, k, mod) - 1, mod);   ans = modulus(modulus(ans, mod) - modulus(temp, mod), mod);   }  if (n == 0) {   ans = 0;  }  ans=ans%mod;  out.println(ans);  }  static long pow(long x, long y, long mod) {  if (y == 0) return 1 % mod;  if (y == 1) return x % mod;  long res = 1;  x = x % mod;  while (y > 0) {   if ((y % 2) != 0) {   res = (res * x) % mod;   }   y = y / 2;   x = (x * x) % mod;  }  return res;  }  static long modulus(long a, long mod) {  return (a % mod + mod) % mod;  }  }  static class InputReader {  private InputStream stream;  private byte[] buf = new byte[8192];  private int curChar;  private int snumChars;  private InputReader.SpaceCharFilter filter;  public InputReader(InputStream stream) {  this.stream = stream;  }  public int snext() {  if (snumChars == -1)   throw new InputMismatchException();  if (curChar >= snumChars) {   curChar = 0;   try {   snumChars = stream.read(buf);   } catch (IOException e) {   throw new InputMismatchException();   }   if (snumChars <= 0)   return -1;  }  return buf[curChar++];  }  public 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;  }  public interface SpaceCharFilter {  public boolean isSpaceChar(int ch);  }  } }
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;   private static int pos;   private static int readLen;   private static final char[] buffer = new char[1024 * 8];   private static char[] str = new char[500 * 8 * 2];   private static boolean[] isDigit = new boolean[256];   private static boolean[] isSpace = new boolean[256];   private static boolean[] isLineSep = new boolean[256];   static {    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;   }   static class EndOfFileRuntimeException extends RuntimeException {   }  } }
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)); }  void debug(Object... objects){  if (ONLINE_JUDGE){  for (Object o: objects){   System.err.println(o.toString());  }  } }    public void run(){  try{  timeBegin = System.currentTimeMillis();  Locale.setDefault(Locale.US);    init();  solve();    out.close();  time();  }catch (Exception e){  e.printStackTrace(System.err);  System.exit(-1);  } }    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';  char readChar() throws IOException{  int intValue = in.read();   if (intValue == -1){  return NOT_A_SYMBOL;  }   return (char) intValue; }  char[] readCharArray() throws IOException{  return readLine().toCharArray(); }    int readInt() throws IOException{  return Integer.parseInt(readString()); }  int[] readIntArray(int size) throws IOException{  int[] array = new int[size];   for (int index = 0; index < size; ++index){  array[index] = readInt();  }   return array; }    long readLong() throws IOException{  return Long.parseLong(readString()); }  long[] readLongArray(int size) throws IOException{  long[] array = new long[size];   for (int index = 0; index < size; ++index){  array[index] = readLong();  }   return array; }    double readDouble() throws IOException{  return Double.parseDouble(readString()); }  double[] readDoubleArray(int size) throws IOException{  double[] array = new double[size];   for (int index = 0; index < size; ++index){  array[index] = readDouble();  }   return array; }    Point readPoint() throws IOException{  int x = readInt();  int y = readInt();  return new Point(x, y); }  Point[] readPointArray(int size) throws IOException{  Point[] array = new Point[size];   for (int index = 0; index < size; ++index){  array[index] = readPoint();  }   return array; }    List<Integer>[] readGraph(int vertexNumber, int edgeNumber) throws IOException{  List<Integer>[] graph = new List[vertexNumber];   for (int index = 0; index < vertexNumber; ++index){  graph[index] = new ArrayList<Integer>();  }   while (edgeNumber-- > 0){  int from = readInt() - 1;  int to = readInt() - 1;    graph[from].add(to);  graph[to].add(from);  }   return graph; }    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);  }   public int getPrecision() {  return precision;  }  public void setPrecision(int precision) {  this.precision = precision;    format = createFormat(precision);  formatWithSpace = format + " ";  }   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} };  boolean check(int index, int lim){  return (0 <= index && index < lim); }    boolean checkBit(int mask, int bitNumber){  return (mask & (1 << bitNumber)) != 0; }    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;  } } }
5	public class Main {   public static void main(String[] args) throws Exception {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);     int n = in.nextInt(), m = 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 ans = 0, r = k, p = n-1;   while (r < m && p >= 0) {    r = r - 1 + a[p];    p--;    ans++;   }   if (r < m) out.println("-1");   else out.println(ans);     out.flush();  }  }
2	public class ed817Q3 { public static void main(String[] args){  InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out);  int t = 1;  for(int zxz=0;zxz<t;zxz++){    long n = in.nextLong();  long s = in.nextLong();  long start=0,end=n;  long ans=n+1;  while(start<=end){   long mid = start+(end-start)/2;   if(mid-digitSum(mid)>=s){   ans = mid;   end = mid-1;   }   else{   start=mid+1;   }  }  System.out.println(n-ans+1);    } } static int digitSum(long n){  int sum=0;  while(n>0){  sum+=n%10;  n=n/10;  }  return sum; } static class InputReader {     private InputStream stream;   private 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 int[] nextIntArray(int n) {    int a[] = new int[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }    public String readString() {    int c = snext();    while (isSpaceChar(c))     c = snext();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = snext();    } while (!isSpaceChar(c));    return res.toString();   }    public boolean isSpaceChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }    public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
2	public class A {  private static 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 char nextChar() {    int c = next();    while (isSpaceChar(c))     c = next();    if ('a' <= c && c <= 'z') {     return (char) c;    }    if ('A' <= c && c <= 'Z') {     return (char) c;    }    throw new InputMismatchException();   }   public String nextToken() {    int c = next();    while (isSpaceChar(c))     c = next();    StringBuilder res = new StringBuilder();    do {     res.append((char) c);     c = next();    } while (!isSpaceChar(c));    return res.toString();   }   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 long nextLong() {    int c = next();    while (isSpaceChar(c))     c = next();    long sgn = 1;    if (c == '-') {     sgn = -1;     c = next();    }    long 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);   }  }  static void debug(Object... o) {   System.err.println(Arrays.deepToString(o));  } }
4	public class C {  public static void main(String[] args) throws Exception  {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   int i,N;   int T=Integer.parseInt(br.readLine().trim());   StringBuilder sb=new StringBuilder();   while (T-->0)   {    N=Integer.parseInt(br.readLine().trim());    int[] a=new int[N];    for(i=0;i<N;i++) a[i]=Integer.parseInt(br.readLine().trim());    int end=1;    int[][] ans=new int[N][N+10];    ans[0][0]=1;    for(i=1;i<N;i++)    {     while (true)     {      if(ans[i-1][end]==a[i]-1) break;      end--;     }     for(int j=0;j<end;j++) ans[i][j]=ans[i-1][j];     ans[i][end]=a[i];     end++;    }    for(i=0;i<N;i++)    {     for(int j=0;j<N&&ans[i][j]!=0;j++)     {      sb.append(ans[i][j]);      if(ans[i][j+1]!=0) sb.append('.');     }     sb.append("\n");    }   }   System.out.println(sb);  } }
3	public class D2 { public static void main(String args[]) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int array[] =new int[n];  for(int i=0; i<=n-1; i++) {  array[i] = sc.nextInt();  }  int m = sc.nextInt();  int result = count(array);  for(int i=1; i<=m; i++) {  int a = sc.nextInt();  int b = sc.nextInt();  result += (b-a)*(b-a+1)/2;  result=result%2;  if(result%2==1)   System.out.println("odd");  else   System.out.println("even");  } }  public static int count(int[] arr) {  int[] array = arr.clone();  return sort(array,0,array.length-1); }  public static int sort(int[] arr, int i, int j) {  if(i>=j) return 0;  int mid = (i+j)/2;  int a = sort(arr,i,mid);  int b = sort(arr,mid+1,j);  int addition = 0;  int r1 = mid+1;  int[] tmp = new int[arr.length];  int tIndex = i;   int cIndex=i;  while(i<=mid&&r1<=j) {  if (arr[i] <= arr[r1])     tmp[tIndex++] = arr[i++];    else {      tmp[tIndex++] = arr[r1++];      addition+=mid+1-i;    }  }  while (i <=mid) {    tmp[tIndex++] = arr[i++];   }   while ( r1 <= j ) {    tmp[tIndex++] = arr[r1++];   }   while(cIndex<=j){    arr[cIndex]=tmp[cIndex];    cIndex++;   }   return a+b+addition; } }
2	public class Main {  void solve() {   long x=nl(),k=nl();   if(x==0) {    pw.println(0);    return;   }   long d=modpow(2,k,M);   long ans=mul(2,d,M);   ans=mul(ans,x,M)%M;   ans++;   ans%=M;   ans=(ans-d+M)%M;   pw.println(ans);   }    long mul(long x, long y, long m) {   long ans = 0;   while (y>0) {    if ((y & 1)>0) {     ans += x;     if (ans >= m) ans -= m;    }    x = x + x;    if (x >= m) x -= m;    y >>= 1;   }   return ans;  }  long modpow(long a, long b,long M)  {   long r=1;   while(b>0)   {    if((b&1)>0) r=mul(r,a,M);    a=mul(a,a,M);    b>>=1;   }   return r;  }  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 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 double nd() { return Double.parseDouble(ns()); }  private char nc() { return (char)skip(); }  private String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b))){    sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }  private char[] ns(int n) {   char[] buf = new char[n];   int b = skip(), p = 0;   while(p < n && !(isSpaceChar(b))){    buf[p++] = (char)b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }  private char[][] nm(int n, int m) {   char[][] map = new char[n][];   for(int i = 0;i < n;i++)map[i] = ns(m);   return map;  }  private int[] na(int n) {   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = ni();   return a;  }  private int ni() {   int num = 0, b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private long nl() {   long num = 0;   int b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); } }
3	public class Main {   public static void main(String[] args) throws Exception{   IO io = new IO(null,null);   int n = io.getNextInt(),ans = 0;   int [] A = new int[n];   for (int i = 0;i < n;i++) {    A[i] = io.getNextInt();    for (int j = 0;j < i;j++)     ans ^= (A[j] > A[i]) ? 1 : 0;   }   String [] word = {"even","odd"};   int m = io.getNextInt();   for (int i = 0;i < m;i++) {    int l = io.getNextInt(),r = io.getNextInt();    int len = r - l + 1;    long tot = len*(len - 1L)/2;    ans ^= tot & 1;    io.println(word[ans]);   }   io.close();  } }  class IO{  private BufferedReader br;  private StringTokenizer st;  private PrintWriter writer;  private String inputFile,outputFile;  public boolean hasMore() throws IOException{   if(st != null && st.hasMoreTokens()) return true;   if(br != null && br.ready()) return true;   return false;  }  public String getNext() throws FileNotFoundException, IOException{   while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());   return st.nextToken();  }  public String getNextLine() throws FileNotFoundException, IOException{   return br.readLine().trim();  }  public int getNextInt() throws FileNotFoundException, IOException{   return Integer.parseInt(getNext());  }  public long getNextLong() throws FileNotFoundException, IOException{   return Long.parseLong(getNext());  }  public void print(double x,int num_digits) throws IOException{   writer.printf("%." + num_digits + "f" ,x);  }  public void println(double x,int num_digits) throws IOException{   writer.printf("%." + num_digits + "f\n" ,x);  }  public void print(Object o) throws IOException{   writer.print(o.toString());  }  public void println(Object o) throws IOException{   writer.println(o.toString());  }  public IO(String x,String y) throws FileNotFoundException, IOException{   inputFile = x;   outputFile = y;   if(x != null) br = new BufferedReader(new FileReader(inputFile));   else br = new BufferedReader(new InputStreamReader(System.in));   if(y != null) writer = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));   else writer = new PrintWriter(new OutputStreamWriter(System.out));  }  protected void close() throws IOException{   br.close();   writer.close();  }  public void outputArr(Object [] A) throws IOException{   int L = A.length;   for (int i = 0;i < L;i++) {    if(i > 0) writer.print(" ");    writer.print(A[i]);   }   writer.print("\n");  } }
5	public class c {  class IO {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(System.out);   StringTokenizer st;   Random rnd = new Random();;   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());   }   double nextDouble() throws IOException {    return Double.parseDouble(nextToken());   }  }   void run() throws IOException{   IO read=new IO();   int n=read.nextInt();   int a[]=new int[n],b[]=new int[n];   for(int i=0;i<n;i++)    a[i]=b[i]=read.nextInt();   Arrays.sort(b);   int cnt=0;   for(int i=0;i<n;i++)    if(a[i]!=b[i])     cnt++;   if(cnt==0||cnt==2)    read.out.println("YES");   else    read.out.println("NO");   read.out.close();  }  public static void main(String[] args) throws IOException {   new c().run();  } }
5	public class Solution {  public static void main(String args[]) throws IOException {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int m = in.nextInt();   int k = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; ++i)    a[i] = in.nextInt();   Arrays.sort(a);     int res = 0, p = n - 1;   while (k < m && p >= 0) {    ++res;    k += a[p] - 1;    --p;   }   if (k >= m)    System.out.println(res);   else    System.out.println("-1");  } }
3	public class Main{  int[] ints; int[] prefix;  public static void main(String[] args) {  new Main().run(); }  public void run() {  Scanner file = new Scanner(System.in);  int N = file.nextInt();  ints = new int[N];  for(int i = 0;i<N;i++)  ints[i] = file.nextInt();  prefix = new int[N];  prefix[0] = ints[0];  for(int i =1;i<prefix.length;i++)  prefix[i] = prefix[i-1]+ints[i];  HashMap<Integer,Integer> ending = new HashMap<>();  HashMap<Integer,Integer> amount = new HashMap<>();  for(int end = 0;end<prefix.length;end++)  {  for(int start = 0;start<=end;start++)  {   int sum = sum(start,end);   if(!ending.containsKey(sum))   ending.put(sum, -1);   if(!amount.containsKey(sum))   amount.put(sum,0);   if(ending.get(sum)<start)   {   amount.put(sum,amount.get(sum)+1);   ending.put(sum,end);   }  }  }  int max = 0;  int maxnum = -1;  for(int x:amount.keySet())  {  if(amount.get(x)>max)  {   max = amount.get(x);   maxnum = x;  }  }  System.out.println(max);  HashMap<Integer,Integer> occurrence = new HashMap<Integer,Integer>();  occurrence.put(0,0);  for(int i = 0;i<prefix.length;i++)  {  if(occurrence.containsKey(prefix[i]-maxnum))  {   System.out.println(occurrence.get(prefix[i]-maxnum)+1+" "+(i+1));   occurrence.clear();  }  occurrence.put(prefix[i],i+1);  } }  public int sum(int L, int R) {  return prefix[R] - prefix[L] + ints[L]; }  }
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;  } }
1	public class n2{  public static void main(String[] args) throws Exception{   BufferedReader in=new BufferedReader(new InputStreamReader(System.in));   int n=Integer.parseInt(in.readLine());   int[] S=new int[4];   int[] L=new int[4];   int m=0;   for(int i=0;i<n;i++){    String s=in.readLine();    if(s.charAt(s.length()-1)=='L'){     L[s.length()-1]++;    }    if(s.charAt(s.length()-1)=='S'){     S[s.length()-1]++;    }    if(s.charAt(s.length()-1)=='M'){     m++;    }   }   for(int i=0;i<n;i++){    String s=in.readLine();    if(s.charAt(s.length()-1)=='L'){     L[s.length()-1]--;    }    if(s.charAt(s.length()-1)=='S'){     S[s.length()-1]--;    }    if(s.charAt(s.length()-1)=='M'){     m--;    }   }   int count=0;   for(int i=0;i<=3;i++){    if(S[i]>0){     count+=S[i];    }    if(L[i]>0){     count+=L[i];    }   }   if(m>0){    count+=m;   }   System.out.println(count);  } }
5	public class Div1_526C {  static int nV;  static ArrayList<Integer>[] chldn;  static int root;  static int[][] anc; static int[] depth;  static int[] num;  static int[] nLoc;  static int[][] tree;  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)));  nV = Integer.parseInt(reader.readLine());  chldn = new ArrayList[nV];  for (int i = 0; i < nV; i++) {  chldn[i] = new ArrayList<>();  }  anc = new int[nV][21];  depth = new int[nV];  num = new int[nV];  nLoc = new int[nV];  tree = new int[nV * 4][2];  for (int[] a : tree) {  a[0] = a[1] = -1;  }  root = 0;  StringTokenizer inputData = new StringTokenizer(reader.readLine());  for (int i = 0; i < nV; i++) {  num[i] = Integer.parseInt(inputData.nextToken());  nLoc[num[i]] = i;  }  inputData = new StringTokenizer(reader.readLine());  for (int i = 1; i < nV; i++) {  anc[i][0] = Integer.parseInt(inputData.nextToken()) - 1;  chldn[anc[i][0]].add(i);  }  preprocess();  build(1, 0, nV - 1);  int nQ = Integer.parseInt(reader.readLine());  while (nQ-- > 0) {  inputData = new StringTokenizer(reader.readLine());  if (inputData.nextToken().equals("1")) {   int a = Integer.parseInt(inputData.nextToken()) - 1;   int b = Integer.parseInt(inputData.nextToken()) - 1;   int temp = num[a];   num[a] = num[b];   num[b] = temp;   nLoc[num[a]] = a;   nLoc[num[b]] = b;   update(1, 0, nV - 1, num[a]);   update(1, 0, nV - 1, num[b]);  } else {   printer.println(query(1, 0, nV - 1, nLoc[0], nLoc[0]) + 1);  }  }  printer.close(); }  static void build(int nI, int cL, int cR) {  if (cL == cR) {  tree[nI][0] = nLoc[cL];  tree[nI][1] = nLoc[cL];  } else {  int mid = (cL + cR) >> 1;  build(nI * 2, cL, mid);  build(nI * 2 + 1, mid + 1, cR);  if (tree[nI * 2][0] != -1 && tree[nI * 2 + 1][0] != -1) {   merge(tree[nI * 2][0], tree[nI * 2][1], tree[nI * 2 + 1][0], tree[nI * 2 + 1][1]);   tree[nI][0] = mResp[0];   tree[nI][1] = mResp[1];  }  } }  static int query(int nI, int cL, int cR, int e1, int e2) {  if (cL == cR) {  merge(e1, e2, nLoc[cL], nLoc[cL]);  if (mResp[0] != -1) {   return cL;  } else {   return cL - 1;  }  }  int mid = (cL + cR) >> 1;  merge(tree[nI * 2][0], tree[nI * 2][1], e1, e2);  if (mResp[0] != -1) {  return query(nI * 2 + 1, mid + 1, cR, mResp[0], mResp[1]);  }  return query(nI * 2, cL, mid, e1, e2); }  static void update(int nI, int cL, int cR, int uI) {  if (cL == cR) {  tree[nI][0] = nLoc[cL];  tree[nI][1] = nLoc[cL];  } else {  int mid = (cL + cR) >> 1;  if (uI <= mid) {   update(nI * 2, cL, mid, uI);  } else {   update(nI * 2 + 1, mid + 1, cR, uI);  }  merge(tree[nI * 2][0], tree[nI * 2][1], tree[nI * 2 + 1][0], tree[nI * 2 + 1][1]);  tree[nI][0] = mResp[0];  tree[nI][1] = mResp[1];  } }  static int[] mResp = new int[2];  static void merge1(int... a) {  for (int i = 0; i < 3; i++) {  if (a[i] == -1) {   mResp[0] = mResp[1] = -1;   return;  }  }  if (onPath(a[0], a[1], a[2])) {  mResp[0] = a[0];  mResp[1] = a[1];  return;  }  if (onPath(a[0], a[2], a[1])) {  mResp[0] = a[0];  mResp[1] = a[2];  return;  }  if (onPath(a[1], a[2], a[0])) {  mResp[0] = a[1];  mResp[1] = a[2];  return;  }  mResp[0] = mResp[1] = -1; }  static void merge(int... a) {  merge1(a[0], a[1], a[2]);  merge1(mResp[0], mResp[1], a[3]); }  static boolean onPath(int a, int b, int c) {  if (a == c || b == c) {  return true;  }  if (depth[a] > depth[c]) {  a = jump(a, depth[a] - depth[c] - 1);  }  if (depth[b] > depth[c]) {  b = jump(b, depth[b] - depth[c] - 1);  }  if (a == b) {  return false;  }  if (anc[a][0] == c || anc[b][0] == c) {  return true;  }  return false; }   static void preprocess() {  anc[root][0] = root;  fParent(root);  for (int k = 1; k <= 20; k++) {  for (int i = 0; i < nV; i++) {   anc[i][k] = anc[anc[i][k - 1]][k - 1];  }  } }  static void fParent(int cV) {  for (int aV : chldn[cV]) {  anc[aV][0] = cV;  depth[aV] = depth[cV] + 1;  fParent(aV);  } }  static int fLCA(int a, int b) {  if (depth[a] > depth[b]) {  int temp = b;  b = a;  a = temp;  }  b = jump(b, depth[b] - depth[a]);  if (a == b) {  return a;  }  for (int i = 20; i >= 0; i--) {  if (anc[a][i] != anc[b][i]) {   a = anc[a][i];   b = anc[b][i];  }  }  return anc[a][0]; }  static int jump(int cV, int d) {  for (int i = 0; i <= 20; i++) {  if ((d & (1 << i)) != 0) {   cV = anc[cV][i];  }  }  return cV; }  static Comparator<Integer> BY_DEPTH = new Comparator<Integer>() {  public int compare(Integer o1, Integer o2) {  return -Integer.compare(depth[o1], depth[o2]);  } }; }
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();  }  int nextInt() throws IOException {   return Integer.parseInt(next());  }  double nextDouble() throws IOException {   return Double.parseDouble(next());  }  long nextLong() throws IOException {   return Long.parseLong(next());  }   void runIt() throws IOException {   st = new StringTokenizer("");     runCase(0);   out.flush();  } }
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();   }   } class Reader {  static BufferedReader reader;  static StringTokenizer tokenizer;  public static int pars(String x) {   int num = 0;   int i = 0;   if (x.charAt(0) == '-') {    i = 1;   }   for (; i < x.length(); i++) {    num = num * 10 + (x.charAt(i) - '0');   }   if (x.charAt(0) == '-') {    return -num;   }   return num;  }  static void init(InputStream input) {   reader = new BufferedReader(     new InputStreamReader(input));   tokenizer = new StringTokenizer("");  }  static void init(FileReader input) {   reader = new BufferedReader(input);   tokenizer = new StringTokenizer("");  }  static String next() throws IOException {   while (!tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(      reader.readLine());   }   return tokenizer.nextToken();  }  static int nextInt() throws IOException {   return pars(next());  }  static long nextLong() throws IOException {   return Long.parseLong(next());  }  static double nextDouble() throws IOException {   return Double.parseDouble(next());  } }
2	public class c {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  long n = scan.nextLong();  long s = scan.nextLong();  scan.close();  long start = s - s % 10;  while (start <= n && !isBig(start, s)) {  start += 10;  }  if (start > n) {  System.out.println(0);  } else {  System.out.println(n - start + 1);  } }  private static boolean isBig(long a, long s) {  char[] digits = ("" + a).toCharArray();  int counter = 0;  for (int i = 0; i < digits.length; i++) {  counter += digits[i] - '0';  }  return a - counter >= s; } }
0	public class Main {  public static void main(String[] args) {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  try {  String[] str = reader.readLine().split(" ");  BigInteger b1 = new BigInteger(str[0]);  BigInteger b2 = new BigInteger(str[1]);   if(b2.subtract(b1).compareTo(new BigInteger("1"))<1){   System.out.println(-1);   return;  }   if(b2.subtract(b1).compareTo(new BigInteger("2"))==0){   BigInteger b = b1.add(new BigInteger("1"));   BigInteger c = b1.add(new BigInteger("2"));   if(!b1.gcd(c).equals(new BigInteger("1"))){   System.out.println(b1.toString()+" "+b.toString()+" "+c.toString());   }else{   System.out.println(-1);   }   return;  }   BigInteger b = b1.add(new BigInteger("1"));  BigInteger c = b1.add(new BigInteger("2"));  BigInteger d = b1.add(new BigInteger("3"));   if(b1.remainder(new BigInteger("2")).equals(new BigInteger("1"))){   System.out.println(b.toString()+" "+c.toString()+" "+d.toString());  }else{   System.out.println(b1.toString()+" "+b.toString()+" "+c.toString());  }  } catch (IOException e) {    e.printStackTrace();  }  } }
5	public class A {  static StreamTokenizer in =  new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  static int nextInt() throws IOException{  in.nextToken();  return (int)in.nval; }  static PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) throws IOException{  int n = nextInt(),  t = nextInt(),  x[] = new int[n],  a[] = new int[n];   for (int i=0; i<n; i++){  x[i] = nextInt();  a[i] = nextInt();  }   for (int i=0; i<n-1; i++)  for (int j=i+1; j<n; j++)   if (x[i] > x[j]){   int p = x[i]; x[i] = x[j]; x[j] = p;    p = a[i]; a[i] = a[j]; a[j] = p;   }   double l[] = new double[n];  double r[] = new double[n];  for (int i=0; i<n; i++){  l[i] = x[i]-a[i]/2.0;  r[i] = x[i]+a[i]/2.0;  }   int res = 2;  for (int i=1; i<n; i++){  if (Math.abs(l[i]-r[i-1]-t) < 0.000001) res++;  else if (l[i]-r[i-1] > t) res += 2;  }   out.println(res);  out.flush(); } }
0	public class A { public static void main(String[] args){  FastScanner sc = new FastScanner();  long a = sc.nextLong();  long b = sc.nextLong();  long result = 0L;  while(a != 0 && b != 0) {  if(a > b) {   result += a/b;   a = a % b;  } else {   result += b/a;   b = b % a;  }   long gcd = gcd(a, b);  a /= gcd;  b /= gcd;  }   System.out.println(result); }  private static long gcd(long a, long b) {  while(a != 0 && b != 0) {  if(a < b) {   long tmp = a;   a = b;   b = tmp;  }  a%=b;  }  return a + b; }  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());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  } } }
5	public class a implements Comparable<a>{   int x, y, id;        public a(int x1, int y1, int id1){   this.x = x1; this.y = y1; this.id = id1;  }   public int compareTo(a o) {   return x - o.x;  }   static int n;  static int arr[];   public static void main(String[] args) {   Scanner in = new Scanner(System.in);        int n = in.nextInt();   arr = new int[n];   int sum = 0;   for (int i=0; i<n; i++){    arr[i] = in.nextInt();    sum +=arr[i];   }   Arrays.sort(arr);   int sum2= 0;   int ans = 0;   for (int i=n-1; i>=0; i--){    sum2+=arr[i];       if (sum2>sum-sum2){     ans = n - i;     break;    }   }   System.out.println(ans);  } }
3	public class C {  private static 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);  }   }  private static 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); }   private static 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());  }  double nextDouble() {  return Double.parseDouble(next());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }  int[] readArray(int n) {  int[] a=new int[n];  for (int i=0; i<n; i++)   a[i]=nextInt();  return a;  }  long[] readLongArray(int n) {  long[] a=new long[n];  for (int i=0; i<n; i++)   a[i]=nextLong();  return a;  } } }
5	public class Main {  public static void main(String[] args) {   Scanner input = new Scanner(System.in);   int n = input.nextInt();   int a = input.nextInt();   int b = input.nextInt();   int x[] = new int[n];   for (int i=0; i<n; i++) x[i]=input.nextInt();   Arrays.sort(x);   int y[] = new int[n];   for (int i=0; i<n; i++) y[i]=x[n-i-1];   System.out.println(y[a-1]-y[a]);  } }
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(){    public void run(){     try{      solve();     } catch(Exception e){      e.printStackTrace();     }    }   },"1",1<<26).start();    }  static class Pair implements Comparable<Pair>  {   long x,y;   Pair (long x,long y)   {     this.x = x;     this.y = y;   }   public int compareTo(Pair o)   {    return Long.compare(this.x,o.x);       }   public boolean equals(Object o)   {    if (o instanceof Pair)    {     Pair p = (Pair)o;     return p.x == x && p.y==y;    }    return false;   }   @Override   public String toString()   {    return x + " "+ y ;   }     }   static long add(long a,long b){   long x=(a+b);   while(x>=mod) x-=mod;   return x;  }  static long sub(long a,long b){   long x=(a-b);   while(x<0) x+=mod;   return x;  }   static long mul(long a,long b){   long x=(a*b);   while(x>=mod) x-=mod;   return x;  }   static String rev(String s){   StringBuilder sb=new StringBuilder(s);   sb.reverse();   return sb.toString();  }   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 long pow(long n,long p,long m)  {   long result = 1;   if(p==0){    return 1;   }      while(p!=0)   {    if(p%2==1)     result *= n;    if(result >= m)     result %= m;    p >>=1;    n*=n;    if(n >= m)     n%=m;   }     return result;  }  static long pow(long n,long p)  {   long result = 1;   if(p==0)    return 1;   while(p!=0)   {    if(p%2==1)     result *= n;     p >>=1;    n*=n;    }   return result;  }  static void debug(Object... o)  {    System.out.println(Arrays.deepToString(o));  }  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 int[] nextIntArray(int n)   {     int a[] = new int[n];     for (int i = 0; i < n; i++)     {       a[i] = nextInt();     }     return a;   }   public long[] nextLongArray(int n)   {     long a[] = new long[n];     for (int i = 0; i < n; i++)     {       a[i] = nextLong();     }     return a;   }   public String readString()   {     int c = snext();     while (isSpaceChar(c))     {       c = snext();     }     StringBuilder res = new StringBuilder();     do     {       res.appendCodePoint(c);       c = snext();     } while (!isSpaceChar(c));     return res.toString();   }   public String nextLine()   {     int c = snext();     while (isSpaceChar(c))       c = snext();     StringBuilder res = new StringBuilder();     do     {       res.appendCodePoint(c);       c = snext();     } while (!isEndOfLine(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;   }   private boolean isEndOfLine(int c)   {     return c == '\n' || c == '\r' || c == -1;   }   public interface SpaceCharFilter   {     public boolean isSpaceChar(int ch);   }  } }
0	public class A {  public static void main(String[] args) {   long fib[] = { 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170, 1836311903, 2971215073L, 4807526976L, 7778742049L, 12586269025L, 20365011074L, 32951280099L, 53316291173L, 86267571272L, 139583862445L, 225851433717L, 365435296162L, 591286729879L, 956722026041L, 1548008755920L, 2504730781961L, 4052739537881L, 6557470319842L, 10610209857723L };   int i = Arrays.binarySearch(fib, new Scanner(System.in).nextLong());   if (i < 4)    if (i == 3)     System.out.println("0 1 1");    else if (fib[i] == 1)     System.out.println("0 0 1");    else     System.out.println("0 0 0");   else    System.out.println(fib[i - 4] + " " + fib[i - 3] + " " + fib[i - 1]);  } }
4	public class Main {  public static void main(String[] args) throws Exception {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   StringBuilder line = new StringBuilder(reader.readLine());   int length = 0;   for (int head = 0; head < line.length(); head++) {    for (int tail = line.length() - 1; tail > head; tail--) {     String subString = line.substring(head, tail);     if(line.indexOf(subString,head+1)>-1){      length = Math.max(subString.length(), length);     }    }   }   System.out.println(length);  } }
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); }  private static int [] rep(int N) { return rep(0, N); } private static 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; }  private final static IOUtils.MyScanner sc = new IOUtils.MyScanner(); private static void exit (Object o, Object ... A) { IOUtils.print(o, A); IOUtils.exit(); } private static class IOUtils {  public static class MyScanner {  public String next() { newLine(); return line[index++]; }  public int nextInt() { return Integer.parseInt(next()); }  public String nextLine() { line = null; return readLine(); }  public String [] nextStrings() { return split(nextLine()); }  public int [] nextInts() {   String [] L = nextStrings();   int [] res = new int [L.length];   for (int i = 0; i < L.length; ++i)   res[i] = Integer.parseInt(L[i]);   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 java.io.BufferedReader r;  private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }  private MyScanner (java.io.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 = split(readLine());   index = 0;   }  }  private String [] split(String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }  }  private static String build(Object o, Object ... A) { return buildDelim(" ", o, A); }  private static String buildDelim(String delim, Object o, Object ... A) {  StringBuilder b = new StringBuilder();  append(b, o, delim);  for (Object p : A)   append(b, p, delim);  return b.substring(delim.length());  }   private static void start() { if (t == 0) t = millis(); }  private static void append(StringBuilder b, Object o, String delim) {  if (o.getClass().isArray()) {   int len = java.lang.reflect.Array.getLength(o);   for (int i = 0; i < len; ++i)   append(b, java.lang.reflect.Array.get(o, i), delim);  } else if (o instanceof Iterable<?>)   for (Object p : (Iterable<?>) o)   append(b, p, delim);  else {   if (o instanceof Double)   o = new java.text.DecimalFormat("#.############").format(o);   b.append(delim).append(o);  }  }  private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);  private static void print(Object o, Object ... A) { pw.println(build(o, A)); }  private static void err(Object o, Object ... A) { System.err.println(build(o, A)); }  private static void exit() {  IOUtils.pw.close();  System.out.flush();  err("------------------");  err(IOUtils.time());  System.exit(0);  }  private static long t;  private static long millis() { return System.currentTimeMillis(); }  private static String time() { return "Time: " + (millis() - t) / 1000.0; } } public static void main (String[] args) { new C(); IOUtils.exit(); } }
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);  } }
0	public class Main {  public static void main(String args[]) throws IOException {  BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String x[]=br.readLine().split(" ");  long l=Long.parseLong(x[0]);  long r=Long.parseLong(x[1]);  if(l%2!=0)  {  l++;  }  if(l+2>r)  {  System.out.println("-1");  }  else  {  System.out.println(l+" "+(l+1)+" "+(l+2));  } } }
0	public class Main {  public static void main(String args[]) throws IOException  {   new Main().run();  }  StreamTokenizer in;  PrintWriter out;  public void run() throws IOException  {   in =new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));   out = new PrintWriter(new OutputStreamWriter(System.out));      solve();   out.flush();  }  public double nextInt() throws IOException  {   in.nextToken();   return in.nval;  }  public void solve() throws IOException  {   double a=nextInt(),v=nextInt(),l=nextInt(),d=nextInt(),w=nextInt();   double s=w*w/(2*a);   if(s>d || w>v)   {   double t=v*v/(2*a);   if(t>l)   {    double f=2*l/a;    out.print(String.format("%.10f",Math.sqrt(f)));    return;   }   double f=v/a;   double k=(l-t)/v;   out.print(String.format("%.10f",f+k));   return;   }   double t;   if((2*v*v-w*w)/(2*a)<d)   t=v/a+(v-w)/a+(d-(2*v*v-w*w)/(2*a))/v;   else   {   double v1=Math.sqrt((2*a*d+w*w)/2);   t=v1/a+(v1-w)/a;   }   double r=l-d;   double tr=(v*v-w*w)/(2*a);   if(tr>r)   {   double t1=(-w+Math.sqrt(w*w+2*a*r))/a;   out.print(String.format("%.10f",t+t1));   return;   }   r-=(v*v-w*w)/(2*a);   t+=(v-w)/a;   out.print(String.format("%.10f",t+r/v));  } }
0	public class Main { static boolean LOCAL = System.getSecurityManager() == null; Scanner sc = new Scanner(System.in);  void run() {  double a = sc.nextDouble(), v = sc.nextDouble();  double L = sc.nextDouble(), d = sc.nextDouble(), w = sc.nextDouble();  w = min(w, v);  double t = 0;  if (w * w / (2 * a) <= d) {  if ((v * v + 2 * v * (v - w) - (v - w) * (v - w)) / (2 * a) <= d) {   t = (2 * v - w) / a + (d - (v * v + 2 * v * (v - w) - (v - w) * (v - w)) / (2 * a)) / v;  } else {   double A = a, B = w, C = (w * w) / (2 * a) - d;   t = w / a + (-B + sqrt(max(0, B * B - A * C))) / A * 2;  }  if ((2 * w * (v - w) + (v - w) * (v - w)) / (2 * a) <= L - d) {   t += (v - w) / a + (L - d - (2 * w * (v - w) + (v - w) * (v - w)) / (2 * a)) / v;  } else {   double A = a, B = w, C = -2 * (L - d);   t += (-B + sqrt(max(0, B * B - A * C))) / A;  }  } else if (v * v / (2 * a) <= L) {  t = v / a + (L - (v * v / (2 * a))) / v;  } else {  t = sqrt(2 * L / a);  }  System.out.printf("%.10f%n", t); }  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 RuntimeException(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());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  } }  void debug(Object...os) {  System.err.println(deepToString(os)); }  public static void main(String[] args) {  if (LOCAL) {  try {   System.setIn(new FileInputStream("in.txt"));  } catch (Throwable e) {   LOCAL = false;  }  }  if (!LOCAL) {  try {   Locale.setDefault(Locale.US);   System.setOut(new PrintStream(new BufferedOutputStream(System.out)));  } catch (Throwable e) {  }  }  new Main().run();  System.out.flush(); } }
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();  } } }
0	public class Main implements Runnable { private final String problemname = ""; private final String FILE_IN = problemname + ".in"; private final String FILE_OUT = problemname + ".out";  public void run() {   in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  _st = new StringTokenizer("");    int n = nextInt();  int best = n + n / 2;    out.println(best);  try {  in.close();  out.close();  }  catch (Exception e) {  System.err.println("Epic fail");  } }  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()); }  private long nextLong() {  return Long.parseLong(next()); }  private double nextDouble() {  return Double.parseDouble(next()); }  private BigInteger nextBigInteger() {  return new BigInteger(next()); } }
3	public class PythonIndentation { public static void main(String args[]) {  Scanner in = new Scanner(System.in) ;  int n = in.nextInt() ;  boolean[] lst = new boolean[n] ;  for(int i=0;i<n;i++)  {  lst[i] = (in.next().equals("s"))?false:true ;  }  System.out.println(dp(lst)) ; } static long dp(boolean[] lst) {  long[][] dp = new long[lst.length][lst.length] ;  dp[0][0] = 1 ;  for(int i=1;i<lst.length;i++)  {    for(int j=0;j<lst.length;j++)  {   if(lst[i-1])   {   if(j==0)    dp[i][j] = 0 ;   else    dp[i][j] = dp[i-1][j-1] ;   }     else   {   if(j==0)   {    for(int k=0;k<lst.length;k++)    dp[i][j] = (dp[i][j]+dp[i-1][k])%1000000007 ;   }   else    dp[i][j] = (dp[i][j-1]-dp[i-1][j-1])%1000000007 ;   }  }  }  long ans = 0 ;  for(int i=0;i<lst.length;i++)  {  ans = (ans + dp[lst.length-1][i])%1000000007 ;  }  if(ans<0)  ans = ans + 1000000007 ;  return ans ; } }
2	public class A {  private static 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 {   private static final long serialVersionUID = -8565341110209207657L; }  static  public class IOFast {   private BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   private PrintWriter out = new PrintWriter(System.out);   void setFileIO(String ins, String outs) throws IOException {    in = new BufferedReader(new FileReader(ins));    out = new PrintWriter(new FileWriter(outs));   }      private static int pos, readLen;   private static final char[] buffer = new char[1024 * 8];   private static final char[] str = new char[500000*8*2];   private static boolean[] isDigit = new boolean[256];   private static boolean[] isSpace = new boolean[256];   private static boolean[] isLineSep = new boolean[256];   static {    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 int nextInt() throws IOException {    return Integer.parseInt(nextString());   }   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 char[] nextLine() throws IOException {    int len = 0;    str[len++] = nextChar();    len = reads(str, len, isLineSep);       try {     if(str[len-1] == '\r') { len--; read(); }    }    catch(EndOfFileRuntimeException e) { ; }       return Arrays.copyOf(str, 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);   }   public double nextDouble() throws IOException {    return Double.parseDouble(nextString());   }  } }
5	public class Main {  BufferedReader reader;  FastScanner sc;   void solve() throws Exception  {   int n = sc.nextInt();   int[] arr = new int[n];   for (int i = 0; i < n; i++)   {    arr[i] = sc.nextInt();   }   Arrays.sort(arr);   if (arr[n - 1] == 1)    arr[n - 1] = 2;   else    arr[n - 1] = 1;   Arrays.sort(arr);   for (int i = 0; i < n; i++)   {    System.out.print(arr[i] + " ");   }   System.out.println();  }    public static void main(String[] args) throws Exception  {   new Main().solve();  }   Main() throws Exception  {   if (System.getProperty("ONLINE_JUDGE") == null)   {          }     reader = new BufferedReader(new InputStreamReader(System.in));   sc = new FastScanner(reader);  } } class FastScanner {  BufferedReader reader;  StringTokenizer strTok;   public FastScanner(BufferedReader reader)  {   this.reader = reader;  }   public String nextToken() throws IOException  {   if (strTok == null || !strTok.hasMoreTokens())   {    strTok = new StringTokenizer(reader.readLine());   }   return strTok.nextToken();  }   public int nextInt() throws IOException  {   return Integer.parseInt(nextToken());  }   public long nextLong() throws IOException  {   return Long.parseLong(nextToken());  }   public double nextDouble() throws IOException  {   return Double.parseDouble(nextToken());  }   public BigInteger nextBigInteger() throws IOException  {   return new BigInteger(nextToken());  }   public BigDecimal nextBigDecimal() throws IOException  {   return new BigDecimal(nextToken());  } }
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 sub(int a, int b) {  int res = a - b;  return res < 0 ? 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 int scanInt() throws IOException {  return parseInt(scanString()); }  static long scanLong() throws IOException {  return parseLong(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);  } } }
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[] diameter(int[][] g) {   int n = g.length;   int f0 = -1, f1 = -1, d01 = -1;   int[] q = new int[n];   boolean[] ved = new boolean[n];   {    int qp = 0;    q[qp++] = 0; ved[0] = true;    for(int i = 0;i < qp;i++){     int cur = q[i];     for(int e : g[cur]){      if(!ved[e]){       ved[e] = true;       q[qp++] = e;       continue;      }     }    }    f0 = q[n-1];   }   {    int[] d = new int[n];    int qp = 0;    Arrays.fill(ved, false);    q[qp++] = f0; ved[f0] = true;    for(int i = 0;i < qp;i++){     int cur = q[i];     for(int e : g[cur]){      if(!ved[e]){       ved[e] = true;       q[qp++] = e;       d[e] = d[cur] + 1;       continue;      }     }    }    f1 = q[n-1];    d01 = d[f1];   }   return new int[]{d01, f0, f1};  }  public static long c(int n, int k) {   return (fac[n] * facInv[k] % MOD) * facInv[n - k] % MOD;  }    public static class SegmentTreeRMQ {   public int M, H, N;   public int[] st;   public SegmentTreeRMQ(int n)   {    N = n;    M = Integer.highestOneBit(Math.max(N-1, 1))<<2;    H = M>>>1;    st = new int[M];    Arrays.fill(st, 0, M, Integer.MAX_VALUE);   }   public SegmentTreeRMQ(int[] a)   {    N = a.length;    M = Integer.highestOneBit(Math.max(N-1, 1))<<2;    H = M>>>1;    st = new int[M];    for(int i = 0;i < N;i++){     st[H+i] = a[i];    }    Arrays.fill(st, H+N, M, Integer.MAX_VALUE);    for(int i = H-1;i >= 1;i--)propagate(i);   }   public void update(int pos, int x)   {    st[H+pos] = x;    for(int i = (H+pos)>>>1;i >= 1;i >>>= 1)propagate(i);   }   private void propagate(int i)   {    st[i] = Math.min(st[2*i], st[2*i+1]);   }   public int minx(int l, int r){    int min = Integer.MAX_VALUE;    if(l >= r)return min;    while(l != 0){     int f = l&-l;     if(l+f > r)break;     int v = st[(H+l)/f];     if(v < min)min = v;     l += f;    }    while(l < r){     int f = r&-r;     int v = st[(H+r)/f-1];     if(v < min)min = v;     r -= f;    }    return min;   }   public int min(int l, int r){ return l >= r ? 0 : min(l, r, 0, H, 1);}   private int min(int l, int r, int cl, int cr, int cur)   {    if(l <= cl && cr <= r){     return st[cur];    }else{     int mid = cl+cr>>>1;     int ret = Integer.MAX_VALUE;     if(cl < r && l < mid){      ret = Math.min(ret, min(l, r, cl, mid, 2*cur));     }     if(mid < r && l < cr){      ret = Math.min(ret, min(l, r, mid, cr, 2*cur+1));     }     return ret;    }   }  }  public static char[] rev(char[] a){char[] b = new char[a.length];for(int i = 0;i < a.length;i++)b[a.length-1-i] = a[i];return b;}  public static double dist(double a, double b){   return Math.sqrt(a * a + b * b);  }  public static long inv(long a){   return quickPOW(a, MOD - 2);  }  public class Interval {   int start;   int end;   public Interval(int start, int end) {    this.start = start;    this.end = end;   }  }  public static ArrayList<Integer> sieveOfEratosthenes(int n) {   boolean prime[] = new boolean[n + 1];   Arrays.fill(prime, true);   for (int p = 2; p * p <= n; p++) {    if (prime[p]) {     for (int i = p * 2; i <= n; i += p) {      prime[i] = false;     }    }   }   ArrayList<Integer> primeNumbers = new ArrayList<>();   for (int i = 2; i <= n; i++) {    if (prime[i]) {     primeNumbers.add(i);    }   }   return primeNumbers;  }   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 int rlowerBound(int[] a, int v){ return lowerBound(a, 0, a.length, v); }  public static int rlowerBound(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 C(int n, int m)  {   if(m == 0 || m == n) return 1l;   if(m > n || m < 0) return 0l;   long res = fac[n] * quickPOW((fac[m] * fac[n - m]) % MOD, MOD - 2) % MOD;   return res;  }  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 Randomized {   public static void shuffle(int[] data) {    shuffle(data, 0, data.length - 1);   }   public static void shuffle(int[] data, int from, int to) {    to--;    for (int i = from; i <= to; i++) {     int s = nextInt(i, to);     int tmp = data[i];     data[i] = data[s];     data[s] = tmp;    }   }   public static void shuffle(long[] data) {    shuffle(data, 0, data.length - 1);   }   public static void shuffle(long[] data, int from, int to) {    to--;    for (int i = from; i <= to; i++) {     int s = nextInt(i, to);     long tmp = data[i];     data[i] = data[s];     data[s] = tmp;    }   }   public static int nextInt(int l, int r) {    return RandomWrapper.INSTANCE.nextInt(l, r);   }  }  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());   }   double nd() {    return Double.parseDouble(next());   }   String nextLine(){    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  }  }
5	public class Solver {  StringTokenizer st;  BufferedReader in;  PrintWriter out;   public long result = 0;  public int k = 0;  public static void main(String[] args) throws NumberFormatException,    IOException {   Solver solver = new Solver();   solver.open();   solver.solve();   solver.close();  }  public void open() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);  }  public String nextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  public int nextInt() throws NumberFormatException, IOException {   return Integer.parseInt(nextToken());  }  public long nextLong() throws NumberFormatException, IOException {   return Long.parseLong(nextToken());  }  public double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextToken());  }  public void solve() throws NumberFormatException, IOException {   int n = nextInt();   int a = nextInt();   int b = nextInt();     int[] ar = new int[n];     for(int i=0;i<n;i++){    ar[i] = nextInt();   }     Arrays.sort(ar);     out.println(ar[b]-ar[b-1]);  }  public void close() {   out.flush();   out.close();  } }
1	public class Solution extends Thread {  final static int MAXNUM = 1 << 20;  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  st = new StringTokenizer("");  int tests = nextInt();  int num = 1;  for (int test = 0; test < tests; test++) {   String s = next();   if (s.charAt(0) == 'R' && s.charAt(1) >= '0' && s.charAt(1) <= '9' && s.indexOf('C') != -1) {   String[] sp = s.split("[RC]");   int r = Integer.parseInt(sp[1]);   int c = Integer.parseInt(sp[2]);   s = "";   while (c > 0) {    if (c % 26 == 0) {    s = 'Z' + s;    c /= 26;    c --;    } else {    s = (char)('A' + c % 26 - 1) + s;    c /= 26;    }   }   s = s + r;   } else {   int pos = 0;   while (s.charAt(pos) < '0' || s.charAt(pos) > '9') {    pos ++;   }   int r = Integer.parseInt(s.substring(pos));   int c = 0;   s = s.substring(0, pos);   for (int i = 0; i < s.length(); i++) {    if (s.charAt(i) < 'Z') {    c = c * 26 + (s.charAt(i) - 'A' + 1);    } else {    c = c * 26 + 26;    }   }   s = "R" + r + "C" + c;   }   System.out.println(s);  }  } catch (Exception ex) {  ex.printStackTrace();  System.exit(-1);  } }  String next() throws IOException {  while (!st.hasMoreTokens())  st = new StringTokenizer(in.readLine());  return st.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(next()); }  double nextDouble() throws IOException {  return Double.parseDouble(next()); }  BufferedReader in; StringTokenizer st;  public static void main(String[] args) {  Locale.setDefault(Locale.US);  new Thread(new Solution()).start(); } }
5	public class con111_A {  public static void main( final String[] args ) throws IOException {   final BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );   final int n = Integer.parseInt( br.readLine() );   final int[] a = new int[n];   final String[] parts = br.readLine().split( " " );   for ( int i = 0; i < n; ++i ) {    a[ i ] = Integer.parseInt( parts[ i ] );   }   System.out.println( solve( n, a ) );  }  private static int solve( final int n, final int[] a ) {   Arrays.sort( a );   int sum = 0;   for ( int i = 0; i < n; ++i ) {    sum += a[ i ];   }   int res = 0;   int ms = 0;   for ( int i = n - 1; i >= 0; --i ) {    if ( ms > sum / 2 ) {     break;    } else {     ms += a[ i ];     ++res;    }   }   return res;  } }
1	public class Main implements Runnable {  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private SpaceCharFilter filter;   private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   public InputReader(InputStream stream) {    this.stream = stream;   }   public int read() {    if (numChars==-1)     throw new InputMismatchException();    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     }     catch (IOException e) {      throw new InputMismatchException();     }     if(numChars <= 0)      return -1;    }    return buf[curChar++];   }   public String nextLine() {    String str = "";    try {     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }   public int nextInt() {    int c = read();    while(isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     if(c<'0'||c>'9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));    return res * sgn;   }   public long nextLong() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));    return res * sgn;   }   public double nextDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, nextInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, nextInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }   public String readString() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    }    while (!isSpaceChar(c));    return res.toString();   }   public boolean isSpaceChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public String next() {    return readString();   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  public static void main(String args[]) throws Exception {   new Thread(null, new Main(),"Main",1<<26).start();  }   public void run() {   InputReader sc = new InputReader(System.in);   PrintWriter out = new PrintWriter(System.out);   int n=sc.nextInt();   String a[]=new String[n];   String b[]=new String[n];   int freaa[][]=new int[5][4];   for (int i = 0; i <n ; i++) {    a[i]=sc.next();    int ll=a[i].length();    for (int j = 0; j <a[i].length() ; j++) {     if(a[i].charAt(j)=='X')      freaa[ll][0]++;     if(a[i].charAt(j)=='L')      freaa[ll][1]++;     if(a[i].charAt(j)=='M')      freaa[ll][2]++;     if(a[i].charAt(j)=='S')      freaa[ll][3]++;    }   }   int frebb[][]=new int[5][4];   for (int i = 0; i <n ; i++) {    b[i]=sc.next();    int ll=b[i].length();    for (int j = 0; j <b[i].length() ; j++) {     if(b[i].charAt(j)=='X')      frebb[ll][0]++;     if(b[i].charAt(j)=='L')      frebb[ll][1]++;     if(b[i].charAt(j)=='M')      frebb[ll][2]++;     if(b[i].charAt(j)=='S')      frebb[ll][3]++;    }   }   int ans=0;   for (int i = 1; i <5 ; i++) {    for (int j = 0; j <4 ; j++) {     if(freaa[i][j]<frebb[i][j]){      ans+=frebb[i][j]-freaa[i][j];     }    }   }   out.println(ans);   out.close();  }  }
1	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    char[] poks = in.next().toCharArray();    boolean[] was = new boolean[52];    for (int i = 0; i < n; i++) {     if (Character.isLowerCase(poks[i])) {      was[poks[i] - 'a'] = true;     } else {      was[poks[i] - 'A' + 26] = true;     }    }    int count = 0;    for (int i = 0; i < 52; i++) {     count += was[i] ? 1 : 0;    }    int[] vis = new int[52];    int pre = 0;    int chr = 0;    int ans = Integer.MAX_VALUE;    for (int i = 0; i < n; i++) {     int pos = poks[i] - 'a';     if (Character.isUpperCase(poks[i])) {      pos = poks[i] - 'A' + 26;     }     if (vis[pos] == 0) {      chr++;     }     vis[pos]++;     while (chr == count) {      ans = Math.min(ans, i - pre + 1);      pos = poks[pre] - 'a';      if (Character.isUpperCase(poks[pre])) {       pos = poks[pre] - 'A' + 26;      }      vis[pos]--;      if (vis[pos] == 0) chr--;      pre++;     }    }    out.println(ans);   }  }  static class InputReader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public InputReader(InputStream stream) {    reader = new BufferedReader(new InputStreamReader(stream), 32768);    tokenizer = null;    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 Main{  static class Reader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;    public Reader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public Reader(String file_name) throws IOException   {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public String readLine() throws IOException   {    byte[] buf = new byte[200005];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == '\n' || c==' ') {           break;     }     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }    public int nextInt() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do    {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');     if (neg)     return -ret;    return ret;   }    public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }    public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();     do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');     if (c == '.')    {     while ((c = read()) >= '0' && c <= '9')     {      ret += (c - '0') / (div *= 10);     }    }     if (neg)     return -ret;    return ret;   }    private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }    private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }    public void close() throws IOException   {    if (din == null)     return;    din.close();   }  }  static class FastScanner {   private final BufferedReader bufferedReader;  private StringTokenizer stringTokenizer;   public FastScanner() {   bufferedReader = new BufferedReader(new InputStreamReader(System.in));  }   public String next() {   while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {    try {     stringTokenizer = new StringTokenizer(bufferedReader.readLine());    } catch (IOException e) {     throw new RuntimeException("Can't read next value", e);    }   }   return stringTokenizer.nextToken();  }   public int nextInt() {   return Integer.parseInt(next());  }   public long nextLong() {   return Long.parseLong(next());  }   public double nextDouble() {   return Double.parseDouble(next());  }   public String nextLine(){   String str = "";   try {    str = bufferedReader.readLine();   } catch (IOException e) {    e.printStackTrace();   }   return str;  } }  static void closeall() throws IOException{  printWriter.close();  sc.close();  in.close(); } static Scanner sc = new Scanner(System.in); static Reader in = new Reader(); static FastScanner fastScanner = new FastScanner(); static PrintWriter printWriter = new PrintWriter(new BufferedOutputStream(System.out)); static BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); static long INF = (long)(1e18);   int V,E; ArrayList<Integer> adj[]; HashMap<Integer,Integer> path; Main(){ } Main(int v,int e){  V=v;  E=e;  adj=new ArrayList[v];  path = new HashMap<Integer,Integer>();  for(int i=0;i<v;i++)  adj[i] = new ArrayList<>(); } void addEdge(int u,int v){  adj[u].add(v);  adj[v].add(u); }   static long power(long a,long k) {  long m = 1000000007;  long ans=1;  long tmp=a%m;  while(k>0)  {   if(k%2==1)    ans=ans*tmp%m;   tmp=tmp*tmp%m;   k>>=1;  }  return ans; }  static class Pair {  long F,S;  Pair(long x,long y){  F = x;  S = y;  }    } static long gcd(long a,long b) {  if(a<b) {  long t = a;  a = b;  b = t;  }  long r = a%b;  if(r==0)  return b;  return gcd(b,r); }  static int lower_bound(int[] a,int low,int high,int val) {  while(low!=high) {  int mid = (low+high)/2;  if(a[mid]<val)   low=mid+1;  else   high=mid;  }  return low; }  static int max(int a,int b) {  return (int)Math.max(a, b); } static long max(long a,long b) {  return (long)Math.max(a, b); } static int min(int a,int b) {  if(a<b)  return a;  return b; } static long mod = 1000000007;  public static void main(String args[])throws IOException{  int n = in.nextInt();  int[] a = new int[n];  for(int i=0;i<n;i++)  a[i] = in.nextInt();  int inv = 0;  for(int i=0;i<n;i++) {  for(int j=0;j<i;j++) {   if(a[j]>a[i])   inv++;  }  }  inv%=2;  int q = in.nextInt();  for(int i=0;i<q;i++) {  int l = in.nextInt();  int r = in.nextInt();  int num = r-l+1;  inv=(inv+num*(num-1)/2)%2;  if(inv==0)   printWriter.println("even");  else   printWriter.println("odd");  }  closeall(); } }
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 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 int nextUnsignedInt() throws IOException{   return (int)nextUnsignedLong();  }   public double nextDouble() throws IOException{   while (((ch=nextChar())<'0' || ch>'9') && ch!='.' && ch!='-');   char[] tmp = new char[255];   int itmp = 0;   tmp[itmp++]=(char)ch;   while (((ch=nextChar())>='0' && ch<='9') || ch=='.' || ch=='-'){    tmp[itmp++]=(char)ch;   }   return Double.parseDouble(new String(tmp,0,itmp));  }   public static void main(String[] args) {   new TemplateBuf().run();  }  }
1	public class AA { 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 d =sc.nextInt();  int[] hotels = new int[n];  for (int i = 0; i < hotels.length; i++) {  hotels[i] = sc.nextInt();  }  int count = 0;  for (int i = 0; i < hotels.length-1; i++) {  int one = hotels[i];  int two = hotels[i+1];  double mid = (two-one)*1.0/2.0;  if(mid==d) {   count++;   }  else if(mid>d) {   count+=2;     }    }  count+=2;  System.out.println(count);     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 int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-') {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.') {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  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;   Scanner in = new Scanner(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskF solver = new TaskF();   solver.solve(1, in, out);   out.close();  }  static class TaskF {   public void solve(int testNumber, Scanner in, PrintWriter out) {    int n = in.nextInt();    int m = in.nextInt();    int[][] graph = new int[n][m];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++)      graph[i][j] = in.nextInt();    }    int[][] mn1 = new int[n][n];    int[][] mn2 = new int[n][n];    for (int i = 0; i < n; i++)     for (int j = 0; j < n; j++) {      int min_val = Integer.MAX_VALUE;      for (int k = 0; k < m; k++)       min_val = Math.min(min_val, Math.abs(graph[i][k] - graph[j][k]));      mn1[i][j] = min_val;      min_val = Integer.MAX_VALUE;      for (int k = 0; k < m - 1; k++) {       min_val = Math.min(min_val, Math.abs(graph[i][k] - graph[j][k + 1]));      }      mn2[i][j] = min_val;     }    int[][] dp = new int[(1 << (n + 2))][n];    int ans = 0;    for (int i = 0; i < n; i++) {     for (int[] temp : dp)      Arrays.fill(temp, -1);     for (int j = 0; j < n; j++) {      dp[1 << j][j] = (j == i ? Integer.MAX_VALUE : 0);     }     for (int j = 0; j < n; j++) {      ans = Math.max(ans, Math.min(mn2[j][i], calc((1 << n) - 1, j, dp, mn1, n)));     }    }    out.println(ans);   }   public int calc(int mask, int v, int[][] dp, int[][] mn1, int n) {    if (dp[mask][v] != -1)     return dp[mask][v];    dp[mask][v] = 0;    for (int u = 0; u < n; u++) {     if (u != v && (((mask >> u) & 1) == 1))      dp[mask][v] = Math.max(dp[mask][v], Math.min(mn1[u][v], calc(mask ^ (1 << v), u, dp, mn1, n)));    }    return dp[mask][v];   }  } }
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();    boolean[] isF = new boolean[n];    for (int i = 0; i < n; i++) {     isF[i] = in.readCharacter() == 'f';    }    FenwickTree[] fenwickTrees = new FenwickTree[n + 1];    for (int i = 0; i < fenwickTrees.length; i++) {     fenwickTrees[i] = new FenwickTree(n + 1);    }    fenwickTrees[n].add(0, 1);    for (int idx = n - 1; idx >= 0; idx--) {     for (int indentLevel = 0; indentLevel < n; indentLevel++) {      long fenwickRes;      if (isF[idx]) {       fenwickRes = fenwickTrees[idx + 1].get(indentLevel + 1, indentLevel + 1);      } else {       fenwickRes = fenwickTrees[idx + 1].get(0, indentLevel);      }      fenwickTrees[idx].add(indentLevel, fenwickRes % MiscUtils.MOD7);     }    }    out.printLine(fenwickTrees[0].get(0, 0));   }  }  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 char readCharacter() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    return (char) c;   }   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(long i) {    writer.println(i);   }  }  static class MiscUtils {   public static final int MOD7 = (int) (1e9 + 7);  }  static class FenwickTree {   private final long[] value;   public FenwickTree(int size) {    value = new long[size];   }   public long get(int from, int to) {    return get(to) - get(from - 1);   }   private long get(int to) {    to = Math.min(to, value.length - 1);    long result = 0;    while (to >= 0) {     result += value[to];     to = (to & (to + 1)) - 1;    }    return result;   }   public void add(int at, long value) {    while (at < this.value.length) {     this.value[at] += value;     at = at | (at + 1);    }   }  } }
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 arr[]=new int[n];   in.getArray(arr);   int arrc[]=new int[n];   for(int i=0;i<n;i++){    arrc[i]=arr[i];   }   Library.sort(arrc);   int c=0;   for(int i=0;i<n;i++){    if(arrc[i]!=arr[i]){     c++;    }   }   if(c>2){    out.println("NO");   }   else{    out.println("YES");   } } } 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());  }  public void getArray(int arr[]){   for(int i=0;i<arr.length;i++){    arr[i]=nextInt();   }  }  } class Library{  public static void sort(int n[]){   int len=n.length;   int l1=len/2;   int l2=len-l1;   int n1[]=new int[l1];   int n2[]=new int[l2];   for(int i=0;i<l1;i++){    n1[i]=n[i];   }   for(int i=0;i<l2;i++){    n2[i]=n[i+l1];   }   if(l1!=0){    sort(n1);    sort(n2);   }   int ind1=0;   int ind2=0;   int ind=0;   for(int i=0;i<len&&ind1<l1&&ind2<l2;i++){    if(n1[ind1]<n2[ind2]){     n[i]=n1[ind1];     ind1++;    }    else{     n[i]=n2[ind2];     ind2++;    }    ind++;   }   if(ind1<l1){    for(int i=ind1;i<l1;i++){     n[ind]=n1[i];     ind++;    }   }   if(ind2<l2){    for(int i=ind2;i<l2;i++){     n[ind]=n2[i];     ind++;    }   }  }   }
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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int N = in.nextInt(), i, a[] = new int[N];    int rev[] = new int[N];    for (i = 0; i < N; i++) {     a[i] = in.nextInt();     rev[N - i - 1] = a[i];    }    long[][] inverse = inversions(a, N);    long[][] revInverse = inversions(rev, N);    int q = in.nextInt();    long inversions = inverse[0][N - 1] % 2;    while (q-- > 0) {     int left = in.nextInt() - 1, right = in.nextInt() - 1;     int length = right - left + 1;     length = length * (length - 1) / 2;     if (length % 2 == 1) {      inversions = 1 - inversions;     }     if (inversions % 2 == 0) {      out.printLine("even");     } else {      out.printLine("odd");     }    }      }   public long[][] inversions(int a[], int N) {    int x[][] = new int[N][N];    int i, j;    for (i = 0; i < N; i++) {     for (j = i + 1; j < N; j++) {      if (a[i] > a[j]) {       x[i][j] = 1;      }     }    }    int colSum[][] = new int[N][N];    for (i = 0; i < N; i++) {     colSum[0][i] = x[0][i];     for (j = 1; j < N; j++) {      colSum[j][i] = colSum[j - 1][i] + x[j][i];     }    }    long inverse[][] = new long[N][N];    for (int length = 2; length <= N; length++) {     j = length - 1;     i = 0;     while (j < N) {      inverse[i][j] = inverse[i][j - 1] + colSum[i + length - 1][j];      if (i > 0) {       inverse[i][j] -= colSum[i - 1][j];      }      i++;      j++;     }    }    return inverse;   }  }  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 printLine(Object... objects) {    print(objects);    writer.println();   }   public void close() {    writer.close();   }  } }
1	public class A { public static boolean ok(int []x,int d,int X) {  for(int i=0;i<x.length;i++)  if(Math.abs(x[i]-X)<d)   return false;  return true; } public static void main(String[] args) throws IOException {  Scanner sc=new Scanner(System.in);  PrintWriter pw=new PrintWriter(System.out);  int ans=0;  int n=sc.nextInt(),d=sc.nextInt();  TreeSet<Integer> set=new TreeSet();  int []x=new int [n];  for(int i=0;i<n;i++)  x[i]=sc.nextInt();  for(int i=0;i<n;i++)  {  int x1=x[i]+d;  if (ok(x,d,x1))   set.add(x1);  x1=x[i]-d;  if (ok(x,d,x1))   set.add(x1);      }  pw.println(set.size());     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 Scanner(String s) throws FileNotFoundException {  br = new BufferedReader(new FileReader(s)); } 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 String nextLine() throws IOException {  return br.readLine(); }  public boolean ready() throws IOException {  return br.ready(); } } }
3	public class SameSumBlock { static BufferedReader br; static StringTokenizer tokenizer;  public static void main(String[] args) throws Exception {  br = new BufferedReader(new InputStreamReader(System.in));  int n = nextInt();  int[] arr = new int[n];  int[] pSum = new int[n];  for(int i = 0; i< n; i++) {  arr[i] = nextInt();  if(i != 0)   pSum[i] += pSum[i - 1];  pSum[i] += arr[i];  }  ArrayList<Interval> sorted = new ArrayList<Interval>();  for(int i = 0; i < n; i++)  sorted.add(new Interval(pSum[i],0, i));  for(int i = 1; i < n; i++) {  for(int j = i; j < n; j++) {   sorted.add(new Interval(pSum[j] - pSum[i - 1], i, j));  }  }  sorted.sort(null);  int i = 0;  int max = 0, idx = 0, end = 0;  while(i < sorted.size()) {  int last = i;  int curr = 1;  int start = i;  sorted.get(i).marked = true;  while(i < sorted.size() - 1 && sorted.get(i).val == sorted.get(i + 1).val) {   i++;   if(sorted.get(i).l > sorted.get(last).r) {   sorted.get(i).marked = true;   curr++;   last = i;   }  }  if(curr > max) {   max = curr;   idx = start;   end = i;  }  i++;  }  System.out.println(max);  for(int j = idx; j <= end; j++) {  if(sorted.get(j).marked)   System.out.println(sorted.get(j).l + 1 + " " + (sorted.get(j).r + 1));  } }  public static String next() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  String line = br.readLine();  if (line == null)   throw new IOException();  tokenizer = new StringTokenizer(line);  }  return tokenizer.nextToken(); }  public static int nextInt() throws IOException {  return Integer.parseInt(next()); } } class Interval implements Comparable<Interval> { int val, l, r; boolean marked; public Interval(int val, int l, int r) {  super();  this.val = val;  this.l = l;  this.r = r; }  @Override public int compareTo(Interval o) {  if(val != o.val)  return val - o.val;  return r - o.r; }  }
2	public class P817C { public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  long n = scan.nextLong();  long s = scan.nextLong();  long ans = 0;  if (s > n)  {  System.out.println(0);  return;  }  if (n > s+200)  {  ans += n-(s+200);  n = s+200;  }  for (long i = s; i <= n; i++)  {  char[] num = (""+i).toCharArray();  int sum = 0;  for (int j = 0; j < num.length; j++)   sum += num[j] - '0';  if (i - sum >= s)   ans++;  }  System.out.println(ans); } }
5	public class CodeforcesRound159 {    public static void main(String[] args)  { Scanner kde = new Scanner(System.in); int n =kde.nextInt();  int m =kde.nextInt();  int k =kde.nextInt();  ArrayList<Integer> count = new ArrayList<Integer>(); for (int i=0; i<n; i++ ) {  count.add(kde.nextInt()) ;  }  Collections.sort(count); Collections.reverse(count); if(m<=k) {  System.out.println("0");   return; }  m=m-k+1;      int res=0; for(int i=0; i<n; i++ )  {  if(i!=0)  {  res+=count.get(i)-1;  }  else   {  res+=count.get(i);  }    if(res>=m)  {   System.out.println(i+1);   return;  }   }         System.out.println("-1");   } }
1	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()) 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()); }  void solve() throws Exception {  boolean[] r = new boolean[1010];  Arrays.fill(r, true);  r[0] = r[1] = false;  for (int i = 2; i < 1010; i++) {  if (r[i]) {   for (int j = i + i; j < 1010; j += i) {   r[j] = false;   }  }  }  int[] pr = new int[1010];  int l = 0;  for (int i = 2; i < 1010; i++) if (r[i]) pr[l++] = i;  int n = nextInt();  int k = nextInt();  int ans = 0;  int j = 0;  for (int i = 2; i <= n; i++) {  if (r[i]) {  for (; j < l - 1; j++) {   if (i == pr[j] + pr[j + 1] + 1) {   ans++;   break;   }   if (i < pr[j] + pr[j + 1] + 1) break;  }  }  }  if (ans >= k) out.println("YES"); else out.println("NO"); }  public void run() {  try {  Locale.setDefault(Locale.US);  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  } catch (Exception e) {  e.printStackTrace();  }  out.flush(); } }
6	public class Main {  private static boolean check(int n , int m , int k) {   for (int i = 0;i < n;i ++) {  for (int j = 0;j < n;j ++) {   for (int l = 0;l < (1 << n);l ++) {   dp[i][j][l] = - 1;   }  }  }  for (int i = 0;i < n;i ++) {  if (dfs(i , i , n , m , k , 0)) {   return true;  }  }  return false;   }   private static boolean dfs(int first , int current , int n , int m , int k , int bitmap) {   bitmap |= (1 << current);  if (bitmap == (1 << n) - 1) {    if (n == 1) {   if (m > 1) {   if (rowMinDist[current] >= k) {    return true;   } else {      return false;   }   } else {   return true;   }  } else {   if (m > 1) {   if (minDistBetweenHeadAndTail[first][current] >= k) {    return true;   } else {    return false;   }   } else {   return true;   }  }  } else {  if (dp[first][current][bitmap] >= 0) {   if (dp[first][current][bitmap] > 0) {   return true;   } else {   return false;   }  }    short ans = 0;  for (int i = 0;i < n;i ++) {   if ((bitmap & (1 << i)) == 0 && minDistBetweenRow[current][i] >= k) {      if (dfs(first , i , n , m , k , bitmap)) {    ans = 1;    break;   }   }  }    dp[first][current][bitmap] = ans;  if (ans > 0) {    return true;  } else {   return false;  }  }   }  private static short[][][] dp = new short[20][20][(1 << 17)];  private static int[][] input = new int[20][10010]; private static int[][] minDistBetweenRow = new int[20][20]; private static int[][] minDistBetweenHeadAndTail = new int[20][20]; private static int[] rowMinDist = new int[20];  public static void main(String[] args) {    Scanner scan = new Scanner(System.in);   int i , j , k , n , m;  n = scan.nextInt();  m = scan.nextInt();  for (i = 0;i < n;i ++) {  for (j = 0;j < m;j ++) {   input[i][j] = scan.nextInt();  }  }  for (i = 0;i < n;i ++) {  for (j = i + 1;j < n;j ++) {   int minDist = - 1;   for (k = 0;k < m;k ++) {   int dist = Math.abs(input[i][k] - input[j][k]);   if (dist < minDist || minDist < 0) {    minDist = dist;   }   }   minDistBetweenRow[i][j] = minDistBetweenRow[j][i] = minDist;   }  }  for (i = 0;i < n;i ++) {  for (j = 0;j < n;j ++) {   if (i != j) {      int minDist = - 1;   for (k = 0;k < m - 1;k ++) {       int dist = Math.abs(input[j][k] - input[i][k + 1]);    if (dist < minDist || minDist < 0) {    minDist = dist;    }   }   minDistBetweenHeadAndTail[i][j] = minDist;   }  }  }   for (i = 0;i < n;i ++) {  int minDist = - 1;  for (j = 0;j < m - 1;j ++) {   int dist = Math.abs(input[i][j] - input[i][j + 1]);   if (dist < minDist || minDist < 0) {   minDist = dist;   }  }  rowMinDist[i] = minDist;  }  int low = 0 , high = 1000000010;  while (low < high) {  int mid = (low + high) / 2;  if (check(n , m , mid)) {     low = mid + 1;  } else {   high = mid;  }  }  System.out.println(high - 1);  }    }
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 LookingForOrder {  static int[] dp = new int[(int) (1 << 24)]; static int[][] points; static int[] sol = new int[1<<24]; static int sx = 0, sy = 0;  public static void main(String[] args) {  sx = in.nextInt();  sy = in.nextInt();  Arrays.fill(dp, -2);  int n = in.nextInt();  points = new int[n][3];  for (int i = 0; i < n; i++) {  points[i][0] = in.nextInt();  points[i][1] = in.nextInt();  points[i][2] = (sx - points[i][0]) * (sx - points[i][0]) + (sy - points[i][1]) * (sy - points[i][1]);  }    System.out.println(solve(0));   int mask=0;  while(true){  System.out.print(0+" ");  if (mask==(1<<n)-1) break;  int x = sol[mask];  int count=0;  for(int i=0; i<n; i++){   if ((x&(1<<i))!=0) {   count++;   System.out.print((i+1)+" ");   mask|=(1<<i);   }   if (count==2) break;     }  }  System.out.println();  }  public static int solve(int mask) {   if (dp[mask]!=-2) return dp[mask];   int n = points.length;  if (mask == ((1 << n)-1)) {  return dp[mask]=0;  }  int here = -1;  for (int i = 0; i < n; i++) {  if ((mask & (1<<i)) == 0) {   here = i;   break;  }  }    int ans = 2*points[here][2]+solve(mask | (1 << here));  sol[mask] = 1<<here;  int x1 = points[here][0];  int y1 = points[here][1];  for (int i = here + 1; i < n; i++) {  if ((mask & (1 << i)) == 0) {   int x2 = points[i][0];   int y2 = points[i][1];   int p = mask|(1<<here);   p = p|(1<<i);   if (ans>points[here][2] + points[i][2] + (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)    + solve(p)){   ans=points[here][2] + points[i][2] + (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)    + solve(p);   sol[mask]=(1<<here)|(1<<i);   }  }  }  return dp[mask]=ans; }  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());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }  }  static MyScanner in = new MyScanner(); }
1	public class Pr468B { public static void main(String[] args) throws IOException {  new Pr468B().run(); }  BufferedReader in; PrintWriter out; StringTokenizer st;  String nextToken() throws IOException {  while (st == null || !st.hasMoreTokens()) {  st = new StringTokenizer(in.readLine());  }  return st.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out, true);  solve();  out.flush(); }  int[] which; boolean[] was; int[] pa; int[] pb;  void dfs(int i, boolean fa) {  was[i] = true;  if (fa) {  if (pa[i] == -1) {   out.println("NO");   out.flush();   System.exit(0);  }  which[i] = 0;  which[pa[i]] = 0;  if (pb[pa[i]] != -1 && !was[pb[pa[i]]]) {   dfs(pb[pa[i]], fa);  }  } else {  if (pb[i] == -1) {   out.println("NO");   out.flush();   System.exit(0);  }  which[i] = 1;  which[pb[i]] = 1;  if (pa[pb[i]] != -1 && !was[pa[pb[i]]]) {   dfs(pa[pb[i]], fa);  }  } }  void solve() throws IOException {  int n = nextInt();  int a = nextInt();  int b = nextInt();  int[] p = new int[n];  HashMap<Integer, Integer> allNums = new HashMap<Integer, Integer>();  for (int i = 0; i < n; i++) {  p[i] = nextInt();  if (p[i] >= Math.max(a, b)) {   out.println("NO");   return;  }  allNums.put(p[i], i);  }  pa = new int[n];  pb = new int[n];  Arrays.fill(pa, -1);  Arrays.fill(pb, -1);  which = new int[n];  Arrays.fill(which, -1);  for (int i = 0; i < n; i++) {  if (pa[i] == -1 && allNums.containsKey(a - p[i])) {   pa[i] = allNums.get(a - p[i]);   pa[pa[i]] = i;  }  if (pb[i] == -1 && allNums.containsKey(b - p[i])) {   pb[i] = allNums.get(b - p[i]);   pb[pb[i]] = i;  }  if (pa[i] == -1 && pb[i] == -1) {   out.println("NO");   return;  }  }  was = new boolean[n];  for (int i = 0; i < n; i++) {  if (!was[i] && pa[i] == -1) {   dfs(i, false);  } else if (!was[i] && pb[i] == -1) {   dfs(i, true);  }  }  for (int i = 0; i < n; i++) {  if (!was[i]) {   dfs(i, true);  }  }  out.println("YES");  for (int i = 0; i < n; i++) {  out.print(which[i] + " ");  } } }
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()); }  public long nextLong() {    return Long.parseLong(next());   }  } }
3	public class GFG {  static int count=0;   public static void main (String[] args) {  Scanner ob=new Scanner(System.in);  int n;  long MOD=(long)(1e9+7);  int f=0,s=0;  n=ob.nextInt();  long dp[][]=new long[n+2][n+2];  dp[0][1]=1;  char ch='s';  char p;  for(int i=1;i<=n;i++)  {   p=ch;   ch=ob.next().charAt(0);   if(p=='f')   {    for(int j=1;j<=n;j++)    dp[i][j+1]=dp[i-1][j];   }   else   {    for(int j=n;j>0;j--)    {     dp[i][j]=(dp[i][j+1]+dp[i-1][j])%MOD;    }   }  }   long ans=0;   for(int i=1;i<=n;i++)  {   ans=(ans+dp[n][i])%MOD;  }  System.out.println(ans); } }
1	public class Code1 {  public static void main(String[] args) {  InputReader in = new InputReader(System.in);  PrintWriter pw = new PrintWriter(System.out);   int n = in.nextInt();  long d = in.nextLong();  long[]a = new long[n];  for(int i=0;i<n;i++)  a[i] = in.nextLong();  int ans = 1;  for(int i=0;i<n-1;i++)  {  long x = a[i+1]-a[i];  if(x==2*d)   ans++;  else if(x>2*d)   ans+=2;    }  ans++;  pw.print(ans);  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 long nextLong()  {  int c = snext();  while (isSpaceChar(c))   {   c = snext();  }  int sgn = 1;  if (c == '-')   {   sgn = -1;   c = snext();  }  long res = 0;  do   {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = snext();  } while (!isSpaceChar(c));  return res * sgn;  }   public int[] nextIntArray(int n)  {  int a[] = new int[n];  for (int i = 0; i < n; i++)   {   a[i] = nextInt();  }  return a;  }   public String readString()  {  int c = snext();  while (isSpaceChar(c))   {   c = snext();  }  StringBuilder res = new StringBuilder();  do   {   res.appendCodePoint(c);   c = snext();  } while (!isSpaceChar(c));  return res.toString();  }   public String nextLine()  {  int c = snext();  while (isSpaceChar(c))   c = snext();  StringBuilder res = new StringBuilder();  do   {   res.appendCodePoint(c);   c = snext();  } while (!isEndOfLine(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;  }   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[] suffle(int[] a,Random gen) {  int n = a.length;  for(int i=0;i<n;i++)  {  int ind = gen.nextInt(n-i)+i;  int temp = a[ind];  a[ind] = a[i];  a[i] = temp;  }  return a; }  public static void swap(int a, int b){  int temp = a;  a = b;  b = temp; }  public static HashSet<Integer> primeFactorization(int n) {  HashSet<Integer> a =new HashSet<Integer>();  for(int i=2;i*i<=n;i++)  {  while(n%i==0)  {   a.add(i);   n/=i;  }  }  if(n!=1)  a.add(n);  return a; }  public static void sieve(boolean[] isPrime,int n) {  for(int i=1;i<n;i++)  isPrime[i] = true;   isPrime[0] = false;  isPrime[1] = false;   for(int i=2;i*i<n;i++)  {  if(isPrime[i] == true)  {   for(int j=(2*i);j<n;j+=i)   isPrime[j] = false;  }  } }  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 long LCM(long a,long b) {  return (a*b)/GCD(a,b); }  public static int LCM(int a,int b) {  return (a*b)/GCD(a,b); }  public static int binaryExponentiation(int x,int n) {  int result=1;  while(n>0)  {   if(n % 2 ==1)    result=result * x;   x=x*x;   n=n/2;  }  return result; }  public static long binaryExponentiation(long x,long n) {  long result=1;  while(n>0)  {   if(n % 2 ==1)    result=result * x;   x=x*x;   n=n/2;  }  return result; }  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; }  public static int modInverse(int A,int M) {  return modularExponentiation(A,M-2,M); }  public static long modInverse(long A,long M) {  return modularExponentiation(A,M-2,M); }  public static boolean isPrime(int n) {    if (n <= 1) return false;  if (n <= 3) return true;    if (n%2 == 0 || n%3 == 0)   return false;    for (int i=5; i*i<=n; i=i+6)  {   if (n%i == 0 || n%(i+2) == 0)    return false;  }    return true; }  static class pair implements Comparable<pair> {  Integer x, y;  pair(int x,int y)  {  this.x=x;  this.y=y;  }   public int compareTo(pair o) {  int result = x.compareTo(o.x);  if(result==0)   result = y.compareTo(o.y);    return result;  }    public String toString()  {  return x+" "+y;  }   public boolean equals(Object o)  {  if (o instanceof pair)   {   pair p = (pair)o;   return p.x == x && p.y == y ;  }  return false;  }   public int hashCode()  {  return new Long(x).hashCode()*31 + new Long(y).hashCode();  } } }
2	public class Main { static long MOD=1000000007; public static long pow(long x,long k){  long base=x%MOD;  long res=1;  while(k>0){  if((k&1)==1){   res=(res*base)%MOD;  }  base=(base*base)%MOD;  k>>=1;  }  return res; }  public static void main (String[] args) throws java.lang.Exception {  Scanner scan=new Scanner(System.in);  long x=scan.nextLong();  long k=scan.nextLong();  long MOD=1000000007;  if(x==0){System.out.println(0);return;}  x %= MOD;  long a=pow(2L,k+1);  long b=pow(2L,k);  long res=(a*x)%MOD-b+1;  if(res<0){res+=MOD;}  System.out.println(res%MOD); } }
3	public class q1 {  static int MOD=1000000007;  static class Reader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;    public Reader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public Reader(String file_name) throws IOException   {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public String readLine() throws IOException   {    byte[] buf = new byte[1000000];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }    public int nextInt() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do    {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');     if (neg)     return -ret;    return ret;   }    public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }    public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();     do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');     if (c == '.')    {     while ((c = read()) >= '0' && c <= '9')     {      ret += (c - '0') / (div *= 10);     }    }     if (neg)     return -ret;    return ret;   }    private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }    private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }    public void close() throws IOException   {    if (din == null)     return;    din.close();   }  }   static boolean isPrime(int n)  {   if (n <= 1)    return false;   if (n <= 3)    return true;   if (n % 2 == 0 || n % 3 == 0)    return false;     for (int i = 5; i * i <= n; i = i + 6)    if (n % i == 0 || n % (i + 2) == 0)     return false;     return true;  }  static int gcd(int a, int b)  {   if (b == 0)   return a;   return gcd(b, a % b);  }       public static void main(String[] args) throws IOException  {   Scanner sc=new Scanner(System.in);      int T=1;   while(T-- > 0){    int N=sc.nextInt();    int a[]=new int[N];    int count=0;    int ans=0;    boolean flag=false;    for(int i=0;i<N;++i){     a[i]=sc.nextInt();    }    Arrays.sort(a);    for(int i=0;i<N;++i){     if(a[i]==-1)     continue;    for(int j=i+1;j<N;++j){     if(a[j]%a[i]==0 && a[j]!=-1){      a[j]=-1;;     }    }    }       for(int i=0;i<N;++i){     if(a[i]!= -1)     count++;    }    System.out.println(count);   }     }    }
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()); }   long nextLong(){ return Long.parseLong(next()); }  }  FastScanner sc;  PrintWriter out;   public static void main(String[] args){   new Main().run();     }   void TLE(){ for(;;); }  void MLE(){   int[][] adj = new int[1024*1024][];   for( int i = 0; i < adj.length; ++i )    adj[i] = new int[1024*1024];  }  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 );  }  }
2	public class Main {   public static void main(String[] args) throws Exception{   FastReader sc=new FastReader();   OutputStream outputStream = System.out;   PrintWriter out = new PrintWriter(outputStream);   Main mm=new Main();   long n=sc.nextLong();   long k=sc.nextLong();   long l=0;   long r=1000000000;   long ans=-1;   while(l<=r) {    long mid=(l+r)/2;    if(n-mid<=0) {     r=mid-1;    }    else {     long temp=(n-mid)*(n-mid+1)-(2*mid);     if(temp==2*k) {      ans=mid;      break;     }     else if(temp<2*k) {      r=mid-1;     }     else if(temp>2*k) {      l=mid+1;     }    }   }   System.out.println(ans);  } }  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());  }   double nextDouble()  {   return Double.parseDouble(next());  }   String nextLine()  {   String str = "";   try   {    str = br.readLine();   }   catch (IOException e)   {    e.printStackTrace();   }   return str;  } }
3	public class CODEFORCES { @SuppressWarnings("rawtypes") static InputReader in; static PrintWriter out;  static void solve() {  int n = in.ni();  int arr[] = new int[n];  for (int i = 0; i < n; i++)  arr[i] = in.ni();  int cnt = 0;  for (int i = 0; i < n; i++)  {  for (int j = 0; j < i; j++)   if (arr[j] > arr[i])   cnt++;  }  cnt %= 2;  int m = in.ni();  while (m-- > 0)  {  int l = in.ni(), r = in.ni();  int fin = r - l + 1;  fin *= (fin - 1);  fin >>= 1;  if ((fin & 1) == 1)   cnt++;  cnt %= 2;  if ((cnt & 1) == 1)   out.println("odd");  else   out.println("even");  } }  @SuppressWarnings("rawtypes") static void soln() {  in = new InputReader(System.in);  out = new PrintWriter(System.out);  solve();  out.flush(); }  static void debug(Object... o) {  System.out.println(Arrays.deepToString(o)); }  public static void main(String[] args) {  new Thread(null, new Runnable()  {  public void run()  {   try   {   soln();   } catch (Exception e)   {   e.printStackTrace();   }  }  }, "1", 1 << 26).start(); }    static class InputReader<SpaceCharFilter> {  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 ni()  {  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 nl()  {  int c = snext();  while (isSpaceChar(c))  {   c = snext();  }  int sgn = 1;  if (c == '-')  {   sgn = -1;   c = snext();  }  long res = 0;  do  {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = snext();  } while (!isSpaceChar(c));  return res * sgn;  }  public int[] nextIntArray(int n)  {  int a[] = new int[n];  for (int i = 0; i < n; i++)  {   a[i] = ni();  }  return a;  }  public long[] nextLongArray(int n)  {  long a[] = new long[n];  for (int i = 0; i < n; i++)  {   a[i] = nl();  }  return a;  }  public String readString()  {  int c = snext();  while (isSpaceChar(c))  {   c = snext();  }  StringBuilder res = new StringBuilder();  do  {   res.appendCodePoint(c);   c = snext();  } while (!isSpaceChar(c));  return res.toString();  }  public String nextLine()  {  int c = snext();  while (isSpaceChar(c))   c = snext();  StringBuilder res = new StringBuilder();  do  {   res.appendCodePoint(c);   c = snext();  } while (!isEndOfLine(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;  }  private boolean isEndOfLine(int c)  {  return c == '\n' || c == '\r' || c == -1;  }  public interface SpaceCharFilter  {  public boolean isSpaceChar(int ch);  }  } }
5	public class CodeforcesA implements Runnable { public static final String taskname = "A"; BufferedReader in; PrintWriter out; StringTokenizer tok;  public static void main(String[] args) {  new Thread(new CodeforcesA()).start(); }  static class Square implements Comparable<Square>{  int x, a;  public Square(int x, int a) {  this.x = x;  this.a = a;  }  @Override  public int compareTo(Square o) {  return x - o.x;  }   int distance(Square a, int t) {  double dist = a.x - x - this.a / 2.0 - a.a / 2.0;  if(dist > t) return 2;  else if(abs(dist - t) < 1e-9) return 1;  return 0;  }   public String toString() {  return x + " " + a;  } }   void solve() throws IOException {  int n = nextInt(), t = nextInt();  Square[] x = new Square[n];  for(int i = 0; i < n; ++i) {  x[i] = new Square(nextInt(), nextInt());  }  Arrays.sort(x);  long res = 2;  for(int i = 0; i < n - 1; ++i) {  res += x[i].distance(x[i + 1], t);  }  out.println(res);   }  @Override public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);    solve();  out.flush();  out.close();  in.close();  } catch (IOException e) {    e.printStackTrace();  }  }  String nextLine() throws IOException {  tok = null;  return in.readLine(); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  String nextToken() throws IOException {  while (tok == null || !tok.hasMoreTokens()) {  tok = new StringTokenizer(in.readLine());  }  return tok.nextToken(); } }
1	public class B {  public static void main(String[] args) throws IOException {   new B().solve();  }  void solve() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   int n = Integer.parseInt(in.readLine());   while (n-- > 0) {    String s = in.readLine();    int pr = s.indexOf('R');    int pc = s.indexOf('C');    if (pr == 0 && pc > 1 && Character.isDigit(s.charAt(1))) {     int r = Integer.parseInt(s.substring(1, pc));     int c = Integer.parseInt(s.substring(pc + 1, s.length()));     out.println(i2s(c) + r);    } else {     int i = 0;     while (!Character.isDigit(s.charAt(i))) ++i;     out.println("R" + Integer.parseInt(s.substring(i, s.length())) + "C" + s2i(s.substring(0, i)));    }   }   out.close();  }  int s2i(String s) {   int r = 0;   for (int i = 0; i < s.length(); ++i) {    r = r * 26 + (s.charAt(i) - 'A' + 1);   }   return r;  }  String i2s(int i) {   StringBuffer s = new StringBuffer();   while (i > 0) {    i -= 1;    s.append((char)('A' + (i % 26)));    i /= 26;   }   return s.reverse().toString();  }  BufferedReader in;  PrintWriter out; }
3	public class x1141F  {  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[] arr = new int[N];   st = new StringTokenizer(infile.readLine());   for(int i=0; i < N; i++)    arr[i] = Integer.parseInt(st.nextToken());      HashMap<Long, ArrayList<Range>> map = new HashMap<Long, ArrayList<Range>>();   for(int r=0; r < N; r++)   {    long sum = 0L;    for(int i=r; i >= 0; i--)    {     sum += arr[i];     if(!map.containsKey(sum))     map.put(sum, new ArrayList<Range>());     map.get(sum).add(new Range(i, r));    }   }   ArrayList<Range> res = new ArrayList<Range>();   for(long key: map.keySet())   {    ArrayList<Range> ls = map.get(key);    ArrayList<Range> temp = new ArrayList<Range>();    temp.add(ls.get(0));    int r = ls.get(0).r;    for(int i=1; i < ls.size(); i++)     if(r < ls.get(i).l)     {     r = ls.get(i).r;     temp.add(ls.get(i));     }    if(res.size() < temp.size())     res = temp;   }   System.out.println(res.size());   StringBuilder sb = new StringBuilder();   for(Range x: res)   {    sb.append(x.l+" "+x.r);    sb.append("\n");   }   System.out.print(sb);  }  }  class Range  {  public int l;  public int r;    public Range(int a, int b)  {   l = a+1;   r = b+1;  }  }
0	public class Main {  public static void main(String[] args) throws Exception {   int n = nextInt();  String nn = Integer.toString(n);  if(n >= 0){  println(n);  } else {  println(Math.max(Integer.parseInt(nn.substring(0,nn.length() - 1)), Integer.parseInt(nn.substring(0, nn.length() - 2) + nn.charAt(nn.length() - 1))));  } }  private static PrintWriter out = new PrintWriter(System.out); private static BufferedReader inB = new BufferedReader(new InputStreamReader(System.in));  private static StreamTokenizer in = new StreamTokenizer(inB);  private static void exit(Object o) throws Exception {  out.println(o);  out.flush();  System.exit(0); } private static void println(Object o) throws Exception{  out.println(o);  out.flush(); } private static void print(Object o) throws Exception{  out.print(o);  out.flush(); } private static long nextLong() throws Exception {  in.nextToken();  return (long)in.nval; }  private static int nextInt() throws Exception {  in.nextToken();  return (int)in.nval; }  private static String nextString() throws Exception {  in.nextToken();  return in.sval;   }  }
1	public class BDiv1 { static int n; static int a; static int b; static HashMap<Integer,Integer> graphA=new HashMap<>(); static HashMap<Integer,Integer> graphB=new HashMap<>(); static int [] array; static int [] original; static boolean x=true;  public static void main(String[] args) throws Exception{   BufferedReader buf =new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st =new StringTokenizer(buf.readLine());   n=parseInt(st.nextToken());   a=parseInt(st.nextToken());   b=parseInt(st.nextToken());   st =new StringTokenizer(buf.readLine());   array=new int[n];   original=new int [n];   for (int i=0;i<n;i++){    array[i]=parseInt(st.nextToken());    original[i]=array[i];   }   Arrays.sort(array); for (int i=0;i<n;i++){  int k= Arrays.binarySearch(array,a-array[i]);  if (k>=0){   graphA.put(array[i],array[k]);   graphA.put(array[k],array[i]);  } } for (int i=0;i<n;i++){  int k= Arrays.binarySearch(array,b-array[i]);  if (k>=0){   graphB.put(array[i],array[k]);   graphB.put(array[k],array[i]);  }  }  for (int i=0;i<n;i++){  Integer j=graphA.get(array[i]);  if (j!=null){   if (graphB.containsKey(array[i]) && graphB.containsKey(j)){    graphA.remove(array[i]);    graphA.remove(j);   }   else if (graphB.containsKey(array[i]) && !graphB.containsKey(j)){       graphB.remove(graphB.get(array[i]));    graphB.remove(array[i]);   }   else if (!graphB.containsKey(array[i]) && graphB.containsKey(j)){    graphB.remove(graphB.get(j));    graphB.remove(j);   }    }  } int [] res=new int [n]; for (int i=0;i<n;i++){  if (graphA.containsKey(original[i]))res[i]=0;  else if (graphB.containsKey(original[i])) res[i]=1;  else {   System.out.println("NO");   return;  } } System.out.println("YES"); for (int k:res)System.out.print(k+" "); }  }
5	public class solver {  FastScanner in = new FastScanner(System.in);  PrintWriter out = new PrintWriter(System.out);     public static void main(String[] args) {   new solver().solve();  }   public void solve() {    int n = in.nextInt();   int[]tab = new int[n];     int sum = 0;     for (int i = 0; i < n; i++) {    tab[i] = in.nextInt();    sum += tab[i];   }     Arrays.sort(tab);   int v1 = 0;   int count = 0;     for (int i = tab.length - 1; i >= 0; i--) {    v1 += tab[i];    count++;    if (v1 > getSum(i, tab)) {     break;    }   }     out.println(count);     in.close();   out.close();  }   public int getSum(int index, int[]tab) {   int sum = 0;   for (int i = 0; i < index; i++) sum += tab[i];   return sum;  }   public int max(int a, int b) {   if (a > b) return a;   else return b;  } }  class FastScanner {  BufferedReader br;  StringTokenizer st;  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) {     System.err.println(e);     return "";    }   }   return st.nextToken();  }  int nextInt() {   return Integer.parseInt(next());  }  long nextLong() {   return Long.parseLong(next());  }  double nextDouble() {   return Double.parseDouble(next());  }  float nextFloat() {   return Float.parseFloat(next());  }  BigInteger nextBigInt() {   return new BigInteger(next());  }  void close() {   try {    br.close();   } catch (IOException e) {   }  } }
5	public class A implements Runnable { public static void main(String[] args) {  new A().run(); }  class FastScanner {  BufferedReader br;  StringTokenizer st;  boolean eof;  String buf;  public FastScanner(String fileName) throws FileNotFoundException {  br = new BufferedReader(new FileReader(fileName));  nextToken();  }  public FastScanner(InputStream stream) {  br = new BufferedReader(new InputStreamReader(stream));  nextToken();  }  String nextToken() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (Exception e) {   eof = true;   break;   }  }  String ret = buf;  buf = eof ? "-1" : st.nextToken();  return ret;  }  int nextInt() {  return Integer.parseInt(nextToken());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  }  void close() {  try {   br.close();  } catch (Exception e) {   }  }  boolean isEOF() {  return eof;  } }  FastScanner sc; PrintWriter out;  public void run() {  Locale.setDefault(Locale.US);  try {  sc = new FastScanner(System.in);  out = new PrintWriter(System.out);  solve();  sc.close();  out.close();  } catch (Throwable e) {  e.printStackTrace();  System.exit(1);  } }  int nextInt() {  return sc.nextInt(); }  String nextToken() {  return sc.nextToken(); }  long nextLong() {  return sc.nextLong(); }  double nextDouble() {  return sc.nextDouble(); }  class House {  int x, t;  public House(int x, int t) {  this.x = x;  this.t = t;  }  }  void solve() {  int n = nextInt();  int t = nextInt();  House[] h = new House[n];  for (int i = 0; i < n; i++) {  h[i] = new House(nextInt(), nextInt());  }  Arrays.sort(h, new Comparator<House>() {  @Override  public int compare(House o1, House o2) {   return o1.x < o2.x ? -1 : o1.x > o2.x ? 1 : 0;  }  });  int ans = 0;  for (int i = 0; i < n; i++) {  if (i == 0   || (h[i].x - h[i - 1].x) * 2 - h[i].t - h[i - 1].t >= 2 * t) {   ++ans;  }  if (i == n - 1   || (h[i + 1].x - h[i].x) * 2 - h[i + 1].t - h[i].t > 2 * t) {   ++ans;  }  }  out.println(ans); } }
1	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) {    int n = in.nextInt();    int d = in.nextInt();    int[] a = in.readIntArray(n);    int ans = 1;    for (int i = 0; i < a.length - 1; ++i) {     int left = a[i] + d;     int right = a[i + 1] - d;     if (left < right) {      ans += 2;     } else if (left == right)      ans++;    }    out.println(ans + 1);   }  }  static class OutputWriter extends PrintWriter {   public OutputWriter(OutputStream outputStream) {    super(outputStream);   }   public OutputWriter(Writer writer) {    super(writer);   }   public OutputWriter(String filename) throws FileNotFoundException {    super(filename);   }   public void close() {    super.close();   }  }  static class InputReader extends BufferedReader {   StringTokenizer tokenizer;   public InputReader(InputStream inputStream) {    super(new InputStreamReader(inputStream), 32768);   }   public InputReader(String filename) {    super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));   }   public String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(readLine());     } catch (IOException e) {      throw new RuntimeException();     }    }    return tokenizer.nextToken();   }   public Integer nextInt() {    return Integer.valueOf(next());   }   public int[] readIntArray(int size) {    int[] array = new int[size];    for (int i = 0; i < size; i++)     array[i] = nextInt();    return array;   }  } }
4	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new FileReader("input.txt"));   String dimensions = br.readLine();  String extractDim = "";  int n = 0, m;  for (int i = 0 ; i < dimensions.length() ; i++)  {  if(dimensions.charAt(i) == ' ')  {   n = Integer.parseInt(extractDim);   extractDim = "";   continue;  }  extractDim += dimensions.charAt(i);  }  m = Integer.parseInt(extractDim);    String burningTrees = br.readLine();   int k = Integer.parseInt(burningTrees);    Point[] coord = new Point[k];   String coordSet = br.readLine();  int spaceCount = 0;  String newCoord = "";  int s = 0;  for(int i = 0 ; i < coordSet.length() ; i++)  {  if(coordSet.charAt(i) == ' ')   spaceCount++;    if(spaceCount == 2)  {   String extractCoord = "";   int x = 0, y;   for (int j = 0 ; j < newCoord.length() ; j++)   {   if(newCoord.charAt(j) == ' ')   {    x = Integer.parseInt(extractCoord);    extractCoord = "";    continue;   }   extractCoord += newCoord.charAt(j);   }   y = Integer.parseInt(extractCoord);     coord[s] = new Point(x,y);   s++;   newCoord = "";   spaceCount = 0;   continue;  }    newCoord += coordSet.charAt(i);  }   String extractCoord = "";  int x = 0, y;  for (int j = 0 ; j < newCoord.length() ; j++)  {  if(newCoord.charAt(j) == ' ')  {   x = Integer.parseInt(extractCoord);   extractCoord = "";   continue;  }  extractCoord += newCoord.charAt(j);  }  y = Integer.parseInt(extractCoord);   coord[s] = new Point(x,y);  s++;   br.close();   int[][] forest = new int[n+2][m+2];   for(int i = 0 ; i < forest.length ; i++)  {  for(int j = 0 ; j < forest[i].length ; j++)  {   if(i == 0 || i == n+1 || j == 0 || j == m+1 )   forest[i][j] = 0;   else   forest[i][j] = 1;  }  }     Queue<Point> q = new LinkedList<>();   for(int i = 0 ; i < coord.length ; i++)  {  forest[coord[i].x][coord[i].y] = 0;  q.add(coord[i]);  }   Point tree = new Point();  while(!q.isEmpty())  {  Point temp = q.remove();  forest[temp.x][temp.y] = 0;    if(q.isEmpty())   tree = new Point(temp.x ,temp.y);  for(int i = -1 ; i <= 1 ; i++)  {   for(int j = -1; j <= 1; j++)   {   if(i != 0 && j != 0 || i == 0 && j == 0)    continue;   if(forest[temp.x+i][temp.y+j] == 0)    continue;   else   {    forest[temp.x+i][temp.y+j] = 0;    q.add(new Point(temp.x+i , temp.y+j));   }   }  }    }     BufferedWriter bw = new BufferedWriter(new FileWriter("output.txt"));  bw.write(tree.x + " " + tree.y);  bw.close();    } }
3	public class Main {  private static final int MAX = 5000 + 10,mod = 1000000007;  private static char [] S;  private static int n;  private static Integer [] [] dp = new Integer[MAX][MAX];  private static int solve(int pos,int open){   if(pos == n) return (open == 0) ? 1 : 0;   if (dp[pos][open] != null) return dp[pos][open];   int res = 0;   if (S[pos] == 's') {    res = solve(pos + 1,open);    if (open > 0) res += solve(pos,open - 1);    if (res >= mod) res -= mod;   }   else {    res = solve(pos+1,open + 1);   }   return dp[pos][open] = res;  }  public static void main(String[] args) throws Exception{   IO io = new IO(null,null);   n = io.getNextInt();   S = new char[n];   for (int i = 0;i < n;i++) S[i] = io.getNext().charAt(0);   io.println(solve(0,0));   io.close();  } }  class IO{  private BufferedReader br;  private StringTokenizer st;  private PrintWriter writer;  private String inputFile,outputFile;  public boolean hasMore() throws IOException{   if(st != null && st.hasMoreTokens()) return true;   if(br != null && br.ready()) return true;   return false;  }  public String getNext() throws FileNotFoundException, IOException{   while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());   return st.nextToken();  }  public String getNextLine() throws FileNotFoundException, IOException{   return br.readLine().trim();  }  public int getNextInt() throws FileNotFoundException, IOException{   return Integer.parseInt(getNext());  }  public long getNextLong() throws FileNotFoundException, IOException{   return Long.parseLong(getNext());  }  public void print(double x,int num_digits) throws IOException{   writer.printf("%." + num_digits + "f" ,x);  }  public void println(double x,int num_digits) throws IOException{   writer.printf("%." + num_digits + "f\n" ,x);  }  public void print(Object o) throws IOException{   writer.print(o.toString());  }  public void println(Object o) throws IOException{   writer.println(o.toString());  }  public IO(String x,String y) throws FileNotFoundException, IOException{   inputFile = x;   outputFile = y;   if(x != null) br = new BufferedReader(new FileReader(inputFile));   else br = new BufferedReader(new InputStreamReader(System.in));   if(y != null) writer = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));   else writer = new PrintWriter(new OutputStreamWriter(System.out));  }  protected void close() throws IOException{   br.close();   writer.close();  } }
2	public class Codeforces {   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());   }    double nextDouble()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  }   public static void main(String[] args) {   FastReader input = new FastReader();   long n = input.nextLong();   long K = input.nextLong();   long root = (long) Math.sqrt(8 * (K+n) + 9);   if (root * root != 8 * (K+n) + 9){    root++;    if (root * root != 8 * (K+n) + 9) root -= 2;   }   System.out.println(n - (root - 3) / 2);       } }
4	public class A {  public static void main(String[] args) throws FileNotFoundException, IOException {   Scanner in = new Scanner();   PrintWriter out = new PrintWriter(System.out);   String val = in.next();   ArrayList<String> list = new ArrayList();   for(int i = 0; i < val.length() ; i++){    list.add(val.substring(i));   }   Collections.sort(list);   int result = 0;   for(int i = 1; i < list.size() ; i++){    String other = list.get(i - 1);    int temp = 0;    for(int j = 0; j < list.get(i).length() && j < other.length() ; j++){     if(other.charAt(j) == list.get(i).charAt(j)){      temp++;     }else{      break;     }    }    if(temp > result){     result = temp;    }   }   out.println(result);   out.close();  }  public static int dist(int x0, int y0, int x1, int y1) {   return (x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1);  }  public static boolean isRight(int a, int b, int c) {   if (a == 0 || b == 0 || c == 0) {    return false;   }   if (a == b + c) {    return true;   }   if (b == a + c) {    return true;   }   if (c == a + b) {    return true;   }   return false;  }  public static int gcd(int a, int b) {   if (b == 0) {    return a;   }   return gcd(b, a % b);  }  static class FT {   int[] data;   FT(int n) {    data = new int[n];   }   void update(int index, int val) {       while (index < data.length) {     data[index] += val;     index += index & (-index);         }   }   int get(int index) {       int result = 0;    while (index > 0) {     result += data[index];     index -= index & (-index);        }    return result;   }  }  static int pow(int a, int b) {   if (b == 0) {    return 1;   }   if (b == 1) {    return a;   }   int val = pow(a, b / 2);   if (b % 2 == 0) {    return val * val;   } else {    return val * val * a;   }  }         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 {   int x, y;   Point(int x, int y) {    this.x = x;    this.y = y;   }   @Override   public String toString() {    return "Point: " + x + " " + y;   }  }  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 long nextLong() {    return Long.parseLong(next());   }   public int nextInt() {    return Integer.parseInt(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    st = null;    try {     return br.readLine();    } catch (Exception e) {     throw new RuntimeException();    }   }   public boolean endLine() {    try {     String next = br.readLine();     while (next != null && next.trim().isEmpty()) {      next = br.readLine();     }     if (next == null) {      return true;     }     st = new StringTokenizer(next);     return st.hasMoreTokens();    } catch (Exception e) {     throw new RuntimeException();    }   }  } }
0	public class LuckyDivision{  public static void main(String [] args){   Scanner input = new Scanner(System.in);   int a = input.nextInt();   if(a%4 == 0) System.out.println("YES");   else if(a%7 == 0) System.out.println("YES");   else if(a%47 == 0) System.out.println("YES");   else if(a%74 == 0) System.out.println("YES");   else if(a%447 == 0) System.out.println("YES");   else if(a%474 == 0) System.out.println("YES");   else if(a%477 == 0) System.out.println("YES");   else if(a%747 == 0) System.out.println("YES");   else if(a%774 == 0) System.out.println("YES");   else System.out.println("NO");  } }
2	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader sc = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   Task solver = new Task();   solver.solve(1, sc, out);   out.close();  }  static class Task {   public void solve(int testNumber, InputReader sc, PrintWriter out) {    double n=sc.nextInt();    double k=sc.nextInt();       double ans=n-(-1.5+Math.sqrt(9.0/4+2*(n+k)));    out.printf("%.0f\n",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());   }   public long nextLong() {    return Long.parseLong(next());   }  } }
1	public class Main { public static void main(String[] args) throws Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int N = Integer.parseInt(br.readLine());  String[] s = {"XXXS", "XXS", "XS", "S", "M", "L", "XL", "XXL", "XXXL"};  int[] size = new int[9];  for(int i=0; i<N; i++){  String c = br.readLine();  for(int j=0; j<9; j++){   if(s[j].equals(c)){   size[j]++;   }  }  }  for(int i=0; i<N; i++){  String c = br.readLine();  for(int j=0; j<9; j++){   if(s[j].equals(c)){   size[j]--;   }  }  }  int sum = 0;  for(int i=0; i<9; i++){  if(size[i]>0)   sum += size[i];  }  System.out.println(sum); } }
3	public class Dasha {  static Scanner sc = new Scanner(System.in);  static PrintWriter pw = new PrintWriter(System.out), pw2 = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {   int n=sc.nextInt();   int[] arr=new int[101];   for(int i=0;i<n;i++)    arr[sc.nextInt()]++;   boolean [] vis=new boolean[101];   int c=0;   for(int i=1;i<=100;i++){    if(!vis[i]&&arr[i]>0){     c++;     for(int j=i+i;j<=100;j+=i)      vis[j]=true;    }   }   pw.println(c);   pw.flush();  }  public static <E> void print2D(E[][] arr) {   for (int i = 0; i < arr.length; i++) {    for (int j = 0; j < arr[i].length; j++) {     pw.println(arr[i][j]);    }   }  }  public static int digitSum(String s) {   int toReturn = 0;   for (int i = 0; i < s.length(); i++) toReturn += Integer.parseInt(s.charAt(i) + " ");   return toReturn;  }  public static boolean isPrime(long n) {   if (n <= 1)    return false;   if (n <= 3)    return true;   if (n % 2 == 0 || n % 3 == 0)    return false;   for (long i = 5; i * i <= n; i = i + 6)    if (n % i == 0 || n % (i + 2) == 0)     return false;   return true;  }  public static long pow(long a, long pow) {   return pow == 0 ? 1 : pow % 2 == 0 ? pow(a * a, pow >> 1) : a * pow(a * a, pow >> 1);  }  public static long sumNum(long a) {   return a * (a + 1) / 2;  }  public static int gcd(int n1, int n2) {   return n2 == 0 ? n1 : gcd(n2, n1 % n2);  }  public static long factorial(long a) {   return a == 0 || a == 1 ? 1 : a * factorial(a - 1);  }  public static void sort(int arr[]) {   shuffle(arr);   Arrays.sort(arr);  }  public static void shuffle(int arr[]) {   Random rnd = new Random();   for (int i = arr.length - 1; i > 0; i--) {    int index = rnd.nextInt(i + 1);    int temp = arr[index];    arr[index] = arr[i];    arr[i] = temp;   }  }  public static Double[] solveQuadratic(double a, double b, double c) {   double result = (b * b) - 4.0 * a * c;   double r1;   if (result > 0.0) {    r1 = ((double) (-b) + Math.pow(result, 0.5)) / (2.0 * a);    double r2 = ((double) (-b) - Math.pow(result, 0.5)) / (2.0 * a);    return new Double[]{r1, r2};   } else if (result == 0.0) {    r1 = (double) (-b) / (2.0 * a);    return new Double[]{r1, r1};   } else {    return new Double[]{null, null};   }  }  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() 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 String nextLine() throws IOException {    return br.readLine();   }   public double nextDouble() throws IOException {    String x = next();    StringBuilder sb = new StringBuilder("0");    double res = 0, f = 1;    boolean dec = false, neg = false;    int start = 0;    if (x.charAt(0) == '-') {     neg = true;     start++;    }    for (int i = start; i < x.length(); i++)     if (x.charAt(i) == '.') {      res = Long.parseLong(sb.toString());      sb = new StringBuilder("0");      dec = true;     } else {      sb.append(x.charAt(i));      if (dec)       f *= 10;     }    res += Long.parseLong(sb.toString()) / f;    return res * (neg ? -1 : 1);   }   public boolean ready() throws IOException {    return br.ready();   }  }  static class pair<E1, E2> implements Comparable<pair> {   E1 x;   E2 y;   pair(E1 x, E2 y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(pair o) {    return x.equals(o.x) ? (Integer) y - (Integer) o.y : (Integer) x - (Integer) o.x;   }   @Override   public String toString() {    return x + " " + y;   }   public double pointDis(pair p1) {    return Math.sqrt(((Integer) y - (Integer) p1.y) * ((Integer) y - (Integer) p1.y) + ((Integer) x - (Integer) p1.x) * ((Integer) x - (Integer) p1.x));   }  } }
1	public class cfedu46a{ public static void main(String [] args) throws IOException{  InputReader in = new InputReader("cfedu46a.in");   int [] arr = new int[9];  int [] arr2 = new int[9];  int [] size = {4, 3, 2, 1, 1, 1, 2, 3, 4};  int n = in.nextInt();  for(int i = 0; i < n; i++){  String s = in.next();  switch(s.length()){   case 1:    if(s.charAt(0) == 'S')    arr[3]++;   if(s.charAt(0) == 'M')    arr[4]++;   if(s.charAt(0) == 'L')    arr[5]++;   break;   default:   if(s.charAt(s.length() - 1) == 'S'){    arr[3 - (s.length() - 1)]++;   }   if(s.charAt(s.length() - 1) == 'L'){    arr[5 + (s.length() - 1)]++;   }   }  }  for(int i = 0; i < n; i++){  String s = in.next();  switch(s.length()){   case 1:    if(s.charAt(0) == 'S')    arr2[3]++;   if(s.charAt(0) == 'M')    arr2[4]++;   if(s.charAt(0) == 'L')    arr2[5]++;   break;   default:   if(s.charAt(s.length() - 1) == 'S'){    arr2[3 - (s.length() - 1)]++;   }   if(s.charAt(s.length() - 1) == 'L'){    arr2[5 + (s.length() - 1)]++;   }   }  }  int cnt = 0;  for(int i = 0; i < 9; i++){  if(arr[i] == arr2[i])   continue;  else{   cnt += (arr2[i] - arr[i] > 0? arr2[i] - arr[i]: 0);  }  }  System.out.println(cnt); }  static class InputReader {  public BufferedReader reader;  public StringTokenizer tokenizer;  public InputReader(String s) {  try{   reader = new BufferedReader(new FileReader(s), 32768);  }  catch (Exception e){    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 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; } }
0	public class N1_CF_199A {  public static void main(String[] args) {  int n = new Scanner(System.in).nextInt();  if( n == 0)  {   System.out.println(0);   System.out.println(0);   System.out.println(0);   return;  }  int i = 0 , j = 1;  while(true)  {   int t = i + j;   if( t == n)   break;   i = j;   j = t;  }  System.out.println(i);  System.out.println(j);  System.out.println(0);  } }
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; }  static String nextString() throws IOException {  in.nextToken();  return in.sval; }  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; } }
6	public class Main {   static final int MAXN = 24;  int[] x = new int[MAXN];  int[] y = new int[MAXN];  int[][] dist = new int[MAXN][MAXN];  int[] single = new int[MAXN];   int sqr(int x) { return x * x; }   void run(int nT) {   int xs = cin.nextInt();   int ys = cin.nextInt();   int n = cin.nextInt();   for (int i = 0; i < n; ++i) {    x[i] = cin.nextInt();    y[i] = cin.nextInt();   }   for (int i = 0; i < n; ++i) {    for (int j = i + 1; j < n; ++j) {     dist[i][j] = sqr(x[i] - xs) + sqr(y[i] - ys)      + sqr(x[i] - x[j]) + sqr(y[i] - y[j]) + sqr(x[j] - xs) + sqr(y[j] - ys);    }   }   for (int i = 0; i < n; ++i) {    single[i] = (sqr(x[i] - xs) + sqr(y[i] - ys)) * 2;   }   int[] dp = new int[1 << n];   int[] pre = new int[1 << n];   int tot = 1 << n;   for (int s = 1; s < tot; ++s) {    int i;    for (i = 0; i < n; ++i) {     if ((s & (1 << i)) != 0) break;    }    dp[s] = dp[s^(1<<i)] + single[i];    pre[s] = i + 1;    for (int j = i + 1; j < n; ++j) {     if ((s & (1 << j)) != 0) {      int cur = dp[s^(1 << i) ^(1<<j)] + dist[i][j];      if (cur < dp[s]) {       dp[s] = cur;       pre[s] = (i + 1) * 100 + (j + 1);      }     }    }   }   out.println(dp[tot - 1]);   int now = tot - 1;   out.print("0");   while (now > 0) {    int what = pre[now];    int px = what % 100 - 1;    int py = what / 100 - 1;    if (px >= 0) {     out.print(" ");     out.print(px + 1);     now ^= 1 << px;    }    if (py >= 0) {     out.print(" ");     out.print(py + 1);     now ^= 1 << py;    }    out.print(" ");    out.print("0");   }   out.println("");  }  public static void main(String[] argv) {   Main solved = new Main();   int T = 1;     for (int nT = 1; nT <= T; ++nT) {    solved.run(nT);   }   solved.out.close();  }  InputReader cin = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out); } 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 (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 ProblemD {  static int n;  static int m;  static boolean[][] fire;   public static void main(String[] args) throws FileNotFoundException {   Scanner sc = new Scanner(new File("input.txt"));   n = sc.nextInt();   m = sc.nextInt();   int k = sc.nextInt();   fire = new boolean[n][m];   Queue<Pos> q = new LinkedList<Pos>();   for (int i = 0; i < k; i++) {    int x = sc.nextInt();    int y = sc.nextInt();    q.add(new Pos(x - 1, y - 1));    fire[x - 1][y - 1] = true;   }   int[] di = new int[] { 1, -1, 0, 0 };   int[] dj = new int[] { 0, 0, 1, -1};   Pos last = null;   while (q.size() > 0) {    Pos pos = q.poll();    last = pos;    for (int kk = 0; kk < 4; kk++) {     int ni = pos.i + di[kk];     int nj = pos.j + dj[kk];     if (ni >= 0 && nj >= 0 && ni < n && nj < m) {      if (!fire[ni][nj]) {       fire[ni][nj] = true;       q.add(new Pos(ni, nj));      }     }    }   }   PrintWriter out = new PrintWriter(new File("output.txt"));   out.println((last.i + 1) + " " + (last.j + 1));   out.flush();   out.close();  }   } class Pos {   int i, j;  public Pos(int i, int j) {   super();   this.i = i;   this.j = j;  }  @Override  public int hashCode() {   final int prime = 31;   int result = 1;   result = prime * result + i;   result = prime * result + j;   return result;  }  @Override  public boolean equals(Object obj) {   if (this == obj)    return true;   if (obj == null)    return false;   if (getClass() != obj.getClass())    return false;   Pos other = (Pos) obj;   if (i != other.i)    return false;   if (j != other.j)    return false;   return true;  }    };
0	public class Main { public static void main(String[] args){  System.out.println("25"); } }
0	public class practice { public static void main(String[] args) throws Exception {   Scanner in = new Scanner(System.in);  String str = in.nextLine();  long n = Long.parseLong(str.substring(0, str.indexOf(" ")));  long m = Long.parseLong(str.substring(str.indexOf(" ") + 1));  if(m - n < 2) {  System.out.println("-1");  } else {  if(m - n == 2 && m % 2 == 1) {   System.out.println("-1");  } else {   System.out.println((n + n % 2) + " " + (n + 1 + n % 2) + " " + (n + 2 + n % 2));  }  } } }
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 size = in.readInt();  int[] array = IOUtils.readIntArray(in, size);  Arrays.sort(array);  if (array[size - 1] == 1)  array[size - 1] = 2;  else  array[size - 1] = 1;  Arrays.sort(array);  out.printLine(Array.wrap(array).toArray()); } } 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 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 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 IOUtils {  public static int[] readIntArray(InputReader in, int size) {  int[] array = new int[size];  for (int i = 0; i < size; i++)  array[i] = in.readInt();  return array; }  } abstract class Array<T> extends AbstractList<T> {  public static List<Integer> wrap(int...array) {  return new IntArray(array); }  protected static class IntArray extends Array<Integer> {  protected final int[] array;  protected IntArray(int[] array) {  this.array = array;  }  public int size() {  return array.length;  }  public Integer get(int index) {  return array[index];  }  public Integer set(int index, Integer value) {  int result = array[index];  array[index] = value;  return result;  } }  }
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;  public void run() {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  System.err.println("");  n = fs.nextInt(); m = fs.nextInt();  str = fs.next().toCharArray();  occs = new int[m][m];  for(int i = 0; i < n-1; i++) {  occs[str[i]-'a'][str[i+1]-'a']++;  occs[str[i+1]-'a'][str[i]-'a']++;  }   int all = (1<<m)-1;  cost = new int[m][1<<m];  for(int i = 0; i < m; i++) {  for(int mask = 1; mask < all; mask++) {   if(((1<<i)&mask) > 0) continue;   int lb = mask & (-mask);   int trail = Integer.numberOfTrailingZeros(lb);   int nmask = mask ^ lb;   cost[i][mask] = cost[i][nmask]+occs[i][trail];  }  }   dp = new int[1<<m];  Arrays.fill(dp, -1);  System.out.println(solve(0));   out.close(); }  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 double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }  public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }  public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  }   public int[] nextIntArray(int n) {  int[] res = new int[n];  for(int i = 0; i < n; i++) res[i] = nextInt();  return res;  }   } }
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 String next() throws Exception {  return nextToken().toString(); }   public int nextInt() throws Exception {   return Integer.parseInt(nextToken());  }  public long nextLong() throws Exception {   return Long.parseLong(nextToken());  }  public double nextDouble() throws Exception {   return Double.parseDouble(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);   ASubtractions solver = new ASubtractions();   solver.solve(1, in, out);   out.close();  }  static class ASubtractions {   public void solve(int testNumber, InputReader c, OutputWriter w) {    int tc = c.readInt();    while (tc-- > 0) {     int a = c.readInt(), b = c.readInt();     int res = 0;     while (a != 0 && b != 0) {      res += b / a;      b = b % a;      int t = b;      b = a;      a = t;     }     w.printLine(res);    }   }  }  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);   }  }  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);   }  } }
1	public class B {  public static void main(String[] args){   Scanner in = new Scanner(System.in);   int t = in.nextInt();   while(t > 0){    t --;    int n = in.nextInt();    if(n % 2 != 0){     System.out.println("NO");     continue;    }    int a = n / 2;    int x = (int)Math.sqrt(a);    if(x * x == a || (x + 1) * (x + 1) == a){     System.out.println("YES");     continue;    }    a = n / 4;    if(n % 4 != 0){     System.out.println("NO");     continue;    }    x = (int)Math.sqrt(a);    if(x * x == a || (x + 1) * (x + 1) == a){     System.out.println("YES");     continue;    }    System.out.println("NO");    }   } }
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;   }  }  double nextDouble(){   return Double.parseDouble(next());  }  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;   }  }  String nextLine(){   try{    StringBuilder res = new StringBuilder("");    int c = System.in.read();    while(c == '\r' || c == '\n')     c = System.in.read();    do{     res.append((char)c);     c = System.in.read();    }while(c != '\r' && c != '\n');    return res.toString();   }catch(Exception e){    return null;   }  }  public static void main(String[] args){   new TaskA1().run();  }  }
0	public class A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   long n = sc.nextLong();     List<Long> fi = new ArrayList<Long>();      fi.add((long) 0);   fi.add((long) 1);     while (fi.get(fi.size()-1)<n) {    fi.add(fi.get(fi.size()-1)+fi.get(fi.size()-2));   }     int last = fi.size()-1;   long z = last-1>=0 ? fi.get(last-1) : 0;   long y = last-3>=0 ? fi.get(last-3) : 0;   long x = last-4>=0 ? fi.get(last-4) : 0;   if (x+y+z<n)    x=1;     System.out.println(x+" "+y+" "+z);  }  }
3	public class PaintTheNumber {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);  int n=sc.nextInt();   ArrayList<Integer> l=new ArrayList<Integer>();   for(int i=0; i<n; i++) {  l.add(sc.nextInt());  }   boolean c=false;     for(int i=0; i<l.size(); i++) {   if(l.get(i)==-1)   continue;   for(int j=0; j<l.size(); j++) {      if(i==j || l.get(j)==-1)    continue;   else {    if(l.get(j)%l.get(i)==0) {    l.set(j, -1);    }   }   }  }    int nbr=0;  for(int i=0; i<l.size(); i++)   if(l.get(i)!=-1)   nbr++;  System.out.println(nbr); } }
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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static  @SuppressWarnings("Duplicates")  class TaskD {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    long[] a = in.nextLongArray(n);    HashMap<Integer, Integer> count = new HashMap<>();    BigInteger res = BigInteger.ZERO;    long prev = 0;    count.put((int) a[0], 1);    long temp;    long nextRes;    for (int i = 1; i < n; i++) {     temp = ((a[i] - a[i - 1]) * i + prev);     nextRes = temp - count.getOrDefault((int) a[i] - 1, 0) + count.getOrDefault((int) a[i] + 1, 0);     res = res.add(new BigInteger(String.valueOf(nextRes)));     count.put((int) a[i], count.getOrDefault((int) a[i], 0) + 1);     prev = temp;    }    out.print(res);   }  }  static class InputReader {   private final BufferedReader reader;   private StringTokenizer tokenizer;   public InputReader(InputStream in) {    reader = new BufferedReader(new InputStreamReader(in));   }   public long[] nextLongArray(int size) {    long[] array = new long[size];    for (int i = 0; i < size; ++i) {     array[i] = nextLong();    }    return array;   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(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;   }  } }
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(); } }
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]+" ");   }  } }
3	public class F1 {   static class Reader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;    public Reader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public Reader(String file_name) throws IOException   {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public String readLine() throws IOException   {    byte[] buf = new byte[64];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }    public int nextInt() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do    {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');     if (neg)     return -ret;    return ret;   }    public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }    public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();     do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');     if (c == '.')    {     while ((c = read()) >= '0' && c <= '9')     {      ret += (c - '0') / (div *= 10);     }    }     if (neg)     return -ret;    return ret;   }    private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }    private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }    public void close() throws IOException   {    if (din == null)     return;    din.close();   }  }     public static void main(String[] args) throws IOException {   Reader s=new Reader();  int n=s.nextInt();     int a[]=new int[n];     for(int i=0;i<n;i++){    a[i]=s.nextInt();   }     Map<Long,PriorityQueue<Node>> map=new HashMap();     for(int i=0;i<n;i++){    long sum=0;    for(int j=i;j<n;j++){     sum=sum+a[j];     PriorityQueue<Node> pq=map.get(sum);     if(pq==null){      pq=new PriorityQueue();      map.put(sum, pq);     }     pq.add(new Node(i,j));    }          }        Set<Long> keys=map.keySet();     Iterator<Long> itr=keys.iterator();   int max=0;   int solbackDp[]=null;   Node solA[]=new Node[0];   while(itr.hasNext()){    Long sum=itr.next();    PriorityQueue<Node> pq1=map.get(sum);                            ArrayList<Node> rangelist=new ArrayList<>();    rangelist.add(new Node(-1, -1));           Node last=rangelist.get(0);    while(!pq1.isEmpty()){     Node n1=pq1.poll();     if(n1.l!=last.l){      rangelist.add(n1);      last=n1;     }           }    int backTrack[]=new int[rangelist.size()];    int dp[]=new int[rangelist.size()];    Arrays.fill(dp, -1);    int ans=fun(0,dp,rangelist,backTrack);    if(ans>max){     max=ans;     solA=rangelist.toArray(solA);     solbackDp=backTrack;    }   }     System.out.println(max);        int pos=0;   while(solbackDp[pos]!=-1){    pos=solbackDp[pos];    System.out.println((solA[pos].l+1)+" "+(solA[pos].r+1));   }  }     static int fun(int pos, int[] dp, ArrayList<Node> rangeList, int[] bactTrack){     if(pos==rangeList.size()-1){    bactTrack[pos]=-1;    return 0;      }     if(dp[pos]!=-1){    return dp[pos];   }     int i=pos+1;   int maxAns=0;   int nextPos=-1;   for(;i<=rangeList.size()-1;i++){           if(rangeList.get(i).l>rangeList.get(pos).r){     int tempAns=1+fun(i, dp,rangeList, bactTrack);     if(tempAns>maxAns){      maxAns=tempAns;      nextPos=i;     }    }   }     dp[pos]=maxAns;   bactTrack[pos]=nextPos;   return maxAns;            }   static class Node implements Comparable<Node>{   int l;   int r;   public Node(int l, int r) {    this.l = l;    this.r = r;   }             @Override   public int compareTo(Node o2) {    if(this.l!=o2.l){     return this.l-o2.l;    } else{     return this.r-o2.r;    }   }    } }
1	public class TaskA { public static void main(String[] args) {  new TaskA(System.in, System.out); }  static class Solver implements Runnable {  int n, d;  long[] arr;  InputReader in;  PrintWriter out;  void solve() throws IOException  {  n = in.nextInt();  d = in.nextInt();  arr = in.nextLongArray(n);   Set<Long> set = new HashSet<>();   for (int i = 0; i < n; i++)  {   if (i == 0)   set.add(arr[i] - d);   else   {   long left = arr[i] - d;    if (left - arr[i - 1] >= d)    set.add(left);   }   if (i == n - 1)   set.add(arr[i] + d);   else   {   long right = arr[i] + d;    if (arr[i + 1] - right >= d)    set.add(right);   }  }   out.println(set.size());  }  void debug(Object... o)  {  System.err.println(Arrays.deepToString(o));  }   public Solver(InputReader in, PrintWriter out)  {  this.in = in;  this.out = out;  }  @Override  public void run()  {  try  {   solve();  }  catch (IOException e)  {   e.printStackTrace();  }  }  }  static class InputReader {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  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 int[] nextIntArray(int arraySize)  {  int array[] = new int[arraySize];   for (int i = 0; i < arraySize; i++)   array[i] = nextInt();   return array;  }  public long nextLong()  {  int c = read();   while (isSpaceChar(c))   c = read();   int sign = 1;   if (c == '-')  {   sign = -1;   c = read();  }   long result = 0;   do  {   if (c < '0' || c > '9')   throw new InputMismatchException();   result *= 10;   result += c & 15;   c = read();  } while (!isSpaceChar(c));   return result * sign;  }  public long[] nextLongArray(int arraySize)  {  long array[] = new long[arraySize];   for (int i = 0; i < arraySize; i++)   array[i] = nextLong();   return array;  }  public float nextFloat()  {  float result, div;  byte c;   result = 0;  div = 1;  c = (byte) read();   while (c <= ' ')   c = (byte) read();   boolean isNegative = (c == '-');   if (isNegative)   c = (byte) read();   do  {   result = result * 10 + c - '0';  } while ((c = (byte) read()) >= '0' && c <= '9');   if (c == '.')   while ((c = (byte) read()) >= '0' && c <= '9')   result += (c - '0') / (div *= 10);   if (isNegative)   return -result;   return result;  }  public double nextDouble()  {  double ret = 0, div = 1;  byte c = (byte) read();   while (c <= ' ')   c = (byte) read();   boolean neg = (c == '-');   if (neg)   c = (byte) read();   do  {   ret = ret * 10 + c - '0';  } while ((c = (byte) read()) >= '0' && c <= '9');   if (c == '.')   while ((c = (byte) read()) >= '0' && c <= '9')   ret += (c - '0') / (div *= 10);   if (neg)   return -ret;   return ret;  }  public String next()  {  int c = read();   while (isSpaceChar(c))   c = read();   StringBuilder res = new StringBuilder();   do  {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));   return res.toString();  }  public String nextLine()  {  int c = read();   StringBuilder result = new StringBuilder();   do  {   result.appendCodePoint(c);   c = read();  } while (!isNewLine(c));   return result.toString();  }  public boolean isNewLine(int c)  {  return c == '\n';  }  public boolean isSpaceChar(int c)  {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  public void close()  {  try  {   stream.close();  }  catch (IOException e)  {   e.printStackTrace();  }  }  public InputReader(InputStream stream)  {  this.stream = stream;  }  }  static class CMath {  static long power(long number, long power)  {  if (number == 1 || number == 0 || power == 0)   return 1;   if (power == 1)   return number;   if (power % 2 == 0)   return power(number * number, power / 2);  else   return power(number * number, power / 2) * number;  }  static long modPower(long number, long power, long mod)  {  if (number == 1 || number == 0 || power == 0)   return 1;   number = mod(number, mod);   if (power == 1)   return number;   long square = mod(number * number, mod);   if (power % 2 == 0)   return modPower(square, power / 2, mod);  else   return mod(modPower(square, power / 2, mod) * number, mod);  }  static long moduloInverse(long number, long mod)  {  return modPower(number, mod - 2, mod);  }  static long mod(long number, long mod)  {  return number - (number / mod) * mod;  }  static int gcd(int a, int b)  {  if (b == 0)   return a;  else   return gcd(b, a % b);  }  static long min(long... arr)  {  long min = arr[0];   for (int i = 1; i < arr.length; i++)   min = Math.min(min, arr[i]);   return min;  }  static long max(long... arr)  {  long max = arr[0];   for (int i = 1; i < arr.length; i++)   max = Math.max(max, arr[i]);   return max;  }  static int min(int... arr)  {  int min = arr[0];   for (int i = 1; i < arr.length; i++)   min = Math.min(min, arr[i]);   return min;  }  static int max(int... arr)  {  int max = arr[0];   for (int i = 1; i < arr.length; i++)   max = Math.max(max, arr[i]);   return max;  }  }  static class Utils {  static boolean nextPermutation(int[] arr)  {  for (int a = arr.length - 2; a >= 0; --a)  {   if (arr[a] < arr[a + 1])   {   for (int b = arr.length - 1; ; --b)   {    if (arr[b] > arr[a])    {    int t = arr[a];     arr[a] = arr[b];    arr[b] = t;     for (++a, b = arr.length - 1; a < b; ++a, --b)    {     t = arr[a];     arr[a] = arr[b];     arr[b] = t;    }     return true;    }   }   }  }   return false;  }  }  public TaskA(InputStream inputStream, OutputStream outputStream) {   InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  Thread thread = new Thread(null, new Solver(in, out), "TaskA", 1 << 29);  try  {  thread.start();  thread.join();  }  catch (InterruptedException e)  {  e.printStackTrace();  }  finally  {  in.close();  out.flush();  out.close();  } } }
3	public class TaskC {  public static void main(String[] args) {  new TaskC().run(); }  void solve(){  int n = in.nextInt();  String s[] = new String[n];  for(int i = 0; i < n; i++) s[i] = in.next();  if(s[n-1].compareTo("f") == 0){  out.println(0);  return;  }  int dp[] = new int[n+2];  int mod = 1000*1000*1000+7;  dp[0] = 1;  for(int i = n-1; i >= 0; i--){   if(s[i].compareTo("s") == 0){   int ss = 0;   for(int j = 0; j <= n; j++){   ss += dp[j];   if(ss>=mod) ss -= mod;   dp[j] = ss;   }  }else{   for(int j = 0; j < n;j++){   dp[j] = dp[j+1];   }   dp[n] = 0;  }  }  out.println(dp[0]); }   FastScanner in; PrintWriter out; void run() {  in = new FastScanner(System.in);  out = new PrintWriter(System.out);  int tests = 1;  while(tests > 0){  solve();  tests--;  }  out.close(); }  class Pair implements Comparable<Pair>{  Integer x, y;  public Pair(int x, int y){  this.x = x;  this.y = y;  }  @Override  public int compareTo(Pair o) {  if(x.compareTo(o.x) == 0) return y.compareTo(o.y);  return x.compareTo(o.x);  }   }  class FastScanner {  StringTokenizer st;  BufferedReader bf;   public FastScanner(InputStream is) {  bf = new BufferedReader(new InputStreamReader(is));  }   public FastScanner(File f){  try{   bf = new BufferedReader(new FileReader(f));  }  catch(IOException ex){   ex.printStackTrace();  }  }  String next(){  while(st == null || !st.hasMoreTokens()){   try{   st = new StringTokenizer(bf.readLine());   }   catch(Exception ex){   ex.printStackTrace();   }  }  return st.nextToken();  }  int nextInt(){  return Integer.parseInt(next());  }  long nextLong(){  return Long.parseLong(next());  }  double nextDouble(){  return Double.parseDouble(next());  }  int[] readArray(int n){  int[] a = new int[n];  for(int i = 0; i < n; i++)   a[i] = nextInt();  return a;  } }  }
2	public class C_3 {  public static void main(String[] args) throws Exception {   FastReader in = new FastReader(System.in);   PrintWriter pw = new PrintWriter(System.out);   long mod = (long) 1e9 + 7;   long xx = in.nextLong(), kk = in.nextLong();   if(xx == 0){    pw.println(0); pw.close();    return;   }   BigInteger x = BigInteger.valueOf(xx), k = BigInteger.valueOf(kk);      BigInteger MOD = BigInteger.valueOf(mod);   BigInteger a = BigInteger.valueOf(2).modPow(BigInteger.valueOf(kk+1), MOD);   BigInteger b = BigInteger.valueOf(2).modPow(BigInteger.valueOf(kk), MOD);    BigInteger s = (a.multiply(x)).mod(MOD);   s = s.subtract(b.mod(MOD));   s = s.add(BigInteger.ONE);   s = s.mod(MOD);   s = s.add(MOD);   s = s.mod(MOD);         pw.println(s);    pw.close();  }   static void debug(Object... obj) {   System.err.println(Arrays.deepToString(obj));  }  static class FastReader {   static final int ints[] = new int[128];   InputStream is;   private byte[] inbuf = new byte[1024];   private int lenbuf = 0, ptrbuf = 0;   public FastReader(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 boolean isSpaceChar(int c) {    return !(c >= 33 && c <= 126);   }   public int skip() {    int b;    while ((b = readByte()) != -1 && isSpaceChar(b)) ;    return b;   }   public String next() {    int b = skip();    StringBuilder sb = new StringBuilder();    while (!(isSpaceChar(b))) {     sb.appendCodePoint(b);     b = readByte();    }    return sb.toString();   }   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();    }   }   public long nextLong() {    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 << 3) + (num << 1) + ints[b];     } else {      return minus ? -num : num;     }     b = readByte();    }   }   public double nextDouble() {    return Double.parseDouble(next());   }      public char[] next(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);   }     } }
1	public class TwoSets {  static int n, a, b;  static HashSet<Integer> arr = new HashSet<Integer>();  static HashSet<Integer> visited = new HashSet<Integer>();  static HashMap<Integer, Integer> result = new HashMap<Integer, Integer>();  static void dfs(int x, int parent, int len) {   stack.push(x);   visited.add(x);   int children = 0;   if (a - x > 0) {    if (a - x != parent && arr.contains(a - x)) {     dfs(a - x, x, len + 1);     children++;    }   }   if (b - x > 0) {    if (b - x != parent && arr.contains(b - x)) {     dfs(b - x, x, len + 1);     children++;    }   }   if (children == 0) {    if (len % 2 == 1) {     System.out.println("NO");     System.exit(0);    } else {     while (!stack.isEmpty()) {      int first = stack.pop();      int second = stack.pop();      if (first == a - second) {       result.put(first, 0);       result.put(second, 0);      } else {       result.put(first, 1);       result.put(second, 1);      }     }    }   }  }  static Stack<Integer> stack = new Stack<Integer>();  public static void main(String[] args) {   InputReader r = new InputReader(System.in);   n = r.nextInt();   a = r.nextInt();   b = r.nextInt();   int[] list = new int[n];   for (int i = 0; i < n; i++) {    list[i] = r.nextInt();    arr.add(list[i]);   }   for (int x : arr) {    if (!visited.contains(x)) {     if (arr.contains(a - x) && arr.contains(b - x))      continue;     if (arr.contains(a - x) || arr.contains(b - x)) {      dfs(x, -1, 1);     } else {      System.out.println("NO");      System.exit(0);     }    }   }   PrintWriter out = new PrintWriter(System.out);   out.println("YES");   for (int i = 0; i < list.length; i++) {    if (result.get(list[i]) == null)     out.println(0);    else     out.println(result.get(list[i]));   }   out.close();  }  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 nextLine() {    try {     return reader.readLine();    } catch (IOException e) {         e.printStackTrace();     return 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());   }  } }
1	public class R364C { public static void main(String[] args) throws NumberFormatException, IOException {  Scanner s = new Scanner(System.in);  BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);   int n = Integer.parseInt(f.readLine());  char[] a = f.readLine().toCharArray();  int difTypes = 0;  TreeSet<Character> types = new TreeSet<Character>();  for(int i = 0; i < n; i++) {  if(!types.contains(a[i])) {   types.add(a[i]);  }  }  int i = 0, j = 0;  difTypes = types.size();  int curTypes = 0;  int min = Integer.MAX_VALUE;  TreeSet<Character> has = new TreeSet<Character>();  HashMap<Character, Integer> freq = new HashMap<Character, Integer>();  while(i < n && j < n) {   has.add(a[j]);  if(!freq.containsKey(a[j])) {   freq.put(a[j], 1);  } else {   freq.put(a[j], freq.get(a[j])+1);  }  j++;  curTypes = has.size();  if(curTypes == difTypes) min = Math.min(min, j-i);    while(i < n && has.size() == difTypes) {   int Freq = freq.get(a[i]);   if(Freq - 1 == 0) {   has.remove(a[i]);   freq.put(a[i], freq.get(a[i])-1);   i++;   break;   }   freq.put(a[i], freq.get(a[i])-1);   i++;   if(curTypes == difTypes) min = Math.min(min, j-i);  }  curTypes = has.size();  }  System.out.println(min); } }
2	public class Main {  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int n = sc.nextInt(), k = sc.nextInt();   long rhs = 2l * (n + k);   for (int x = 1; ; x++) {    long lhs = 1l * x * x + 3l * x;    if (rhs == lhs) {     out.println(n - x);     break;    }   }   out.flush();   out.close();  }   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 String nextLine() throws IOException {    return br.readLine();   }   public int nextInt() throws IOException {    return Integer.parseInt(next());   }   public double nextDouble() throws IOException {    return Double.parseDouble(next());   }   public char nextChar() throws IOException {    return next().charAt(0);   }   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;   }   public long[] nextLongArray(int n) throws IOException {    long[] a = new long[n];    for (int i = 0; i < n; i++)     a[i] = nextLong();    return a;   }    public Integer[] nextIntegerArray(int n) throws IOException {    Integer[] a = new Integer[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }   public double[] nextDoubleArray(int n) throws IOException {    double[] ans = new double[n];    for (int i = 0; i < n; i++)     ans[i] = nextDouble();    return ans;   }   public short nextShort() throws IOException {    return Short.parseShort(next());   }  } }
5	public class AA {  static class Pair implements Comparable<Pair> {  public int x, y;  public Pair(int x, int y) {  this.x = x;  this.y = y;  }  public int compareTo(Pair p) {  if (p.x != x)   return x - p.x;  return y - p.y;  } }  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  int t = in.nextInt() * 2;  List<Pair> l = new ArrayList<Pair>();  for (int i = 0; i < n; i++) {  int c = in.nextInt() * 2;  int a = in.nextInt();  l.add(new Pair(c - a, c + a));  }  Collections.sort(l);  int ret = 2;  for (int i = 1; i < n; i++) {  if (l.get(i).x - l.get(i-1).y > t)   ret += 2;  else if (l.get(i).x - l.get(i-1).y == t)   ret += 1;  }  System.out.println(ret); } }
1	public class CommentaryBoxes {  public static void main(String[] args) {     FastReader in = new FastReader();     long n = in.nextLong();   long m = in.nextLong();   long a = in.nextLong();   long b = in.nextLong();   long total = 0;     long val =(n%m);   if (n%m != 0){       long x = (val)*b;    long y = (m-val)*a;       total = Math.min(x, y);   }   System.out.println(Math.abs(total));    }  public 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());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String string = "";    try {     string = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return string;   }  } }
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();   int[] a = in.nextIntArray(n);   int[] b = a.clone();   ArrayUtils.safeSort(b);   int diff = 0;   for (int i = 0; i < n; i++) {    if (a[i] != b[i])     diff++;   }   out.println(diff <= 2 ? "YES" : "NO");  } } 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 int[] nextIntArray(int count) {   int[] result = new int[count];   for (int i = 0; i < count; i++) {    result[i] = nextInt();   }   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(String x) {   writer.println(x);  }  public void close() {   writer.close();  }  } class ArrayUtils {   public static List<Integer> asList(int[] array) {   return new IntList(array);  }  private static class IntList extends AbstractList<Integer> implements RandomAccess {   int[] array;   private IntList(int[] array) {    this.array = array;   }   public Integer get(int index) {    return array[index];   }   public Integer set(int index, Integer element) {    int result = array[index];    array[index] = element;    return result;   }   public int size() {    return array.length;   }  }  public static void safeSort(int[] array) {   Collections.shuffle(asList(array));   Arrays.sort(array);  }  }
0	public class ChessKing {    public static void main(String[] args) { Scanner input = new Scanner(System.in); long size = input.nextLong(); long a = input.nextLong(); long b = input.nextLong(); long sum = a+b;  long d = sum-2;  long d1 = size*2 - sum; if(d<d1) System.out.println("White"); else if(d>d1) System.out.println("Black"); else System.out.println("White");   }  }
6	public class LookingForOrder { public Scanner in = new Scanner(System.in); public PrintStream out = System.out;  public int[] go; public int[][] cost;  public int [] sol; public Pair[] how; public int n, lim;  public Pair bag; public Pair[] obj;  public void main() {   bag = new Pair(in.nextInt(), in.nextInt());   n = in.nextInt();  obj = new Pair[n];  for(int i=0;i<n;++i) obj[i] = new Pair(in.nextInt(), in.nextInt());   go = new int[n];  cost = new int[n][n];  for(int i=0;i<n;++i)  {  go[i] = squDist(bag, obj[i]);  for(int j=0;j<n;++j) cost[i][j] = squDist(obj[i], obj[j]);  }   lim = (1<<n);   sol = new int[lim];  Arrays.fill(sol, -1);  how = new Pair[lim];   out.println(solve(lim-1));   Pair T;  int set = lim-1;   out.print("0");  while(set > 0)  {  solve(set);  T = how[set];  out.print(" "+(T.x+1));  set = off(T.x, set);  if(T.y >= 0)   {   out.print(" " + (T.y+1));   set = off(T.y, set);  }  out.print(" 0");  }  out.println(); }  public int oo = 987654321;  public boolean in(int x, int set) { return ((1<<x) & set) != 0; }  public int on(int x, int set) { return (set | (1<<x)); }  public int off(int x, int set) { return (set ^ (set & (1<<x)) ); }    public int solve(int set) {  if(sol[set] >= 0) return sol[set];   int ret;  if(set == 0) ret = 0;  else  {  ret = oo;    int x, y, sub, c;  for(x=0;x<n;++x) if(in(x, set)) break;    sub = off(x, set);  c = go[x]+go[x]+solve(sub);    if(c < ret)  {   how[set] = new Pair(x, -1);   ret = c;  }    for(y=x+1;y<n;++y) if(in(y, set))  {   c = go[x]+cost[x][y]+go[y] + solve(off(y, sub));   if(c < ret)   {   ret = c;   how[set] = new Pair(x, y);   }  }  }   return sol[set] = ret; }  public int squDist(int ax, int ay, int bx, int by) {  int dx, dy;  dx = ax - bx;  dy = ay - by;  return dx*dx + dy*dy; }  public int squDist(Pair p, Pair q) {  return squDist(p.x, p.y, q.x, q.y); }   private class Pair implements Comparable<Pair> {  public int x, y;  public Pair(int xx, int yy) { x = xx; y = yy; }  public int compareTo(Pair u)  {  if(x!=u.x) return x-u.x;  return y-u.y;  }  public String toString() { return "(" + x + "," + y + ")"; } }   public static void main(String[] args) {  (new LookingForOrder()).main(); } }
4	public class tank {  static final FastScanner fs = new FastScanner();  static PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) {   int t = fs.nextInt();   while(t-->0) {    run_case();   }   out.close();  }  static void run_case() {   int n = fs.nextInt(), prevLen = 1, one = 1;   int[] arr = fs.readArray(n);   int[] len = new int[1001];   StringBuilder[] prev = new StringBuilder[1001];   len[1] = 1;   out.println(1);   for (int i = 0; i < 1001; i++) {    prev[i] = new StringBuilder();   }   prev[1].append("1");   for (int i = 1; i < n; i++) {    if(arr[i] == 1) {     prev[prevLen + 1] = new StringBuilder(prev[prevLen]);     prev[prevLen + 1].append(".1");     out.println(prev[prevLen + 1]);     prevLen++;     len[prevLen] = 1;    }else {     for (int j = 1000; j > 0; j--) {      if(len[j] == arr[i] - 1 && j <= prevLen) {       char[] tmp = prev[j].toString().toCharArray();       if(fn(tmp)) {        prev[j] = new StringBuilder("" + (len[j] + 1));       }else {        prev[j] = new StringBuilder();        int ub = fn2(tmp);        for (int k = 0; k <= ub; k++) {         prev[j].append(tmp[k]);        }        prev[j].append(len[j] + 1);       }       out.println(prev[j]);       len[j] = len[j] + 1;       prevLen = j;       break;      }      if(j == 1) {       prev[j] = new StringBuilder("" + (one + 1));       out.println(prev[j]);       len[j] = one + 1;       prevLen = j;       one++;      }     }    }   }  }  static boolean fn(char[] arr) {   for(char c: arr) {    if(c == '.') return false;   }   return true;  }  static int fn2(char[] arr) {   int ret = 0;   for (int i = 0; i < arr.length; i++) {    if(arr[i] == '.') ret = i;   }   return ret;  }  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();   }   String nextLine(){    try {     return br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return "";   }   int nextInt() {    return Integer.parseInt(next());   }   int[] readArray(int n) {    int[] a=new int[n];    for (int i=0; i<n; i++) a[i]=nextInt();    return a;   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }  } }
2	public class Main{  static StreamTokenizer in=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  static BufferedReader buffer=new BufferedReader(new InputStreamReader(System.in));  static Scanner sc=new Scanner(System.in);  static PrintWriter out=new PrintWriter(System.out);   static final int inf=10000000;  public static void main(String args[])throws Exception {   double n,k;   n=sc.nextDouble();   k=sc.nextDouble();   double ans=0;   ans=Math.sqrt(2.25+2*(n+k))-1.5;   System.out.printf("%.0f\n",n-ans);  }  static void ssort(int arr[]){   int len=arr.length;   for(int i=0;i<len;i++){    int t=(int)(len*Math.random());    int temp=arr[t];    arr[t]=arr[i];    arr[i]=temp;   }   Arrays.sort(arr);  }  static int getInt()throws Exception{   in.nextToken();   return (int)in.nval;  } } class InputReader {  private final InputStream stream;  private final byte[] buf = new byte[8192];  private int curChar, snumChars;  public InputReader(InputStream st) {   this.stream = st;  }  public int read() {   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 = read();   while (isSpaceChar(c)) {    c = read();   }   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   int res = 0;   do {    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 {    res *= 10;    res += c - '0';    c = read();   } while (!isSpaceChar(c));   return res * sgn;  }  public int[] nextIntArray(int n) {   int a[] = new int[n];   for (int i = 0; i < n; i++) {    a[i] = nextInt();   }   return a;  }  public String readString() {   int c = read();   while (isSpaceChar(c)) {    c = read();   }   StringBuilder res = new StringBuilder();   do {    res.appendCodePoint(c);    c = read();   } while (!isSpaceChar(c));   return res.toString();  }  public String nextLine() {   int c = read();   while (isSpaceChar(c))    c = read();   StringBuilder res = new StringBuilder();   do {    res.appendCodePoint(c);    c = read();   } while (!isEndOfLine(c));   return res.toString();  }  public 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;  } }
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;   private static 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());   }  } }
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);   G1PlaylistForPolycarpEasyVersion solver = new G1PlaylistForPolycarpEasyVersion();   solver.solve(1, in, out);   out.close();  }  static class G1PlaylistForPolycarpEasyVersion {   long mod = (long) 1e9 + 7;   public void solve(int testNumber, InputReader s, PrintWriter w) {    int n = s.nextInt(), T = s.nextInt();    int[] t = new int[n + 1];    int[] g = new int[n + 1];    int[] f = new int[4];    for (int i = 1; i <= n; i++) {     t[i] = s.nextInt();     g[i] = s.nextInt();     f[g[i]]++;    }    long[] fact = new long[n + 1];    fact[0] = 1;    for (int i = 1; i <= n; i++)     fact[i] = fact[i - 1] * i % mod;    long[][][][] perm = new long[f[1] + 1][f[2] + 1][f[3] + 1][3 + 1];    long[][][] sumPerm = new long[f[1] + 1][f[2] + 1][f[3] + 1];    perm[0][0][0][0] = 1;    for (int a = 0; a <= f[1]; a++) {     for (int b = 0; b <= f[2]; b++) {      for (int c = 0; c <= f[3]; c++) {       if (a - 1 >= 0)        perm[a][b][c][1] = (sumPerm[a - 1][b][c] - perm[a - 1][b][c][1] + mod) % mod;       if (b - 1 >= 0)        perm[a][b][c][2] = (sumPerm[a][b - 1][c] - perm[a][b - 1][c][2] + mod) % mod;       if (c - 1 >= 0)        perm[a][b][c][3] = (sumPerm[a][b][c - 1] - perm[a][b][c - 1][3] + mod) % mod;       for (int i = 0; i <= 3; i++)        sumPerm[a][b][c] = (sumPerm[a][b][c] + perm[a][b][c][i]) % mod;      }     }    }    long[][][][][] dp = new long[n + 1][f[1] + 1][f[2] + 1][f[3] + 1][T + 1];    dp[0][0][0][0][0] = 1;    for (int i = 1; i <= n; i++) {     for (int a = 0; a <= f[1]; a++) {      for (int b = 0; b <= f[2]; b++) {       for (int c = 0; c <= f[3]; c++) {        for (int j = 0; j <= T; j++) {         dp[i][a][b][c][j] = dp[i - 1][a][b][c][j];         if (j - t[i] >= 0) {          if (g[i] == 1 && a > 0) {           dp[i][a][b][c][j] = (dp[i][a][b][c][j] + dp[i - 1][a - 1][b][c][j - t[i]]) % mod;          } else if (g[i] == 2 && b > 0) {           dp[i][a][b][c][j] = (dp[i][a][b][c][j] + dp[i - 1][a][b - 1][c][j - t[i]]) % mod;          } else if (g[i] == 3 && c > 0) {           dp[i][a][b][c][j] = (dp[i][a][b][c][j] + dp[i - 1][a][b][c - 1][j - t[i]]) % mod;          }         }        }       }      }     }    }    long res = 0;    for (int a = 0; a <= f[1]; a++)     for (int b = 0; b <= f[2]; b++)      for (int c = 0; c <= f[3]; c++)       res = (res + dp[n][a][b][c][T] * sumPerm[a][b][c] % mod * fact[a] % mod * fact[b] % mod * fact[c] % mod) % mod;    w.println(res);   }  }  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);   }  } }
2	public class Main {  public static void main(String[] args) {  try {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter pw = new PrintWriter(System.out);    String[] param = br.readLine().split(" ");  long n = Long.parseLong(param[0])-1;  long k = Long.parseLong(param[1])-1;  long max = k*(k+1)/2;  long answer;  if (n > max) answer = -1;  else {   long margin = max - n;   long m = Math.max(0,(long)Math.floor((1.0+Math.sqrt(1+8*margin))/2.0)-1);   long min = m*(m+1)/2;   while (min <= margin) { m++; min = m*(m+1)/2; }   answer = k - m + 1;  }  pw.println(answer);    pw.close();  br.close();  } catch (IOException e) {  e.printStackTrace();  return;  } } }
0	public class Main {  private static 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();  }  private static BufferedReader br;  private static StringTokenizer st;  private static PrintWriter out;  private static boolean hasNextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    String line = br.readLine();    if (line == null) {     return false;    }    st = new StringTokenizer(line);   }   return true;  }  private static String nextToken() throws IOException {   return hasNextToken() ? st.nextToken() : null;  }  private static int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  private static long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  private static double nextDouble() throws IOException {   return Double.parseDouble(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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   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 long[] nal(int n) {  long[] a = new long[n];  for(int i = 0;i < n;i++)a[i] = nl();  return a; }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[][] nmi(int n, int m) {  int[][] map = new int[n][];  for(int i = 0;i < n;i++)map[i] = na(m);  return map; }  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 {  private static 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;  }  private static 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;  }  private static 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(); } }  public void trnz(int... o) {  for(int i = 0;i < o.length;i++)if(o[i] != 0)System.out.print(i+":"+o[i]+" ");  System.out.println(); }   public void trt(long... o) {  Queue<Integer> stands = new ArrayDeque<>();  for(int i = 0;i < o.length;i++){  for(long x = o[i];x != 0;x &= x-1)stands.add(i<<6|Long.numberOfTrailingZeros(x));  }  System.out.println(stands); }  public void tf(boolean... r) {  for(boolean x : r)System.out.print(x?'#':'.');  System.out.println(); }  public void tf(boolean[]... b) {  for(boolean[] r : b) {  for(boolean x : r)System.out.print(x?'#':'.');  System.out.println();  }  System.out.println(); }  public void tf(long[]... b) {  if(INPUT.length() != 0) {  for (long[] r : b) {   for (long x : r) {   for (int i = 0; i < 64; i++) {    System.out.print(x << ~i < 0 ? '#' : '.');   }   }   System.out.println();  }  System.out.println();  } }  public void tf(long... b) {  if(INPUT.length() != 0) {  for (long x : b) {   for (int i = 0; i < 64; i++) {   System.out.print(x << ~i < 0 ? '#' : '.');   }  }  System.out.println();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
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)));  } }
4	public class Main {  static FastScanner sc = new FastScanner(System.in);  static PrintWriter pw = new PrintWriter(System.out);  static StringBuilder sb = new StringBuilder();  static long mod = (long) 1e9 + 7;  public static void main(String[] args) throws Exception {   solve();   pw.flush();  }   static ArrayList<ArrayList<ArrayList<int[]>>> kruscal = new ArrayList<>();  static long ans = Integer.MAX_VALUE;  static int[][][] map;  public static void solve() {   int n = sc.nextInt(), m = sc.nextInt(), k = sc.nextInt();   for(int i = 0; i < n; i++){    kruscal.add(new ArrayList<>());    for(int j = 0; j < m; j++){     kruscal.get(i).add(new ArrayList<>());    }   }   map = new int[n][m][k+1];   for(int i = 0; i < n; i++){    for(int j = 0; j < m-1; j++){         int now = sc.nextInt();     kruscal.get(i).get(j).add(new int[]{now,i,j+1});     kruscal.get(i).get(j+1).add(new int[]{now,i,j});    }   }   for(int i = 0; i < n-1; i++){    for(int j = 0; j < m; j++){         int now = sc.nextInt();     kruscal.get(i).get(j).add(new int[]{now,i+1,j});     kruscal.get(i+1).get(j).add(new int[]{now,i,j});    }   }   if(k % 2 != 0){    for(int i = 0; i < n; i++){     for(int j = 0; j < m; j++){      sb.append(-1).append(" ");     }     pw.println(sb.toString().trim());     sb.setLength(0);    }    return;   }   for(int i = 0; i < n; i++){    for(int j = 0; j < m; j++){     Arrays.fill(map[i][j],Integer.MAX_VALUE/2);     map[i][j][k/2] = 0;    }   }   for(int kk = k/2; kk > 0; kk--){    for(int i = 0; i < n; i++){     for(int j = 0; j < m; j++){      for(int[] next : kruscal.get(i).get(j)){       int d = next[0], i2 = next[1], j2 = next[2];       map[i2][j2][kk-1] = Math.min(map[i2][j2][kk-1],map[i][j][kk]+d);      }     }    }   }   for(int i = 0; i < n; i++){    for(int j = 0; j < m; j++){     sb.append(map[i][j][0]*2).append(" ");    }    pw.println(sb.toString().trim());    sb.setLength(0);   }  }   static void dfs(Stack<Integer> st, int y, int x, int cnt, long total){   if(st.size() == cnt){    ans = Math.min(total,ans);   }   for(int[] next : kruscal.get(y).get(x)){    int d = next[0], i = next[1], j = next[2];    if(Math.abs(i-y)+Math.abs(j-x)-st.size() < 0){     continue;    }    Stack<Integer> stk = (Stack<Integer>)st.clone();    stk.push(d);    dfs(stk,i,j,cnt,total + d);   }   int rem = cnt - st.size();   long tmp = 0;   int c = 0;   while(st.size() > 0){    tmp += st.pop();    c++;    if(rem % c == 0){     ans = Math.min(ans,total + tmp * (rem/c));    }   }  }   static class ArrayComparator implements Comparator<int[]> {   @Override   public int compare(int[] a1, int[] a2) {    for (int i = 0; i < a1.length; i++) {     if (a1[i] < a2[i]) {      return -1;     } else if (a1[i] > a2[i]) {      return 1;     }    }    if (a1.length < a2.length) {     return -1;    } else if (a1.length > a2.length) {     return 1;    } else {     return 0;    }   }  }   private static String ArraysToString(int[] arr){   String s = Arrays.toString(arr);   s = s.replaceAll(",","");   s = s.substring(1,s.length()-1);   return s;  }  static class GeekInteger {   public static void save_sort(int[] array) {    shuffle(array);    Arrays.sort(array);   }   public static int[] shuffle(int[] array) {    int n = array.length;    Random random = new Random();    for (int i = 0, j; i < n; i++) {     j = i + random.nextInt(n - i);     int randomElement = array[j];     array[j] = array[i];     array[i] = randomElement;    }    return array;   }   public static void save_sort(long[] array) {    shuffle(array);    Arrays.sort(array);   }   public static long[] shuffle(long[] array) {    int n = array.length;    Random random = new Random();    for (int i = 0, j; i < n; i++) {     j = i + random.nextInt(n - i);     long randomElement = array[j];     array[j] = array[i];     array[i] = randomElement;    }    return array;   }  } } class DSU {  private int n;  private int[] parentOrSize;  private java.util.ArrayList<java.util.ArrayList<Integer>> map;  public DSU(int n) {   this.n = n;   this.map = new java.util.ArrayList<java.util.ArrayList<Integer>>();   for (int i = 0; i < n; i++) {    this.map.add(new java.util.ArrayList<Integer>());    this.map.get(i).add(i);   }   this.parentOrSize = new int[n];   java.util.Arrays.fill(parentOrSize, -1);  }  int merge(int a, int b) {   if (!(0 <= a && a < n))    throw new IndexOutOfBoundsException("a=" + a);   if (!(0 <= b && b < n))    throw new IndexOutOfBoundsException("b=" + b);   int x = leader(a);   int y = leader(b);   if (x == y)    return x;   if (-parentOrSize[x] < -parentOrSize[y]) {    int tmp = x;    x = y;    y = tmp;   }   parentOrSize[x] += parentOrSize[y];   parentOrSize[y] = x;   this.map.get(x).addAll(this.map.get(y));   return x;  }  boolean same(int a, int b) {   if (!(0 <= a && a < n))    throw new IndexOutOfBoundsException("a=" + a);   if (!(0 <= b && b < n))    throw new IndexOutOfBoundsException("b=" + b);   return leader(a) == leader(b);  }  int leader(int a) {   if (parentOrSize[a] < 0) {    return a;   } else {    parentOrSize[a] = leader(parentOrSize[a]);    return parentOrSize[a];   }  }  int size(int a) {   if (!(0 <= a && a < n))    throw new IndexOutOfBoundsException("" + a);   return -parentOrSize[leader(a)];  }  java.util.ArrayList<java.util.ArrayList<Integer>> groups() {   int[] leaderBuf = new int[n];   int[] groupSize = new int[n];   for (int i = 0; i < n; i++) {    leaderBuf[i] = leader(i);    groupSize[leaderBuf[i]]++;   }   java.util.ArrayList<java.util.ArrayList<Integer>> result = new java.util.ArrayList<>(n);   for (int i = 0; i < n; i++) {    result.add(new java.util.ArrayList<>(groupSize[i]));   }   for (int i = 0; i < n; i++) {    result.get(leaderBuf[i]).add(i);   }   result.removeIf(java.util.ArrayList::isEmpty);   return result;  }  java.util.ArrayList<Integer> getArray(int n) {   return this.map.get(n);  } } class FastScanner {  private BufferedReader reader = null;  private StringTokenizer tokenizer = null;  public FastScanner(InputStream in) {   reader = new BufferedReader(new InputStreamReader(in));   tokenizer = null;  }  public FastScanner(FileReader in) {   reader = new BufferedReader(in);   tokenizer = null;  }  public String next() {   if (tokenizer == null || !tokenizer.hasMoreTokens()) {    try {     tokenizer = new StringTokenizer(reader.readLine());    } catch (IOException e) {     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }  public String nextLine() {   if (tokenizer == null || !tokenizer.hasMoreTokens()) {    try {     return reader.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }   return tokenizer.nextToken("\n");  }  public long nextLong() {   return Long.parseLong(next());  }  public int nextInt() {   return Integer.parseInt(next());  }  public double nextDouble() {   return Double.parseDouble(next());  }  public String[] nextArray(int n) {   String[] a = new String[n];   for (int i = 0; i < n; i++)    a[i] = next();   return a;  }  public int[] nextIntArray(int n) {   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = nextInt();   return a;  }  public long[] nextLongArray(int n) {   long[] a = new long[n];   for (int i = 0; i < n; i++)    a[i] = nextLong();   return a;  } }
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 {   @Override   public void run() {    InputStream inputStream = System.in;    OutputStream outputStream = System.out;    FastInput in = new FastInput(inputStream);    FastOutput out = new FastOutput(outputStream);    TaskC solver = new TaskC();    solver.solve(1, in, out);    out.close();   }  }  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;   private static 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();   }  }  static class DigitUtils {   private static final long[] DIGIT_VALUES = new long[19];   static {    DIGIT_VALUES[0] = 1;    for (int i = 1; i < 19; i++) {     DIGIT_VALUES[i] = DIGIT_VALUES[i - 1] * 10;    }   }   private DigitUtils() {   }   public static int mod(int x, int mod) {    x %= mod;    if (x < 0) {     x += mod;    }    return x;   }   public static class BitOperator {    public int setBit(int x, int i, boolean v) {     if (v) {      x |= 1 << i;     } else {      x &= ~(1 << i);     }     return x;    }   }  } }
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];  }   }
4	public class D {  static FastIO f; static long ve[][], he[][];  public static void main(String args[]) throws IOException {  f = new FastIO();  int n = f.ni(), m = f.ni(), k = f.ni(), i, j;  ve = new long[n-1][];  he = new long[n][];  long[][] ans = new long[n][m], pans = new long[n][m], temp;  for(i = 0; i < n; i++)  he[i] = f.nla(m-1);  for(i = 0; i < n-1; i++)  ve[i] = f.nla(m);  if(k%2 == 1)  {  for(i = 0; i < n; i++)   Arrays.fill(ans[i], -1L);  }  else  {  k /= 2;   while(k-->0)  {   for(i = 0; i < n; i++)   {   for(j = 0; j < m; j++)   {    ans[i][j] = Integer.MAX_VALUE;    if(i != 0)    ans[i][j] = Math.min(ans[i][j], pans[i-1][j] + 2*edge(i, j, i-1, j));    if(i != n-1)    ans[i][j] = Math.min(ans[i][j], pans[i+1][j] + 2*edge(i, j, i+1, j));    if(j != 0)    ans[i][j] = Math.min(ans[i][j], pans[i][j-1] + 2*edge(i, j, i, j-1));    if(j != m-1)    ans[i][j] = Math.min(ans[i][j], pans[i][j+1] + 2*edge(i, j, i, j+1));   }   }         temp = pans;   pans = ans;   ans = temp;  }   temp = pans;  pans = ans;  ans = temp;  }  for(i = 0; i < n; i++)  {  for(j = 0; j < m; j++)  {   f.out(ans[i][j] + " ");  }   f.out("\n");  }  f.flush(); }  public static void errorprint(long[][] p, int n, int m) throws IOException {  int i, j;  for(i = 0; i < n; i++)  {  for(j = 0; j < m; j++)  {   f.err(p[i][j] + " ");  }   f.err("\n");  }   f.err("\n"); }  public static long edge(int i, int j, int x, int y) {  if(i == x)  return he[i][Math.min(j, y)];  else  return ve[Math.min(i, x)][j]; }  public static class FastIO {  BufferedReader br;  BufferedWriter bw, be;  StringTokenizer st;  public FastIO()  {  br = new BufferedReader(new InputStreamReader(System.in));  bw = new BufferedWriter(new OutputStreamWriter(System.out));  be = new BufferedWriter(new OutputStreamWriter(System.err));  st = new StringTokenizer("");  }  private void read() throws IOException  {  st = new StringTokenizer(br.readLine());  }  public String ns() throws IOException  {  while(!st.hasMoreTokens())   read();  return st.nextToken();  }  public int ni() throws IOException  {  return Integer.parseInt(ns());  }  public long nl() throws IOException  {  return Long.parseLong(ns());  }  public float nf() throws IOException  {  return Float.parseFloat(ns());  }  public double nd() throws IOException  {  return Double.parseDouble(ns());  }  public char nc() throws IOException  {  return ns().charAt(0);  }  public int[] nia(int n) throws IOException  {  int[] a = new int[n];  for(int i = 0; i < n; i++)   a[i] = ni();   return a;  }  public long[] nla(int n) throws IOException  {  long[] a = new long[n];  for(int i = 0; i < n; i++)   a[i] = nl();   return a;  }  public char[] nca() throws IOException  {  return ns().toCharArray();  }  public void out(String s) throws IOException  {  bw.write(s);  }  public void flush() throws IOException  {  bw.flush();  be.flush();  }  public void err(String s) throws IOException  {  be.write(s);  } } }
2	public class B { static FastReader scan; static PrintWriter out;  public static void main(String[] args) throws FileNotFoundException {  Solver solver = new Solver();  scan = new FastReader();  out = new PrintWriter(System.out);  int testCases = 1;  for(int i = 1; i <= testCases; i++) {   solver.solve();  }  out.close(); }  static class Solver {   void solve() {  long n = scan.nextLong(), k = scan.nextLong();  long low = 0, high = n;  while(true) {   long mid = (low+high)/2;   long s = sum(n-mid);   if(s - mid == k) {   out.println(mid);   return;   }   else if(s - mid < k) {   high = mid-1;   }   else low = mid+1;     }    }   static long sum(long a) {  if(a == 0) return 0;  return (a+1)*a/2;  }   }   static class DSU {  int[] root, size;  int n;  DSU(int n) {  this.n = n;  root = new int[n];  size = new int[n];  for (int i = 0; i < n; i++) {   root[i] = i;   size[i] = 1;  }  }  int findParent(int idx) {  while (root[idx] != idx) {   root[idx] = root[root[idx]];   idx = root[idx];  }  return idx;  }  boolean union(int x, int y) {  int parX = findParent(x);  int parY = findParent(y);  if (parX == parY)   return false;  if (size[parX] < size[parY]) {   root[parY] = parX;   size[parX] += size[parY];  } else {   root[parX] = parY;   size[parY] += size[parX];  }  return true;  } }  static class Extra {  static void sort(int[] a) {  Integer[] aa = new Integer[a.length];  for (int i = 0; i < aa.length; i++)   aa[i] = a[i];  Arrays.sort(aa);  for (int i = 0; i < aa.length; i++)   a[i] = aa[i];  }  static void sort(long[] a) {  Long[] aa = new Long[a.length];  for (int i = 0; i < aa.length; i++)   aa[i] = a[i];  Arrays.sort(aa);  for (int i = 0; i < aa.length; i++)   a[i] = aa[i];  }  static void sort(double[] a) {  Double[] aa = new Double[a.length];  for (int i = 0; i < aa.length; i++)   aa[i] = a[i];  Arrays.sort(aa);  for (int i = 0; i < aa.length; i++)   a[i] = aa[i];  }  static void sort(char[] a) {  Character[] aa = new Character[a.length];  for (int i = 0; i < aa.length; i++)   aa[i] = a[i];  Arrays.sort(aa);  for (int i = 0; i < aa.length; i++)   a[i] = aa[i];  }  static long gcd(long a, long b) {  while (b > 0) {   long temp = b;   b = a % b;   a = temp;  }  return a;  }  static long lcm(long a, long b) {  return a * (b / gcd(a, b));  }  static boolean isPrime(long n) {  if (n <= 1)   return false;  if (n <= 3)   return true;  if (n % 2 == 0 || n % 3 == 0)   return false;  for (long i = 5; i * i <= n; i = i + 6) {   if (n % i == 0 || n % (i + 2) == 0)   return false;  }  return true;  } }  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());  }  int[] nextIntArray(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = nextInt();  return a;  }  long nextLong() {  return Long.parseLong(next());  }  long[] nextLongArray(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  double nextDouble() {  return Double.parseDouble(next());  }  double[] nextDoubleArray(int n) {  double[] a = new double[n];  for (int i = 0; i < n; i++)   a[i] = nextDouble();  return a;  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  } } }
6	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);   TaskE solver = new TaskE();   solver.solve(1, in, out);   out.close();  }  static class TaskE {   int n;   int k;   long[] neigibor;   Random random = new Random();   long maxClique;   public void solve(int testNumber, MyInput in, PrintWriter out) {    n = in.nextInt();    k = in.nextInt();    neigibor = new long[n];    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      neigibor[i] |= in.nextLong() << j;     }    }    long maxClique = bronKerbosch();    long a = Long.bitCount(maxClique);    dump(a);    out.printf("%.12f\n", a * (a - 1.0) / 2 * k / a * k / a);   }   static void dump(Object... o) {    System.err.println(Arrays.deepToString(o));   }   long bronKerbosch() {    maxClique = 0;    bronKerbosch2(0, (1L << n) - 1, 0);    return maxClique;   }   void bronKerbosch2(long r, long p, long x) {    if (Long.bitCount(maxClique) >= Long.bitCount(r | p | x)) return;    long px = p | x;    if (px == 0) {     if (Long.bitCount(maxClique) < Long.bitCount(r)) {      maxClique = r;     }     return;    }    int cnt = Long.bitCount(px);    int choice = random.nextInt(cnt);    int u;    for (int i = 0; ; i++) {     if ((px >>> i & 1) != 0 && choice-- == 0) {      u = i;      break;     }    }    long ne = p & ~neigibor[u];    for (int v = 0; v < n; v++)     if ((ne >>> v & 1) != 0) {      bronKerbosch2(r | 1L << v, p & neigibor[v], x & neigibor[v]);      p &= ~(1L << v);      x |= 1L << v;     }   }  }  static class MyInput {   private final BufferedReader in;   private static int pos;   private static int readLen;   private static final char[] buffer = new char[1024 * 8];   private static char[] str = new char[500 * 8 * 2];   private static boolean[] isDigit = new boolean[256];   private static boolean[] isSpace = new boolean[256];   private static boolean[] isLineSep = new boolean[256];   static {    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 long nextLong() {    int len = 0;    str[len++] = nextChar();    len = reads(len, isSpace);    int i = 0;    long 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;   }   static class EndOfFileRuntimeException extends RuntimeException {   }  } }
4	public class c1523 implements Runnable{   public static void main(String[] args) {  try{    new Thread(null, new c1523(), "process", 1<<26).start();   }   catch(Exception e){    System.out.println(e);   }  } public void run() {  FastReader scan = new FastReader();   PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));   Task solver = new Task();  int t = scan.nextInt();   for(int i = 1; i <= t; i++) solver.solve(i, scan, out);  out.close(); }  static class Task {  static final int oo = Integer.MAX_VALUE;  static final long OO = Long.MAX_VALUE;  public void solve(int testNumber, FastReader sc, PrintWriter out) {  int N = sc.nextInt();  int[] arr = sc.readArray(N);    Stack<Integer> cur = new Stack<>();  StringBuilder sb = new StringBuilder("");  for(int i = 0; i < N; i++) {   if(arr[i] == 1) {   cur.add(1);   } else {   while(cur.peek() != arr[i] - 1)    cur.pop();   cur.pop();   cur.add(arr[i]);   }     for(int each: cur) {   sb.append(each + ".");   }   sb.deleteCharAt(sb.length()-1);   sb.append("\n");  }    out.println(sb);  }   } static long modInverse(long N, long MOD) {  return binpow(N, MOD - 2, MOD); } static long modDivide(long a, long b, long MOD) {  a %= MOD;  return (binpow(b, MOD-2, MOD) * a) % MOD; } static long binpow(long a, long b, long m) {  a %= m;  long res = 1;  while (b > 0) {  if ((b & 1) == 1)   res = res * a % m;  a = a * a % m;  b >>= 1;  }  return res; } static int[] reverse(int a[])  {   int[] b = new int[a.length];   for (int i = 0, j = a.length; i < a.length; i++, j--) {    b[j - 1] = a[i];   }      return b;  } static long[] reverse(long a[])  {   long[] b = new long[a.length];   for (int i = 0, j = a.length; i < a.length; i++, j--) {    b[j - 1] = a[i];   }      return b;  }  static void shuffle(Object[] a) {  Random get = new Random();  for (int i = 0; i < a.length; i++) {  int r = get.nextInt(a.length);  Object temp = a[i];  a[i] = a[r];  a[r] = temp;  } }  static void shuffle(int[] a) {  Random get = new Random();  for (int i = 0; i < a.length; i++) {  int r = get.nextInt(a.length);  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(a.length);  long temp = a[i];  a[i] = a[r];  a[r] = temp;  } }  static class tup implements Comparable<tup>, Comparator<tup>{  int a, b;  tup(int a,int b){  this.a=a;  this.b=b;  }  public tup() {  }  @Override  public int compareTo(tup o){  return Integer.compare(b,o.b);  }  @Override  public int compare(tup o1, tup o2) {  return Integer.compare(o1.b, o2.b);  }   @Override  public int hashCode() {  return Objects.hash(a, b);  }   @Override  public boolean equals(Object obj) {   if (this == obj)     return true;   if (obj == null)     return false;   if (getClass() != obj.getClass())     return false;   tup other = (tup) obj;   return a==other.a && b==other.b;  }    @Override  public String toString() {   return a + " " + b;  } }  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());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }   int[] readArray(int size) {  int[] a = new int[size];  for(int i = 0; i < size; i++) {   a[i] = nextInt();  }  return a;  }   long[] readLongArray(int size) {  long[] a = new long[size];  for(int i = 0; i < size; i++) {   a[i] = nextLong();  }  return a;  } }  static void dbg(int[] arr) {  System.out.println(Arrays.toString(arr)); } static void dbg(long[] arr) {  System.out.println(Arrays.toString(arr)); } static void dbg(boolean[] arr) {  System.out.println(Arrays.toString(arr)); }  static void dbg(Object... args) {   for (Object arg : args)    System.out.print(arg + " ");   System.out.println();  } }
0	public class Solution implements Runnable {  public long gcd(long a, long b) {  long tmp;  while (b > 0) {  a %= b;  tmp = a;  a = b;  b = tmp;  }  return a; }  public void solve() throws Exception {  long a = sc.nextLong();  long b = sc.nextLong();  long ans = 0;  long k = 0;  if (a == 1 || b == 1) {  out.println(max(a, b));  return;  }  while (a > 1 && b > 1) {  if (a > b) {   k = a / b;   ans += k;   a -= (k * b);    } else {   k = b / a;   ans += k;   b -= (k * a);  }  k = gcd(a, b);  a /= k;  b /= k;  }  if (a == 1)  ans += b;  else  ans += a;  out.println(ans); }  static Throwable throwable;  BufferedReader in; PrintWriter out; FastScanner sc;  public static void main(String[] args) throws Throwable {  Thread thread = new Thread(null, new Solution(), "", (1 << 26));  thread.start();  thread.join();  if (throwable != null) {  throw throwable;  } }  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  sc = new FastScanner(in);  solve();  } catch (Throwable throwable) {  this.throwable = throwable;   } finally {  out.close();  }  } } class FastScanner { BufferedReader reader; StringTokenizer strTok;  public FastScanner(BufferedReader reader) {  this.reader = reader; }  public String nextToken() throws Exception {  while (strTok == null || !strTok.hasMoreTokens()) {  strTok = new StringTokenizer(reader.readLine());  }  return strTok.nextToken(); }  public int nextInt() throws Exception {  return Integer.parseInt(nextToken()); }  public long nextLong() throws Exception {  return Long.parseLong(nextToken()); }  public double nextDouble() throws Exception {  return Double.parseDouble(nextToken()); } }
0	public class Main {    public static void main(String[] args) {     Scanner scanner = new Scanner(System.in);   int T = scanner.nextInt();   while(T-->0){    int m , n , count=0;    m = scanner.nextInt();    n = scanner.nextInt();    while(m!=0&&n!=0){     int tmp;     if(m<n) {      tmp = n;      n = m;      m = tmp;     }     count+=m/n;     m = m%n;    }    if(T!=0)System.out.println(count);    else System.out.print(count);   }  } }
5	public class DD { public static void main(String[] args)throws Throwable {  MyScanner sc=new MyScanner();  PrintWriter pw=new PrintWriter(System.out);   int n=sc.nextInt();  int [] a=new int [n];  for(int i=0;i<n;i++)  a[i]=sc.nextInt();   TreeMap<Integer, Integer> map=new TreeMap<Integer, Integer>();  BigInteger ans=new BigInteger("0");  long sum=0;  for(int i=0;i<n;i++){  sum+=a[i];  map.put(a[i], map.getOrDefault(a[i], 0)+1);  int cntSame=map.get(a[i]);  int cntLess=map.getOrDefault(a[i]-1, 0);  int cntMore=map.getOrDefault(a[i]+1, 0);  long sum2=sum;  sum2-=1L*cntSame*a[i];  sum2-=1L*cntLess*(a[i]-1);  sum2-=1L*cntMore*(a[i]+1);  int cnt=i+1-(cntSame+cntLess+cntMore);  ans = ans.subtract(BigInteger.valueOf(sum2));  ans= ans.add(BigInteger.valueOf(1L*cnt*a[i]));    }  pw.println(ans);  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());}  long nextLong() {return Long.parseLong(next());}  double nextDouble() {return Double.parseDouble(next());}  String nextLine(){String str = "";  try {str = br.readLine();}  catch (IOException e) {e.printStackTrace();}  return str;} } }
4	public class C1523 { public static void print(Stack<Integer> st, PrintWriter pw) {  for (int i = 0; i < st.size(); i++) {  pw.print(st.get(i));  if (i != st.size() - 1) {   pw.print(".");  }  }  pw.println(); }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);  int t = sc.nextInt();  while (t-- > 0) {  int n = sc.nextInt();  int[] arr = sc.nextIntArr(n);  Stack<Integer> st = new Stack<Integer>();  st.add(arr[0]);  print(st, pw);  for (int i = 1; i < n; i++) {   if (arr[i] == 1) {   st.add(arr[i]);   } else {   while (st.peek() != arr[i] - 1) {    st.pop();   }   st.pop();   st.add(arr[i]);   }   print(st, pw);  }  }  pw.close(); }  static class Scanner {  BufferedReader br;  StringTokenizer st;  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 int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public int[] nextIntArr(int n) throws IOException {  int[] arr = new int[n];  for (int i = 0; i < n; i++) {   arr[i] = Integer.parseInt(next());  }  return arr;  }  } }
5	public class R111_D2_A {  public static void main(String[] args) {   InputReader in = new InputReader(System.in);        int n = in.readInt();   int[] inp = new int[n];   for (int i = 0; i < inp.length; i++) {    inp[i] = in.readInt();   }   Arrays.sort(inp);   int sum1 = 0;   int res = 0;   for (int i = inp.length - 1; i >= 0; i--) {    sum1 += inp[i];    res++;    int sum2 = 0;    for (int j = 0; j < i; j++) {     sum2 += inp[j];    }    if (sum1 > sum2) {     break;    }   }   System.out.println(res);  }  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;   }   public long readLong() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public String readString() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuffer res = new StringBuffer();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   private String readLine0() {    StringBuffer buf = new StringBuffer();    int c = read();    while (c != '\n' && c != -1) {     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 char readCharacter() {    int c = read();    while (isSpaceChar(c))     c = read();    return (char) c;   }   public double readDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, readInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, readInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }  } }
3	public final class PythonIndentation { public static void main(String[] args) {  new PythonIndentation(System.in, System.out); }  static class Solver implements Runnable {  static final int MOD = (int) 1e9 + 7;  int n;  char[] arr;  long[][] dp;  BufferedReader in;  PrintWriter out;  void solve() throws IOException  {  n = Integer.parseInt(in.readLine());  arr = new char[n];  dp = new long[n + 1][n + 1];   for (int i = 0; i < n; i++)   arr[i] = in.readLine().charAt(0);   for (int i = 0; i <= n; i++)   Arrays.fill(dp[i], -1);   dp[0][0] = 1;   if (arr[0] == 's')   out.println(find(1, 0));  else   out.println(find(1, 1));  }  long find(int curr, int backIndents)  {  if (backIndents < 0)   return 0;   if (curr == n)   return 1;   if (dp[curr][backIndents] != -1)   return dp[curr][backIndents];   long ans;   if (arr[curr] == 's')   ans = find(curr + 1, backIndents);  else   ans = find(curr + 1, backIndents + 1);   if (arr[curr - 1] != 'f')   ans = CMath.mod(ans + find(curr, backIndents - 1), MOD);   return dp[curr][backIndents] = ans;  }  public Solver(BufferedReader in, PrintWriter out)  {  this.in = in;  this.out = out;  }  @Override public void run()  {  try  {   solve();  }  catch (IOException e)  {   e.printStackTrace();  }  }  }  static class CMath {  static long mod(long number, long mod)  {  return number - (number / mod) * mod;  }  }  private PythonIndentation(InputStream inputStream, OutputStream outputStream) {  BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));  PrintWriter out = new PrintWriter(outputStream);  Thread thread = new Thread(null, new Solver(in, out), "PythonIndentation", 1 << 29);  try  {  thread.start();  thread.join();  }  catch (InterruptedException e)  {  e.printStackTrace();  }  finally  {  try  {   in.close();  }  catch (IOException e)  {   e.printStackTrace();  }   out.flush();  out.close();  } } }
0	public class Ideone {  public static void main (String[] args) throws java.lang.Exception  {   Scanner sc = new Scanner(System.in);   long l= sc.nextLong();   long r = sc.nextLong();   if(l%2==0){    if(r>=l+2){     System.out.println(l + " " + (l+1) + " " + (l+2));    }    else{     System.out.println(-1);    }   }   else{    if(r>=l+3){     System.out.println((l+1) + " " + (l+2) + " " + (l+3));    }    else{     System.out.println(-1);    }   }  } }
3	public class Codeforce { 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();  }  int color = 0;  Arrays.sort(arr);  for(int i=0; i<n; i++) {  if(arr[i]!=0) {   int col = arr[i];   color++;   for(int j=i; j<n; j++) {   if(arr[j]%col==0) arr[j]=0;   }  }  }  System.out.println(color);  sc.close(); } }
1	public class codeforces { public static void main(String[] args) {  PrintWriter out=new PrintWriter(System.out);  Scanner s=new Scanner(System.in);   int t=s.nextInt();  for(int tt=0;tt<t;tt++) {   long n=s.nextInt();   long x=(long)Math.sqrt(n/2);   long y=(long)Math.sqrt(n/4);   if(x*x*2==n || y*y*4==n) {   out.println("YES");   }else {   out.println("NO");   }  }  out.close();  s.close(); }  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); }  }
1	public class ProblemaNoldbaha implements Runnable{ public static void main(String[] args) throws IOException {  new Thread(new ProblemaNoldbaha()).start(); }  BufferedReader br; StringTokenizer in; PrintWriter 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()); }  public double nextDouble() throws IOException{  return Double.parseDouble(nextToken()); }  public void solve() throws IOException{  int n = nextInt();  int k = nextInt();   int[] prime = new int[1000];   int l = 0;   for (int i = 2; i <= n; i++) {  boolean f = false;  for (int j = 2; j < i; j++) {   if (i % j == 0){   f = true;   break;   }  }    if (!f){   prime[l] = i;   l++;  }  }   int count = 0;  for (int i = 2; i < l; i++) {  boolean f = false;  for (int j = 0; j < l - 1; j++) {   if (prime[j] + prime[j + 1] + 1 == prime[i]){   f = true;   break;   }  }    if (f) count++;  }   if (count >= k){  out.println("YES");  }  else{  out.println("NO");  } }  public void run(){  try{  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);    solve();    out.close();  }  catch(IOException e){  e.printStackTrace();  System.exit(1);  } } }
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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   static int n;   static int m;   static int steps;   static long[][] distJ;   static long[][] distI;   static long[][][] memo;   public void solve(int testNumber, InputReader in, OutputWriter out) {    n = in.nextInt();    m = in.nextInt();    steps = in.nextInt();    memo = new long[n][m][steps];    distJ = new long[n][m - 1];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m - 1; j++) {      distJ[i][j] = in.nextLong();     }    }    distI = new long[n - 1][m];    for (int i = 0; i < n - 1; i++) {     for (int j = 0; j < m; j++) {      distI[i][j] = in.nextLong();     }    }     for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      if (steps % 2 != 0) {       out.print(-1 + " ");      } else {       out.print(2 * lowestCost(i, j, steps / 2) + " ");      }     }     out.println();    }   }   private long lowestCost(int i, int j, int distance) {    if (distance == 0) {     return 0;    }    if (memo[i][j][distance] > 0) {     return memo[i][j][distance];    }    long minDist = Long.MAX_VALUE;       if (j < m - 1) {         minDist = Math.min(minDist, distJ[i][j] + lowestCost(i, j + 1, distance - 1));    }    if (j > 0) {         minDist = Math.min(minDist, distJ[i][j - 1] + lowestCost(i, j - 1, distance - 1));    }    if (i < n - 1) {         minDist = Math.min(minDist, distI[i][j] + lowestCost(i + 1, j, distance - 1));    }    if (i > 0) {         minDist = Math.min(minDist, distI[i - 1][j] + lowestCost(i - 1, j, distance - 1));    }        memo[i][j][distance] = minDist;    return minDist;   }  }  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() {    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 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 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 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 GridGraph extends Graph{  int N; int M; String[] S; HashMap<Character,Integer> map; GridGraph(int n,int m,String[] s,char[] c){  super(n*m);  N = n;  M = m;  S = s;  map = new HashMap<Character,Integer>();  for(int i=0;i<n-1;i++) {  for(int j=0;j<m;j++) {   if(S[i].charAt(j)!='#'&&S[i+1].charAt(j)!='#') {   addEdge(toint(i,j),toint(i+1,j));   addEdge(toint(i+1,j),toint(i,j));   }  }  }  for(int i=0;i<n;i++) {  for(int j=0;j<m-1;j++) {   if(S[i].charAt(j)!='#'&&S[i].charAt(j+1)!='#') {   addEdge(toint(i,j),toint(i,j+1));   addEdge(toint(i,j+1),toint(i,j));      }  }  }  for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   for(int k=0;k<c.length;k++) {   if(S[i].charAt(j)==c[k])map.put(c[k],toint(i,j));   }  }  } }  int toint(int i,int j) {  return i*M+j; }  } class BetterGridGraph{ int N; int M; char[][] S; HashMap<Character,Integer> map; int[] dx = {0,1,0,-1}; int[] dy = {1,0,-1,0}; char w; char b = '#'; BetterGridGraph(int n,int m,String[] s,char[] c){   N = n;  M = m;  for(int i=0;i<s.length;i++) {  S[i] = s[i].toCharArray();  }  map = new HashMap<Character,Integer>();  for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   for(int k=0;k<c.length;k++) {   if(S[i][j]==c[k])map.put(c[k],toint(i,j));   }  }  } } BetterGridGraph(int n,int m,char[][] s,char[] c){   N = n;  M = m;  S = s;  map = new HashMap<Character,Integer>();  for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   for(int k=0;k<c.length;k++) {   if(S[i][j]==c[k])map.put(c[k],toint(i,j));   }  }  } }  BetterGridGraph(int n,int m,String[] s,char[] c,char W,char B){   N = n;  M = m;  for(int i=0;i<s.length;i++) {  S[i] = s[i].toCharArray();  }  w = W;  b = B;  map = new HashMap<Character,Integer>();  for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   for(int k=0;k<c.length;k++) {   if(S[i][j]==c[k])map.put(c[k],toint(i,j));   }  }  } } BetterGridGraph(int n,int m,char[][] s,char[] c,char W,char B){   N = n;  M = m;  S = s;  w = W;  b = B;  map = new HashMap<Character,Integer>();  for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   for(int k=0;k<c.length;k++) {   if(S[i][j]==c[k])map.put(c[k],toint(i,j));   }  }  } }  int toint(int i,int j) {  return i*M+j; }  int[] bfs(char C) {  int s = map.get(C);  int[] L = new int[N*M];  for(int i=0;i<N*M;i++){  L[i] = -1;  }  L[s] = 0;  ArrayDeque<Integer> Q = new ArrayDeque<Integer>();  Q.add(s);  Range X = new Range(0,N-1);  Range Y = new Range(0,M-1);  while(!Q.isEmpty()){  int v = Q.poll();  for(int i=0;i<4;i++){   int x = v/M;   int y = v%M;   int nx = x+dx[i];   int ny = y+dy[i];   if(X.isIn(nx)&&Y.isIn(ny)&&S[nx][ny]!=b) {   int w = toint(nx,ny);   if(L[w]==-1){    L[w] = L[v] + 1;    Q.add(w);   }   }  }  }  return L; }  int[][] bfs2(char C,int K){  int s = map.get(C);  int[][] L = new int[N*M][K+1];  for(int i=0;i<N*M;i++){  for(int j=0;j<=K;j++)  L[i][j] = 1000000007;  }  L[s][0] = 0;  ArrayDeque<IntIntPair> Q = new ArrayDeque<IntIntPair>();  Q.add(new IntIntPair(s,0));  Range X = new Range(0,N-1);  Range Y = new Range(0,M-1);  while(!Q.isEmpty()){  IntIntPair v = Q.poll();  for(int i=0;i<4;i++){   int x = v.a/M;   int y = v.a%M;   int h = v.b;   int nx = x+dx[i];   int ny = y+dy[i];   if(X.isIn(nx)&&Y.isIn(ny)&&S[nx][ny]!=b) {   int ni = toint(nx,ny);   int nh = S[nx][ny]==w?h+1:h;   if(nh>K) continue;   if(L[ni][nh]==1000000007){    L[ni][nh] = L[v.a][h] + 1;    Q.add(new IntIntPair(ni,nh));   }   }  }  }  for(int i=0;i<N*M;i++) {  for(int j=1;j<=K;j++) {   L[i][j] = Math.min(L[i][j],L[i][j-1]);  }  }  return L; } } class StringManager{ ArrayList<Character> S; static Mathplus mp; static boolean calced; static int base; static long baserev; ArrayList<Long> l; StringManager(String s){  S = new ArrayList<Character>();  for(int i=0;i<s.length();i++) {  S.add(s.charAt(i));  }  if(!calced) {  calced = true;  mp = new Mathplus();  base = 1000003;  baserev = mp.rev(base);  mp.buildpow(base,1000050);  mp.buildrevpow((int) baserev,1000050);  }  l = new ArrayList<Long>();  l.add((long)S.get(0));  for(int i=1;i<S.size();i++) {  char c = S.get(i);  l.add((l.get(i-1) + mp.pow[i] * c)%mp.mod);  } } void add(char C){  int i = S.size();  S.add(C);  l.add((l.get(i-1) + mp.pow[i] * C)%mp.mod); } long gethash(int le,int ri) {  long res = l.get(ri);  if(le!=0) {  res -= l.get(le-1);  res += mp.mod;  res %= mp.mod;  res *= mp.revpow[le];  res %= mp.mod;  }  return res; }  }  class Trie{ int nodenumber = 1; ArrayList<TrieNode> l; Trie(){  l = new ArrayList<TrieNode>();  l.add(new TrieNode()); }  void add(String S,int W){  int now = 0;  for(int i=0;i<S.length();i++) {  TrieNode n = l.get(now);  char c = S.charAt(i);  if(n.Exist[c-'a']!=-1) {   now = n.Exist[c-'a'];  }else {   l.add(new TrieNode());   n.Exist[c-'a'] = nodenumber;   now = nodenumber;   nodenumber++;  }  }  l.get(now).weight = W; }  void find(String S,int i,int[] dp) {  int now = 0;  dp[i+1] = Math.max(dp[i],dp[i+1]);  for(int j=0;;j++) {  TrieNode n = l.get(now);  dp[i+j] = Math.max(dp[i+j],dp[i]+n.weight);  int slook = i+j;  if(slook>=S.length())return;  char c = S.charAt(slook);  if(n.Exist[c-'a']==-1)return;  now = n.Exist[c-'a'];  } } } class TrieNode{  int[] Exist = new int[26]; int weight = 0; TrieNode(){  for(int i=0;i<26;i++) {  Exist[i] = -1;  } } } class SizeComparator implements Comparator<Edge>{ int[] size; SizeComparator(int[] s) {  size = s; }  public int compare(Edge o1, Edge o2) {  return size[o1.to]-size[o2.to];  } } class ConvexHullTrick { long[] A, B; int len;  public ConvexHullTrick(int n) {  A = new long[n];  B = new long[n]; }  private boolean check(long a, long b) {  return (B[len - 2] - B[len - 1]) * (a - A[len - 1]) >= (B[len - 1] - b) * (A[len - 1] - A[len - 2]); }  public void add(long a, long b) {  while (len >= 2 && check(a, b)) {  len--;  }  A[len] = a;  B[len] = b;  len++; }  public long query(long x) {  int l = -1, r = len - 1;  while (r - l > 1) {  int mid = (r + l) / 2;  if (get(mid,x)>=get(mid+1,x)) {   l = mid;  } else {   r = mid;  }  }  return get(r,x); }  private long get(int k, long x) {  return A[k] * x + B[k]; } } 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 LeftComparator implements Comparator<Range>{ public int compare(Range P, Range Q) {  return P.l-Q.l; } } class RightComparator implements Comparator<Range>{ public int compare(Range P, Range Q) {  return P.r-Q.r; } } class LengthComparator implements Comparator<Range>{ public int compare(Range P, Range Q) {  return P.length-Q.length; } } class SegmentTree<T,E>{ int N; BiFunction<T,T,T> f; BiFunction<T,E,T> g; T d1; ArrayList<T> dat; SegmentTree(BiFunction<T,T,T> F,BiFunction<T,E,T> G,T D1,T[] v){  int n = v.length;  f = F;  g = G;  d1 = D1;  init(n);  build(v); }  void init(int n) {  N = 1;  while(N<n)N*=2;  dat = new ArrayList<T>(); }  void build(T[] v) {  for(int i=0;i<2*N;i++) {  dat.add(d1);  }  for(int i=0;i<v.length;i++) {  dat.set(N+i-1,v[i]);  }  for(int i=N-2;i>=0;i--) {  dat.set(i,f.apply(dat.get(i*2+1),dat.get(i*2+2)));  } }  void update(int k,E a) {  k += N-1;  dat.set(k,g.apply(dat.get(k),a));  while(k>0){  k = (k-1)/2;  dat.set(k,f.apply(dat.get(k*2+1),dat.get(k*2+2)));  } }  T query(int a,int b, int k, int l ,int r) {  if(r<=a||b<=l) return d1;  if(a<=l&&r<=b) return dat.get(k);  T vl = query(a,b,k*2+1,l,(l+r)/2);  T vr = query(a,b,k*2+2,(l+r)/2,r);  return f.apply(vl, vr); } T query(int a,int b){  return query(a,b,0,0,N); } } class LazySegmentTree<T,E> extends SegmentTree<T,E>{ BiFunction<E,E,E> h; BiFunction<E,Integer,E> p = (E a,Integer b) ->{return a;}; E d0; ArrayList<E> laz; LazySegmentTree(BiFunction<T,T,T> F,BiFunction<T,E,T> G,BiFunction<E,E,E> H,T D1,E D0,T[] v){  super(F,G,D1,v);  int n = v.length;  h = H;  d0 = D0;  Init(n); } void build() {  } void Init(int n){  laz = new ArrayList<E>();  for(int i=0;i<2*N;i++) {  laz.add(d0);  } }  void eval(int len,int k) {  if(laz.get(k).equals(d0)) return;  if(k*2+1<N*2-1) {  laz.set(k*2+1,h.apply(laz.get(k*2+1),laz.get(k)));  laz.set(k*2+2,h.apply(laz.get(k*2+2),laz.get(k)));  }  dat.set(k,g.apply(dat.get(k), p.apply(laz.get(k), len)));  laz.set(k,d0); }  T update(int a,int b,E x,int k,int l,int r) {  eval(r-l,k);  if(r<=a||b<=l) {  return dat.get(k);  }  if(a<=l&&r<=b) {  laz.set(k,h.apply(laz.get(k),x));  return g.apply(dat.get(k),p.apply(laz.get(k),r-l));  }  T vl = update(a,b,x,k*2+1,l,(l+r)/2);  T vr = update(a,b,x,k*2+2,(l+r)/2,r);  dat.set(k,f.apply(vl,vr));  return dat.get(k);  }  T update(int a,int b,E x) {  return update(a,b,x,0,0,N); }  T query(int a,int b,int k,int l,int r) {  eval(r-l,k);  if(r<=a||b<=l) return d1;  if(a<=l&&r<=b) return dat.get(k);  T vl = query(a,b,k*2+1,l,(l+r)/2);  T vr = query(a,b,k*2+2,(l+r)/2,r);  return f.apply(vl, vr); }  T query(int a,int b){  return query(a,b,0,0,N); } } class AddSumSegmentTree{ int N; int d1; ArrayList<Integer> dat; AddSumSegmentTree(int[] v){  int n = v.length;  init(n);  build(v); }  void init(int n) {  N = 1;  while(N<n)N*=2;  dat = new ArrayList<Integer>(); }  void build(int[] v) {  for(int i=0;i<2*N;i++) {  dat.add(d1);  }  for(int i=0;i<v.length;i++) {  dat.set(N+i-1,v[i]);  }  for(int i=N-2;i>=0;i--) {  dat.set(i,dat.get(i*2+1)+dat.get(i*2+2));  } }  void update(int k,int a) {  k += N-1;  dat.set(k,dat.get(k)+a);  while(k>0){  k = (k-1)/2;  dat.set(k,dat.get(k*2+1)+dat.get(k*2+2));  } }  int query(int a,int b, int k, int l ,int r) {  if(r<=a||b<=l) return d1;  if(a<=l&&r<=b) return dat.get(k);  int vl = query(a,b,k*2+1,l,(l+r)/2);  int vr = query(a,b,k*2+2,(l+r)/2,r);  return vl+vr; } int query(int a,int b){  return query(a,b,0,0,N); } } class AddSumLazySegmentTree { int N; long[] dat; long[] laz; AddSumLazySegmentTree(long[] v){  init(v.length);  for(int i=0;i<v.length;i++) {  dat[N+i-1]=v[i];  }  for(int i=N-2;i>=0;i--) {  dat[i]=dat[i*2+1]+dat[i*2+2];  } }  void init(int n) {  N = 1;  while(N<n)N*=2;  dat = new long[2*N];  laz = new long[2*N]; }  void eval(int len,int k) {  if(laz[k]==0) return;  if(k*2+1<N*2-1) {  laz[k*2+1] += laz[k];  laz[k*2+2] += laz[k];  }  dat[k] += laz[k] * len;  laz[k] = 0; }  long update(int a,int b,long x,int k,int l,int r) {  eval(r-l,k);  if(r<=a||b<=l) {  return dat[k];  }  if(a<=l&&r<=b) {  laz[k] += x;  return dat[k]+laz[k]*(r-l);  }  long vl = update(a,b,x,k*2+1,l,(l+r)/2);  long vr = update(a,b,x,k*2+2,(l+r)/2,r);  return dat[k] = vl+vr;  }  long update(int a,int b,long x) {  return update(a,b,x,0,0,N); }  long query(int a,int b,int k,int l,int r) {  eval(r-l,k);  if(r<=a||b<=l) return 0;  if(a<=l&&r<=b) return dat[k];  long vl = query(a,b,k*2+1,l,(l+r)/2);  long vr = query(a,b,k*2+2,(l+r)/2,r);  return vl+vr; }  long query(int a,int b){  return query(a,b,0,0,N); } } class BinaryIndexedTree{ int[] val; BinaryIndexedTree(int N){  val = new int[N+1]; } long sum(int i) {  if(i==0)return 0;  long s = 0;  while(i>0) {  s += val[i];  i -= i & (-i);  }  return s; } void add(int x,int i) {  if(i==0)return;  while(i<val.length){  val[i] += x;  i += i & (-i);  } } } 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 boolean isRoot(int x) {  return x==find(x); } public int extraEdge(int x) {  int r = find(x);  return edge[r] - size[r] + 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 ParticalEternalLastingUnionFindTree extends UnionFindTree{ int[] time; int now; ParticalEternalLastingUnionFindTree(int N){  super(N);  time = new int[N];  for(int i=0;i<N;i++) {  time[i] = 1000000007;  } }  public int find(int t,int i) {  if(time[i]>t) {  return i;  }else {  return find(t,root[i]);  } }  public void unite(int x,int y,int t) {  now = t;  x = find(t,x);  y = find(t,y);  if(x==y)return;  if(rank[x]<rank[y]){  root[x] = y;  size[y] += size[x];  time[x] = t;  }else{  root[y] = x;  size[x] += size[y];  if(rank[x]==rank[y]){   rank[x]++;  }  time[y] = t;  } }  public int sametime(int x,int y) {  if(find(now,x)!=find(now,y)) return -1;  int ok = now;  int ng = 0;  while(ok-ng>1) {  int mid = (ok+ng)/2;  if(find(mid,x)==find(mid,y)) {   ok = mid;  }else {   ng = mid;  }  }  return ok; }  } class Graph { ArrayList<Edge>[] list; int size; TreeSet<LinkEdge> Edges = new TreeSet<LinkEdge>(new LinkEdgeComparator());  @SuppressWarnings("unchecked") 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)); }  void addEgdes(int[] a,int[] b){  for(int i=0;i<a.length;i++){  list[a[i]].add(new Edge(b[i],1));  } }  void addWeighterEdges(int[] a ,int[] b ,int[] c){  for(int i=0;i<a.length;i++){  list[a[i]].add(new Edge(b[i],c[i]));  } }  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; } long[] bfs2(int[] d,int s){  long[] L = new long[size];  for(int i=0;i<size;i++){  L[i] = -1;  }  int p = 0;  L[s] = 0;  d[s] = p;  p++;  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[w]==-1){   d[w] = p;   p++;   L[w] = L[v] + c;   Q.add(w);   }  }  }  return L; }  int[] isTwoColor(){  int[] L = new int[size];  for(int i=0;i<size;i++){  L[i] = -1;  }  L[0] = 0;  ArrayDeque<Integer> Q = new ArrayDeque<Integer>();  Q.add(0);  while(!Q.isEmpty()){  int v = Q.poll();  for(Edge e:list[v]){   int w = e.to;   if(L[w]==-1){   L[w] = 1-L[v];   Q.add(w);   }else{   if(L[v]+L[w]!=1){    L[0] = -2;   }   }  }  }  return L; }  long[] dijkstra(int s){  long[] L = new long[size];  for(int i=0;i<size;i++){  L[i] = -1;  }  int[] v = new int[size];  L[s] = 0;  PriorityQueue<LongIntPair> Q = new PriorityQueue<LongIntPair>(new LongIntSampleComparator());  Q.add(new LongIntPair(0,s));  while(!Q.isEmpty()){   LongIntPair C = Q.poll();    if(v[C.b]==0){   L[C.b] = C.a;   v[C.b] = 1;   for(Edge D:list[C.b]) {   if(L[D.to]==-1||L[D.to]>L[C.b]+D.cost) {    L[D.to]=L[C.b]+D.cost;    Q.add(new LongIntPair(L[C.b]+D.cost,D.to));   }     }  }  }  return L; }  ArrayList<Graph> makeapart(){  ArrayList<Graph> ans = new ArrayList<Graph>();  boolean[] b = new boolean[size];  int[] num = new int[size];  for(int i=0;i<size;i++){  if(b[i])continue;  int sz = 0;  ArrayList<Integer> l = new ArrayList<Integer>();  ArrayDeque<Integer> Q = new ArrayDeque<Integer>();  Q.add(i);  b[i] = true;  while(!Q.isEmpty()){   int v = Q.poll();   num[v] = sz;   sz++;   l.add(v);   for(Edge e:list[v]){   if(!b[e.to]){    Q.add(e.to);    b[e.to] = true;   }   }  }  Graph H = new Graph(sz);  for(int e:l){   for(Edge E:list[e]){   H.addWeightedEdge(num[e],num[E.to],E.cost);   }  }  ans.add(H);  }  return ans; }  long[] bellmanFord(int s) {  long inf = 1000000000;  inf *= inf;  long[] d = new long[size];  boolean[] n = new boolean[size];  d[s] = 0;  for(int i=1;i<size;i++){  d[i] = inf;  d[i] *= d[i];  }  for(int i=0;i<size-1;i++){  for(int j=0;j<size;j++){   for(Edge E:list[j]){   if(d[j]!=inf&&d[E.to]>d[j]+E.cost){    d[E.to]=d[j]+E.cost;   }   }  }  }  for(int i=0;i<size;i++){  for(int j=0;j<size;j++){   for(Edge e:list[j]){   if(d[j]==inf) continue;   if(d[e.to]>d[j]+e.cost) {    d[e.to]=d[j]+e.cost;    n[e.to] = true;   }   if(n[j])n[e.to] = true;   }  }  }  for(int i=0;i<size;i++) {  if(n[i])d[i] = inf;  }  return d; }  long[][] WarshallFloyd(long[][] a){  int n = a.length;  long[][] ans = new long[n][n];  for(int i=0;i<n;i++) {  for(int j=0;j<n;j++) {   ans[i][j] = a[i][j]==0?(long)1e16:a[i][j];   if(i==j)ans[i][j]=0;  }  }  for(int k=0;k<n;k++) {  for(int i=0;i<n;i++) {   for(int j=0;j<n;j++) {   ans[i][j] = Math.min(ans[i][j],ans[i][k]+ans[k][j]);   }  }  }  return ans; } long[] maxtra(int s,long l){  long[] L = new long[size];  for(int i=0;i<size;i++){  L[i] = -1;  }  int[] v = new int[size];  L[s] = -1;  PriorityQueue<Pair> Q = new PriorityQueue<Pair>(new SampleComparator());  Q.add(new Pair(l,s));  while(!Q.isEmpty()){   Pair C = Q.poll();  if(v[(int)C.b]==0){   L[(int)C.b] = C.a;   v[(int) C.b] = 1;   for(Edge D:list[(int) C.b])Q.add(new Pair(Math.max(L[(int)C.b],D.cost),D.to));  }  }  return L; } long[] mintra(int s){  long[] L = new long[size];  for(int i=0;i<size;i++){  L[i] = -1;  }  int[] v = new int[size];  L[s] = s;  PriorityQueue<Pair> Q = new PriorityQueue<Pair>(new SampleComparator().reversed());  Q.add(new Pair(s,s));  while(!Q.isEmpty()){   Pair C = Q.poll();  if(v[(int)C.b]==0){   L[(int)C.b] = C.a;   v[(int) C.b] = 1;   for(Edge D:list[(int) C.b])Q.add(new Pair(Math.min(L[(int)C.b],D.cost),D.to));  }  }  return L; } long Kruskal(){  long r = 0;  for(int i=0;i<size;i++) {  for(Edge e:list[i]) {   Edges.add(new LinkEdge(e.cost,i,e.to));  }  }  UnionFindTree UF = new UnionFindTree(size);  for(LinkEdge e:Edges){  if(e.a>=0&&e.b>=0) {   if(!UF.same(e.a,e.b)){   r += e.L;   UF.unite(e.a,e.b);   }  }  }  return r; }  ArrayList<Integer> Kahntsort(){  ArrayList<Integer> ans = new ArrayList<Integer>();  PriorityQueue<Integer> q = new PriorityQueue<Integer>();  int[] in = new int[size];  for(int i=0;i<size;i++) {  for(Edge e:list[i])in[e.to]++;  }  for(int i=0;i<size;i++) {  if(in[i]==0)q.add(i);  }  while(!q.isEmpty()) {  int v = q.poll();  ans.add(v);  for(Edge e:list[v]) {   in[e.to]--;   if(in[e.to]==0)q.add(e.to);  }  }  for(int i=0;i<size;i++) {  if(in[i]>0)return new ArrayList<Integer>();  }  return ans; }  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 Tree extends Graph{  public Tree(int N) {  super(N); }  long[] tyokkei(){  long[][] a = bfs(0);  System.out.println();  int md = -1;  long m = 0;  for(int i=0;i<size;i++){  if(m<a[0][i]){   m = a[0][i];   md = i;  }  }  long[][] b = bfs(md);  int md2 = -1;  long m2 = 0;  for(int i=0;i<size;i++){  if(m2<b[0][i]){   m2 = b[0][i];   md2 = i;  }  }  long[] r = {m2,md,md2};  return 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; }  public int hashCode(){  return Objects.hash(L,a,b); } } class Edge{ int to; long cost;  Edge(int a,long b){  to = a;  cost = b; } } class LinkEdgeComparator implements Comparator<LinkEdge>{ public int compare(LinkEdge P, LinkEdge Q) {  long t = P.L-Q.L;  if(t==0){  if(P.a>Q.a){   return 1;  }else{   return P.b>Q.b?1:-1;     }  }  return t>=0?1:-1; } } class Triplet{ long a; long b; long c; Triplet(long p,long q,long r){  a = p;  b = q;  c = r; } public boolean equals(Object o){  Triplet O = (Triplet) o;  return O.a==this.a&&O.b==this.b&&O.c==this.c?true:false;   }  public int hashCode(){  return Objects.hash(a,b,c); } } class TripletComparator implements Comparator<Triplet>{ public int compare(Triplet P, Triplet Q) {  long t = P.a-Q.a;  if(t==0){  long tt = P.b-Q.b;  if(tt==0) {   if(P.c>Q.c) {   return 1;   }else if(P.c<Q.c){   return -1;   }else {   return 0;   }  }  return tt>0?1:-1;  }  return t>=0?1:-1; } } 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; }  public int hashCode(){  return Objects.hash(a,b); } } class SampleComparator implements Comparator<Pair>{ public int compare(Pair P, Pair Q) {  long t = P.a-Q.a;  if(t==0){  return P.b>=Q.b?1:-1;  }  return t>=0?1:-1; } }  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;  }  public int hashCode(){  return Objects.hash(a,b); } } class LongIntSampleComparator implements Comparator<LongIntPair>{ public int compare(LongIntPair P, LongIntPair Q) {  long t = P.a-Q.a;  if(t==0){  if(P.b>Q.b){   return 1;  }else{   return -1;  }  }  return t>=0?1:-1; } }  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;   }  public int hashCode(){  return Objects.hash(a,b); } }  class IntIntSampleComparator implements Comparator<IntIntPair>{ public int compare(IntIntPair P, IntIntPair Q) {  int t = P.a-Q.a;  if(t==0){  return P.b-Q.b;  }  return t; } }   class DoublePair{ double a; double b;  DoublePair(double p,double 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;   }  public int hashCode(){  return Objects.hash(a,b); } } class DDSampleComparator implements Comparator<DoublePair>{ public int compare(DoublePair P, DoublePair Q) {  return P.b-Q.b>=0?1:-1; } } 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;   }  public int hashCode(){  return Objects.hash(a,b,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;}  private static 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 char nextChar() {  return next().charAt(0);  }  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();   }  }  public int[] nextInts(int n) {  int[] a = new int[n];  for(int i=0;i<n;i++) {   a[i] = nextInt();  }  return a;  }  public long[] nextLongs(int n) {  long[] a = new long[n];  for(int i=0;i<n;i++) {   a[i] = nextLong();  }  return a;  }  public int[][] nextIntses(int n,int m){  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;  } }  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;  int color(int[][] diff,int N) {   int[] val = new int[1<<N];  val[0] = 1;  for(int i=0;i<(1<<N);i++) {   for(int j=0;j<N;j++) {   if(contains(i,j)) {   if(val[bitremove(i,j)]==1) {    boolean b = true;    for(int k=0;k<N;k++) {    if(contains(i,k)&&diff[j][k]==1) {     b = false;    }    }    if(b)val[i] = 1;   }   break;   }  }  }  int[] dp = new int[1<<N];  Arrays.fill(dp,mod);;  dp[0] = 0;  for(int i=0;i<(1<<N);i++) {  for(int j=i;j>0;j=(j-1)&i) {   if(val[j]==1)dp[i]=Math.min(dp[i],dp[i^j]+1);  }  }  return dp[(1<<N)-1]; }  public DoubleTriplet Line(double x1,double y1,double x2,double y2) {  double a = y1-y2;  double b = x2-x1;  double c = x1*y2-x2*y1;  return new DoubleTriplet(a,b,c); } public double putx(DoubleTriplet T,double x) {  return -(T.a*x+T.c)/T.b; } public double puty(DoubleTriplet T,double y) {  return -(T.b*y+T.c)/T.a; } public double DistanceofPointandLine(DoublePair P,Triplet T) {  return Math.abs(P.a*T.a+P.b*T.b+T.c) / Math.sqrt(T.a*T.a+T.b*T.b); } public boolean cross(long ax, long ay, long bx, long by, long cx, long cy, long dx, long dy) {  long ta = (cx - dx) * (ay - cy) + (cy - dy) * (cx - ax);  long tb = (cx - dx) * (by - cy) + (cy - dy) * (cx - bx);  long tc = (ax - bx) * (cy - ay) + (ay - by) * (ax - cx);  long td = (ax - bx) * (dy - ay) + (ay - by) * (ax - dx);  return((tc>=0&&td<=0)||(tc<=0&&td>=0))&&((ta>=0&&tb<=0)||(ta<=0&&tb>=0)); } public boolean dcross(double ax, double ay, double bx, double by, double cx, double cy, double dx, double dy) {  double ta = (cx - dx) * (ay - cy) + (cy - dy) * (cx - ax);  double tb = (cx - dx) * (by - cy) + (cy - dy) * (cx - bx);  double tc = (ax - bx) * (cy - ay) + (ay - by) * (ax - cx);  double td = (ax - bx) * (dy - ay) + (ay - by) * (ax - dx);  return((tc>=0&&td<=0)||(tc<=0&&td>=0))&&((ta>=0&&tb<=0)||(ta<=0&&tb>=0)); }  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 long[] buildrui(int[] a) {  int n = a.length;  long[] ans = new long[n];  ans[0] = a[0];  for(int i=1;i<n;i++) {  ans[i] = ans[i-1] + a[i];  }  return ans; } public long[][] buildrui(int[][] a) {  int n = a.length;  int m = a[0].length;  long[][] ans = new long[n][m];  for(int i=1;i<n;i++) {  for(int j=1;j<m;j++) {   ans[i][j] = a[i][j];  }  }  for(int i=1;i<n;i++) {  for(int j=1;j<m;j++) {   ans[i][j] += ans[i][j-1] + ans[i-1][j] - ans[i-1][j-1];  }  }  return ans; } long divroundup(long n,long d) {  if(n==0)return 0;  return (n-1)/d+1; } public long sigma(long i) {  return i*(i+1)/2; } public int digit(long i) {  int ans = 1;  while(i>=10) {  i /= 10;  ans++;  }  return ans;  } public int popcount(int i) {  int ans = 0;  while(i>0) {  ans += i%2;  i /= 2;  }  return ans; } 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);} public boolean isSubSet(int S,int T) {return (S-T)==(S^T);} public boolean isDisjoint(int S,int T) {return (S+T)==(S^T);} public int isBigger(int[] d, int i) {  int ok = d.length;  int ng = -1;  while(Math.abs(ok-ng)>1) {  int mid = (ok+ng)/2;  if(d[mid]>i) {   ok = mid;  }else {   ng = mid;  }  }  return ok; } public int isSmaller(int[] d, int i) {  int ok = -1;  int ng = d.length;  while(Math.abs(ok-ng)>1) {  int mid = (ok+ng)/2;  if(d[mid]<i) {   ok = mid;  }else {   ng = mid;  }  }  return ok; } public int isBigger(long[] d, long i) {  int ok = d.length;  int ng = -1;  while(Math.abs(ok-ng)>1) {  int mid = (ok+ng)/2;  if(d[mid]>i) {   ok = mid;  }else {   ng = mid;  }  }  return ok; } public int isSmaller(long[] d, long i) {  int ok = -1;  int ng = d.length;  while(Math.abs(ok-ng)>1) {  int mid = (ok+ng)/2;  if(d[mid]<i) {   ok = mid;  }else {   ng = mid;  }  }  return ok; } public int isBigger(ArrayList<Long> d, long i) {  int ok = d.size();  int ng = -1;  while(Math.abs(ok-ng)>1) {  int mid = (ok+ng)/2;  if(d.get(mid)>i) {   ok = mid;  }else {   ng = mid;  }  }  return ok; } public int isSmaller(ArrayList<Long> d, long i) {  int ok = -1;  int ng = d.size();  while(Math.abs(ok-ng)>1) {  int mid = (ok+ng)/2;  if(d.get(mid)<i) {   ok = mid;  }else {   ng = mid;  }  }  return ok; } public HashSet<Integer> primetable(int m) {  HashSet<Integer> pt = new HashSet<Integer>();  for(int i=2;i<=m;i++) {  boolean b = true;  for(int d:pt) {   if(i%d==0) {   b = false;   break;   }  }  if(b) {   pt.add(i);  }  }  return pt; } public ArrayList<Integer> primetablearray(int m) {  ArrayList<Integer> al = new ArrayList<Integer>();  Queue<Integer> q = new ArrayDeque<Integer>();  for(int i=2;i<=m;i++) {  q.add(i);    }  boolean[] b = new boolean[m+1];  while(!q.isEmpty()) {  int e = q.poll();  if(!b[e]) {   al.add(e);   for(int j=1;e*j<=1000000;j++) {   b[e*j] = true;   }  }  }  return al; } public HashMap<Integer,Integer> hipPush(ArrayList<Integer> l){  HashMap<Integer,Integer> r = new HashMap<Integer,Integer>();  TreeSet<Integer> s = new TreeSet<Integer>();  for(int e:l)s.add(e);  int p = 0;  for(int e:s) {  r.put(e,p);  p++;  }  return r; } public TreeMap<Integer,Integer> thipPush(ArrayList<Integer> l){  TreeMap<Integer,Integer> r = new TreeMap<Integer,Integer>();  Collections.sort(l);  int b = -(mod+9393);  int p = 0;  for(int e:l) {  if(b!=e) {   r.put(e,p);   p++;  }  b=e;  }  return r; }  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 sum(long[] a){  long s = 0;  for(int i=0;i<a.length;i++)s += a[i];  return s; } long sum(int[] a){  long s = 0;  for(int i=0;i<a.length;i++)s += a[i];  return s; } 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); } long lcm(long a, long b) {return a / gcd(a,b) * b;} public long perm(int a,int num) {  if(!isBuild)buildFac();  return fac[a]*(rev(fac[a-num]))%mod; } void buildComb(int N) {  comb = new long[N+1][N+1];  comb[0][0] = 1;  for(int i=1;i<=N;i++) {  comb[i][0] = 1;  for(int j=1;j<N;j++) {   comb[i][j] = comb[i-1][j-1]+comb[i-1][j];   if(comb[i][j]>mod)comb[i][j]-=mod;  }  comb[i][i] = 1;  } } 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 mulchoose(int n,int k) {  if(k==0) return 1;  return comb(n+k-1,k); } 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;  } } }
4	public class a{  static BufferedReader br;  static PrintWriter pw;  static int N, M, K;  static ArrayList<Integer> graph[][];  public static void main(String args[]) throws IOException{   br = new BufferedReader(new InputStreamReader(System.in));   pw = new PrintWriter(System.out);   StringTokenizer st = new StringTokenizer(br.readLine());   N = Integer.parseInt(st.nextToken());   M = Integer.parseInt(st.nextToken());   K = Integer.parseInt(st.nextToken());   if(K % 2 == 1){    for(int i = 0; i < N; i++){     for(int j = 0; j < M; j++){      pw.print("-1 ");     }     pw.println();    }    br.close(); pw.close();    return;   }   graph = new ArrayList[N][M];   for(int i = 0; i < N; i++){    for(int j = 0; j < M; j++){     graph[i][j] = new ArrayList<Integer>();    }   }   for(int i = 0; i < N; i++){    st = new StringTokenizer(br.readLine());    for(int j = 0; j < M-1; j++){     int w = Integer.parseInt(st.nextToken());     graph[i][j].add(w);    }   }   for(int i = 0; i < N; i++){    graph[i][M-1].add(0);   }   for(int i = 0; i < N-1; i++){    st = new StringTokenizer(br.readLine());    for(int j = 0; j < M; j++){     int w = Integer.parseInt(st.nextToken());     graph[i][j].add(w);    }   }   K /= 2;   for(int i = 0; i < M; i++) graph[N-1][i].add(0);   long ans[][][] = new long[K+1][N][M];   for(int i = 0; i < N; i++){    Arrays.fill(ans[0][i], 0);   }   for(int i = 1; i <= K; i++){    for(int x = 0; x < N; x++){     for(int y = 0; y < M; y++){      long cur = (long)1e17;      if(x < N-1){       cur = (long)Math.min(cur, graph[x][y].get(1) + ans[i-1][x+1][y]);      }      if(y < M-1){       cur = (long)Math.min(cur, graph[x][y].get(0) + ans[i-1][x][y+1]);      }      if(x > 0){       cur = (long)Math.min(cur, graph[x-1][y].get(1) + ans[i-1][x-1][y]);            }      if(y > 0){       cur = (long)Math.min(cur, graph[x][y-1].get(0) + ans[i-1][x][y-1]);      }      ans[i][x][y] = cur;     }    }   }   for(int i = 0; i < N; i++){    for(int j = 0; j < M; j++){     pw.print(ans[K][i][j] * 2 + " ");    }    pw.println();   }   br.close(); pw.close();  }  static class pii implements Comparable<pii>{   int f, s, k;   pii(int f, int s, int k){    this.f = f;    this.s = s;    this.k = k;   }   public int compareTo(pii x){    return Integer.compare(f, x.f);   }  } }
2	public class P {  public static void main(String[] args) throws NumberFormatException, IOException {  Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out);  int N = sc.nextInt(), x = sc.nextInt(), y = sc.nextInt();  long C = sc.nextLong();  int lo = 0, hi = (int) (1e6);  int answer = -1;  while (lo <= hi) {  int L = lo + (hi - lo) / 2;  long area = 0;  for (int steps = 0; steps <= L; ++steps) {   if (y + steps > N)   break;   long up = Math.min(x, 1 + L - steps), down = Math.min(N - x, L - steps);   area += up + down;  }   for (int steps = 1; steps <= L; ++steps) {   if (y - steps < 1)   break;   long up = Math.min(x, 1 + L - steps), down = Math.min(N - x, L - steps);   area += up + down;  }  if (area >= C) {   answer = L;   hi = L - 1;  } else   lo = L + 1;  }  out.println(answer);  out.flush();  out.close(); }  static class Scanner {  BufferedReader br;  StringTokenizer st;  Scanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  Scanner(String file) throws FileNotFoundException {  br = new BufferedReader(new FileReader(file));  }  String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(next());  }  String nextLine() throws IOException {  return br.readLine();  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  } }
2	public class 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();  }   int nextInt()  {   return Integer.parseInt(next());  }   long nextLong()  {   return Long.parseLong(next());  }   double nextDouble()  {   return Double.parseDouble(next());  }   String nextLine()  {   String str = "";   try  {   str = br.readLine();   }   catch (IOException e)   {   e.printStackTrace();   }   return str;  }  }  public static void main(String[] args)  {   FastReader sc = new FastReader();      double n = (double)sc.nextLong();   double k = (double)sc.nextLong();     double div = 9+8*n+8*k;   double ss = Math.sqrt(div);      ss = (ss-3)/2;   System.out.println( (int)(n-ss) ); } }
1	public class B {  public static void main(String[] args) throws Exception {   new B().solve();  }   void solve() throws IOException {   BufferedReader in = new BufferedReader(new     InputStreamReader(System.in));        String[] sp = in.readLine().split(" ");     int n = Integer.parseInt(sp[0]);   int k = Integer.parseInt(sp[1]);   int[] a = new int[n];   sp = in.readLine().split(" ");   for (int i = 0; i < n; i++) {    a[i] = Integer.parseInt(sp[i]);   }     HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();   int r = 0;   map.put(a[r], 1);   while (map.size() < k) {    r++;    if (r == n) {         System.out.println("-1 -1");     return;    }    if (map.containsKey(a[r])) {     map.put(a[r], map.get(a[r]) + 1);    } else {     map.put(a[r], 1);    }   }   int l = 0;   while (map.get(a[l]) > 1) {    map.put(a[l], map.get(a[l]) - 1);    l++;   }   System.out.println((l + 1) + " " + (r + 1));  } }
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;  }  public int compareTo(S s){   return this.loyal - s.loyal;  } }
4	public class C {  public static void main(String[] args) throws FileNotFoundException {   Scanner in = new Scanner(new FileReader(new File("input.txt")));   PrintWriter out = new PrintWriter(new File("output.txt"));   int n = in.nextInt();   int m = in.nextInt();   int[][] T = new int[n][m];   int k = in.nextInt();   int[] X = new int[k];   int[] Y = new int[k];   for (int i = 0; i < k; i++) {    X[i] = in.nextInt() - 1;    Y[i] = in.nextInt() - 1;   }   int max = 0;   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++) {     int min = Integer.MAX_VALUE;     for (int ii = 0; ii < k; ii++)      min = Math.min(min,        Math.abs(i - X[ii]) + Math.abs(j - Y[ii]));     max = Math.max(max, T[i][j] = min);    }   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     if (T[i][j] == max) {      out.println((i + 1) + " " + (j + 1));      out.flush();      return;     }  } }
2	public class A { BufferedReader in;  PrintWriter out; StringTokenizer st;   public String next() {  while (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(in.readLine());  } catch(Exception e) {}  }  return st.nextToken(); }  public int nextInt() {  return Integer.parseInt(next());  } public long nextLong() {  return Long.parseLong(next()); }  boolean bit(int m, int i) {  return (m & (1 << i)) > 0;  }  int n, x, y, c;   long cnt(int m) {  long ret=0;  for (int i=max(1, y-m); i<=min(n, y+m); i++) {   int x1 = max(1, x - (m - abs(i - y)));   int x2 = min(n, x + (m - abs(i - y)));   ret += x2 - x1 + 1;   }  return ret;  }  public void run() {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  n = nextInt();  x = nextInt();  y = nextInt();  c = nextInt();  int l = 0, r = 1000000;  int ans=0;  while (l <= r) {  int m = (l+r) / 2;   if (cnt(m) >= c) {   ans = m;   r = m-1;   } else l=m+1;  }   out.println(ans);  out.close();  }  class Pair implements Comparable<Pair> {  long x,y;  public Pair(long x, long y) {  this.x=x;   this.y=y;  }  public int compareTo(Pair o) {  if (x != o.x) return sign(o.x - x);   return sign(y - o.y);  } }  int sign(long x) {  if (x < 0) return -1;  if (x > 0) return 1;  return 0; }  public static void main(String[] args) throws Exception {  new A().run();   } }
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();  } }
3	public class Main { public static void main (String[] args) throws java.lang.Exception {  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  int n=Integer.parseInt(br.readLine());  int[] A=new int[n];  String[] s=br.readLine().split(" ");  for(int i=0;i<n;i++){  A[i]=Integer.parseInt(s[i]);  }   int inv=0;  for(int i=0;i<n;i++){  for(int j=i+1;j<n;j++){   if(A[i]>A[j]){   inv++;   }  }  }  StringBuilder sb=new StringBuilder("");  int m=Integer.parseInt(br.readLine());  for(int i=0;i<m;i++){  s=br.readLine().split(" ");  int li=Integer.parseInt(s[0]);  int ri=Integer.parseInt(s[1]);  int tot=ri-li+1;  inv=inv+tot*(tot-1)/2;  if(inv%2==0){   sb.append("even\n");  }  else{   sb.append("odd\n");  }  }  System.out.print(sb); } }
4	public class Solution {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new FileReader("input.txt"));   PrintWriter out = new PrintWriter("output.txt");   String[] raw = in.readLine().split(" ");   int n = Integer.parseInt(raw[0]);   int m = Integer.parseInt(raw[1]);   int k = Integer.parseInt(in.readLine());   raw = in.readLine().split(" ");   boolean[][] map = new boolean[n][m];   LinkedList<Point> queue = new LinkedList<>();   for (int i = 0; i < k; i++) {    Point fireStarter = new Point(Integer.parseInt(raw[i * 2]) - 1, Integer.parseInt(raw[i * 2 + 1]) - 1);    queue.addLast(fireStarter);   }   int treesLeft = n * m;   while (true) {    Point firepoint = queue.removeFirst();    if (map[firepoint.x][firepoint.y])     continue;    treesLeft--;    map[firepoint.x][firepoint.y] = true;    if (treesLeft == 0) {     out.printf("%d %d", firepoint.x + 1, firepoint.y + 1);     out.flush();     return;    }    if (firepoint.x > 0 && !map[firepoint.x - 1][firepoint.y])     queue.add(new Point(firepoint.x - 1, firepoint.y));    if (firepoint.y > 0 && !map[firepoint.x][firepoint.y - 1])     queue.add(new Point(firepoint.x, firepoint.y - 1));    if (firepoint.x < n - 1 && !map[firepoint.x + 1][firepoint.y])     queue.add(new Point(firepoint.x + 1, firepoint.y));    if (firepoint.y < m - 1 && !map[firepoint.x][firepoint.y + 1])     queue.add(new Point(firepoint.x, firepoint.y + 1));       }  }  private static class Point {   public int x;   public int y;   public Point(int x, int y) {    this.x = x;    this.y = y;   }  } }
2	public class Main implements Runnable {  public static void main(String[] args) {   new Thread(null, new Main(), "Check2", 1 << 28).start();  }  static long mod = (long) (1e9 + 7);  public void run() {   InputReader in = new InputReader(System.in);   PrintWriter w = new PrintWriter(System.out);    long n = in.nextLong();   long k = in.nextLong();   long ans= 0;   for (long i=1;i<=Math.min(100000,n);i++){    long left = i;    long right = n-i;    long sum = left * (left + 1);    sum /= 2;    if (sum - right ==k){     ans = right;    }   }   w.println(ans);   w.close();  }  void debug(Object...args) {   System.out.println(Arrays.deepToString(args));  }  static class pair implements Comparable<pair>{   int a;   int b;   pair(int a,int b){    this.a = a;    this.b = b;   }   public int compareTo(pair o){    if(this.b != o.b)return this.b - o.b;    return this.a - o.a;   }  }  long modinv(long a,long b) {   long p=power(b,mod-2,mod);   p=a%mod*p%mod;   p%=mod;   return p;  }  long power(long x,long y,long mod){   if(y==0)return 1%mod;   if(y==1)return x%mod;   long res=1;   x=x%mod;   while(y>0)   {    if((y%2)!=0){     res=(res*x)%mod;    }    y=y/2;    x=(x*x)%mod;   }   return res;  }  long gcd(long a,long b){   if(b==0)return a;   return gcd(b,a%b);  }  void sev(int a[],int n){   for(int i=2;i<=n;i++)a[i]=i;   for(int i=2;i<=n;i++){    if(a[i]!=0){     for(int j=2*i;j<=n;){      a[j]=0;      j=j+i;     }    }   }  }  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 stock = "";    try    {     stock = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return stock;   }   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);   }  } }
5	public class CF22_1 {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);   int num=sc.nextInt();  if(num!=1)  {   ArrayList<Integer>data=new ArrayList<Integer>();   for (int i=0;i<num;i++){    data.add(sc.nextInt());      }   Collections.sort(data);     int ind=1;    while( data.get(ind-1)==data.get(ind) )    {    ind++;    if(ind ==data.size())     break;    }     if(data.size()>ind)   System.out.println(data.get(ind));   else    System.out.println("NO");       }  else   System.out.println("NO");  }  }
6	public class Main { private static StreamTokenizer in; private static PrintWriter out; static {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(   System.in)));  out = new PrintWriter(System.out); }  private static int nextInt() throws Exception {  in.nextToken();  return (int) in.nval; }  private static double nextDouble() throws Exception {  in.nextToken();  return in.nval; }  private static String nextString() throws Exception {  in.nextToken();  return in.sval; }  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(); } }
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));}  } }
6	public class c8 {  static int n;  static int[] ds;  static int[][] g; public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int x = input.nextInt(), y = input.nextInt();  n = input.nextInt();  int[] xs = new int[n], ys = new int[n];  for(int i = 0; i<n; i++)  {   xs[i] = input.nextInt();   ys[i] = input.nextInt();  }  ds = new int[n];  g = new int[n][n];  for(int i = 0; i<n; i++)  {   ds[i] = (x - xs[i]) * (x - xs[i]) + (y - ys[i]) * (y - ys[i]);   for(int j = 0; j<n; j++)   {    g[i][j] = (xs[i] - xs[j]) * (xs[i] - xs[j]) + (ys[i] - ys[j]) * (ys[i] - ys[j]);   }  }  int[] dp = new int[1<<n];  Arrays.fill(dp, 987654321);  dp[0] = 0;  for(int i = 0; i<(1<<n); i++)  {   if(dp[i] == 987654321) continue;   for(int a = 0; a<n; a++)   {    if((i & (1<<a)) > 0) continue;    dp[i | (1<<a)] = Math.min(dp[i | (1<<a)], dp[i] + 2*ds[a]);    for(int b = a+1; b<n; b++)    {     if((i & (1<<b)) > 0) continue;     dp[i | (1<<a) | (1<<b)] = Math.min(dp[i | (1<<a) | (1<<b)], dp[i] + ds[a] + ds[b] + g[a][b]);    }    break;   }  }  Stack<Integer> stk = new Stack<Integer>();  stk.add(0);  int i = (1<<n) - 1;    trace:  while(i > 0)  {     for(int a = 0; a<n; a++)   {    if((i & (1<<a)) == 0) continue;    if( dp[i] == dp[i - (1<<a)] + 2*ds[a])    {     stk.add(a+1);     stk.add(0);     i -= (1<<a);     continue trace;    }    for(int b = a+1; b<n; b++)    {     if((i & (1<<b)) == 0) continue;     if(dp[i] == dp[i - (1<<a) - (1<<b)] + ds[a] + ds[b] + g[a][b])     {      stk.add(a+1);      stk.add(b+1);      stk.add(0);      i -= (1<<a) + (1<<b);      continue trace;     }    }      }  }  System.out.println(dp[(1<<n) - 1]);  while(!stk.isEmpty()) System.out.print(stk.pop()+" "); } }
4	public class CF {  class W implements Comparable<W> {  int id, sz;  W(int id, int sz) {  this.id = id;  this.sz = sz;  }  @Override  public int compareTo(W o) {  return -Integer.compare(sz, o.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(); }  void runWithFiles() {  in = new FastScaner(new File("input.txt"));  try {  out = new PrintWriter(new File("output.txt"));  } catch (FileNotFoundException e) {  e.printStackTrace();  }  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());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  } } }
0	public class Main { public static void main(String args[]) throws IOException {  BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));  String line = stdin.readLine();  String[] prms = line.split(" ");   long a = Long.parseLong(prms[0]);  long b = Long.parseLong(prms[1]);   long cnt = 0;  while (a > 0 && b > 0) {  if (a >= b) {   cnt += a / b;   a = a % b;  }  long c = a;  a = b;  b = c;  }   System.out.println(cnt); } }
6	public class CodeD { 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());  }   public double nextDouble()  {  return Double.parseDouble(next());  }   public int[] nextIntArray(int n)  {  int[] res = new int[n];  for(int i = 0; i < res.length; i++)   res[i] = nextInt();  return res;  }   public long[] nextLongArray(int n)  {  long[] res = new long[n];  for(int i = 0; i < res.length; i++)   res[i] = nextLong();  return res;  }   public double[] nextDoubleArray(int n)  {  double[] res = new double[n];  for(int i = 0; i < res.length; i++)   res[i] = nextLong();  return res;  }  public void sortIntArray(int[] array)  {  Integer[] vals = new Integer[array.length];  for(int i = 0; i < array.length; i++)   vals[i] = array[i];  Arrays.sort(vals);  for(int i = 0; i < array.length; i++)   array[i] = vals[i];  }   public void sortLongArray(long[] array)  {  Long[] vals = new Long[array.length];  for(int i = 0; i < array.length; i++)   vals[i] = array[i];  Arrays.sort(vals);  for(int i = 0; i < array.length; i++)   array[i] = vals[i];  }   public void sortDoubleArray(double[] array)  {  Double[] vals = new Double[array.length];  for(int i = 0; i < array.length; i++)   vals[i] = array[i];  Arrays.sort(vals);  for(int i = 0; i < array.length; i++)   array[i] = vals[i];  } } static final Scanner sc; static final int n; static final int[][] distancias; static final int[] distancia; static final int[] dp; static final int[] dpNext; static final int X; static final int Y;  static {  sc = new Scanner();  X = sc.nextInt();  Y = sc.nextInt();  n = sc.nextInt();  distancias = new int[n][n];  distancia = new int[n];  dp = new int[1 << n];  Arrays.fill(dp, -1);  dpNext = new int[1 << n]; }   static int dp(int mascara) {  if(dp[mascara] != -1)  return dp[mascara];  int highest = -1;  for(int i = 0, tmp = mascara; tmp != 0; i++, tmp >>= 1)  {  if((tmp & 1) == 1)   highest = i;  }  if(highest == -1)  return 0;  int nextMsc = mascara ^ (1 << highest);  int costHighest = distancia[highest];  int best = (costHighest << 1) + dp(nextMsc);  int bestNext = nextMsc;  for(int i = 0, tmp = nextMsc, iC = 1; tmp != 0; i++, tmp >>= 1, iC <<= 1)  {  if((tmp & 1) == 1)  {   int msc = nextMsc ^ iC;   int possibleA = costHighest + distancias[highest][i] + distancia[i] + dp(msc);   if(possibleA < best)   {   best = possibleA;   bestNext = msc;   }  }  }  dpNext[mascara] = bestNext;  return dp[mascara] = best;   } public static void main(String[] args) {  int[][] objetos = new int[n][2];  for(int i = 0; i < n; i++)  {  objetos[i][0] = sc.nextInt();  objetos[i][1] = sc.nextInt();  distancia[i] = (X - objetos[i][0]) * (X - objetos[i][0]) + (Y - objetos[i][1]) * (Y - objetos[i][1]);  }  for(int i = 0; i < n; i++)  for(int j = 0; j < n; j++)   distancias[i][j] = (objetos[i][0] - objetos[j][0]) * (objetos[i][0] - objetos[j][0]) + (objetos[i][1] - objetos[j][1]) * (objetos[i][1] - objetos[j][1]);  int ans = dp((1 << n) - 1);  System.out.println(ans);  int current = (1 << n) - 1;  while(current != 0)  {  int next = dpNext[current];  int differents = next ^ current;  System.out.print("0 ");  for(int i = 0; i < n; i++)   if((differents & (1 << i)) != 0)   System.out.print((i + 1) + " ");  current = next;  }  System.out.println("0"); } }
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);  }  }
2	public class B { public static void main(String[] args) {  MScanner sc = new MScanner();  PrintWriter out = new PrintWriter(System.out);  long N = sc.nextLong();  long X = sc.nextLong();  long Y = sc.nextLong();  long C = sc.nextLong();  long low = 0;  long high = N*2;  long mid = 0;  long ans = 0;  while (low <= high) {  mid = (low + high) >> 1;  long painted = F(mid, X-1, Y-1, N);  if (painted < C) {   low = mid + 1;  } else {   ans = mid;   high = mid - 1;  }  }  out.println(ans);  out.close();  }  private static long F(long mid, long x, long y, long n) {  long base = 2 * mid * (mid + 1) + 1;  base -= excess(mid - x);  base -= excess(mid - y);  base -= excess(mid - (n-1-x));  base -= excess(mid - (n-1-y));  base += corner(mid - (x + y + 1));  base += corner(mid - (x + (n - y - 1) + 1));  base += corner(mid - ((n - x - 1) + y + 1));  base += corner(mid - (1 + (n - 1 - y) + (n - 1 - x)));  return base; }  private static long corner(long a) {  if (a < 0)return 0;  return (a * a + a) >> 1; }  private static long excess(long thing) {  if(thing<0)return 0;  return thing * thing; }  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;  }  } }
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{ static final double eps = 1e-10; public static void main(String []args){  Scanner cin = new Scanner(System.in);  double a,v;  double l,d,w;  double time;   a = cin.nextDouble();  v = cin.nextDouble();   l = cin.nextDouble();  d = cin.nextDouble();  w = cin.nextDouble();   if(v < w + eps)  {  double t1 = v / a;  double len_bond = (v * v) / (2 * a);  if(len_bond + eps > l)  {   time = Math.sqrt(2 * l / a);  }  else  {   double t2 = (l - len_bond) / v;   time = t1 + t2;  }  System.out.println(time);  }  else  {  double len_bondv = (v * v) / (2 * a);  double len_bondw = (w * w) / (2 * a);  if(len_bondw + eps > d)  {   if(len_bondv + eps > l)   time = Math.sqrt(2 * l / a);   else{   double t1 = v / a;   double t2 = (l - len_bondv) / v;   time = t1 + t2;   }  }  else  {   double len_bonds = (v * v - w * w) / (2 * a);     if(len_bondv + len_bonds < d + eps)   time = v / a + (d - len_bondv - len_bonds) / v + (v - w) / a;   else   {   double f = Math.sqrt(d * a + w * w / 2);   time = f / a + (f - w) / a;   }   if (len_bonds + eps > l - d) {   double lv = Math.sqrt((l - d) * 2 * a + w * w);   time += (lv - w) / a;   } else {   time += (v - w) / a + (l - d - len_bonds) / v;   }  }    System.out.println(time);  } } }
5	public class Test {  public static void main(String[] args) throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   String[] line = reader.readLine().split(" ");   int w = Integer.valueOf(line[0]);   int h = Integer.valueOf(line[1]);   int n = Integer.valueOf(line[2]);   Request[] requests = new Request[n];   for (int i = 0; i < n; i++) {    line = reader.readLine().split(" ");    requests[i] = new Request(line[0], Integer.valueOf(line[1]));   }   for (long e : solve(h, w, requests))    System.out.println(e);      }  private static Request[] generate(int w, int h, int n) {   Request[] requests = new Request[n];   Random rnd = new Random();   for (int i = 0; i < n; i++) {    requests[i] = rnd.nextBoolean() ? new Request("V", rnd.nextInt(w)) : new Request("H", rnd.nextInt(h));   }   return requests;  }  private static long[] solve(int h, int w, Request[] requests) {   TreeSet<Integer> hTree = new TreeSet<>();   TreeSet<Integer> wTree = new TreeSet<>();   Queue<CoordinateWithSize> hHeap = new PriorityQueue<>();   Queue<CoordinateWithSize> wHeap = new PriorityQueue<>();   hTree.add(0);   hTree.add(h);   wTree.add(0);   wTree.add(w);   hHeap.add(new CoordinateWithSize(0, h));   wHeap.add(new CoordinateWithSize(0, w));   long[] res = new long[requests.length];   for (int i = 0; i < requests.length; i++) {    Request request = requests[i];    switch (request.type) {     case "H": {      if (!hTree.contains(request.coordinate)) {       int higher = hTree.higher(request.coordinate);       int lower = hTree.lower(request.coordinate);       hHeap.add(new CoordinateWithSize(lower, request.coordinate - lower));       hHeap.add(new CoordinateWithSize(request.coordinate, higher - request.coordinate));       hTree.add(request.coordinate);      }      break;     }     case "V": {      if (!wTree.contains(request.coordinate)) {       int higher = wTree.higher(request.coordinate);       int lower = wTree.lower(request.coordinate);       wHeap.add(new CoordinateWithSize(lower, request.coordinate - lower));       wHeap.add(new CoordinateWithSize(request.coordinate, higher - request.coordinate));       wTree.add(request.coordinate);      }      break;     }     default:      throw new IllegalStateException("Unknown type [type=" + request.type + "]");    }    while (true) {     CoordinateWithSize c = hHeap.peek();     if (hTree.higher(c.coordinate) - c.coordinate == c.size)      break;     hHeap.remove();    }    while (true) {     CoordinateWithSize c = wHeap.peek();     if (wTree.higher(c.coordinate) - c.coordinate == c.size)      break;     wHeap.remove();    }    res[i] = 1L * hHeap.peek().size * wHeap.peek().size;   }   return res;  }  private static class CoordinateWithSize implements Comparable<CoordinateWithSize> {   private final int coordinate;   private final int size;   public CoordinateWithSize(int coordinate, int size) {    this.coordinate = coordinate;    this.size = size;   }   @Override public int compareTo(CoordinateWithSize o) {    return Integer.compare(o.size, size);   }  }  private static class Request {   private final String type;   private final int coordinate;   public Request(String type, int coordinate) {    this.type = type;    this.coordinate = coordinate;   }  } }
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; } }
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());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }  }  static class card {   long a;   int cnt;   int i;   public card(long a, int cnt, int i) {    this.a = a;    this.cnt = cnt;    this.i = i;   }  }  static class ascend implements Comparator<pair> {   public int compare(pair o1, pair o2) {    return o1.a - o2.a;   }  }  static class extra {   static boolean v[] = new boolean[100001];   static List<Integer> l = new ArrayList<>();   static int t;   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);   }   static long gcd(long a, long b) {    if (b == 0)     return a;    else     return gcd(b, a % b);   }   static boolean valid(int i, int j, int r, int c) {    if (i >= 0 && i < r && j >= 0 && j < c)     return true;    else     return false;   }   static void seive() {    for (int i = 2; i < 100001; i++) {     if (!v[i]) {      t++;      l.add(i);      for (int j = 2 * i; j < 100001; j += i)       v[j] = true;     }    }   }   static int binary(long a[], long val, int n) {    int mid = 0, l = 0, r = n - 1, ans = 0;    while (l <= r) {     mid = (l + r) >> 1;     if (a[mid] == val) {      r = mid - 1;      ans = mid;     } else if (a[mid] > val)      r = mid - 1;     else {      l = mid + 1;      ans = l;     }    }    return (ans + 1);   }   static long fastexpo(int x, int y) {    long res = 1;    while (y > 0) {     if ((y & 1) == 1) {      res *= x;     }     y = y >> 1;     x = x * x;    }    return res;   }   static long lfastexpo(int x, int y, int p) {    long res = 1;    x = x % p;    while (y > 0) {     if ((y & 1) == 1) {      res = (res * x) % p;     }     y = y >> 1;     x = (x * x) % p;    }    return res;   }  }  static class pair {   int a;   int b;   public pair(int a, int i) {    this.a = a;    this.b = i;   }  }  static class pair1 {   pair p;   int in;   public pair1(pair a, int n) {    this.p = a;    this.in = n;   }  }  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);   }  } }
4	public class St {  static void metod() throws Exception {   Scanner in = new Scanner(System.in);   String str = in.next();   int max = 0;   for (int i = 0; i < str.length(); i++) {    for (int j = i + 1; j < str.length() + 1; j++) {     for (int k = 0; k < str.length(); k++) {      for (int n = k + 1; n < str.length() + 1; n++) {       if ((str.substring(i, j).equals(str.substring(k, n)))         && (k != i)) {        if (j - i > max)         max = j - i;       }      }     }    }   }   System.out.println(max);  }  public static void main(String args[]) throws Exception {   St.metod();  } }
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]); } }
0	public class Subtractions {  public static void main(String[] args) {  Scanner kb = new Scanner(System.in);  int count = kb.nextInt();  while(count > 0) {  int smaller = kb.nextInt();  int larger = kb.nextInt();  int ops = 0;    while(smaller > 0 && larger > 0) {   if(smaller > larger) {   int temp = smaller;   smaller = larger;   larger = temp;   }      ops += larger/smaller;   larger = larger % smaller;  }  System.out.println(ops);  count--;  }  } }
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 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;         }    }    }     }   private static 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;  }  private static boolean bitTest(int perm, int i) {     int test = (1<<i);   if((test&perm)==test)    return true;   return false;  }  private static int bitSet(int perm, int i) {     int np = (1<<i);   return np;  } }
4	public class FireAgain {  static int dx[] = { 0, 0, 1, -1 };  static int dy[] = { 1, -1, 0, 0 };  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(new File("input.txt"));   BufferedWriter write = new BufferedWriter(new FileWriter("output.txt"));   int n = sc.nextInt();   int m = sc.nextInt();   boolean[][] v = new boolean[n][m];   int k = sc.nextInt();   Queue<Integer> q = new LinkedList<Integer>();   for (int i = 0; i < k; i++) {    int x = sc.nextInt() - 1;    int y = sc.nextInt() - 1;    q.add(x);    q.add(y);    v[x][y] = true;   }   int lastx = 0;   int lasty = 0;   while (!q.isEmpty()) {    lastx = q.poll();    lasty = q.poll();    for (int i = 0; i < 4; i++) {     int r = lastx + dx[i];     int c = lasty + dy[i];     if (r >= 0 && c >= 0 && r < n && c < m && !v[r][c]) {      v[r][c] = true;      q.add(r);      q.add(c);     }    }   }   write.write((lastx + 1) + " " + (lasty + 1));   write.close();  } }
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();  }  class pair{   int F, S;   pair(int a, int b){    F = a; S = b;   }  }  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 long nextLong(){    return Long.parseLong(next());   }   public double nextDouble(){    return Double.parseDouble(next());   }   public String next(){    while(st == null || !st.hasMoreTokens()){     try{      st = new StringTokenizer(br.readLine());     }catch(IOException e){}    }    return st.nextToken();   }  } }
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 B { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni(), x = ni(), y = ni();  long c = nl();  int l = x-1, r = n-x;  int u = y-1, d = n-y;  long low = -1, high = 2*n+3;  while(high - low > 1){  long t = (high + low) / 2;  long num = diag(t, l, u) + diag(t, r, u) + diag(t, l, d) + diag(t, r, d)   + hor(t, l) + hor(t, r) + hor(t, u) + hor(t, d) + 1;  if(num >= c){   high = t;  }else{   low = t;  }  }  out.println(high); }  long hor(long t, int n) {  return Math.min(t, n); }  long diag(long t, long r, long u) {  if(t > 2+r+u-2){  return r*u;  }   long ret = t*(t-1)/2;  if(t > r)ret -= (t-r)*(t-r-1)/2;  if(t > u)ret -= (t-u)*(t-u-1)/2;  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 B().run(); }  private byte[] inbuf = new byte[1024]; private int lenbuf = 0, ptrbuf = 0;  private int readByte() {  if(lenbuf == -1)throw new InputMismatchException();  if(ptrbuf >= lenbuf){  ptrbuf = 0;  try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }  if(lenbuf <= 0)return -1;  }  return inbuf[ptrbuf++]; }  private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }  private double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
6	public class Main { public static void main(String[] args) {  new Main().run(); }  boolean[][] graph; public void run() {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int m = sc.nextInt();  graph = new boolean[n][n];  for (int i = 0; i < m; i++) {  int a = sc.nextInt() - 1;  int b = sc.nextInt() - 1;  graph[a][b] = true;  graph[b][a] = true;  }   long res = 0;  for (int i = 3; i <= n; i++) {  res += solve(i);  }  System.out.println(res);  }  long solve(int n) {   long[][] dp = new long[1 << n][n];  dp[1 << (n-1)][n-1] = 1;  for (int i = 0; i < (1 << n); ++i) {  for (int l = 0; l < n; ++l) if (dp[i][l] > 0) {   for (int x = 0; x < n - 1; ++x) if (graph[l][x] && (i >> x & 1) == 0) {   dp[i | (1 << x)][x] += dp[i][l];   }  }  }  long res = 0;  for (int i = 0; i < (1 << n); ++i) if (Integer.bitCount(i) >= 3) {  for (int l = 0; l < n; ++l) {   if (graph[l][n-1]) res += dp[i][l];  }  }  return res / 2;  } }
5	public class ProblemA {  public void solve() {   boolean oj = true;   try {    Reader reader = oj ? new InputStreamReader(System.in) : new FileReader("A.in");    Writer writer = oj ? new OutputStreamWriter(System.out) : new FileWriter("A.out");    BufferedReader br = new BufferedReader(reader);    StreamTokenizer st = new StreamTokenizer(reader);    PrintWriter out = new PrintWriter(writer);    MyTokenizer tok = new MyTokenizer(br.readLine());    int n = (int)tok.getNum();    tok =new MyTokenizer(br.readLine());    List<Integer> a = new ArrayList<Integer>();    for(int i=0;i<n;i++) {     int r = (int)tok.getNum();     if (!a.contains(r)) {      a.add(r);     }    }    Collections.sort(a);    if (a.size() < 2) {     out.printf("NO");    } else {     out.printf("%d", a.get(1));    }    br.close();    out.close();    reader.close();    writer.close();   }   catch (Exception ex) {    ex.printStackTrace();   }   finally {   }  }   public static void main(String[] args) {   ProblemA f = new ProblemA();   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) == '.' || s.charAt(cur) == '-')) {     snum += s.charAt(cur);     cur++;    }    return Double.valueOf(snum);   }   public String getString() {    skip();    String s2 = "";    while (cur < s.length() && (((s.charAt(cur) >= 'a' && s.charAt(cur) <= 'z')) || ((s.charAt(cur) >= 'A' && s.charAt(cur) <= 'Z')))) {     s2 += s.charAt(cur);     cur++;    }    return s2;   }   public char getCurrentChar() throws Exception {    if (cur < s.length())     return s.charAt(cur);    else     throw new Exception("Current character out of string length");   }   public void moveNextChar() {    if (cur < s.length())     cur++;   }   public boolean isFinished() {    return cur >= s.length();   }  } }
0	public class Main {  public static void main(String[] args){   Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int a, b, min, max, result = 0, temp;  while(n-->0){  a = sc.nextInt();  b = sc.nextInt();  max = Math.max(a, b);  min = Math.min(a, b);  result = 0;  while(true){   result += max/min;   if(max%min == 0){   System.out.println(result);   break;   }     temp = max;   max = min;   min = temp%min;  }  }  sc.close(); }  }
3	public class D { public static void main(String[] args) throws Exception {  new D().run(); } int[] BIT; public void run() throws Exception {  FastScanner f = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int n = f.nextInt();  int[] arr = new int[n];  BIT = new int[n+10];  int inv = 0;  for(int i = 0; i < n; i++) {  arr[i] = f.nextInt();  inv ^= (i-query(arr[i])) & 1;  add(arr[i]);  }  int k = f.nextInt();  while(k-->0) {  int diff = -f.nextInt()+f.nextInt()+1;  inv ^= (diff*(diff-1)/2) & 1;  out.println(inv == 1 ? "odd" : "even");  }  out.flush(); }  public int query(int i) {  i++;  int res = 0;  while(i > 0) {  res += BIT[i];  i -= i & -i;  }  return res; } public void add(int i) {  i++;  while(i < BIT.length) {  BIT[i]++;  i += i & -i;  } }     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 long nextLong() {   return Long.parseLong(next());   }   public double nextDouble() {   return Double.parseDouble(next());   }   public String nextLine() {   try {    return reader.readLine();   } catch(IOException e) {    throw new RuntimeException(e);   }   }   } }
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 nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}   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 long l(){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 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 double d() throws IOException {return Double.parseDouble(s()) ;}   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 int[] arr(int n){int[] ret = new int[n];for (int i = 0; i < n; i++) {ret[i] = i();}return ret;}  }                         public static long check(long mid,long x,long y,long n)  {   long ans=2*mid*mid+2*mid+1;   long uleft=Math.max(0,mid-x+1);   long dleft=Math.max(0,mid-(n-x));   long lleft=Math.max(0,mid-y+1);   long rleft=Math.max(0,mid-(n-y));   ans-=uleft*uleft+dleft*dleft+lleft*lleft+rleft*rleft;     ans+=(Math.max(0,mid-(x+y-1))*(Math.max(0,mid-(x+y-1))+1))/2;   ans+=(Math.max(0,mid-(x+n-y))*(Math.max(0,mid-(x+n-y))+1))/2;   ans+=(Math.max(0,mid-(y+n-x))*(Math.max(0,mid-(y+n-x))+1))/2;   ans+=(Math.max(0,mid-(n-x+n-y+1))*(Math.max(0,mid-(n-x+n-y+1))+1))/2;   return ans;  }  public static void main(String[] args)throws IOException  {   PrintWriter out= new PrintWriter(System.out);   Reader sc=new Reader();   long n=sc.l();   long x=sc.l();   long y=sc.l();   long c=sc.l();   long low=0;   long high=(long)Math.pow(10,9);   while(low<high)   {    long mid=(low+high)/2;    if(check(mid,x,y,n)>=c)    high=mid;    else    low=mid+1;   }   out.println(low);   out.flush();  } }
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());  } }
4	public class CodeForces {  public static void main(String[] args) throws FileNotFoundException {   FastIO io = new FastIO();   int width = io.nextInt();   int height = io.nextInt();   int initials = io.nextInt();   boolean[][] visited = new boolean[width][height];   Queue<Coordinate> q = new ArrayDeque<>();   for (int i = 0; i < initials; i++) {    q.add(new Coordinate(io.nextInt() - 1, io.nextInt() - 1));   }   Coordinate oneOfLast = null;   while (!q.isEmpty()) {    int len = q.size();    for (int times = 0; times < len; times++) {     Coordinate c = q.poll();     if (visited[c.x][c.y]) {      continue;     }     oneOfLast = c;     visited[c.x][c.y] = true;     int[][] deltas = new int[][]{       {-1, 0}, {0, -1}, {1, 0}, {0, 1}     };     for (int[] delta : deltas) {      int ci = c.y + delta[0];      int cj = c.x + delta[1];      if (ci >= 0 && cj >= 0 && ci < height && cj < width) {       q.add(new Coordinate(cj, ci));      }     }    }   }   io.println((oneOfLast.x + 1) + " " + (oneOfLast.y + 1));   io.close();  }  static class Coordinate {   int x;   int y;   public Coordinate(int x, int y) {    this.x = x;    this.y = y;   }  }  static class FastIO extends PrintWriter {   BufferedReader br;   StringTokenizer st;   public FastIO() throws FileNotFoundException {    super(new BufferedOutputStream(new FileOutputStream("output.txt")));    br = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));   }   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());   }   String nextToken() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   String nextLine() {    try {     return br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return "";   }  } }
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();   int testCount = Integer.parseInt(in.next());   for (int i = 1; i <= testCount; i++)    solver.solve(i, in, out);   out.close();  }  static class TaskE2 {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int m = in.nextInt();    TaskE2.Column[] columns = new TaskE2.Column[m];    for (int i = 0; i < m; ++i) columns[i] = new TaskE2.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 (int i = 0; i < m; ++i) columns[i].initMax();    Arrays.sort(columns, new Comparator<TaskE2.Column>() {     public int compare(TaskE2.Column o1, TaskE2.Column o2) {      return o2.max - o1.max;     }    });    if (columns.length > n) {     columns = Arrays.copyOf(columns, n);    }    out.println(solveOne(columns));   }   private int solveOne(TaskE2.Column[] columns) {    int n = columns[0].vals.length;    int[] best = new int[1 << n];    int[] next = new int[1 << n];    int[] tmp = new int[1 << n];    for (TaskE2.Column c : columns) {     System.arraycopy(best, 0, next, 0, best.length);     for (int rot = 0; rot < n; ++rot) {      System.arraycopy(best, 0, tmp, 0, best.length);      for (int i = 0, pos = rot; i < n; ++i, ++pos) {       if (pos >= n) pos = 0;       int val = c.vals[pos];       for (int j = 0; j < tmp.length; ++j)        if ((j & (1 << i)) == 0) {         tmp[j ^ (1 << i)] = Math.max(tmp[j ^ (1 << i)], tmp[j] + val);        }      }      for (int j = 0; j < tmp.length; ++j) {       next[j] = Math.max(next[j], tmp[j]);      }     }     int[] aa = best;     best = next;     next = aa;    }    return best[best.length - 1];   }   static class Column {    int[] vals;    int max;    public Column(int[] vals) {     this.vals = vals;    }    void initMax() {     max = 0;     for (int x : vals) max = Math.max(max, 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());   }  } }
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 {  private static 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);  }  private static int slightFix(int a, int mod) {  return a >= mod   ? a - mod   : a < 0 ? a + mod : a;  }  }  static class QuickScanner {  private static 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;  }  } }
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 String nextLine() {    String str = "";    try {     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }   public int nextInt() {    int c = read();     while(isSpaceChar(c))     c = read();     int sgn = 1;     if (c == '-') {     sgn = -1;     c = read();    }     int res = 0;    do {     if(c<'0'||c>'9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));     return res * sgn;   }    public long nextLong() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;     do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));     return res * sgn;   }    public double nextDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, nextInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, nextInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }    public String readString() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    }    while (!isSpaceChar(c));     return res.toString();   }    public boolean isSpaceChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }    public String next() {    return readString();   }    public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  public static long min(long a,long b)  {   if(a>b)   {    return b;   }   return a;  }  public static int min(int a,int b)  {   if(a>b)   {    return b;   }   return a;  }  public static long max(long a,long b)  {   if(a>b)   {    return a;   }   return b;  }  public static int max(int a,int b)  {   if(a>b)   {    return a;   }   return b;  }  static class pair  {  long x;  long y;  pair(long x,long y)  {   this.x = x;   this.y = y;  }  public String toString()  {   return x+" "+y;  }  }  public static int gcd(int a,int b)  {   if(a==0)   return b;   if(b==0)   return a;   while((a%=b)!=0&&(b%=a)!=0);   return a^b;  }  static int num = (int)1e6;  public static int random(int min,int max)  {  return min+(int)((max-min)*Math.random());  }  float min(float a,float b)  {   if(a>b)   {    return b;   }   return a;  }  float dist(float x1,float y1,float x2,float y2)  {   return (float)Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));  }  float mod(float x)  {   if(x>0)   {    return x;   }   return -x;  }  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();  } public void run() {  InputReader sc = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out);  int t1 = sc.nextInt();  while(t1-->0)  {   int n = sc.nextInt();   long k = sc.nextLong();   if(n>31)   {    out.println("YES "+(n-1));    continue;   }   int steps = bsearch(n,k);   if(steps==0)   {    if(k==0)     out.println("YES "+n);    else     out.println("NO");   }   if(valid(n,k,steps))   {    out.println("YES "+(n-steps));   }   else   {    out.println("NO");   }  }  out.close(); } }
0	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   String input = in.nextLine();   if (input.equals("1"))    System.out.println("NO");   else {    if (checkNum(input))     System.out.println("YES");    else {     int i = 2;     while (i < Integer.parseInt(input)) {      if (checkNum(i + "")) {       if (Integer.parseInt(input) % i != 0)        i++;       else        break;      } else       i++;     }     if (i == Integer.parseInt(input))      System.out.println("NO");     else      System.out.println("YES");    }   }  }  public static boolean checkNum(String s) {   int i = 0;   int flag = 0;   while (i < s.length()) {    if (s.charAt(i) == '4' || s.charAt(i) == '7') {     flag = 1;     i++;    } else     return false;   }   if (flag == 1)    return true;   return false;  } }
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 nextLine() throws IOException {  return in.readLine(); }  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; }  public static long[] longArray(int n) throws IOException {  long[] a = new long[n];  for (int i = 0; i < n; i++)  a[i] = nextLong();  return a; } }
4	public class A {  public static void main(String[] args)  {  new A(new Scanner(System.in));  }  public A(Scanner in)  {  TreeSet<String> ts = new TreeSet<String>();  ArrayList<String> sr = new ArrayList<String>();   String s = in.next();  for (int i=0; i<s.length(); i++)  {   for (int j=i+1; j<=s.length(); j++)   {    String ss = s.substring(i, j);    if (ts.contains(ss))    {     sr.add(ss);    }    ts.add(ss);   }  }   int res = 0;  for (String ss : sr)  {   if (ss.length() > res)    res = ss.length();  }   System.out.printf("%d%n", res);  } }
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(); }  private static 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;   }  }  } }  private static 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;  }  } } }
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);   TaskF2 solver = new TaskF2();   solver.solve(1, in, out);   out.close();  }  static class TaskF2 {   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] = in.nextInt();    }    HashMap<Integer, Integer> lastIndex = new HashMap<>();    HashMap<Integer, Integer> maxSize = new HashMap<>();    for (int i = 0; i < n; i++) {     int sum = 0;     for (int j = i; j < n; j++) {      sum += a[j];      if (maxSize.containsKey(sum) == false) {       maxSize.put(sum, 0);      }      int curMaxSize = maxSize.get(sum);      int curLastIndex = curMaxSize == 0 ? -1 : lastIndex.get(sum);      if (curMaxSize == 0 || curLastIndex < i) {       curMaxSize++;       curLastIndex = j;      } else if (curLastIndex >= j) {       curLastIndex = j;      }      maxSize.put(sum, curMaxSize);      lastIndex.put(sum, curLastIndex);     }    }    int bestSum = -1;    int bestSize = -1;    for (int sum : maxSize.keySet()) {     if (maxSize.get(sum) > bestSize) {      bestSize = maxSize.get(sum);      bestSum = sum;     }    }    ArrayList<Interval> best = new ArrayList<>();    lastIndex = new HashMap<>();    maxSize = new HashMap<>();    for (int i = 0; i < n; i++) {     int sum = 0;     for (int j = i; j < n; j++) {      sum += a[j];      if (sum != bestSum)       continue;      if (maxSize.containsKey(sum) == false) {       maxSize.put(sum, 0);      }      int curMaxSize = maxSize.get(sum);      int curLastIndex = curMaxSize == 0 ? -1 : lastIndex.get(sum);      if (curMaxSize == 0 || curLastIndex < i) {       curMaxSize++;       curLastIndex = j;       best.add(new Interval(i, j));      } else if (curLastIndex >= j) {       curLastIndex = j;       best.set(best.size() - 1, new Interval(i, j));      }      maxSize.put(sum, curMaxSize);      lastIndex.put(sum, curLastIndex);     }    }    out.println(bestSize);    for (Interval i : best) {     out.println((i.l + 1) + " " + (i.r + 1));    }   }   class Interval {    int l;    int r;    Interval(int l, int r) {     this.l = l;     this.r = r;    }   }  }  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;   }  } }
1	public class Main {  public static void main(String args[]) {   Scanner scan = new Scanner(System.in);   int n=scan.nextInt();   int m=scan.nextInt();   int[] game=new int[n];   int[] bill=new int[m];   for (int i = 0; i <n ; i++) {    game[i]=scan.nextInt();   }   for (int i = 0; i <m ; i++) {    bill[i]=scan.nextInt();   }   int i=0;   int j=0;   int ans=0;   while (i<m){    boolean f=true;    for (int k = j; k <n ; k++) {     if (bill[i]>=game[k]){      ans++;      i++;      j=k+1;      f=false;      break;     }    }    if (f){     break;    }   }   System.out.println(ans);  } }
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 hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}  void exit(boolean b){if(!b)System.exit(0);}  static void debug(Object... o){System.err.println(Arrays.deepToString(o));}  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[][] make(int n, int e, int[] from, int[] to, boolean f){   int[][] g = new int[n][];int[]cnt = new int[n];   for(int i = 0; i< e; i++){    cnt[from[i]]++;    if(f)cnt[to[i]]++;   }   for(int i = 0; i< n; i++)g[i] = new int[cnt[i]];   for(int i = 0; i< e; i++){    g[from[i]][--cnt[from[i]]] = to[i];    if(f)g[to[i]][--cnt[to[i]]] = from[i];   }   return g;  }  int[][][] makeS(int n, int e, int[] from, int[] to, boolean f){   int[][][] g = new int[n][][];int[]cnt = new int[n];   for(int i = 0; i< e; i++){    cnt[from[i]]++;    if(f)cnt[to[i]]++;   }   for(int i = 0; i< n; i++)g[i] = new int[cnt[i]][];   for(int i = 0; i< e; i++){    g[from[i]][--cnt[from[i]]] = new int[]{to[i], i, 0};    if(f)g[to[i]][--cnt[to[i]]] = new int[]{from[i], i, 1};   }   return g;  }  int find(int[] set, int u){return set[u] = (set[u] == u?u:find(set, set[u]));}  int digit(long s){int ans = 0;while(s>0){s/=10;ans++;}return ans;}  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 p(Object o){out.print(o);}  void pn(Object o){out.println(o);}  void pni(Object o){out.println(o);out.flush();}  String n()throws Exception{return in.next();}  String nln()throws Exception{return in.nextLine();}  int ni()throws Exception{return Integer.parseInt(in.next());}  long nl()throws Exception{return Long.parseLong(in.next());}  double nd()throws Exception{return Double.parseDouble(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;   }  } }
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());   }  } }
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 char nextChar() {  return next().charAt(0);  }    public int nextInt() {  return Integer.parseInt(next());  }   public long nextLong() {  return Long.parseLong(next());  }   public double nextDouble() {  return Double.parseDouble(next());  }   public String nextLine() {  line = null;  return readLine();  }   public String [] nextStrings() {  line = null;  return readLine().split(" ");  }   public char [] nextChars() {  return next().toCharArray();  }  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 cprint(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); }  void NO() {  throw new Error("NO!"); }    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 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;   }  }   double nextDouble(){   return Double.parseDouble(next());  }   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;   }  }   String nextLine(){   try{    StringBuilder res=new StringBuilder("");    int c=System.in.read();    while(c=='\r'||c=='\n')     c=System.in.read();    do{     res.append((char)c);     c=System.in.read();    }while(c!='\r'&&c!='\n');    return res.toString();   }catch(Exception e){    return null;   }  } }
2	public class Main { final static 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(); } }
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 A {  public A () throws IOException {  String input = r.readLine();  int N = Integer.parseInt(input);  int [] A = new int [N];  input = r.readLine();  String [] S = input.split(" ");  for (int i = 0; i < N; ++i)  A[i] = Integer.parseInt(S[i]);  solve(N, A); }  public void solve (int N, int [] A) {  t = millis();  Arrays.sort(A);  if (A[N-1] > 1) A[N-1] = 1;  else A[N-1] = 2;  Arrays.sort(A);  System.out.print(A[0]);  for (int i = 1; i < N; ++i)  System.out.print(" " + A[i]);  System.out.println(); }   static BufferedReader r; static long t;  static void print2 (Object o) {  System.out.println(o); }  static void print (Object o) {  print2(o);   System.exit(0); }  static void run () throws IOException {  r = new BufferedReader(new InputStreamReader(System.in));  new A(); }  public static void main(String[] args) throws IOException {  run(); }  static long millis() {  return System.currentTimeMillis(); } }
0	public class CF {  long getAns(long a, long b) {  if (a == b)  return 1;  if (a < b) {  return getAns(b, a);  }   long cnt = (a - 1) / b;  return cnt + getAns(b, a - b * cnt); }  void solve() {  long a = in.nextLong();  long b = in.nextLong();  out.println(getAns(a, b)); }  FastScaner in; PrintWriter out;  void run() {  in = new FastScaner(System.in);  out = new PrintWriter(System.out);  solve();  out.close(); }  void runWithFiles() {  in = new FastScaner(new File("input.txt"));  try {  out = new PrintWriter(new File("output.txt"));  } catch (FileNotFoundException e) {  e.printStackTrace();  }  solve();  out.close(); }  public static void main(String[] args) {  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());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  } } }
4	public class Main { public static void main(String[] args) {  InputStream inputStream;  try {  inputStream = new FileInputStream("input.txt");  } catch (IOException e) {  throw new RuntimeException(e);  }  OutputStream outputStream;  try {  outputStream = new FileOutputStream("output.txt");  } catch (IOException e) {  throw new RuntimeException(e);  }  PandaScanner in = new PandaScanner(inputStream);  PrintWriter out = new PrintWriter(outputStream);  C solver = new C();  solver.solve(1, in, out);  out.close(); } } class C {  final int dx[] = { -1, 0, 1, 0};  final int dy[] = { 0, -1, 0, 1};  final int SHIFT = 15;  final int COLUMN_MASK = (1 << SHIFT) - 1;  public void solve(int testNumber, PandaScanner in, PrintWriter out) {   int n = in.nextInt();   int m = in.nextInt();   boolean burning[][] = new boolean[n][m];   int k = in.nextInt();   ArrayDeque<Integer> q = new ArrayDeque<>();   for (int i = 0; i < k; i++) {    int x = in.nextInt() - 1;    int y = in.nextInt() - 1;    burning[x][y] = true;    q.add((x << SHIFT) + y);   }   int last = 0;   while (!q.isEmpty()) {    last = q.poll();    int x = last >> SHIFT;    int y = last & COLUMN_MASK;    for (int d = 0; d < 4; d++) {     int nx = x + dx[d];     int ny = y + dy[d];     if (nx >= 0 && nx < n && ny >= 0 && ny < m && !burning[nx][ny]) {      burning[nx][ny] = true;      q.add((nx << SHIFT) + ny);     }    }   }   out.printf("%d %d\n", (last >> SHIFT) + 1, (last & COLUMN_MASK) + 1);  } } class PandaScanner {  public BufferedReader br;  public StringTokenizer st;  public InputStream in;  public PandaScanner(InputStream in) {   br = new BufferedReader(new InputStreamReader(this.in = in));  }  public String nextLine() {   try {    return br.readLine();   }   catch (Exception e) {    return null;   }  }  public String next() {   if (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(nextLine().trim());    return next();   }   return st.nextToken();  }  public int nextInt() {   return Integer.parseInt(next());  }  }
1	public class CF_1515_B{   void pre() throws Exception{}  void solve(int TC) throws Exception{   long N = nl();   if(N%2 == 1){    pn("NO");    return;   }   N /= 2;   boolean yes = ps(N);   if(N%2 == 0)yes |= ps(N/2);   pn(yes?"YES":"NO");  }  boolean ps(long N){   long T = (long)Math.sqrt(N);   while(T*T > N)T--;   while (T*T < N)T++;   return (T*T == N);  }   void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}  void exit(boolean b){if(!b)System.exit(0);}  static void dbg(Object... o){System.err.println(Arrays.deepToString(o));}  final long IINF = (long)1e17;  final int INF = (int)1e9+2;  DecimalFormat df = new DecimalFormat("0.00000000000");  double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-8;  static boolean multipleTC = true, 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 CF_1515_B().run();}catch(Exception e){e.printStackTrace();System.exit(1);}}}, "1", 1 << 28).start();   else new CF_1515_B().run();  }  int[][] make(int n, int e, int[] from, int[] to, boolean f){   int[][] g = new int[n][];int[]cnt = new int[n];   for(int i = 0; i< e; i++){    cnt[from[i]]++;    if(f)cnt[to[i]]++;   }   for(int i = 0; i< n; i++)g[i] = new int[cnt[i]];   for(int i = 0; i< e; i++){    g[from[i]][--cnt[from[i]]] = to[i];    if(f)g[to[i]][--cnt[to[i]]] = from[i];   }   return g;  }  int[][][] makeS(int n, int e, int[] from, int[] to, boolean f){   int[][][] g = new int[n][][];int[]cnt = new int[n];   for(int i = 0; i< e; i++){    cnt[from[i]]++;    if(f)cnt[to[i]]++;   }   for(int i = 0; i< n; i++)g[i] = new int[cnt[i]][];   for(int i = 0; i< e; i++){    g[from[i]][--cnt[from[i]]] = new int[]{to[i], i, 0};    if(f)g[to[i]][--cnt[to[i]]] = new int[]{from[i], i, 1};   }   return g;  }  int find(int[] set, int u){return set[u] = (set[u] == u?u:find(set, set[u]));}  int digit(long s){int ans = 0;while(s>0){s/=10;ans++;}return ans;}  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 p(Object... o){for(Object oo:o)out.print(oo+" ");}  void pn(Object... o){for(int i = 0; i< o.length; i++)out.print(o[i]+(i+1 < o.length?" ":"\n"));}  void pni(Object... o){for(Object oo:o)out.print(oo+" ");out.println();out.flush();}  String n()throws Exception{return in.next();}  String nln()throws Exception{return in.nextLine();}  int ni()throws Exception{return Integer.parseInt(in.next());}  long nl()throws Exception{return Long.parseLong(in.next());}  double nd()throws Exception{return Double.parseDouble(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;   }  } }
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);   }   private static 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) + " ");   }  } }
0	public class A_Lucky_Division { public static void main(String[] args){  Scanner input=new Scanner(System.in);  int number=input.nextInt();  int flag=0;  if(number%4==0)flag=1;  else if(number%7==0)flag=1;  else if(number%47==0)flag=1;  else if(number%74==0)flag=1;  else if(number%444==0)flag=1;  else if(number%447==0)flag=1;  else if(number%474==0)flag=1;  else if(number%477==0)flag=1;  else if(number%744==0)flag=1;  else if(number%747==0)flag=1;  else if(number%774==0)flag=1;  else if(number%777==0)flag=1;  if(flag==1)System.out.println("YES");  else System.out.println("NO");   } }
1	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) {    int n = in.nextInt();     String[] a = new String[n];    Map<String, Integer> map = new HashMap<>();    for (int i = 0; i < n; i++) {     a[i] = in.next();     map.merge(a[i], 1, Integer::sum);    }    String[] b = new String[n];    for (int i = 0; i < n; i++) {     b[i] = in.next();     if (map.containsKey(b[i])) {      map.put(b[i], map.get(b[i]) - 1);      if (map.get(b[i]) <= 0)       map.remove(b[i]);     }    }    int ans = 0;    for (String s : map.keySet()) {     ans += map.get(s);    }    out.println(ans);    }  }  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 String nextString() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     if (Character.isValidCodePoint(c)) {      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 String next() {    return nextString();   }   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 println(int i) {    writer.println(i);   }  } }
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); } void ruffleSort(int a[]) {  Random rand=new Random();  int n=a.length;  for(int i=0;i<n;i++) {  int j=rand.nextInt(n);  int temp=a[i];  a[i]=a[j];  a[j]=temp;  }  Arrays.sort(a); } void ruffleSort(long a[]) {  Random rand=new Random();  int n=a.length;  for(int i=0;i<n;i++) {  int j=rand.nextInt(n);  long temp=a[i];  a[i]=a[j];  a[j]=temp;  }  Arrays.sort(a); }   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());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String s="";    try {     s=br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return s;   }  }   long fact[]; long invFact[]; void init(int n) {  fact=new long[n+1];  invFact=new long[n+1];  fact[0]=1;  for(int i=1;i<=n;i++) {  fact[i]=mul(i,fact[i-1]);  }  invFact[n]=power(fact[n],mod-2);  for(int i=n-1;i>=0;i--) {  invFact[i]=mul(invFact[i+1],i+1);  } }  long nCr(int n, int r) {  if(n<r || r<0) return 0;  return mul(fact[n],mul(invFact[r],invFact[n-r])); }  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]+" "); }     static void input(long a[], int n) {  for(int i=0;i<n;i++) {  a[i]=inp.nextLong();  } } static void input(int a[], int n) {  for(int i=0;i<n;i++) {  a[i]=inp.nextInt();  } }  static void input(String s[],int n) {  for(int i=0;i<n;i++) {  s[i]=inp.next();  } } static void input(int a[][], int n, int m) {  for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   a[i][j]=inp.nextInt();  }  } } static void input(long a[][], int n, int m) {  for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {   a[i][j]=inp.nextLong();  }  } }  }
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 long nl() {  return Long.parseLong(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 final class PythonIndentation { public static void main(String[] args) {  new PythonIndentation(System.in, System.out); }  static class Solver implements Runnable {  static final int MOD = (int) 1e9 + 7;  int n;  char[] arr;  long[][] dp;  BufferedReader in;  PrintWriter out;  void solve() throws IOException  {  n = Integer.parseInt(in.readLine());  arr = new char[n];  dp = new long[n + 1][n + 1];   for (int i = 0; i < n; i++)   arr[i] = in.readLine().charAt(0);   for (int i = 0; i <= n; i++)   Arrays.fill(dp[i], -1);   dp[0][0] = 1;   if (arr[0] == 's')   out.println(find(1, 0));  else   out.println(find(1, 1));  }  long find(int curr, int backIndents)  {  if (backIndents < 0)   return 0;   if (curr == n)   return 1;   if (dp[curr][backIndents] != -1)   return dp[curr][backIndents];   long ans;   if (arr[curr] == 's')  {   if (arr[curr - 1] == 'f')   ans = find(curr + 1, backIndents);   else   ans = CMath.mod(find(curr + 1, backIndents) + find(curr, backIndents - 1), MOD);  }  else  {   ans = find(curr + 1, backIndents + 1);   if (arr[curr - 1] != 'f')   ans = CMath.mod(ans + find(curr, backIndents - 1), MOD);  }   return dp[curr][backIndents] = ans;  }  public Solver(BufferedReader in, PrintWriter out)  {  this.in = in;  this.out = out;  }  @Override public void run()  {  try  {   solve();  }  catch (IOException e)  {   e.printStackTrace();  }  }  }  static class CMath {  static long mod(long number, long mod)  {  return number - (number / mod) * mod;  }  }  private PythonIndentation(InputStream inputStream, OutputStream outputStream) {  BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));  PrintWriter out = new PrintWriter(outputStream);  Thread thread = new Thread(null, new Solver(in, out), "PythonIndentation", 1 << 29);  try  {  thread.start();  thread.join();  }  catch (InterruptedException e)  {  e.printStackTrace();  }  finally  {  try  {   in.close();  }  catch (IOException e)  {   e.printStackTrace();  }   out.flush();  out.close();  } } }
2	public class Main {  public static void main(String[] args) {   new Thread(null, new Runnable() {    public void run() {     new Main().solve();    }   }, "1", 1 << 26).start();  }  void solve() {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   BSportMafia solver = new BSportMafia();   solver.solve(1, in, out);   out.close();  }  static class BSportMafia {   public long findsqrt(long a) {    long b = (long) Math.sqrt(a);    for (long tt = Math.max(0, b - 10); tt <= b + 10; tt++) if (tt * tt == a) return tt;    return -1;   }   public void solve(int testNumber, ScanReader in, PrintWriter out) {    long n = in.scanInt();    long k = in.scanInt();    out.println(n - (-3 + findsqrt(9 + 8 * (k + n))) / 2);   }  }  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;   }  } }
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 {   private long mod = 1_000_000_007;   private int n;   private boolean[] s;   public void Solve(InputReader in, PrintWriter out) {    n = in.NextInt();    s = new boolean[n];    for (int i = 0; i < n; i++) {     String ss = in.Next();     s[i] = ss.charAt(0) == 'f';    }    if (s[n - 1]) {     out.println(0);     return;    }    long[] dpSum = new long[n + 1], lastDpSum = new long[n + 1];    for (int i = 0; i <= n; i++) {     lastDpSum[i] = i + 1;    }    for (int i = n - 2; i >= 0; i--) {     for (int j = 0; j <= i; j++) {      if (!s[i]) {       dpSum[j] = lastDpSum[j];      } else {       dpSum[j] = lastDpSum[j + 1] - lastDpSum[j];      }      if (j != 0) {       dpSum[j] += dpSum[j - 1];      }      dpSum[j] %= mod;      while (dpSum[j] < 0) dpSum[j] += mod;     }     long[] temp = dpSum;     dpSum = lastDpSum;     lastDpSum = temp;    }    out.println(lastDpSum[0]);   }   public static int GetMax(int[] ar) {    int max = Integer.MIN_VALUE;    for (int a : ar) {     max = Math.max(max, a);    }    return max;   }   public static int GetMin(int[] ar) {    int min = Integer.MAX_VALUE;    for (int a : ar) {     min = Math.min(min, a);    }    return min;   }   public static long GetSum(int[] ar) {    long s = 0;    for (int a : ar) s += a;    return s;   }   public static int[] GetCount(int[] ar) {    return GetCount(ar, GetMax(ar));   }   public static int[] GetCount(int[] ar, int maxValue) {    int[] dp = new int[maxValue + 1];    for (int a : ar) {     dp[a]++;    }    return dp;   }   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(), " \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());    }    public double NextDouble() {     return Double.parseDouble(Next());    }    public int[] NextIntArray(int n) {     return NextIntArray(n, 0);    }    public int[] NextIntArray(int n, int offset) {     int[] a = new int[n];     for (int i = 0; i < n; i++) {      a[i] = NextInt() - offset;     }     return a;    }    public int[][] NextIntMatrix(int n, int m) {     return NextIntMatrix(n, m, 0);    }    public int[][] NextIntMatrix(int n, int m, int offset) {     int[][] a = new int[n][m];     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) {       a[i][j] = NextInt() - offset;      }     }     return a;    }   }  } }
4	public class TaskC extends Thread {  public TaskC() {   try {    this.input = new BufferedReader(new FileReader("input.txt"));    this.output = new PrintWriter("output.txt");    this.setPriority(Thread.MAX_PRIORITY);   } catch (Throwable e) {    System.exit(666);   }  }  private void solve() throws Throwable {   int n = nextInt();   int m = nextInt();   int k = nextInt();   Queue<Integer> qX = new ArrayDeque<Integer>();   Queue<Integer> qY = new ArrayDeque<Integer>();   boolean [][]was = new boolean[n][m];   for (int i = 0; i < k; ++i) {    int x = nextInt() - 1, y = nextInt() - 1;    qX.add(x);    qY.add(y);    was[x][y] = true;   }   int lastX = -1, lastY = -1;   while (!qX.isEmpty()) {    lastX = qX.poll();    lastY = qY.poll();    for (int i = 0; i < dx.length; ++i) {     int nextX = lastX + dx[i], nextY = lastY + dy[i];     if (nextX < n && nextY < m && nextX >= 0 && nextY >= 0 && !was[nextX][nextY]) {      qX.add(nextX);      qY.add(nextY);      was[nextX][nextY] = true;     }    }   }   ++lastX;   ++lastY;   output.println(lastX + " " + lastY);   }  public void run() {   try {    solve();   } catch (Throwable e) {    System.err.println(e.getMessage());    e.printStackTrace();    System.exit(666);   } finally {    output.flush();    output.close();   }  }  public static void main(String[] args) {   new TaskC().start();  }  private int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  private long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  private double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  private String nextToken() throws IOException {   while (tokens == null || !tokens.hasMoreTokens()) {    tokens = new StringTokenizer(input.readLine());   }   return tokens.nextToken();  }  static final int PRIME = 3119;  static final int[]dx = {1, -1, 0, 0}, dy = {0, 0, -1, 1};  private BufferedReader input;  private PrintWriter output;  private StringTokenizer tokens = null; }
5	public class A { static Comparator<Point> cmp = new Comparator<Point>() {  public int compare(Point a, Point b)  {  if(a.x < b.x)   return -1;  else if(a.x > b.x)   return 1;   return 0;  } };  public static void main(String args[]) {  Scanner scan = new Scanner(System.in);  while(scan.hasNextInt())  {  int n = scan.nextInt();  int k = scan.nextInt();  Point[] a = new Point[n];  for(int i=0;i < n;i++)  {  a[i] = new Point();  a[i].x = scan.nextInt();  a[i].y = scan.nextInt();  }  Arrays.sort(a, cmp);  int rtn = 0;  ArrayList<Double> ans = new ArrayList<Double>();  for(int i=0;i < n;i++)  {    double lb = a[i].x - (a[i].y / 2.0) - k;  double pos = lb + (k/2.0);  boolean good = true;   for(int j=0;j < ans.size();j++)   if(Math.abs(ans.get(j) - pos) < 0.0000001)   good = false;   if(good && (i == 0 || a[i-1].x + (a[i-1].y / 2.0) <= lb))  {   rtn++;   ans.add(pos);  }   double rb = a[i].x + (a[i].y / 2.0) + k;  pos = rb - (k/2.0);  good = true;   for(int j=0;j < ans.size();j++)   if(Math.abs(ans.get(j) - pos) < 0.0000001)   good = false;   if(good && (i == n-1 || a[i+1].x - (a[i+1].y / 2.0) >= rb))  {   rtn++;   ans.add(pos);  }  }  System.out.println(rtn);  } } }
1	public class Solution1515B { public static void main(String[] args) {  InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out);  Solver1515B solver = new Solver1515B();  int n = in.nextInt();  for (int i = 0; i < n; i++) {  solver.solve(i, in, out);  }  out.close(); }  static class Solver1515B {  public void solve(int testNumber, InputReader in, PrintWriter out) {  int n = in.nextInt();  boolean f = false;  if (n % 2 == 0) {   int s = (int) Math.sqrt(n / 2);   if (s * s == n / 2) {   f = true;   }  }  if (n % 4 == 0) {   int s = (int) Math.sqrt(n / 4);   if (s * s == n / 4) {   f = true;   }  }  if (f) {   out.println("YES");  } else {   out.println("NO");  }  } }  static class InputReader {  public BufferedReader reader;  public StringTokenizer tokenizer;  public InputReader(InputStream stream) {  reader = new BufferedReader(new InputStreamReader(stream), 32768);  tokenizer = null;  }  public String next() {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {   try {   tokenizer = new StringTokenizer(reader.readLine());   } catch (IOException e) {   throw new RuntimeException(e);   }  }  return tokenizer.nextToken();  }  public int nextInt() {  return Integer.parseInt(next());  } } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   Input in = new Input(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, Input in, PrintWriter out) {    try {     int n = in.readInt();     int[] a = new int[n];     for (int i = 0; i < n; i++) {      a[i] = in.readInt();     }     Arrays.sort(a);     boolean[] b = new boolean[n];     int ans = 0;     while (true) {      int x = 0;      for (int i = 0; i < n; i++) {       if (!b[i] && x == 0) {        x = a[i];       }       if (x != 0 && a[i] % x == 0) {        b[i] = true;       }      }      if (x == 0) {       break;      }      ans++;     }     out.println(ans);    } catch (Exception e) {     throw new RuntimeException(e);    }   }  }  static class Input {   public final BufferedReader reader;   private String line = "";   private int pos = 0;   public Input(InputStream inputStream) {    reader = new BufferedReader(new InputStreamReader(inputStream));   }   private boolean isSpace(char ch) {    return ch <= 32;   }   public String readWord() throws IOException {    skip();    int start = pos;    while (pos < line.length() && !isSpace(line.charAt(pos))) {     pos++;    }    return line.substring(start, pos);   }   public int readInt() throws IOException {    return Integer.parseInt(readWord());   }   private void skip() throws IOException {    while (true) {     if (pos >= line.length()) {      line = reader.readLine();      pos = 0;     }     while (pos < line.length() && isSpace(line.charAt(pos))) {      pos++;     }     if (pos < line.length()) {      return;     }    }   }  } }
5	public class C { Scanner sc; BufferedReader in; PrintStream out; StringTokenizer tok;  public C() throws NumberFormatException, IOException {     in = new BufferedReader(new InputStreamReader(System.in));   out = System.out;  run(); } void run() throws NumberFormatException, IOException {   int[] array;  int n = nextInt();  array = new int[n];  int max = 0;  int pos = 0;  for(int i = 0; i <n; i++)  {  int l = nextInt();  if(l > max)  {   pos = i;   max = l;  }  array[i] = l;  }  if(max == 1)array[pos] = 2;  else array [pos] = 1;  Arrays.sort(array);  out.print(array[0]);  for(int i = 1; i < n; i++)  out.print(" " + array[i]);  out.println(); } public static void main(String[] args) throws NumberFormatException, IOException  {  new C(); } String nextToken() throws IOException {  if(tok ==null || !tok.hasMoreTokens()) tok = new StringTokenizer(in.readLine());  return tok.nextToken(); } int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(nextToken()); } long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(nextToken()); } double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(nextToken()); } }
2	public class D {  static long n;  static long x;  static long y;  static long c;  static long f(long t){   long s=0;   if(t==0)    s=1;   else{    s=(4+4*t)/2*t+1;   }   if(x+t>n){    long c=x+t-n;    s-=c*c;   }   if(x-t<=0){    long c=t-x+1;    s-=c*c;   }   if(y+t>n){    long c=y+t-n;    s-=c*c;   }   if(y-t<=0){    long c=t-y+1;    s-=c*c;   }   if(t>x+y-1){    long m=t-x-y+1;    s+=m*(m+1)/2;   }   if (t>x+n-y) {    long m=t-x-n+y;    s+=m*(m+1)/2;   }   if (t>n-x+y) {    long m=t-n-y+x;    s+=m*(m+1)/2;   }   if (t>n-x+n-y+1) {    long m=t-2*n+x+y-1;    s+=m*(m+1)/2;   }   return s;  }  public static void main(String[] args) {     Scanner in=new Scanner(new InputStreamReader(System.in));   PrintWriter out=new PrintWriter(System.out);     n=in.nextLong();   x=in.nextLong();   y=in.nextLong();   c=in.nextLong();             long l=0;   long r=2*n;   while(l<r){    long m=(l+r)/2;    long ff=f(m);    if(ff<c){     l=m+1;    }    else{     r=m;    }   }   out.println(l);   out.close();  } }
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 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");    }  } }
2	public class B {  public static void main(String[] args) throws Exception {  new B().run(); }  public void run() throws Exception {  FastIO file = new FastIO();  long n = file.nextLong();  long k = file.nextLong();  long lo = 1;  long hi = n;  long ans = 0;  while (lo <= hi) {  long mi = lo + (hi - lo) / 2;  long q = mi * (mi + 1) / 2 - (n - mi);  if (q == k) {   ans = (n - mi);   break;  }  else if (q < k) {   lo = mi + 1;  }  else {   hi = mi - 1;  }  }  System.out.println(ans); }  public static class FastIO {  BufferedReader br;  StringTokenizer st;  public FastIO() {  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());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  } }  public static long pow(long n, long p, long mod) {  if (p == 0)  return 1;  if (p == 1)  return n % mod;  if (p % 2 == 0) {  long temp = pow(n, p / 2, mod);  return (temp * temp) % mod;  } else {  long temp = pow(n, p / 2, mod);  temp = (temp * temp) % mod;  return (temp * n) % mod;  } }  public static long pow(long n, long p) {  if (p == 0)  return 1;  if (p == 1)  return n;  if (p % 2 == 0) {  long temp = pow(n, p / 2);  return (temp * temp);  } else {  long temp = pow(n, p / 2);  temp = (temp * temp);  return (temp * n);  } }  public static long gcd(long x, long y) {  if (x == 0)  return y;  else  return gcd(y % x, x); }  public static boolean isPrime(int n) {  if (n <= 1)  return false;  if (n <= 3)  return true;  if (n % 2 == 0 || n % 3 == 0)  return false;  for (int i = 5; i * i <= n; i = i + 6)  if (n % i == 0 || n % (i + 2) == 0)   return false;  return true; } }
5	public class Main { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tokenizer=null;  public static void main(String[] args) throws IOException {  new Main().execute(); }  void debug(Object...os) {  System.out.println(Arrays.deepToString(os)); }  int ni() throws IOException {  return Integer.parseInt(ns()); }  long nl() throws IOException  {  return Long.parseLong(ns()); }  double nd() throws IOException  {  return Double.parseDouble(ns()); }   String ns() throws IOException  {  while (tokenizer == null || !tokenizer.hasMoreTokens())   tokenizer = new StringTokenizer(br.readLine());  return tokenizer.nextToken(); }  String nline() throws IOException {  tokenizer=null;  return br.readLine(); }     int totalCases, testNum;  int sum; int n; int arr[];  void execute() throws IOException {  totalCases = 1;  for(testNum = 1; testNum <= totalCases; testNum++)  {  if(!input())   break;  solve();  } }  void solve() throws IOException {  Arrays.sort(arr);  int count = 0;  int ans = 0;  for(int i = n-1;i>=0;i--)  {  count+= arr[i];  if(count>sum-count)  {   ans = n-i;   break;  }  }  System.out.println(ans); }   boolean input() throws IOException {  n = ni();  sum = 0;  arr = new int[n];  for(int i = 0;i<n;i++)  {  arr[i] = ni();  sum = sum+arr[i];  }  return true; }  }
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 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); }  void debug(Object... os){  System.err.println(Arrays.deepToString(os)); }  public static void main(String[] args){  Locale.setDefault(Locale.US);  new P111C().run(); } }
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);   TaskBR574D2 solver = new TaskBR574D2();   solver.solve(1, in, out);   out.close();  }  static class TaskBR574D2 {   public void solve(int testNumber, Scanner in, PrintWriter out) {    long n = in.nextLong();    long k = in.nextLong();    long r = (long) (Math.sqrt(9 + 8 * (n + k)) - 3) / 2;    out.println(n - r);   }  } }
5	public class A135 { public static void main(String[] args) throws Exception {  BufferedReader r = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(r.readLine());  int[] ar = new int[n];  StringTokenizer st = new StringTokenizer(r.readLine());  for (int x = 0; x < n; x++) {  ar[x] = Integer.parseInt(st.nextToken());  }  Arrays.sort(ar);  if (n == 1) {   System.out.println(ar[0]==1?"2":"1");  return;  }  if (ar[n - 1] == 1) {  ar[n - 2] = 2;  }  System.out.print("1");  for (int x = 0; x < n - 1; x++) {  System.out.print(" " + ar[x]);  }  System.out.println(); } }
2	public class a {  public static void main(String args[])throws IOException{  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  OutputStream out=new BufferedOutputStream(System.out);  String s[]=br.readLine().trim().split("\\ ");  BigInteger a1=new BigInteger(s[0]);  BigInteger a=new BigInteger(s[0]);  String q=a.toString();  String q1=q.substring(q.length()-1, q.length());  a=a.subtract(new BigInteger(q1));   BigInteger c=new BigInteger("1");  BigInteger b=new BigInteger(s[1]);  int z=check(a,a.toString(),b);  if(z==1)  {  out.write("0".getBytes());  out.flush();    return;  }  while(a.compareTo(c)>0)  {  BigInteger d=a;  if(d.subtract(c).compareTo(new BigInteger("9"))==-1)  {   break;  }  else  {   BigInteger mid=a;   mid=mid.add(c);   mid=mid.divide(new BigInteger("2"));     if(check(mid,mid.toString(),b)==1)   {   c=mid;   c=c.add(new BigInteger("1"));   }   else   {   a=mid;         }     }    }  q=a.toString();  q1=q.substring(q.length()-1, q.length());  a=a.subtract(new BigInteger(q1));  BigInteger ans=a1.subtract(a);  ans=ans.add(new BigInteger("1"));  out.write(ans.toString().getBytes());      out.flush(); }   static int check(BigInteger a,String s,BigInteger b)  {  int l=s.length();  long z=0;  for(int i=0;i<l;i++)  {   z+=Long.parseLong(s.substring(i,i+1));  }  BigInteger c=a.subtract(new BigInteger(Long.toString(z)));    return -1*c.compareTo(b);  } }
3	public class Main {  BufferedReader br;  PrintWriter pw;  StringTokenizer st;  long mod = (long) (1e9 + 7);  public static void main(String[] args) {   (new Main()).run();  }  void solve() throws IOException {   int n = nextInt();   boolean p[] = new boolean[n];   for (int i = 0; i < n; i++) {    String s = nextToken();    if (s.charAt(0) == 'f') p[i] = true;   }   long d[][] = new long[n][n];   d[0][0] = 1;   for (int i = 1; i < n; i++) {    if (p[i - 1]) {     d[i][0] = 0;     for (int j = 1; j < n; j++) {      d[i][j] = d[i - 1][j - 1];     }    } else {     long sum = 0;     for (int j = n - 1; j >= 0; j--) {      sum += d[i - 1][j];      sum %= mod;      d[i][j] = sum;     }    }   }   long sum = 0;   for (int i = 0; i < n; i++) {    sum += d[n - 1][i];    sum %= mod;   }   pw.print(sum);  }  void run() {   try {      br = new BufferedReader(new InputStreamReader(System.in));    pw = new PrintWriter(new OutputStreamWriter(System.out));    solve();    pw.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }  String nextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return st.nextToken();  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  class h {   int ans;   int last;   public h() {    last = -1;    ans = 0;   }  } }
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(); } }
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));   }  } }
2	public class C implements Runnable{ public static void main (String[] args) {new Thread(null, new C(), "_cf", 1 << 28).start();}  long MOD = (long)1e9+7;  public void run() {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  System.err.println("Go!");  long x = fs.nextLong();  long k = fs.nextLong();  if(x == 0) {  System.out.println(0);  return;  }  if(k == 0) {  System.out.println(mult(x, 2));  return;  }   long max = mult(x, power(2, k, MOD));  long min = sub(max, power(2, k, MOD));  long total = 0;  if(min <= max) {  total = sub(summ(max), summ(min));  }  else {  total = summ(max);  total = add(total, sub(summ(MOD-1), summ(min)));  }  total = mult(total, 2);  total = div(total, power(2, k, MOD));  out.println(total);  out.close(); }  long summ(long x) {  x *= x+1;  x /= 2;  x %= MOD;  return x; }  long add(long a, long b) {  a %= MOD;  b %= MOD;  a += b;  a %= MOD;  return a; }  long sub(long a, long b) {  a %= MOD;  b %= MOD;  a -= b;  while(a < 0) a += MOD;  a %= MOD;  return a; }  long mult(long a, long b) {  a %= MOD;  b %= MOD;  a *= b;  a %= MOD;  return a; }  long div(long a, long b) {  a %= MOD;  b %= MOD;  a *= inv(b);  a %= MOD;  return a; }  long inv(long x) {  long res = power(x, MOD-2, MOD);  while(res < 0) res += MOD;  res %= MOD;  return res; }  long power (long x, long y, long m) {  long res = 1;  x %= m;  while(y > 0) {   if(y % 2 == 1) {   res = (res * x) % m;   }   y >>= 1L;   x = (x * x) % m;  }  return res;  }  void sort (int[] a) {  int n = a.length;  for(int i = 0; i < 50; i++) {  Random r = new Random();  int x = r.nextInt(n), y = r.nextInt(n);  int temp = a[x];  a[x] = a[y];  a[y] = temp;  }  Arrays.sort(a); }  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;  }  public double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }  public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }  public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  }   public int[] nextIntArray(int n) {  int[] res = new int[n];  for(int i = 0; i < n; i++) res[i] = nextInt();  return res;  }   } }
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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   int n;   ArrayList<Integer>[] adj;   long[] mem;   long cycles(int cur, int start, int visited) {    if (cur == start && visited > 0) {     return Integer.bitCount(visited) >= 3 ? 1 : 0;    }    int index = n * visited + cur;    if (mem[index] != -1) return mem[index];    long res = 0;    int newvisited = visited | (1 << cur);    for (int nxt : adj[cur]) {     if (nxt >= start && (nxt == start || ((visited >> nxt) & 1) == 0)) {      res += cycles(nxt, start, newvisited);     }    }    return mem[index] = res;   }   public void solve(int testNumber, InputReader in, OutputWriter out) {    n = in.readInt();    int m = in.readInt();    adj = new ArrayList[n];    mem = new long[n * (1 << n)];    for (int i = 0; i < adj.length; i++) adj[i] = new ArrayList<>();    for (int i = 0; i < m; i++) {     int a = in.readInt() - 1, b = in.readInt() - 1;     adj[a].add(b);     adj[b].add(a);    }    long res = 0;    for (int start = 0; start < n; start++) {     Arrays.fill(mem, -1);     res += cycles(start, start, 0) / 2;    }    out.printLine(res);   }  }  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);   }  }  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);   }  } }
1	public class Main {  private static void solve() {  int n = ni();  int d = ni();  int[] a = na(n);  Arrays.sort(a);  Set<Integer> set = new HashSet<>();  for (int i = 0; i < n; i ++) {  int cand1 = a[i] - d;  int cand2 = a[i] + d;  int d1 = d;  int d2 = d;  for (int j = 0; j < n; j ++) {   d1 = Math.min(d1, Math.abs(a[j] - cand1));   d2 = Math.min(d2, Math.abs(a[j] - cand2));  }  if (d1 == d) {   set.add(cand1);  }  if (d2 == d) {   set.add(cand2);  }  }  System.out.println(set.size()); }   public static void main(String[] args) {  new Thread(null, new Runnable() {  @Override  public void run() {   long start = System.currentTimeMillis();   String debug = args.length > 0 ? args[0] : null;   if (debug != null) {   try {    is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));   } catch (Exception e) {    throw new RuntimeException(e);   }   }   reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);   solve();   out.flush();   tr((System.currentTimeMillis() - start) + "ms");  }  }, "", 64000000).start(); }  private static java.io.InputStream is = System.in; private static java.io.PrintWriter out = new java.io.PrintWriter(System.out); private static java.util.StringTokenizer tokenizer = null; private static 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(); }  private static double nd() {  return Double.parseDouble(next()); }  private static long nl() {  return Long.parseLong(next()); }  private static int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = ni();  return a; }  private static char[] ns() {  return next().toCharArray(); }  private static long[] nal(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)  a[i] = nl();  return a; }  private static int[][] ntable(int n, int m) {  int[][] table = new int[n][m];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   table[i][j] = ni();  }  }  return table; }  private static int[][] nlist(int n, int m) {  int[][] table = new int[m][n];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   table[j][i] = ni();  }  }  return table; }  private static int ni() {  return Integer.parseInt(next()); }  private static void tr(Object... o) {  if (is != System.in)  System.out.println(java.util.Arrays.deepToString(o)); } }
2	public class CodeForces {  class Pair<K, V> {   K first;   V second;   public Pair(K k, V v) {    first = k;    second = v;   }  }  private boolean contain(int set, int i) {   return (set & (1<<i)) > 0;  }  private static 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;  }   private static boolean isSame(double a, double b) {   return Math.abs(a - b) < 1e-10;  }  private static void swapBoolean(boolean[] p, int i, int j) {   boolean tmp = p[i];   p[i] = p[j];   p[j] = tmp;  }  private static void swap(int[] p, int i, int j) {   int tmp = p[i];   p[i] = p[j];   p[j] = tmp;  }  private static int countOne(int a) {   if (a == 0) return 0;   return countOne(a & (a-1)) + 1;  }  private static int sdiv(int a, int b) {   return (a +b -1) / b;  }  private int[] retran(int index) {   int[] res = new int[2];   res[0] = index / M;   res[1] = index % M;   return res;  }  private int tran(int x, int y) {   return x * M + y;  }  private boolean inTable(int x, int y) {   return x>=0 && x< N && y >= 0 && y < M;  }  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<>();  class Edge {   int u;   int v;   int start;   int duration;   public Edge(int u, int v, int l, int d) {    this.u = u;    this.v = v;    this.start = l;    this.duration = d;   }  }  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);  } }
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));   }  } }
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);   }  } }
5	public class Main {    public static void main(String[] args) {     int n, i;   boolean status = false;   int answer;   Scanner in = new Scanner(System.in);   n = in.nextInt();   int a[] = new int[n];   for (i = 0; i < n; i++) {    a[i] = in.nextInt();   }   Arrays.sort(a);   answer = a[0];   for (i = 1; i < n; i++) {    if (a[i] != answer) {     answer = a[i];     status = true;     i = n + 1;    }   }   if (status) {    System.out.println(answer);   } else {    System.out.println("NO");   }  } }
3	public class Main {  public static void main(String[] args) {  Scanner in=new Scanner(System.in);   int n=in.nextInt();  int a[]=new int[n];  for(int i=0; i<n; i++)   a[i]=in.nextInt();  long no=0;  for(int i=0; i<n-1; i++)  {   for(int j=i+1; j<n; j++)   {   if(a[i]>a[j])    no++;   }  }    no%=2;  int m=in.nextInt();  int te;  String te2="odd",te1="even";  for(int i=0; i<m; i++)  {   te=in.nextInt()-in.nextInt();   te=-te+1;    if((te*(te-1)/2)%2==0)   {     if(no==0)    System.out.println("even");   else    System.out.println("odd");   }   else   {   no=(no+1)%2;   if(no==0)    System.out.println("even");   else    System.out.println("odd");   }  }    } }
2	public class ReallyBigNumbers817c {  static long sd(String s) {   long c = 0;   for (int i = 0; i < s.length(); i++) {    c += s.charAt(i);   }   return c - s.length() * 0x30;  }    public static void main(String[] args) {   Scanner in = new Scanner(System.in);   long n = in.nextLong();   long s = in.nextLong();      long i = (s/10+1)*10 ;   if (n<10||n-sd(n+"")<s) {    System.out.println(0);    return;   }   while(!(i-sd(i+"")>=s)){   i+=10;     }   System.out.println(n-i+1);    }   }
0	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);     int n = in.nextInt();     out.println(n+" 0 0");     in.close();   out.close();    } }
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");}     }  }
5	public class TaskA implements Runnable { private InputReader in; private PrintWriter out;  public static void main(String[] args) {  new Thread(new TaskA()).start();  }  public TaskA() {      in = new InputReader(System.in);  out = new PrintWriter(System.out); }  public void run() {    int n = in.readInt();  int t = in.readInt();  final int[] x = new int[n];  int[] a = new int[n];  for (int i = 0; i < n; i++) {  x[i] = in.readInt();  a[i] = in.readInt();  }  Integer[] o = new Integer[n];  for (int i = 0; i < n; i++)  o[i] = i;  Arrays.sort(o, new Comparator<Integer>() {  public int compare(Integer o1, Integer o2) {   return x[o1] - x[o2];  }  });  int ans = 2;  for (int i = 1; i < n; i++) {  int d = x[o[i]] - x[o[i - 1]];  d = 2 * d - a[o[i]] - a[o[i - 1]] - 2 * t;  if (d > 0)   ans += 2;  else if (d == 0)   ans++;  }  out.println(ans);  out.close(); }  private 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;  }  public long readLong() {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  long res = 0;  do {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  } while (!isSpaceChar(c));  return res * sgn;  }  public String readString() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuffer res = new StringBuffer();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  private boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  private String readLine0() {  StringBuffer buf = new StringBuffer();  int c = read();  while (c != '\n' && c != -1) {   buf.appendCodePoint(c);   c = read();  }  return buf.toString();  }  public String readLine() {  String s = readLine0();  while (s.trim().length() == 0)   s = readLine0();  return s;  }  public String readLine(boolean ignoreEmptyLines) {  if (ignoreEmptyLines)   return readLine();  else   return readLine0();  }  public BigInteger readBigInteger() {  try {   return new BigInteger(readString());  } catch (NumberFormatException e) {   throw new InputMismatchException();  }  }  public char readCharacter() {  int c = read();  while (isSpaceChar(c))   c = read();  return (char) c;  }  public double readDouble() {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.') {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  if (c == '.') {   c = read();   double m = 1;   while (!isSpaceChar(c)) {   if (c < '0' || c > '9')    throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();   }  }  return res * sgn;  } } }
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 printLevels() {   int i;   for (i=0;i<N;i++) {    System.out.println(i+" "+dl[i]);   }  }   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);         } }
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()); } long nl() { return Long.parseLong(in.next()); } double nd() { return Double.parseDouble(in.next()); } boolean oj = System.getProperty("ONLINE_JUDGE") != null; void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
5	public class r114 {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int a = sc.nextInt();   int b = sc.nextInt();     ArrayList<Integer> l = new ArrayList<Integer>();   for (int i = 0 ; i < n; i++) {    l.add(sc.nextInt());   }   Collections.sort(l);     int pet = l.get(n - a);   int vas = l.get(b - 1);     if (pet <= vas) {    System.out.println(0);   }   else System.out.println(pet - vas);       sc.close();  } }
3	public class Solution {   static MyScanner sc;  private static PrintWriter out;  static long M2 = 1_000_000_000L + 7;  private static HashMap<Long, Long>[] mods;  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();  }  private static void solve() throws IOException {   int n = sc.nextInt();   int[] data = sc.na(n);   boolean ev = true;   for (int t = 0; t < n - 1; t++) {    for (int x = t + 1; x < n; x++) {     if (data[t] > data[x]) {      ev = !ev;     }    }   }   int m = sc.nextInt();   for (int i = 0; i < m; i++) {    int dd = -sc.nextInt() + sc.nextInt();    int dm = (dd + 1) * dd / 2;    if (dm % 2 == 1) {     ev = !ev;    }    out.println(ev ? "even" : "odd");   }   }   private static void initData() {   }   private static boolean isset(long i, int k) {   return (i & (1 << k)) > 0;  }  private static void solveT() throws IOException {   int t = sc.nextInt();   while (t-- > 0) {    solve();   }  }   private static long gcd(long l, long l1) {   if (l > l1) return gcd(l1, l);   if (l == 0) return l1;   return gcd(l1 % l, l);  }  private static 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();   }   Integer[] nab(int n) {    Integer[] k = new Integer[n];    for (int i = 0; i < n; i++) {     k[i] = sc.fi();    }    return k;   }   int[] na(int n) {    int[] k = new int[n];    for (int i = 0; i < n; i++) {     k[i] = sc.fi();    }    return k;   }   long[] nl(int n) {    long[] k = new long[n];    for (int i = 0; i < n; i++) {     k[i] = sc.nextLong();    }    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());   }   double nextDouble() {    return Double.parseDouble(next());   }  }  }
2	public class CodeforcesRound176B {   public static void main(String[] args)  {  Scanner kde =new Scanner (System.in);  Long n = kde.nextLong();  Long k = kde.nextLong();  if(((k-1)*(k-2)+2*k)<(n*(long)2))  {  System.out.println(-1);  return;  }  Long a,b;  if(n==1)  {   System.out.println(0);   return;  }    if(k>=n)  {   System.out.println(1);   return;  }  else  {  a=(long)2;  b=k-1;   }   boolean flag =false;  while(true)  {  if(a>=b)  {     break;       }   long c =(a+b)/2;   if(2*(k-c+1)+(k-1+k-c+1)*(c-1)<(n*2))   {   a=c+1;   }   else   {   b=c;   }   flag=true;  }  if(flag==true )  {  System .out.println(a);  }  else  {  System .out.println(a);  }     } }
2	public class A { private static 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(); } }
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());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    try {     return reader.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }  } }
6	public class Main implements Runnable {      private int n;  private int nn;  private int[][] D;  private int[] dp;  private int[] prev;  private void solve() throws Throwable {   int xs = nextInt(), ys = nextInt();   n = nextInt();   int[][] pts = new int[n][2];   for (int i = 0; i < n; i++) {    pts[i][0] = nextInt();    pts[i][1] = nextInt();   }   D = new int[n][n];   for (int i = 0; i < n; i++) {    for (int j = 0; j < n; j++) {     if (i == j) {      D[i][i] = 2 * (sqr(pts[i][0] - xs) + sqr(pts[i][1] - ys));     } else {      D[i][j] = sqr(pts[i][0] - xs) + sqr(pts[i][1] - ys)        + sqr(pts[i][0] - pts[j][0])        + sqr(pts[i][1] - pts[j][1]) + sqr(pts[j][0] - xs)        + sqr(pts[j][1] - ys);     }    }   }   nn = 1 << n;   dp = new int[nn];   prev = new int[nn];   Arrays.fill(dp, -1);   Arrays.fill(prev, -1);   dp[0] = 0;   Dp(nn - 1);   pw.println(dp[nn - 1]);   pw.print(0);   for (int p = nn - 1; p != -1 && prev[p] != -1; p = prev[p]) {    int vv = p ^ prev[p];    for (int j = 0; j < n; j++) {     int jj = 1 << j;     if ((vv & jj) == 0) continue;     pw.print(' ');     pw.print(j + 1);    }    pw.print(" 0");   }   pw.println();  }  private int Dp(int i) {   if (dp[i] != -1) return dp[i];   int ans = 107374182, p = -1;   int j1 = 1, pos1 = 0;   for (; pos1 < n && j1 < nn; j1 *= 2, pos1++) {    if ((i & j1) == 0) continue;    int a = D[pos1][pos1] + Dp(i ^ j1);    if (a < ans) {     ans = a;     p = i ^ j1;    }    int j2 = j1 * 2, pos2 = pos1 + 1;    for (; pos2 < n && j2 < nn; j2 *= 2, pos2++) {     if ((i & j2) == 0) continue;     a = D[pos1][pos2] + Dp(i ^ (j1 | j2));     if (a < ans) {      ans = a;      p = i ^ (j1 | j2);     }    }    break;   }     dp[i] = ans;   prev[i] = p;   return ans;  }  private int sqr(int i) {   return i * 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());  }  long nextLong() throws NumberFormatException, IOException {   return Long.parseLong(nextString());  }  double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextString());  }  static Throwable sError;  public static void main(String[] args) throws Throwable {    new Main().run();   if (sError instanceof OutOfMemoryError) {    throw sError;   }   }  public void run() {   try {    initStreams();    solve();   } catch (Throwable e) {    sError = e;   } finally {    if (pw != null)     pw.close();   }  } }
1	public class Third{ static long mod=1000000007;   public static void main(String[] args) throws Exception{      InputReader in = new InputReader(System.in);    PrintWriter pw=new PrintWriter(System.out);                 int n=in.readInt();      String a=in.readString();  char c[]=a.toCharArray();  HashSet<Character>ht=new HashSet<Character>();  Deque<Character>q=new LinkedList<Character>();  HashSet<Character>hs=new HashSet<Character>();  HashMap<Character,Integer>hm=new HashMap<Character,Integer>();  for(int i=0;i<n;i++)  {   ht.add(c[i]);  }  int t=ht.size();  q.addLast(c[0]);  hs.add(c[0]);  hm.put(c[0],1);  int ans=Integer.MAX_VALUE;  if(hs.size()==t)  {     ans=min(ans,q.size());  }    for(int i=1;i<n;i++)  {   q.addLast(c[i]);  hs.add(c[i]);  if(hm.containsKey(c[i]))  {   int x=hm.get(c[i]);   hm.put(c[i],x+1);  }  else   hm.put(c[i],1);   while(hs.size()==t)   {      ans=min(ans,q.size());   char ch=q.peekFirst();   int x=hm.get(ch);   if(x==1)    break;   else    {    hm.put(ch, x-1);    q.pollFirst();    }      }          }  pw.println(ans);           pw.close();  }    public static long gcd(long x,long y) { if(x%y==0)  return y; else  return gcd(y,x%y); } public static int gcd(int x,int y) { if(x%y==0)  return y; else  return gcd(y,x%y); } public static int abs(int a,int b) { return (int)Math.abs(a-b); } public static long abs(long a,long b) { return (long)Math.abs(a-b); } public static int max(int a,int b) { if(a>b)  return a; else  return b; } public static int min(int a,int b) { if(a>b)  return b; else  return a; } public static long max(long a,long b) { if(a>b)  return a; else  return b; } public static long min(long a,long b) { if(a>b)  return b; else  return a; }  public static long pow(long n,long p,long m) {  long result = 1;  if(p==0)  return 1; if (p==1)  return n; while(p!=0) {  if(p%2==1)   result *= n;  if(result>=m)  result%=m;  p >>=1;  n*=n;  if(n>=m)  n%=m; } return result; } public static long pow(long n,long p) { long result = 1;  if(p==0)  return 1; if (p==1)  return n; while(p!=0) {  if(p%2==1)   result *= n;    p >>=1;  n*=n;   } return result; } static class Pair implements Comparable<Pair> { int a,b; Pair (int a,int b) {  this.a=a;  this.b=b; }  public int compareTo(Pair o) {   if(this.a!=o.a)  return Integer.compare(this.a,o.a);  else  return Integer.compare(this.b, o.b);   } public boolean equals(Object o) {   if (o instanceof Pair) {    Pair p = (Pair)o;    return p.a == a && p.b == b;   }   return false;  }  public int hashCode() {   return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();  }  }   static long sort(int a[]) { int n=a.length; int b[]=new int[n];  return mergeSort(a,b,0,n-1);} static long mergeSort(int a[],int b[],long left,long right) { long c=0;if(left<right) { long mid=left+(right-left)/2;  c= mergeSort(a,b,left,mid);  c+=mergeSort(a,b,mid+1,right);  c+=merge(a,b,left,mid+1,right); }  return c; } static long merge(int a[],int b[],long left,long mid,long right) {long c=0;int i=(int)left;int j=(int)mid; int k=(int)left; while(i<=(int)mid-1&&j<=(int)right) { if(a[i]<=a[j]) {b[k++]=a[i++]; } else { b[k++]=a[j++];c+=mid-i;}} while (i <= (int)mid - 1) b[k++] = a[i++]; while (j <= (int)right) b[k++] = a[j++]; for (i=(int)left; i <= (int)right; i++)  a[i] = b[i]; return c; }  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; }   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 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 double readDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, readInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, readInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }   public 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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public String next()   {    return readString();   }   public interface SpaceCharFilter   {    public boolean isSpaceChar(int ch);   }  }                           }
0	public class Subtract { public static void main(String[] args){  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int a,b;  String answer = "";  while(n!=0){  a = sc.nextInt();  b = sc.nextInt();  answer += solve(a,b) + "\n";  n--;  }  System.out.println(answer); }  public static int solve(int a, int b){  int count = 0;  int div;  int mod;  while(true){  if(a >= b){   div = a/b;   mod = a%b;   count += div;   if(mod==0){   return count;   }   else{   a = mod;   }  }  else{   div = b/a;   mod = b%a;   count += div;   if(mod==0){   return count;   }   else{   b = mod;   }  }  } } }
4	public class TaskA implements Runnable { private InputReader in; private PrintWriter out;  public static void main(String[] args) {  new Thread(new TaskA()).start();  }  public TaskA() {      in = new InputReader(System.in);  out = new PrintWriter(System.out); }  public void run() {    String s = in.readString();  Set<String> m = new HashSet<String>();  int ans = 0;  for (int i = 0; i < s.length(); i++) {  for (int j = i + 1; j <= s.length(); j++) {   if (m.contains(s.substring(i, j)))   ans = Math.max(ans, j - i);   else   m.add(s.substring(i, j));  }  }  out.print(ans);  out.close(); }  private 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;  }  public long readLong() {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  long res = 0;  do {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  } while (!isSpaceChar(c));  return res * sgn;  }  public String readString() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuffer res = new StringBuffer();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  private boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  private String readLine0() {  StringBuffer buf = new StringBuffer();  int c = read();  while (c != '\n' && c != -1) {   buf.appendCodePoint(c);   c = read();  }  return buf.toString();  }  public String readLine() {  String s = readLine0();  while (s.trim().length() == 0)   s = readLine0();  return s;  }  public String readLine(boolean ignoreEmptyLines) {  if (ignoreEmptyLines)   return readLine();  else   return readLine0();  }  public BigInteger readBigInteger() {  try {   return new BigInteger(readString());  } catch (NumberFormatException e) {   throw new InputMismatchException();  }  }  public char readCharacter() {  int c = read();  while (isSpaceChar(c))   c = read();  return (char) c;  }  public double readDouble() {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.') {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  if (c == '.') {   c = read();   double m = 1;   while (!isSpaceChar(c)) {   if (c < '0' || c > '9')    throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();   }  }  return res * sgn;  } } }
1	public class Round1B {  public static void main(String[] args) throws Exception {  new Round1B().run(); }  private void run() throws Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int tc = Integer.parseInt(br.readLine().trim());  while (tc > 0) {  String s = br.readLine().trim();  if (s.matches("R[0-9]+C[0-9]+")) {   Pattern p = Pattern.compile("R([0-9]+)C([0-9]+)");   Matcher m = p.matcher(s);   if (m.matches()) {   int rows = Integer.parseInt(m.group(1));   int cols = Integer.parseInt(m.group(2));   String col = "";   while (cols > 0) {    int mod = (cols - 1) % 26;    col = (char)('A' + mod) + col;    cols = (cols - 1) / 26;   }   System.out.println(col + rows);   } else {   throw new Exception();   }  } else {   Pattern p = Pattern.compile("([A-Z]+)([0-9]+)");   Matcher m = p.matcher(s);   if (m.matches()) {      int rows = Integer.parseInt(m.group(2));   int cols = 0;   int mul = 1;   for (int i = m.group(1).length() - 1; i >= 0; i--) {    cols += mul * (m.group(1).charAt(i) - 'A' + 1);    mul *= 26;   }   System.out.printf("R%dC%d\n", rows, cols);   }   else {   throw new Exception();   }  }   tc--;  }  br.close(); } }
1	public class AB {  private InputStream input;  private PrintStream output;  private Scanner inputSc;  public AB(InputStream input, PrintStream output) {   this.input = input;   this.output = output;   init();  }  private void init() {   inputSc = new Scanner(input);  }  static int lineToInt(String line) {   return Integer.parseInt(line);  }  static long lineToLong(String line) {   return Long.parseLong(line);  }  static double lineToDouble(String line) {   return Double.parseDouble(line);  }   public void solve()  {    solveTestCase();  }   HashMap<Integer,Integer> mat ; long dist[] ; int vec[] ; int ar[] ; Set<Integer> st ; boolean isDone[] ; final long INF = 100000000000000000L ; @SuppressWarnings("unchecked")  private void solveTestCase()  {  int i , j , k , n , m , d , l ,b , p , q , r;  long N , M, K;  int x1 , y1 , x2 , y2 ,x;  int a1,a2,b1,b2,a ;  DecimalFormat df = new DecimalFormat("#,###,##0.00");   String str = inputSc.nextLine();   String delims = "[ ]+";  String tokens[] = str.split(delims);  n = lineToInt(tokens[0]);  a = lineToInt(tokens[1]);  b = lineToInt(tokens[2]);  mat = new HashMap<Integer,Integer>() ;  st = new TreeSet<Integer>();  ar = new int[n+4] ;  vec = new int[n+4] ;  str = inputSc.nextLine();  tokens = str.split(delims);  for( i = 1 ; i <= n ; i++ )  {  ar[i] = lineToInt(tokens[i-1]);  mat.put(ar[i],i) ;  st.add(ar[i]);  vec[i] = i ;  }  vec[n+1] = n+1 ;  vec[n+2] = n+2 ;  for( i = 1 ; i <= n ; i++ )  {  x= ar[i];    if(st.contains(a-x))  {   Bing(mat.get(x),mat.get(a-x));  }  else   Bing(n+1 , mat.get(x));  if(st.contains(b-x))  {   Bing(mat.get(x),mat.get(b-x));  }  else   Bing(n+2 , mat.get(x));  }  if(find(n+1)==find(n+2))  {  output.println("NO");  return ;  }  output.println("YES");  for( i =1 ; i<= n ; i ++ )  {  if(find(i)==find(n+1))   output.print("1 ");  else   output.print("0 ");  }  output.println();   } int find(int x) { if(x==vec[x]) return x; return vec[x]=find(vec[x]); } void Bing(int a,int b) { int A=find(a);int B=find(b); if(A==B) return ; vec[B]=A; }    public static void main(String[] args)  {  FileInputStream in = null;   FileOutputStream out = null;  PrintStream ps = null ;  InputStream is = null ;  try  {    is = new FileInputStream("file.in");    out = new FileOutputStream("file.out");  ps = new PrintStream(out);   }  catch ( Exception e )  {}   AB sd = new AB(System.in, System.out);   sd.solve();  try  {   if (is != null)  {   is.close();  }   if (out != null) {    out.close();   }  if (ps != null) {    ps.close();   }   }catch (Exception e){}      } }
0	public class ProblemD { 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(" ");  double a = Double.valueOf(data[0]);  double v = Double.valueOf(data[1]);   String[] line = s.readLine().split(" ");  double l = Double.valueOf(line[0]);  double d = Double.valueOf(line[1]);  double w = Double.valueOf(line[2]);  double ans = solve(a, v, l, d, w);  out.println(String.format("%.07f", ans));   out.flush(); }  private static double solve(double a, double v, double l, double d, double w) {  double maxSpeedAtD = Math.sqrt(2 * d / a) * a;  if (v <= w || maxSpeedAtD <= w) {    double maxSpeedAtL = Math.sqrt(2 * l / a) * a;  if (maxSpeedAtL <= v) {   return Math.sqrt(2 * l / a);  } else {   double timeToMaxSpeed = v / a;   double leftDist = l - 0.5 * a * timeToMaxSpeed * timeToMaxSpeed;   return timeToMaxSpeed + leftDist / v;  }  }   double time = 0.0d;  double maxSpeedTime = Math.sqrt((d / a) + (w * w / (2 * a * a)));  double maxSpeed = maxSpeedTime * a;  if (maxSpeed <= v) {  time = maxSpeedTime + (a * maxSpeedTime - w) / a;  } else {  double vtime = (2 * a * d + w * w - 2 * v * v) / (2 * a * v);  time = v / a + vtime + (v - w) / a;  }     double timeToV = (v - w) / a;  double timeToVLen = timeToV * w + 0.5 * timeToV * (v - w);  if (timeToVLen <= l - d) {  double leftLen = l - d - timeToVLen;  time += timeToV + leftLen / v;  } else {  time += (-w + Math.sqrt(w*w + a * (2 * l - 2 * d))) / a;  }  return time; }  public static void debug(Object... os){  System.err.println(Arrays.deepToString(os)); } }
4	public class Watermelon {  static int[][] ans;static int n,m;static boolean[][] vis;  public static void main(String[] args) throws IOException {   Scanner sc=new Scanner(new File("input.txt"));   PrintWriter pw=new PrintWriter("output.txt");   int n=sc.nextInt(),m=sc.nextInt(),k=sc.nextInt();   Queue<Integer> pq=new ArrayDeque<>();   boolean[] vis=new boolean[n*m];   for(int i=0;i<k;i++){    int r=sc.nextInt()-1,c=sc.nextInt()-1;    pq.add(m*r+c);    vis[m*r+c]=true;   }   sc.close();   int ans=0;   while(pq.size()!=0){    int x=pq.remove();    ans=x;    if(n!=1 && x%n==0){     if(x+m<n*m&&!vis[x+m]){      pq.add(x+m);      vis[x+m]=true;     }     if(x-m>=0&&!vis[x-m]){      pq.add(x-m);      vis[x-m]=true;     }     if(x+1<n*m&&!vis[x+1]){      pq.add(x+1);      vis[x+1]=true;     }    }    else if(n!=1 && (x+1)%n==0){     if(x+m<n*m&&!vis[x+m]){      pq.add(x+m);      vis[x+m]=true;     }     if(x-m>=0&&!vis[x-m]){      pq.add(x-m);      vis[x-m]=true;     }     if(x-1>=0&&!vis[x-1]){      pq.add(x-1);      vis[x-1]=true;     }    }    else{     if(x+m<n*m&&!vis[x+m]){      pq.add(x+m);      vis[x+m]=true;     }     if(x-m>=0&&!vis[x-m]){      pq.add(x-m);      vis[x-m]=true;     }     if(x-1>=0&&!vis[x-1]){      pq.add(x-1);      vis[x-1]=true;     }     if(x+1<n*m&&!vis[x+1]){      pq.add(x+1);      vis[x+1]=true;     }    }   }   pw.println((ans/m+1)+" "+(ans%m+1));   pw.close();  }  static class Reader{   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;   public Reader() {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public Reader(String file_name) throws IOException {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public String readLine() throws IOException {    byte[] buf = new byte[64];    int cnt = 0, c;    while ((c = read()) != -1) {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }   public int nextInt() throws IOException {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public long nextLong() throws IOException {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public double nextDouble() throws IOException {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (c == '.') {     while ((c = read()) >= '0' && c <= '9') {      ret += (c - '0') / (div *= 10);     }    }    if (neg)     return -ret;    return ret;   }   private void fillBuffer() throws IOException {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }   private byte read() throws IOException {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }   public void close() throws IOException {    if (din == null)     return;    din.close();   }  }  }
6	public class G1_PlaylistForPolycarp {  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();  }  private static class Solver {   private void solve(InputReader inp, PrintWriter out) {    int n = inp.nextInt(), t = inp.nextInt();    int[][] tracks = new int[n][2];    long MOD = 1000000007;    for (int i = 0; i < n; i++) {     tracks[i][0] = inp.nextInt();     tracks[i][1] = inp.nextInt() - 1;    }    long[][] dp = new long[2 << n][4];    dp[0][3] = 1;        int curr = 1;    while (curr <= n) {     int mask = 0;     for (int i = 0; i < curr; i++) mask |= (1 << i);          while (mask < 2 << n) {           for (int i = 0; i < n; i++) {             if ((mask & (1 << i)) != 0) {               for (int j = 0; j < 4; j++) {         if (j == tracks[i][1]) continue;         dp[mask][tracks[i][1]] += dp[mask - (1 << i)][j];        }       }      }            mask = nextNumberXBits(mask);     }     curr++;    }    long res = 0;    for (int i = 0; i < (2 << n); i++) {     int time = 0;     for (int j = 0; j < n; j++) {      if ((i & (1 << j)) != 0) time += tracks[j][0];     }     if (time == t) {      for (int j = 0; j < 4; j++) {       res += dp[i][j];      }      res %= MOD;     }    }    out.print(res);   }   private static int nextNumberXBits(int mask) {    int c = mask & -mask;    int r = mask + c;    return (((r ^ mask) >> 2) / c) | r;   }  }  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());   }  } }
6	public class Main implements Runnable { private void solution() throws IOException {  int n = in.nextInt();  int m = in.nextInt();  boolean[][] adj = new boolean[n][n];  long res = 0;  for (int i = 0; i < m; ++i) {  int x = in.nextInt();  int y = in.nextInt();  adj[x - 1][y - 1] = true;  adj[y - 1][x - 1] = true;  }  final long[][] dp = new long[1 << n][n];  for (int i = 0; i < n; ++i) {  int Limit = 1 << (n - i);  int nn = n - i;  for (int mask = 0; mask < Limit; ++mask) {   for (int j = 0; j < nn; ++j) {   dp[mask][j] = 0;   }  }  dp[0][0] = 1;  for (int mask = 0; mask < Limit; ++mask) {   if ((mask & 1) == 0) {   for (int j = 0; j < nn; ++j) {    if (dp[mask][j] != 0) {    long am = dp[mask][j];    for (int k = 0; k < nn; ++k) {     if (((mask >> k) & 1) == 0 && adj[j + i][k + i]) {     dp[mask | (1 << k)][k] += am;     }    }    }   }   } else {   res += dp[mask][0];   }  }  }  out.println((res - m) / 2); }  public void run() {  try {  solution();  in.reader.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  private class Scanner {  BufferedReader reader;  StringTokenizer tokenizer;  public Scanner(Reader reader) {  this.reader = new BufferedReader(reader);  this.tokenizer = new StringTokenizer("");  }  public boolean hasNext() throws IOException {  while (!tokenizer.hasMoreTokens()) {   String next = reader.readLine();   if (next == null) {   return false;   }   tokenizer = new StringTokenizer(next);  }  return true;  }  public String next() throws IOException {  hasNext();  return tokenizer.nextToken();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static void main(String[] args) throws IOException {  new Thread(null, new Main(), "", 1 << 28).start(); } PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new InputStreamReader(System.in)); }
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());   }   public long nextLong() {   return Long.parseLong(next());   }   public double nextDouble() {   return Double.parseDouble(next());   }   public String nextLine() {   try {    return reader.readLine();   } catch(IOException e) {    throw new RuntimeException(e);   }   }  } }
0	public class Main { public static void main(String[] args) {  Scanner scanner = new Scanner(System.in);  BigInteger l = new BigInteger(scanner.next());  BigInteger r = new BigInteger(scanner.next());  if(r.subtract(l).intValue() < 2) {  System.out.println(-1);  return;  }  BigInteger a = l.abs(),b,c;   BigInteger toothless = r.subtract(BigInteger.valueOf(1));  while(a.compareTo(toothless) == -1) {  b = l.add(BigInteger.valueOf(1));  while(b.compareTo(r) == -1) {   c = l.add(BigInteger.valueOf(2));   while(c.compareTo(r) == -1 || c.compareTo(r) == 0) {   if(gcd(a,b) == 1 && gcd(b,c) == 1 && gcd(a,c) != 1) {    System.out.println(a + " " + b + " " + c);    return;   }      c = c.add(BigInteger.valueOf(1));   }   b = b.add(BigInteger.valueOf(1));  }  a = a.add(BigInteger.valueOf(1));  }  System.out.println(-1); } private static int gcd(BigInteger a, BigInteger b) {  return a.gcd(b).intValue(); } }
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"); } }
5	public class C {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(in.readLine());   String[] S = in.readLine().split(" ");   int[] A = new int[n];   boolean allOnes = true;   for (int i = 0; i < n; i++) {    A[i] = Integer.parseInt(S[i]);    allOnes &= A[i] == 1;   }   Arrays.sort(A);   if (A[A.length - 1] > 1)    A[A.length - 1] = 1;   else    A[A.length - 1] = 2;   Arrays.sort(A);   for (int i = 0; i < A.length; i++)    System.out.print(A[i] + " ");   System.out.println();  } }
0	public class A {  public static void main(String[] args) throws Throwable {  new A().go(); }  void p(String s) {  System.out.println(s); }  void go() throws Throwable {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  String[] t = in.readLine().split(" ");  long a = Long.parseLong(t[0]), b = Long.parseLong(t[1]);  long mv = 0;  while (a > 1 && b > 1) {  if (a > b) {   long tt = a;   a = b;   b = tt;  }  mv += b / a;  b %= a;  }  System.out.println(mv + Math.max(a, b)); } }
1	public class A { public static void main(String[] args) throws Exception {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  List<Integer> list = new ArrayList<Integer>(), list2;  for (; n-- > 0;) {  list.add(scan.nextInt());  }  list2 = new ArrayList<Integer>(list);  Collections.sort(list2, new Comparator<Integer>() {  public int compare(Integer o1, Integer o2) {   return o1 % 2 - o2 % 2;  }  });  System.out.println(list.indexOf(list2.get(list2.get(1) % 2 > 0 ? 0   : list2.size() - 1)) + 1); } }
4	public class FireAgain {  public static void main(String[] args) throws IOException {  System.setIn(new FileInputStream("input.txt"));  System.setOut(new PrintStream("output.txt"));   BufferedReader r = new BufferedReader(new InputStreamReader(System.in));  String s[] = r.readLine().split("\\s+");  int n = Integer.parseInt(s[0]);  int m = Integer.parseInt(s[1]);  int k = Integer.parseInt(r.readLine());  int[][] a = new int[n][m];  for(int i = 0; i < n; i++) {  for(int j = 0; j < m; j++)   a[i][j] = Integer.MAX_VALUE;  }  assert k >= 1 && k < n * m;  int max = 0;  StringTokenizer st = new StringTokenizer(r.readLine());  assert st.countTokens() == k;  for(; k > 0; k--) {  int x = Integer.parseInt(st.nextToken()) - 1;  int y = Integer.parseInt(st.nextToken()) - 1;  assert x >= 1 && x <= n && y >= 1 && y <= n;   for(int i = 0; i < n; i++) {   for(int j = 0; j < m; j++) {   int d = Math.abs(i - x) + Math.abs(j - y);   if(a[i][j] > d)    a[i][j] = d;   if(k == 1 && a[i][j] > max)    max = a[i][j];   }  }  }  for(int i = 0; i < n; i++) {  for(int j = 0; j < m; j++) {   if(a[i][j] == max) {   System.out.println((i + 1) + " " + (j + 1));   return;   }  }  }  } }
3	public class A {  static int countColors(List<Integer> colors) {  Collections.sort(colors);  int k = 0;  while (!colors.isEmpty()) {  Integer c = colors.get(0);  colors.remove(0);  k++;   List<Integer> toRemove = new ArrayList<>();  for (int i = 0; i < colors.size(); i++) {   if (colors.get(i) % c == 0) toRemove.add(i);  }   Collections.reverse(toRemove);  for (Integer integer : toRemove) {   colors.remove(integer.intValue());  }  }  return k; }  public static void main(String[] args) {  try (Scanner scanner = new Scanner(System.in)) {  int n = scanner.nextInt();  scanner.nextLine();  List<Integer> integers = Arrays.stream(scanner.nextLine().split(" ")).map(Integer::parseInt).collect(Collectors.toList());  System.out.println(countColors(integers));  } } }
3	public final class Solution {  BufferedReader br;  StringTokenizer st;   {   st = null;   br = new BufferedReader(new InputStreamReader(System.in));  }   public static void main(String[] args) throws Exception {   new Solution().run();  }   void run() throws Exception {   int n = ni();   int[] a = new int[n];   for(int i=0; i<n; i++) a[i] = ni();   for(int i=1; i<n; i++) a[i] += a[i-1];     HashMap<Integer, List<Point>> map = new HashMap<>();   for(int i=0; i<n; i++) {    for(int j=i; j<n; j++) {     int sum = getSum(a, i, j);     if(!map.containsKey(sum)) map.put(sum, new ArrayList<>());     map.get(sum).add(new Point(i+1, j+1));    }   }     for(int key : map.keySet()) {    Collections.sort(map.get(key), new Comparator<Point>() {     @Override     public int compare(Point p1, Point p2) {      if(p1.x == p2.x) return p1.y - p2.y;      return p1.x - p2.x;     }    });   }     Stack<Point> stack = new Stack<>();   for(int key : map.keySet()) {    Stack<Point> st = getPairs(map.get(key));    if(st.size() > stack.size()) stack = st;   }     pl(stack.size());   while(!stack.isEmpty()) {    Point p = stack.pop();    pl(p.x + " " + p.y);   }  }   Stack<Point> getPairs(List<Point> list) {   Stack<Point> stack = new Stack<>();   stack.push(list.get(0));   for(int i=1; i<list.size(); i++) {    Point p = list.get(i);    if(p.x >= stack.peek().x && p.x <= stack.peek().y) {     Point p2 = stack.pop();     if(p2.y < p.y) {      stack.push(p2);     } else {      stack.push(p );     }    } else {     stack.push(p);    }   }   return stack;  }   int getSum(int[] a, int l, int r) {   return (l == 0) ? a[r] : a[r] - a[l-1];  }   class Node {   HashSet<Integer> adj;   public Node() {    adj = new HashSet<>();   }  }     String nt() throws Exception {   if(st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine(), " ");   }   return st.nextToken();  }   int ni() throws Exception {   return Integer.parseInt(nt());  }   long nl() throws Exception {   return Long.parseLong(nt());  }   void p(Object o) {   System.out.print(o);  }   void pl(Object o) {   System.out.println(o);  } }
4	public class Main { public static Scanner scan = new Scanner(System.in);  int n, m; int[][] x; int[][] y; int k, k2;  int[][] sol0; int[][] sol1;   public Main(int[][] x, int[][] y, int k) {  this.x = x;  this.y = y;  this.k = k;  this.n = x.length;  this.m = x[0].length; }  void go() {  if(k%2 != 0) {  for(int i=0; i<n; ++i) {   for(int j=0; j<m; ++j) {   System.out.print(-1 + " ");   }   System.out.println();  }   return;  }  k2 = k/2;  sol0 = new int[n][m];  sol1 = new int[n][m];   for(int d=0; d<k2; ++d) {  var zzz = sol1;  sol1 = sol0;  sol0 = zzz;    for(int i=0; i<n; ++i)   for(int j=0; j<m; ++j) {   update(i,j);   }  }  for(int i=0; i<n; ++i) {  for(int j=0; j<m; ++j) {   System.out.print(sol1[i][j]*2 + " ");  }  System.out.println();  }  }  void update(int i, int j) {  int ret = Integer.MAX_VALUE;  if(i>0)  ret = Math.min(ret, sol0[i-1][j] + y[i-1][j]);  if(j>0)  ret = Math.min(ret, sol0[i][j-1] + x[i][j-1]);  if(i < n-1)  ret = Math.min(ret, sol0[i+1][j] + y[i][j]);  if(j < m-1)  ret = Math.min(ret, sol0[i][j+1] + x[i][j]);  sol1[i][j] = ret; }   public static void main(String[] args) {  int n = scan.nextInt();  int m = scan.nextInt();  int k = scan.nextInt();  int x[][] = new int[n][m];  int y[][] = new int[n][m];  for(int i=0; i<n; ++i) {  for(int j=0; j<m-1; ++j) {   x[i][j] = scan.nextInt();  }  }  for(int i=0; i<n-1; ++i) {  for(int j=0; j<m; ++j) {   y[i][j] = scan.nextInt();  }  }  Main mm = new Main(x,y,k);  mm.go(); } }
1	public class B {  static long sqr(long a) {  return a * a; }  static void solve() throws Exception {  int tests = scanInt();  for (int test = 0; test < tests; test++) {  int n = scanInt();  out.println(n == 2 * sqr(round(sqrt(n / 2))) || n == 4 * sqr(round(sqrt(n / 4))) ? "YES" : "NO");  } }  static int scanInt() throws IOException {  return parseInt(scanString()); }  static long scanLong() throws IOException {  return parseLong(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);  } } }
2	public class Main {  public static void main(String[] args) throws IOException {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   Answer solver = new Answer();   solver.solve(in, out);   out.close();  } } class Answer {  private int sumd(long x) {   int sum = 0;   while (x != 0) {    sum += x % 10;    x /= 10;   }   return sum;  }  private long bin(long l, long r, long s) {   if (l > r) {    return -1;   }   long x = (l + r) >> 1;   int sum = sumd(x);   if (x - sum < s) {    return bin(x + 1, r, s);   }   long t = bin(l, x - 1, s);   if (t != -1) {    return t;   }   return x;  }  public void solve(InputReader in, PrintWriter out) throws IOException {   long n = in.nextLong();   long s = in.nextLong();   long t = bin(1, n, s);   if (t == -1) {    out.print("0");   } else {    long ans = n - t + 1;    out.print(ans);   }  } } class InputReader {  private BufferedReader reader;  private StringTokenizer tokenizer;  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());  } }
2	public class NastyaWardrobe {  static long modulo = 1000000007;  static long ans = 0;  public static void main(String[] args) throws IOException {   BufferedReader inp = new BufferedReader(new InputStreamReader(System.in));   String[] s1 = inp.readLine().split(" ");   long clothes = Long.parseLong(s1[0]);   long months = Long.parseLong(s1[1]);      calc(clothes,months);   System.out.print(ans);  }  static void calc(long clothes,long months){   if(clothes!=0) {    long a;    long count = 0;    ArrayList<Long> list = new ArrayList<>();    if (months >= 2) {     a = 2;     long c = months;     while (c > 1) {      if (c % 2 == 1) {       count++;       list.add(a);      }      c = c / 2;      a = (a * a) % modulo;     }     while (count > 0) {      long b = list.get(0);      list.remove(0);      a = (a * b) % modulo;      count--;     }    } else {     a = (long) Math.pow(2, months);    }     long b = clothes;        b = (2 * b - 1) % modulo;    ans = (a * b) % modulo;    ans = (ans + 1) % modulo;   }else{    ans = 0;   }  } }
2	public class F {  public static void main(String[] args) throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   PrintWriter writer = new PrintWriter(System.out);   StringTokenizer st = new StringTokenizer(reader.readLine());   long n = Integer.parseInt(st.nextToken());   long k = Integer.parseInt(st.nextToken());   long l = 0;   long r = n;   while(l <= r){    long min = (l + r) / 2;    if((min * (min + 1) / 2 - (n - min) == k)){     System.out.println(n - min);     return;    }    else if((min * (min + 1) / 2 - (n - min) > k)){     r = min - 1;    }    else{     l = min + 1;    }   }  } }
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();   int[] a = in.nextIntArray(n);   int[] b = a.clone();   Collections.sort(ArrayUtils.asList(b));   int diff = 0;   for (int i = 0; i < n; i++) {    if (a[i] != b[i])     diff++;   }   out.println(diff <= 2 ? "YES" : "NO");  } } 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 int[] nextIntArray(int count) {   int[] result = new int[count];   for (int i = 0; i < count; i++) {    result[i] = nextInt();   }   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(String x) {   writer.println(x);  }  public void close() {   writer.close();  }  } class ArrayUtils {  public static List<Integer> asList(int[] array) {   return new IntList(array);  }  private static class IntList extends AbstractList<Integer> implements RandomAccess {   int[] array;   private IntList(int[] array) {    this.array = array;   }   public Integer get(int index) {    return array[index];   }   public Integer set(int index, Integer element) {    int result = array[index];    array[index] = element;    return result;   }   public int size() {    return array.length;   }  }  }
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 String rl() throws IOException{  byte[] buf=new byte[1024];  int cnt=0, c;  while((c=read())!=-1){   if(c=='\n') break;   buf[cnt++]=(byte)c;  }  return new String(buf, 0, cnt);  }  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 long nl() throws IOException{  long 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 char nc() throws IOException{ return (char)next(); }  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 char[][] nm(int n, int m) throws IOException{  char[][] map=new char[n][];  for(int i=0; i<n; i++) map[i]=ns(m);  return map;  }  private int[] na(int n) throws IOException{  int[] a=new int[n];  for(int i=0; i<n; i++) a[i]=ni();  return a;  }  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();  } } }
5	public class Solution implements Runnable {  void solve() throws Exception {  int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int a [] = new int [n];  for (int i = 0; i < n; i++) {  a[i] = sc.nextInt();  }  Arrays.sort(a);  if (k >= m) {  out.println(0);  return;  }  int sum = k;  for (int j = n - 1; j >= 0; j--) {  sum--;  sum += a[j];  if (sum >= m) {   out.println((n - j));   return;  }  }  out.println(-1); }  BufferedReader in; PrintWriter out; FastScanner sc;  static Throwable uncaught;  @Override public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  sc = new FastScanner(in);  solve();  } catch (Throwable t) {  Solution.uncaught = t;  } finally {  out.close();  } }  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()); }  public long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  public double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
6	public class s11_d {  public static void main(String[] args) throws IOException {   new s11_d().run();  }  int nextInt() throws IOException {   in.nextToken();   return (int) in.nval;  }  String nextString() throws IOException {   in.nextToken();   return (String) in.sval;  }  StreamTokenizer in;  Writer writer;  Reader reader;  void run() throws IOException {   boolean oj = System.getProperty("ONLINE_JUDGE") != null;   reader = oj ? new InputStreamReader(System.in, "ISO-8859-1") : new FileReader("input/is11_d.txt");   writer = new OutputStreamWriter(System.out, "ISO-8859-1");   in = new StreamTokenizer(new BufferedReader(reader));   PrintWriter out = new PrintWriter(writer);   int n = nextInt();   int e = nextInt();   boolean[][] is = new boolean[n + 1][n + 1];   for (int i = 0; i < e;i++) {    int a = nextInt() - 1;    int b = nextInt() - 1;    is[a][b] = true;    is[b][a] = true;   }     long[] am = new long[n + 1];     long[][] ways = new long[1 << (n - 1)][n];     for (int start = 0; start < n; ++start) {      for (int mask = 0; mask < (1 << (n - start - 1)); ++mask)       for (int last = start; last < n; ++last) {        ways[mask][last - start] = 0;       }      ways[1 >> 1][0] = 1;      for (int mask = 1; mask < (1 << (n - start)); mask += 2) {       int cnt = 0;       int tmp = mask;       while (tmp > 0) {        ++cnt;        tmp = tmp & (tmp - 1);       }       for (int last = start; last < n; ++last)        if (ways[mask >> 1][last - start] > 0) {         long amm = ways[mask >> 1][last - start];         for (int i = start; i < n; ++i)          if ((mask & (1 << (i - start))) == 0 && is[last][i]) {           ways[(mask | (1 << (i - start))) >> 1][i - start] += amm;          }         if (is[last][start])          am[cnt] += ways[mask >> 1][last - start];        }      }     }     long res = 0;     for (int cnt = 3; cnt <= n; ++cnt) {      if (am[cnt] % (2) != 0)       throw new RuntimeException();      res += am[cnt] / (2);     }   out.println(res);   out.flush();   out.close();  } }
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 Main{ public static void main(String[]YAHIA_MOSTAFA){  Scanner sc =new Scanner(System.in);  long n=sc.nextLong(),x=sc.nextLong(),y=sc.nextLong();  long xb,xw,yb,yw;  xw=x-1;yw=y-1;xb=n-x;yb=n-y;  if (x==n&&y==n){  System.out.println("Black");return;  }  long c1=0,c2=0;  long f =Math.max(xb,yb);  long h =Math.max(xw,yw);   if (h<=f)  System.out.println("White");  else  System.out.println("Black"); } }
4	public class CF23A implements Runnable{    public static void main(String args[]){   new CF23A().run();  }   @Override  public void run(){   try{    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    tok = null;    solve();    in.close();    out.close();      }   catch(IOException e){    e.printStackTrace();    System.exit(0);   }  }   int nextInt()throws IOException{   return Integer.parseInt(nextToken());  }    double nextDouble()throws IOException{   return Double.parseDouble(nextToken());  }   long nextLong() throws IOException{   return Long.parseLong(nextToken());  }   String nextToken()throws IOException{   while(tok == null || !tok.hasMoreTokens()){    tok = new StringTokenizer(in.readLine());   }   return tok.nextToken();  }   BufferedReader in;  PrintWriter out;  StringTokenizer tok;     private void solve()throws IOException{   String s = nextToken();   int l = s.length();   int ans = 0;   for(int i = 0; i < l - 1; i++){    for(int j = i + 1; j < l; j++){     String now = s.substring(i, j);     if(s.substring(i + 1).indexOf(now) >= 0){     ans = Math.max(ans, j - i);        }    }   }     out.println(ans);  } }
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);  } }
6	public class CF1102F { 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[][] aa = new int[n][m];  for (int i = 0; i < n; i++) {  st = new StringTokenizer(br.readLine());  for (int j = 0; j < m; j++)   aa[i][j] = Integer.parseInt(st.nextToken());  }  int[][] dd = new int[n][n];  for (int i = 0; i < n; i++)  for (int j = i + 1; j < n; j++) {   int d = Integer.MAX_VALUE;   for (int h = 0; h < m; h++)   d = Math.min(d, Math.abs(aa[i][h] - aa[j][h]));   dd[i][j] = dd[j][i] = d;  }  int[][] dd_ = new int[n][n];  for (int i = 0; i < n; i++)  for (int j = 0; j < n; j++) {   int d = Integer.MAX_VALUE;   for (int h = 0; h < m - 1; h++)   d = Math.min(d, Math.abs(aa[i][h] - aa[j][h + 1]));   dd_[i][j] = d;  }  if (n == 1) {  System.out.println(dd_[0][0]);  return;  }  int[] ii = new int[1 << n];  for (int i = 0; i < n; i++)  ii[1 << i] = i;  int[][][] dp = new int[1 << n][n][n];  for (int b = 0; b < 1 << n; b++)  for (int u = b; u > 0; u &= u - 1) {   int i = ii[u & -u];   for (int v = b ^ 1 << i; v > 0; v &= v - 1) {   int j = ii[v & -v];   if (b == (1 << i ^ 1 << j))    dp[b][i][j] = dd[i][j];   else {    int x = 0;    for (int w = b ^ 1 << i ^ 1 << j; w > 0; w &= w - 1) {    int k = ii[w & -w];    x = Math.max(x, Math.min(dp[b ^ 1 << j][i][k], dd[k][j]));    }    dp[b][i][j] = x;   }   }  }  int b = (1 << n) - 1;  int x = 0;  for (int i = 0; i < n; i++)  for (int j = 0; j < n; j++)   if (i != j)   x = Math.max(x, Math.min(dp[b][i][j], dd_[i][j]));  System.out.println(x); } }
3	public class CF915D { static ArrayList[] aa; static boolean[] visited, instack; static int[] stack; static int cnt, h_, i_, j_; static boolean dfs1(int i) {  if (visited[i]) {  if (instack[i]) {   h_ = i;   return true;  }  return false;  }  visited[i] = instack[i] = true;  stack[cnt++] = i;  ArrayList<Integer> adj = aa[i];  for (int j : adj)  if (dfs1(j))   return true;  instack[i] = false;  cnt--;  return false; } static boolean dfs2(int i) {  if (visited[i])  return instack[i];  visited[i] = instack[i] = true;  ArrayList<Integer> adj = aa[i];  for (int j : adj)  if (!(i == i_ && j == j_) && dfs2(j))   return true;  instack[i] = false;  return false; } 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());  aa = new ArrayList[n];  for (int i = 0; i < n; i++)  aa[i] = new ArrayList<Integer>();  while (m-- > 0) {  st = new StringTokenizer(br.readLine());  int i = Integer.parseInt(st.nextToken()) - 1;  int j = Integer.parseInt(st.nextToken()) - 1;  aa[i].add(j);  }  visited = new boolean[n];  instack = new boolean[n];  stack = new int[n];  for (int i = 0; i < n; i++)  if (dfs1(i))   break;  if (cnt == 0) {  System.out.println("YES");  return;  }  for (j_ = h_, i_ = stack[--cnt]; ; j_ = i_, i_ = stack[--cnt]) {  Arrays.fill(visited, false);  Arrays.fill(instack, false);  boolean cycle = false;  for (int i = 0; i < n; i++)   if (dfs2(i)) {   cycle = true;   break;   }  if (!cycle) {   System.out.println("YES");   return;  }  if (i_ == h_)   break;  }  System.out.println("NO"); } }
0	public class z3 { public static boolean divch(int i,int a) { if (a>1000) return false; if ((a>0)&&(i%a==0)) return true; return (divch(i,a*10+4)||divch(i,a*10+7)); } public static void main(String[] args) throws IOException {  Scanner in = new Scanner(System.in);  System.out.println(divch(in.nextInt(),0)?"YES":"NO"); } }
0	public class Subtractions {  public static void main(String[] args) {   Scanner s=new Scanner(System.in);  int t=s.nextInt();  while(t--!=0){  int a=s.nextInt();  int b=s.nextInt();  int min=Math.min(a, b);  int max=Math.max(a, b);  int ops=0;  while(true){   int quo=max/min;   ops+=quo;   int rem=max%min;   max=Math.max(rem, min);   min=Math.min(min, rem);   if(rem==0) break;  }  System.out.println(ops);  } } }
1	public class A { 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 {  public void solve(int testNumber, InputReader in, PrintWriter out) {  int n = in.nextInt();  int d = in.nextInt();  int a[] = new int[n];  int c[] = new int[2 * n];  for (int i = 0; i < n; i++) {   a[i] = in.nextInt();   c[2 * i] = a[i] - d;   c[2 * i + 1] = a[i] + d;  }  Arrays.sort(c);  int ans = 0;  for (int i = 0; i < 2 * n; i++) {   if (i != 0 && c[i] == c[i - 1]) continue;   int mind = d + 1;   for (int j = 0; j < n; j++)   mind = Math.min(mind, Math.abs(a[j] - c[i]));   if (mind == d) {   ans += 1;   }  }  out.println(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());  }  public long nextLong() {  return Long.parseLong(next());  }  } }
0	public class origami { public static void main(String args[]){  Scanner input = new Scanner(System.in);  double n = input.nextInt();  double k = input.nextInt();  double red = 0;  double green = 0;  double blue = 0;  double ans = 0;  red = (2 * n) / k;  green = (5 * n) / k;  blue = (8 * n) / k;  double red1 = Math.ceil(red) ;  double green1 = Math.ceil(green);  double blue1 = Math.ceil(blue);  ans+=red1;  ans+=green1;  ans+=blue1;  Double answer = new Double(ans);  int finished = answer.intValue();  System.out.println(finished); } }
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(); } } class TaskB {  public void solve(int testNumber, InputReader in, PrintWriter out) {   long n = in.nextInt();   long x = in.nextInt();   long y = in.nextInt();   long c = in.nextInt();   if (c == 1) {    out.println(0);    return;   }   long left = 1, right = 2 * n, middle, res = -1;   long val = getNumberOfCells(x, y, n, 2);   while (left <= right) {    middle = (left + right) / 2;    long numberOfCells = getNumberOfCells(x, y, n, middle);    if (numberOfCells < c) {     left = middle + 1;    } else {     res = middle;     right = middle - 1;    }   }   out.println(res);  }  private long getNumberOfCells(long x, long y, long n, long middle) {   long res = 0;   res += calc(x, y, middle + 1);   res += calc(n - x + 1, y, middle + 1);   res += calc(x, n - y + 1, middle + 1);   res += calc(n - x + 1, n - y + 1, middle + 1);   res -= calcX(x, n, middle);   res -= calcX(y, n, middle);   --res;   return res;  }  private long calcX(long x, long n, long size) {   long left = x - size;   long right = x + size;   left = Math.max(left, 1);   right = Math.min(right, n);   if (left <= right) {    return right - left + 1;   }   return 0;  }  private long calc(long x, long y, long size) {   if (size <= Math.min(x, y)) {    return (1 + size) * size / 2;   }   if (size >= x + y - 1) {    return x * y;   }   if (size > Math.max(x, y)) {    return x * y - calc(x, y, x + y - 1 - size);   }   long min = Math.min(x, y);   long res = (1 + min) * min / 2;   long rest = size - min;   res += rest * min;   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();   } 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());  } }
4	public class Main {  public static void main(String[] args) throws Exception {   FastIO in = new FastIO(args);   int t = in.ni();   while (t-- > 0) {    int n = in.ni();    LinkedList<Integer> l = new LinkedList<>();    ArrayList<LinkedList<Integer>> al = new ArrayList<>();    for (int i = 0; i < n; i++) {     int p = in.ni();     if (p == 1) {      l.addFirst(1);     } else {      while (true) {       if (l.peekFirst() == p - 1) {        l.addFirst(l.removeFirst() + 1);        break;       } else {        l.removeFirst();       }      }     }     al.add(new LinkedList<>(l));    }    for (LinkedList<Integer> ll : al) {     while (ll.size() > 1) {      System.out.print(ll.removeLast() + ".");     }     System.out.println(ll.remove());    }    System.out.println();   }   in.bw.flush();  }  static boolean willbealive(int i, int a[]) {   if (i < 0 || i >= a.length)    return false;   if (a.length == 1)    return false;   if (a[i] == 1)    return false;   if (i == 0)    return a[1] == 1;   else if (i == a.length - 1)    return a[i - 1] == 1;   else    return (a[i - 1] == 1) ^ (a[i + 1] == 1);  }  static class Data implements Comparable<Data> {   int a, b;   public Data(int a, int b) {    this.a = a;    this.b = b;   }   @Override   public int compareTo(Data o) {    if (a == o.a) {     return Integer.compare(b, o.b);    }    return Integer.compare(a, o.a);   }   public static void sort(int a[]) {    Data d[] = new Data[a.length];    for (int i = 0; i < a.length; i++) {     d[i] = new Data(a[i], 0);    }    Arrays.sort(d);    for (int i = 0; i < a.length; i++) {     a[i] = d[i].a;    }   }  }  static class FastIO {   private final BufferedReader br;   private final BufferedWriter bw;   private String s[];   private int index;   public FastIO(String[] args) throws IOException {    if (args.length > 1) {     br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(args[0]))));     bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(args[1]))));    } else {     br = new BufferedReader(new InputStreamReader(System.in));     bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));    }    s = br.readLine().split(" ");    index = 0;   }   public int ni() throws IOException {    return Integer.parseInt(nextToken());   }   public double nd() throws IOException {    return Double.parseDouble(nextToken());   }   public long nl() throws IOException {    return Long.parseLong(nextToken());   }   public String next() throws IOException {    return nextToken();   }   public String nli() throws IOException {    try {     return br.readLine();    } catch (IOException ex) {    }    return null;   }   public int[] gia(int n) throws IOException {    int a[] = new int[n];    for (int i = 0; i < n; i++) {     a[i] = ni();    }    return a;   }   public int[] gia(int n, int start, int end) throws IOException {    validate(n, start, end);    int a[] = new int[n];    for (int i = start; i < end; i++) {     a[i] = ni();    }    return a;   }   public double[] gda(int n) throws IOException {    double a[] = new double[n];    for (int i = 0; i < n; i++) {     a[i] = nd();    }    return a;   }   public double[] gda(int n, int start, int end) throws IOException {    validate(n, start, end);    double a[] = new double[n];    for (int i = start; i < end; i++) {     a[i] = nd();    }    return a;   }   public long[] gla(int n) throws IOException {    long a[] = new long[n];    for (int i = 0; i < n; i++) {     a[i] = nl();    }    return a;   }   public long[] gla(int n, int start, int end) throws IOException {    validate(n, start, end);    long a[] = new long[n];    for (int i = start; i < end; i++) {     a[i] = nl();    }    return a;   }   public void print(String s) throws IOException {    bw.write(s);   }   public void println(String s) throws IOException {    bw.write(s);    bw.newLine();   }   public void print(int s) throws IOException {    bw.write(s + "");   }   public void println(int s) throws IOException {    bw.write(s + "");    bw.newLine();   }   public void print(long s) throws IOException {    bw.write(s + "");   }   public void println(long s) throws IOException {    bw.write(s + "");    bw.newLine();   }   public void print(double s) throws IOException {    bw.write(s + "");   }   public void println(double s) throws IOException {    bw.write(s + "");    bw.newLine();   }   private String nextToken() throws IndexOutOfBoundsException, IOException {    if (index == s.length) {     s = br.readLine().split(" ");     index = 0;    }    return s[index++];   }   private void validate(int n, int start, int end) {    if (start < 0 || end >= n) {     throw new IllegalArgumentException();    }   }  } }
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();   }  } }
5	public class P113A {   public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   PrintStream out = System.out;      int n = sc.nextInt();   int k = sc.nextInt();   List<Team> l = new ArrayList<Team>();   for (int i = 0; i < n; i++) {    l.add(new Team(sc.nextInt(), sc.nextInt()));   }   Collections.sort(l, new Comparator<Team>() {     public int compare(Team a, Team b) {      if (a.s == b.s)       return a.t - b.t;      return b.s - a.s;     }     });   int f = k - 1;   int la = k - 1;   Team p = l.get(k - 1);   while (la < n && l.get(la).s == p.s && l.get(la).t == p.t) la++;   while ( f >= 0 && l.get(f).s == p.s && l.get(f).t == p.t) f--;   out.println(la - f - 1);  }  static class Team {   int s;   int t;   public Team(int a, int b) { s = a; t = b; }  }  }
6	public class _8C {  static int[] x = new int[30], y = new int[30]; static int[][] dist = new int[30][30]; static int n; static final int M = 1000; static int[] bitPos = new int[M]; static {  Arrays.fill(bitPos, -1);  for (int i=0; i<24; i++)  bitPos[(1 << i) % M] = i; }  static int sqr(int i) {  return i * i; }  public static void main(String[] args) throws Exception {  Reader.init(System.in);  BufferedWriter cout = new BufferedWriter(new OutputStreamWriter(System.out));  x[0] = Reader.nextInt();  y[0] = Reader.nextInt();  n = Reader.nextInt();  for (int i=1; i<=n; i++) {  x[i] = Reader.nextInt();  y[i] = Reader.nextInt();  }  for (int i=0; i<=n; i++)  for (int j=0; j<=n; j++)   dist[i][j] = sqr(x[i] - x[j]) + sqr(y[i] - y[j]);   int[] f = new int[1 << n];  int[] r = new int[1 << n];  for (int mask=1; mask<(1 << n); mask++) {  int lowbit = mask & -mask;  int lowbitPos = bitPos[lowbit % M];  f[mask] = dist[lowbitPos + 1][0] * 2 + f[mask ^ lowbit];  r[mask] = lowbit;   for (int i=mask^(lowbit); i>0; i=i^(i & -i)) {   int otherBit = i & -i;   int otherBitPos = bitPos[otherBit % M];   int tmp = dist[0][lowbitPos + 1] + dist[lowbitPos + 1][otherBitPos + 1] + dist[otherBitPos + 1][0] + f[mask ^ otherBit ^ lowbit];   if (tmp < f[mask]) {    f[mask] = tmp;    r[mask] = lowbit | otherBit;   }  }  }   System.out.println(f[(1 << n) - 1]);  int mask = (1 << n) - 1;  while(mask > 0) {  if ((r[mask] ^ (r[mask] & -r[mask])) == 0) {   System.out.print("0 " + (bitPos[r[mask] % M] + 1) + " ");  }  else {   int bit1 = r[mask] & -r[mask];   int bit2 = r[mask] ^ bit1;   System.out.print("0 " + (bitPos[bit1 % M] + 1) + " " + (bitPos[bit2 % M] + 1) + " ");  }  mask ^= r[mask];  }  System.out.println("0");    cout.close(); }  static class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {  final U _1;  final V _2;  private Pair(U key, V val) {  this._1 = key;  this._2 = val;  }  public static <U extends Comparable<U>, V extends Comparable<V>> Pair<U, V> instanceOf(U _1, V _2) {  return new Pair<U, V>(_1, _2);  }  @Override  public String toString() {  return _1 + " " + _2;  }  @Override  public int hashCode() {  int res = 17;  res = res * 31 + _1.hashCode();  res = res * 31 + _2.hashCode();  return res;  }  @Override  public int compareTo(Pair<U, V> that) {  int res = this._1.compareTo(that._1);  if (res < 0 || res > 0)   return res;  else   return this._2.compareTo(that._2);  }  @Override  public boolean equals(Object obj) {  if (this == obj)   return true;  if (!(obj instanceof Pair))   return false;  Pair<?, ?> that = (Pair<?, ?>) obj;  return _1.equals(that._1) && _2.equals(that._2);  } }   static class Reader {  static BufferedReader reader;  static StringTokenizer tokenizer;    static void init(InputStream input) {  reader = new BufferedReader(new InputStreamReader(input));  tokenizer = new StringTokenizer("");  }    static String next() throws IOException {  while (!tokenizer.hasMoreTokens()) {     tokenizer = new StringTokenizer(reader.readLine());  }  return tokenizer.nextToken();  }  static int nextInt() throws IOException {  return Integer.parseInt(next());  }  static double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  static class ArrayUtil {  static void swap(int[] a, int i, int j) {  int tmp = a[i];  a[i] = a[j];  a[j] = tmp;  }  static void swap(long[] a, int i, int j) {  long tmp = a[i];  a[i] = a[j];  a[j] = tmp;  }  static void swap(double[] a, int i, int j) {  double tmp = a[i];  a[i] = a[j];  a[j] = tmp;  }  static void swap(char[] a, int i, int j) {  char tmp = a[i];  a[i] = a[j];  a[j] = tmp;  }  static void swap(boolean[] a, int i, int j) {  boolean tmp = a[i];  a[i] = a[j];  a[j] = tmp;  }  static void reverse(int[] a, int i, int j) {  for (; i < j; i++, j--)   swap(a, i, j);  }  static void reverse(long[] a, int i, int j) {  for (; i < j; i++, j--)   swap(a, i, j);  }  static void reverse(double[] a, int i, int j) {  for (; i < j; i++, j--)   swap(a, i, j);  }  static void reverse(char[] a, int i, int j) {  for (; i < j; i++, j--)   swap(a, i, j);  }  static void reverse(boolean[] a, int i, int j) {  for (; i < j; i++, j--)   swap(a, i, j);  }  static long sum(int[] a) {  int sum = 0;  for (int i : a)   sum += i;  return sum;  }  static long sum(long[] a) {  long sum = 0;  for (long i : a)   sum += i;  return sum;  }  static double sum(double[] a) {  double sum = 0;  for (double i : a)   sum += i;  return sum;  }  static int max(int[] a) {  int max = Integer.MIN_VALUE;  for (int i : a)   if (i > max)   max = i;  return max;  }  static int min(int[] a) {  int min = Integer.MAX_VALUE;  for (int i : a)   if (i < min)   min = i;  return min;  }  static long max(long[] a) {  long max = Long.MIN_VALUE;  for (long i : a)   if (i > max)   max = i;  return max;  }  static long min(long[] a) {  long min = Long.MAX_VALUE;  for (long i : a)   if (i < min)   min = i;  return min;  } } }
3	public class D { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni();  int[] a = na(n);  int[] ft = new int[n+3];  int x = 0;  for(int i = n-1;i >= 0;i--){  x ^= sumFenwick(ft, a[i]);  addFenwick(ft, a[i], 1);  }  x &= 1;  for(int Q = ni();Q > 0;Q--){  int l = ni(), r = ni();  long u = (r-l+1)*(r-l)/2;  x ^= u&1;  if(x == 0){   out.println("even");  }else{   out.println("odd");  }  } }  public static int sumFenwick(int[] ft, int i) {  int sum = 0;  for (i++; i > 0; i -= i & -i)  sum += ft[i];  return sum; }  public static void addFenwick(int[] ft, int i, int v) {  if (v == 0 || i < 0)  return;  int n = ft.length;  for (i++; i < n; i += i & -i)  ft[i] += v; }  public static int findGFenwick(int[] ft, int v) {  int i = 0;  int n = ft.length;  for (int b = Integer.highestOneBit(n); b != 0 && i < n; b >>= 1) {  if (i + b < n) {   int t = i + b;   if (v >= ft[t]) {   i = t;   v -= ft[t];   }  }  }  return v != 0 ? -(i + 1) : i - 1; }  public static int valFenwick(int[] ft, int i) {  return sumFenwick(ft, i) - sumFenwick(ft, i - 1); }  public static int[] restoreFenwick(int[] ft) {  int n = ft.length - 1;  int[] ret = new int[n];  for (int i = 0; i < n; i++)  ret[i] = sumFenwick(ft, i);  for (int i = n - 1; i >= 1; i--)  ret[i] -= ret[i - 1];  return ret; }  public static int before(int[] ft, int x) {  int u = sumFenwick(ft, x - 1);  if (u == 0)  return -1;  return findGFenwick(ft, u - 1) + 1; }  public static int after(int[] ft, int x) {  int u = sumFenwick(ft, x);  int f = findGFenwick(ft, u);  if (f + 1 >= ft.length - 1)  return -1;  return f + 1; }  public static int[] buildFenwick(int[] a) {  int n = a.length;  int[] ft = new int[n + 1];  System.arraycopy(a, 0, ft, 1, n);  for (int k = 2, h = 1; k <= n; k *= 2, h *= 2) {  for (int i = k; i <= n; i += k) {   ft[i] += ft[i - h];  }  }  return ft; }  public static int[] buildFenwick(int n, int v) {  int[] ft = new int[n + 1];  Arrays.fill(ft, 1, n + 1, v);  for (int k = 2, h = 1; k <= n; k *= 2, h *= 2) {  for (int i = k; i <= n; i += k) {   ft[i] += ft[i - h];  }  }  return ft; }   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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
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); } public static class input {  static BufferedReader reader;  static StringTokenizer tokenizer;    static void init(InputStream input) {   reader = new BufferedReader(      new InputStreamReader(input) );   tokenizer = new StringTokenizer("");  }    static String next() throws IOException {   while ( ! tokenizer.hasMoreTokens() ) {       tokenizer = new StringTokenizer(      reader.readLine() );   }   return tokenizer.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt( next() );  }   static double nextDouble() throws IOException {   return Double.parseDouble( next() );  }  static long nextLong() throws IOException {   return Long.parseLong( next() );  } } static class IT {  int[] left,right, val, a, b;  IT(int n)  {   left = new int[3*n];   right = new int[3*n];   val = new int[3*n];   a = new int[3*n];   b = new int[3*n];   init(0,0, n);  }  int init(int at, int l, int r)  {   a[at] = l;   b[at] = r;   if(l==r)    left[at] = right [at] = -1;   else   {    int mid = (l+r)/2;    left[at] = init(2*at+1,l,mid);    right[at] = init(2*at+2,mid+1,r);   }   return at++;  }   int get(int x, int y)  {   return go(x,y, 0);  }  int go(int x,int y, int at)  {   if(at==-1) return 0;   if(x <= a[at] && y>= b[at]) return val[at];   if(y<a[at] || x>b[at]) return 0;   return go(x, y, left[at]) + go(x, y, right[at]);  }   void add(int x, int y, int v)  {   go3(x, y, v, 0);  }  void go3(int x, int y, int v, int at)  {   if(at==-1) return;   if(y < a[at] || x > b[at]) return;   val[at] += (Math.min(b[at], y) - Math.max(a[at], x) + 1)*v;   go3(x, y, v, left[at]);   go3(x, y, v, right[at]);  } } }
5	public class Solution implements Runnable {        public void solve() throws Exception {   int n = sc.nextInt();   int a[] = new int[n];   int s = 0;   for (int i = 0;i < n; ++ i) {    a[i] = sc.nextInt();    s += a[i];   }   Arrays.sort(a);   int s2 = 0;   for (int i = n - 1;i >= 0; -- i) {    s2 += a[i];    if (s2 > s - s2) {     out.println(n - i);     break;    }   }    }   class Pair implements Comparable<Pair> {     int x;   int y;     public Pair() {      }     public Pair(int x, int y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(Pair arg0) {    if (x == arg0.x)     return y - arg0.y;    return x - arg0.x;   }  }           static String filename = "";  static boolean fromFile = false;   BufferedReader in;  PrintWriter out;  FastScanner sc;   public static void main(String[] args) {   new Thread(null, new Solution(), "", 1 << 25).start();  }   public void run() {   try {    init();    solve();   } catch (Exception e) {    throw new RuntimeException(e);   } finally {    out.close();   }  }   void init() throws Exception {   if (fromFile) {    in = new BufferedReader(new FileReader(filename+".in"));    out = new PrintWriter(new FileWriter(filename+".out"));   } else {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);   }   sc = new FastScanner(in);  } } class FastScanner {   BufferedReader reader;  StringTokenizer strTok;   public FastScanner(BufferedReader reader) {   this.reader = reader;  }   public String nextToken() throws IOException {   while (strTok == null || !strTok.hasMoreTokens()) {    strTok = new StringTokenizer(reader.readLine());   }     return strTok.nextToken();  }   public int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }   public long nextLong() throws IOException {   return Long.parseLong(nextToken());  }   public double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }   public BigInteger nextBigInteger() throws IOException {   return new BigInteger(nextToken());  }   public BigDecimal nextBigDecimal() throws IOException {   return new BigDecimal(nextToken());  } }
3	public class Sample implements Runnable  {       public static void solve()   {     int n=i();     int[] a=new int[n];    for(int i=0;i<n;i++)a[i]=i();    int temp=0;    for(int i=0;i<n;i++)    {     for(int j=i+1;j<n;j++)     {     if(a[j]<a[i])temp++;     }    }    boolean even=(temp%2==0)?true:false;    int m=i();    while(m-->0)    {     int l=i(); int r=i();     long tt=(long)(Math.floor(r-l+1)/2);     if(tt%2==1)     {     if(even)     {     out.println("odd");     even=false;     }     else     {     out.println("even");     even=true;     }     }else     {     if(even)     {     out.println("even");          }     else     {     out.println("odd");          }     }    }       }          public void run()   {     solve();    out.close();   }    public static void main(String[] args) throws IOException   {     new Thread(null, new Sample(), "whatever", 1<<26).start();   }   abstract static class Pair implements Comparable<Pair>   {    long a;    int b;       Pair(){}    Pair(long a,int b)    {       this.a=a;       this.b=b;    }     public int compareTo(Pair x)    {     return Long.compare(x.a,this.a);    }   }             static class Merge  {    public static void sort(long inputArr[])   {    int length = inputArr.length;    doMergeSort(inputArr,0, length - 1);   }    private static void doMergeSort(long[] arr,int lowerIndex, int higherIndex)   {      if (lowerIndex < higherIndex) {     int middle = lowerIndex + (higherIndex - lowerIndex) / 2;     doMergeSort(arr,lowerIndex, middle);     doMergeSort(arr,middle + 1, higherIndex);     mergeParts(arr,lowerIndex, middle, higherIndex);    }   }    private static void mergeParts(long[]array,int lowerIndex, int middle, int higherIndex)   {    long[] temp=new long[higherIndex-lowerIndex+1];    for (int i = lowerIndex; i <= higherIndex; i++)    {     temp[i-lowerIndex] = array[i];    }    int i = lowerIndex;    int j = middle + 1;    int k = lowerIndex;    while (i <= middle && j <= higherIndex)    {     if (temp[i-lowerIndex] < temp[j-lowerIndex])     {      array[k] = temp[i-lowerIndex];      i++;     } else {      array[k] = temp[j-lowerIndex];      j++;     }     k++;    }    while (i <= middle)    {     array[k] = temp[i-lowerIndex];     k++;     i++;    }    while(j<=higherIndex)    {     array[k]=temp[j-lowerIndex];     k++;     j++;    }   }   }          static boolean isPal(String s)  {   for(int i=0, j=s.length()-1;i<=j;i++,j--)   {     if(s.charAt(i)!=s.charAt(j)) return false;   }   return true;  }  static String rev(String s)  {     StringBuilder sb=new StringBuilder(s);     sb.reverse();     return sb.toString();  }  static int gcd(int a,int b){return (a==0)?b:gcd(b%a,a);}  static long gcdExtended(long a,long b,long[] x)  {    if(a==0){    x[0]=0;    x[1]=1;    return b;   }   long[] y=new long[2];   long gcd=gcdExtended(b%a, a, y);    x[0]=y[1]-(b/a)*y[0];   x[1]=y[0];    return gcd;  }   boolean findSum(int set[], int n, long sum)  {  if (sum == 0)   return true;  if (n == 0 && sum != 0)   return false;  if (set[n-1] > sum)   return findSum(set, n-1, sum);  return findSum(set, n-1, sum) ||findSum(set, n-1, sum-set[n-1]);  }    public static long modPow(long base, long exp, long mod)  {   base = base % mod;   long result = 1;   while (exp > 0)   {    if (exp % 2 == 1)    {     result = (result * base) % mod;    }    base = (base * base) % mod;    exp = exp >> 1;   }   return result;  }   static long[] fac;  static long[] inv;  static long mod=(long)1e9+7;  public static void cal()  {   fac = new long[1000005];   inv = new long[1000005];   fac[0] = 1;   inv[0] = 1;   for (int i = 1; i <= 1000000; i++)   {    fac[i] = (fac[i - 1] * i) % mod;    inv[i] = (inv[i - 1] * modPow(i, mod - 2, mod)) % mod;   }  }   public static long ncr(int n, int r)  {   return (((fac[n] * inv[r]) % mod) * inv[n - r]) % mod;  }      static InputReader sc = new InputReader(System.in);  static PrintWriter out= new PrintWriter(System.out);    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 int[] nextIntArray(int n)   {     int a[] = new int[n];     for (int i = 0; i < n; i++)      {       a[i] = nextInt();     }     return a;   }    public long[] nextLongArray(int n)   {     long a[] = new long[n];     for (int i = 0; i < n; i++)      {       a[i] = nextLong();     }     return a;   }       public String nextLine()   {     int c = snext();     while (isSpaceChar(c))       c = snext();     StringBuilder res = new StringBuilder();     do {       res.appendCodePoint(c);       c = snext();     } while (!isEndOfLine(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;   }    private boolean isEndOfLine(int c)    {     return c == '\n' || c == '\r' || c == -1;   }    public interface SpaceCharFilter    {     public boolean isSpaceChar(int ch);   }   }   static int i()  {   return sc.nextInt();  }  static long l(){   return sc.nextLong();  }  static int[] iarr(int n)  {   return sc.nextIntArray(n);  }  static long[] larr(int n)  {   return sc.nextLongArray(n);  }  static String s(){   return sc.nextLine();  }   }
1	public class Cf2207C {  private static InputReader in = new InputReader(System.in);  private static OutputWriter out = new OutputWriter(System.out);  private static void solve() throws Exception {   int n = in.readInt();   String s = in.readString();   int[] count = new int[200];   boolean[] flag = new boolean[200];   for(int i=0; i<n; ++i){    flag[s.charAt(i)] = true;   }   int ref = 0;   for(int i=0; i<200; ++i){    if(flag[i]){     ref++;    }   }   int total = 0;   int min = Integer.MAX_VALUE;   int j = 0;   for(int i=0; i<n; ++i){    if((j==n)&&(total<ref)){     break;    }    if(total==ref){     min = Math.min(min,j-i);     count[s.charAt(i)]--;     if(count[s.charAt(i)]==0){      total--;     }     continue;    }    for(;j<n; ++j){     count[s.charAt(j)]++;     if(count[s.charAt(j)]==1){      total++;     }     if(total==ref){      min = Math.min(min,j-i+1);      j++;      break;     }    }    count[s.charAt(i)]--;    if(count[s.charAt(i)]==0){     total--;    }   }   out.println(min);  }  public static void main(String[] args) throws Exception {   solve();   out.close();  }  private static class InputReader {   private InputStream stream;   private byte[] buffer;   private int currentIndex;   private int bytesRead;   public InputReader(InputStream stream) {    this.stream = stream;    buffer = new byte[16384];   }   public InputReader(InputStream stream, int bufferSize) {    this.stream = stream;    buffer = new byte[bufferSize];   }   private int read() throws IOException {    if (currentIndex >= bytesRead) {     currentIndex = 0;     bytesRead = stream.read(buffer);     if (bytesRead <= 0) {      return -1;     }    }    return buffer[currentIndex++];   }   public String readString() throws IOException {    int c = read();    while (!isPrintable(c)) {     c = read();    }    StringBuilder result = new StringBuilder();    do {     result.appendCodePoint(c);     c = read();    } while (isPrintable(c));    return result.toString();   }   public int readInt() throws Exception {    int c = read();    int sign = 1;    while (!isPrintable(c)) {     c = read();    }    if (c == '-') {     sign = -1;     c = read();    }    int result = 0;    do {     if ((c < '0') || (c > '9')) {      throw new InputMismatchException();     }     result *= 10;     result += (c - '0');     c = read();    } while (isPrintable(c));    return sign * result;   }   public long readLong() throws Exception {    int c = read();    int sign = 1;    while (!isPrintable(c)) {     c = read();    }    if (c == '-') {     sign = -1;     c = read();    }    long result = 0;    do {     if ((c < '0') || (c > '9')) {      throw new InputMismatchException();     }     result *= 10;     result += (c - '0');     c = read();    } while (isPrintable(c));    return sign * result;   }   public double readDouble() throws Exception {    int c = read();    int sign = 1;    while (!isPrintable(c)) {     c = read();    }    if (c == '-') {     sign = -1;     c = read();    }    boolean fraction = false;    double multiplier = 1;    double result = 0;    do {     if ((c == 'e') || (c == 'E')) {      return sign * result * Math.pow(10, readInt());     }     if ((c < '0') || (c > '9')) {      if ((c == '.') && (!fraction)) {       fraction = true;       c = read();       continue;      }      throw new InputMismatchException();     }     if (fraction) {      multiplier /= 10;      result += (c - '0') * multiplier;      c = read();     } else {      result *= 10;      result += (c - '0');      c = read();     }    } while (isPrintable(c));    return sign * result;   }   private boolean isPrintable(int c) {    return ((c > 32) && (c < 127));   }  }  private static class OutputWriter {   private 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 implements Runnable{  static ArrayList <Integer> adj[];  static int co=0,f=0;  static void Check2(int n){   adj=new ArrayList[n+1];   for(int i=0;i<=n;i++){    adj[i]=new ArrayList<>();   }  }  static void add(int i,int j){   adj[i].add(j);   adj[j].add(i);  }  public static void main(String[] args) {   new Thread(null, new main(), "Check2", 1<<26).start();  }  static long mod=(long)(1e9+7);  public void run() {        InputReader in = new InputReader(System.in);   PrintWriter w = new PrintWriter(System.out);    long n=in.nextLong();   long s=in.nextLong();     long l=1;   long r=(long)(n);   long ans=-1;   while(l<=r){       long mid=(l+r)/2;    if(ch(mid,s)){     ans=mid;     r=mid-1;    }    else    {     l=mid+1;    }      }   if(ans==-1)w.println(0);   else    w.println(n-ans+1);   w.close();  }   public boolean ch(long a,long s){       long p=0;    long val=a;    while(val>0){     p=p+val%10;     val=val/10;    }    if(a-p>=s)return true;    return false;      }  public boolean rec(int a,int b,int x,int y,int c,int d,int co){   if(a>x|b>y)return false;   if(a<-100000||b<-100000||co>100000)return false;   if(a==x&&b==y)return true;    return (rec(a+c,b+d,x,y,c,d,co+1)||rec(a+c,b-d,x,y,c,d,co+1)||rec(a-c,b+d,x,y,c,d,co+1)||rec(a-c,b-d,x,y,c,d,co+1));   }   static int gcd(int a,int b){   if(b==0)return a;   return gcd(b,a%b);  }  static void dfs(int i,int v[],int val,int b[]){    if(v[i]==1)return ;   v[i]=1;   b[i]=val;   Iterator <Integer> it=adj[i].iterator();   while(it.hasNext()){    int q=it.next();    dfs(q,v,val,b);   }    }  static void sev(int a[],int n){   for(int i=2;i<=n;i++)a[i]=i;   for(int i=2;i<=n;i++){    if(a[i]!=0){     for(int j=2*i;j<=n;){      a[j]=0;      j=j+i;     }    }   }  }  static class pair implements Comparable<pair> {   int x,y;   pair(int c,int d){    x=c;    y=d;   }   public int compareTo(pair o){    return (this.x-o.x);    }   }  static class node{   int y;   int val;   node(int a,int b){    y=a;    val=b;   }   }  static void rec(String s,int a,int b,int n){   if(b==n){    System.out.println(s);    return ;   }   String p=s;   if(a>b){    s=p+")" ;    rec(s,a,b+1,n);   }   if(a<n){    s=p+"(";    rec(s,a+1,b,n);   }    }  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);   }  }    }
2	public class zz{ static int mod=(int)1e9+7;  public static void main(String[] args) throws Exception{     MScanner sc = new MScanner(System.in);   PrintWriter pw=new PrintWriter(System.out);   int n=sc.nextInt();     int k=sc.nextInt();   int x=(-3+(int)Math.sqrt(9+4*1.0*(2*k*1.0+2*n*1.0)))/2;   pw.println(n-x);   pw.flush();  }  static class pair implements Comparable<pair>{  String t;int d;int idx;  pair(String x,int y,int i){   t=x;d=y;idx=i;  }  @Override  public int compareTo(pair o) {   if(t.compareTo(o.t)!=0) {   return t.compareTo(o.t);   }   return o.d-d;  }     public boolean equals(pair o) {   if(this.compareTo(o)==0)return true;   return false;  }  public String toString() {   return "("+t+" "+d+")";  }  }  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 String nextLine() throws IOException {  return br.readLine();  }   public int nextInt() throws IOException {  return Integer.parseInt(next());  }   public double nextDouble() throws IOException {  return Double.parseDouble(next());  }   public char nextChar() throws IOException {  return next().charAt(0);  }   public Long nextLong() throws IOException {  return Long.parseLong(next());  }   public boolean ready() throws IOException {  return br.ready();  }   public void waitForInput() throws InterruptedException {  Thread.sleep(3000);  } } }
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);   BSportMafia solver = new BSportMafia();   solver.solve(1, in, out);   out.close();  }  static class BSportMafia {   int MAXN = 200005;   PrintWriter out;   InputReader in;   public void solve(int testNumber, InputReader in, PrintWriter out) {    this.out = out;    this.in = in;    long n = nl();    long k = nl();    long i = 0;    k += n;    for (i = 0; i < MAXN; i++) {     long x = (i * (i + 3)) / 2;     if (k == x) {      pn(n - i);      return;     }    }   }   long nl() {    return in.nextLong();   }   void pn(long zx) {    out.println(zx);   }  }  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 long nextLong() {    return Long.parseLong(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;   }  } }
5	public class A135 {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   int n = s.nextInt();   int[] arr = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = s.nextInt();   }   Arrays.sort(arr);   int[] ans = new int[n];     if (arr[n-1] == 1) {    for (int i = 0 ;i < n; i++) {     ans[i] = arr[i];    }    ans[n-1] = 2;   } else {    ans[0] = 1;    for (int i = 1; i < n; i++) {     ans[i] = arr[i-1];    }   }   StringBuffer buf = new StringBuffer();   for (int i = 0; i < n; i++) {    buf.append(ans[i]);    if (i != n-1) buf.append(' ');   }   System.out.print(buf.toString());  } }
4	public class A23 {  static StreamTokenizer in; static PrintWriter out;  static int nextInt() throws IOException {  in.nextToken();  return (int)in.nval; }  static String nextString() throws IOException {  in.nextToken();  return in.sval; }  public static void main(String[] args) throws IOException {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(System.out);   String s = nextString();   for (int i = s.length(); i > 0; i--) {  for (int j = 0; j+i-1 < s.length(); j++)   for (int k = j+1; k+i-1 < s.length(); k++)   if (s.substring(j, j+i).equals(s.substring(k, k+i))) {    out.println(i);    out.flush();    return;   }  }   out.println("0");   out.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);   BSportMafia solver = new BSportMafia();   solver.solve(1, in, out);   out.close();  }  static class BSportMafia {   public void solve(int testNumber, InputReader in, PrintWriter out) {    long n = in.nextLong();    long k = in.nextLong();    long b = 2 * n + 3;    long c = n * n - 2 * k + n;    long d = b * b - 4 * c;    long val = (b - (long) Math.sqrt(d)) / 2;    out.println(val);   }  }  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 Main { public static void main(String [] args) throws IOException{  Scanner in = new Scanner(new FileInputStream("input.txt"));   File file = new File("output.txt");  FileOutputStream fos = new FileOutputStream(file);  if (!file.exists()) {   file.createNewFile();  }   int N = in.nextInt();  int M = in.nextInt();  int K = in.nextInt();  int [][] fireTime = new int[N][M];  for (int i=0; i<K; i++){  int x = in.nextInt()-1;  int y = in.nextInt()-1;  fireTime[x][y] = -1;    for (int j=1; j<=x+y; j++){   for (int p=0; p<=j; p++){   if (x-j+p >= 0 && y-p >=0 && (fireTime[x-j+p][y-p] == 0 || fireTime[x-j+p][y-p] > j)){    fireTime[x-j+p][y-p] = j;   }   }  }    for (int j=1; j<=x+M-1-y; j++){   for (int p=0; p<=j; p++){   if (x-j+p >= 0 && y+p < M && (fireTime[x-j+p][y+p] == 0 || fireTime[x-j+p][y+p] > j)){    fireTime[x-j+p][y+p] = j;   }   }  }    for (int j=1; j<=N-1-x+y; j++){   for (int p=0; p<j; p++){   if (x+j-p < N && y-p >= 0 && (fireTime[x+j-p][y-p] == 0 || fireTime[x+j-p][y-p] > j)){    fireTime[x+j-p][y-p] = j;   }   }  }    for (int j=1; j<=N-1-x+M-1-y; j++){   for (int p=0; p<=j; p++){      if (x+j-p < N && y+p < M && (fireTime[x+j-p][y+p] == 0 || fireTime[x+j-p][y+p] > j)){       fireTime[x+j-p][y+p] = j;   }   }  }  }   int max = -1;  int tx = 1;  int ty = 1;  for (int i=0; i<N; i++){  for (int j=0; j<M; j++){     if (fireTime[i][j] > max){   max = fireTime[i][j];   tx = i+1;   ty = j+1;   }  }    }   String output = tx+" "+ty;   byte[] bA = output.getBytes();  fos.write(bA);  fos.flush(); } }
3	public class inversioncounting {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int[] permutation = new int[n];  for (int i = 0; i < n; i++) {  permutation[i] = sc.nextInt();  }  int m = sc.nextInt();  int[][] reverse = new int[m][2];  for (int i = 0; i < m; i++) {  reverse[i][0] = sc.nextInt();  reverse[i][1] = sc.nextInt();  }  int counter = 0;  for (int i = 0; i < n - 1; i++) {  for (int j = i + 1; j < n; j++) {   if (permutation[i] > permutation[j]) {   counter++;   }  }  }  boolean bayus = true;  if (counter % 2 == 1) {  bayus = false;  }  for (int i = 0; i < m; i++) {  int bobib = reverse[i][1] - reverse[i][0] + 1;  int bafry = nChoose2(bobib);  if (bafry%2 == 1) {   bayus = !bayus;  }  if (bayus) {   System.out.println("even");  }  else {   System.out.println("odd");  }  }  } private static int nChoose2 (int n) {  return (n * (n-1)) / 2; } }
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; } }
1	public class A { public static void main(String[] args) throws Exception {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int k = scan.nextInt()-1;  PrimeGen p = new PrimeGen(n);  List<Integer> prims = new ArrayList<Integer>();  for(int i = 2; i <= n; i++){  if(p.isPrime(i)>0){   prims.add(i);  }  }  int sum = 0;  for(int i = 0; i < prims.size() - 1; i++){  int c = prims.get(i) + prims.get(i+1) + 1;  if(c <= n && p.isPrime(c)>0){   sum ++;  }  }  System.out.println(sum>=k?"YES":"NO"); }  static int sum(List<Integer> is) {  int c = 0;  for (int i : is)  c += i;  return c; }  static class PrimeGen {  public PrimeGen(int m) {  m = (int) Math.sqrt(m);  double max = 0;  int r = 1;  for (int i = 0; i < 4;) {   max += r * m / Math.pow(Math.log1p(m), ++i);   r *= i;  }  p = new int[(int) max];  for (int i = 0, e = 2; i < p.length; i++) {   for (; isPrime(e) < 1; e++)   ;   p[i] = e++;  }  this.m = p[p.length - 1];  this.m = this.m * this.m;  }  int isPrime(int n) {  for (int e : p)   if (e < 1)   break;   else if (n != e && n % e < 1)   return 0;  return 1;  }  int max() {  return m;  }  int[] p;  int m; } }
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());   }   public long readLong() {    return Long.parseLong(read());   }   public void readIntArrays(int[]... arrays) {    for (int i = 0; i < arrays[0].length; i++) {     for (int j = 0; j < arrays.length; j++) {      arrays[j][i] = readInt();     }    }   }  } }
1	public class P3 {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   String s = "";   while (s.length() == 0) {    s = sc.nextLine();   }   char[] pokemons = s.toCharArray();   Set<Character> pokemonTypes = new HashSet<>();   for (int i = 0; i < n; i++) {    pokemonTypes.add(pokemons[i]);   }   int types = pokemonTypes.size();   int l = 0;   int r = 0;   int min = n;   Map<Character, Integer> currentPokemons = new HashMap<>();    while (r < n) {    while (currentPokemons.size() < types && r < n) {     char pokemon = pokemons[r++];     currentPokemons.merge(pokemon, 1, (a, b) -> a + b);    }    min = Math.min(r - l, min);    while (currentPokemons.size() == types) {     char pokemon = pokemons[l++];     if (currentPokemons.get(pokemon) == 1) {      currentPokemons.remove(pokemon);     } else {      min = Math.min(r - l, min);      currentPokemons.put(pokemon, currentPokemons.get(pokemon) - 1);     }    }   }   min = Math.min(min, r - l + 1);   min = Math.max(min, types);   System.out.println(min);  } }
5	public class Main { private static 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);  } } }
3	public class CFA {  private static final String INPUT = "8\n" +    "7 6 5 4 3 2 2 3\n";  private static final int MOD = 1_000_000_007;  private PrintWriter out;  private FastScanner sc;  public static void main(String[] args) {   new CFA().run();  }  public void run() {   sc = new FastScanner(oj ? System.in : new ByteArrayInputStream(INPUT.getBytes()));   out = new PrintWriter(System.out);   long s = System.currentTimeMillis();   solve();   out.flush();   tr(System.currentTimeMillis() - s + "ms");  }  static class Color {   int nr;   boolean used;   public Color(int nr) {    this.nr = nr;   }  }  private void solve() {   int n = sc.nextInt();   Color[] a = new Color[n];   for (int i = 0; i < n; i++) {    a[i] = new Color(sc.nextInt());   }   Arrays.sort(a, Comparator.comparingInt(c -> c.nr));   int ans = 0;   for (int i = 0; i < n; i++) {    if (a[i].used) continue;    ans++;    for (int j = i+1; j < n; j++) {     if (a[j].nr % a[i].nr == 0) {      a[j].used = true;     }    }   }   out.println(ans);  }    static class SolutionFailedException extends Exception {   int code;   public SolutionFailedException(int code) {    this.code = code;   }  }  int [] sort(int [] a) {   final int SHIFT = 16, MASK = (1 << SHIFT) - 1, SIZE = (1 << SHIFT) + 1;   int n = a.length, ta [] = new int [n], ai [] = new int [SIZE];   for (int i = 0; i < n; ai[(a[i] & MASK) + 1]++, i++);   for (int i = 1; i < SIZE; ai[i] += ai[i - 1], i++);   for (int i = 0; i < n; ta[ai[a[i] & MASK]++] = a[i], i++);   int [] t = a; a = ta; ta = t;   ai = new int [SIZE];   for (int i = 0; i < n; ai[(a[i] >> SHIFT) + 1]++, i++);   for (int i = 1; i < SIZE; ai[i] += ai[i - 1], i++);   for (int i = 0; i < n; ta[ai[a[i] >> SHIFT]++] = a[i], i++);   return ta;  }  private static void shuffle(int[] array) {   Random random = new Random();   for (int i = array.length - 1; i > 0; i--) {    int index = random.nextInt(i + 1);    int temp = array[index];    array[index] = array[i];    array[i] = temp;   }  }    private static int lowerBound(long[] arr, long key) {   int lo = 0;   int hi = arr.length - 1;   while (lo < hi) {    int mid = (lo + hi) / 2;    if (key <= arr[mid]) {     hi = mid - 1;    } else {     lo = mid + 1;    }   }   return arr[lo] < key ? lo + 1 : lo;  }    private static int upperBound(long[] arr, long key) {   int lo = 0;   int hi = arr.length - 1;   while (lo < hi) {    int mid = (lo + hi) / 2;    if (key >= arr[mid]) {     lo = mid + 1;    } else {     hi = mid;    }   }   return arr[lo] <= key ? lo + 1 : lo;  }  private static int ceil(double d) {   int ret = (int) d;   return ret == d ? ret : ret + 1;  }  private static int round(double d) {   return (int) (d + 0.5);  }  private static int gcd(int a, int b) {   BigInteger b1 = BigInteger.valueOf(a);   BigInteger b2 = BigInteger.valueOf(b);   BigInteger gcd = b1.gcd(b2);   return gcd.intValue();  }  private static long gcd(long a, long b) {   BigInteger b1 = BigInteger.valueOf(a);   BigInteger b2 = BigInteger.valueOf(b);   BigInteger gcd = b1.gcd(b2);   return gcd.longValue();  }  private int[] readIntArray(int n) {   int[] res = new int[n];   for (int i = 0; i < n; i++) {    res[i] = sc.nextInt();   }   return res;  }  private long[] readLongArray(int n) {   long[] res = new long[n];   for (int i = 0; i < n; i++) {    res[i] = sc.nextLong();   }   return res;  }  @SuppressWarnings("unused")  static class FastScanner {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   FastScanner(InputStream stream) {    this.stream = stream;   }   int read() {    if (numChars == -1)     throw new InputMismatchException();    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (numChars <= 0) return -1;    }    return buf[curChar++];   }   boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   boolean isEndline(int c) {    return c == '\n' || c == '\r' || c == -1;   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String next() {    int c = read();    while (isSpaceChar(c)) c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   public String nextLine() {    int c = read();    while (isEndline(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isEndline(c));    return res.toString();   }  }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null;  private void tr(Object... o) {   if (!oj) System.out.println(Arrays.deepToString(o));  } }
0	public class Hexadecimal { public static void main(String args[]){  Scanner input = new Scanner(System.in);  int n = input.nextInt();  System.out.print("0 0 " + n); } }
6	public class E1 { 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[][] sss = new int[1<<n][m];  for(int i = 1;i < 1<<n;i+=2){   int[] ss = new int[m];   for(int j = 0;j < m;j++){   int cur = i;   int lmax = 0;   for(int sh = 0;sh < n;sh++){    int s = 0;    for(int k = 0;k < n;k++){    if(cur<<~k<0){     s += a[k][j];    }    }    lmax = Math.max(lmax, s);    cur = cur>>>1|(cur&1)<<n-1;   }   ss[j] = lmax;   }   sss[i] = ss;  }  ptns = new HashMap<>();  dfs(new int[n], 0, -1);  int ans = 0;  if(n == 4 && m >= 4){   int[] one = Arrays.copyOf(sss[1], m);   Arrays.sort(one);   ans = one[m-1] + one[m-2] + one[m-3] + one[m-4];  }    for(int[] cs : ptns.values()){   if(cs.length == 4)continue;   int[] u = new int[cs.length];   inner:   do{   for(int i = 0;i < cs.length;i++){    for(int j = i+1;j < cs.length;j++){    if(u[i] == u[j])continue inner;    }   }   int val = 0;   for(int i = 0;i < cs.length;i++){    val += sss[cs[i]][u[i]];   }   ans = Math.max(ans, val);   }while(inc(u, m));  }  out.println(ans);  } }  public static boolean inc(int[] a, int base) {  int n = a.length;  int i;  for (i = n - 1; i >= 0 && a[i] == base - 1; i--)  ;  if (i == -1)  return false;  a[i]++;  Arrays.fill(a, i + 1, n, 0);  return true; }   Map<Long, int[]> ptns = new HashMap<>();   void dfs(int[] a, int pos, int max) {  if(pos == a.length){  int[] ptn = new int[max+1];  int n = a.length;  for(int i = 0;i < n;i++){   ptn[a[i]] |= 1<<i;  }  for(int i = 0;i <= max;i++){   ptn[i] = ptn[i]>>>Integer.numberOfTrailingZeros(ptn[i]);  }       Arrays.sort(ptn);  long h = 0;  for(int v : ptn){   h= h * 1000000009 + v;  }   ptns.put(h, ptn);  return;  }   for(int i = 0;i <= max+1;i++){  a[pos] = i;  dfs(a, pos+1, Math.max(i, max));  } }  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 E1().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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
1	public class Main { public static void main(String args[]) throws IOException {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  String s;  int i,j;  for(i=0;i<n;i++)  {  s = sc.next();  j = 0;  boolean ok;       while((s.charAt(j)>='A')&&(s.charAt(j)<='Z')) j++;       while((j<s.length())&&(s.charAt(j)>='0')&&(s.charAt(j)<='9')) j++;       if (j==s.length()) ok = true; else ok = false;       String s1="",s2="";       if (ok)       {       j = 0;       while((s.charAt(j)>='A')&&(s.charAt(j)<='Z'))        {        s1 += s.charAt(j);        j++;       }       while(j<s.length())        {        s2 += s.charAt(j);        j++;       }       int v = 0,p = 1;       for(j=s1.length()-1;j>=0;j--)       {        v += p*(s1.charAt(j)-'A'+1);        p*=26;       }       System.out.println("R"+s2+"C"+v);       } else       {       j = 1;       while((s.charAt(j)>='0')&&(s.charAt(j)<='9'))       {        s1 += s.charAt(j);        j++;       }       j++;       while(j<s.length())       {        s2 += s.charAt(j);        j++;       }   Integer a = new Integer(s2);       String s3="";       int d;       while(a > 0)       {        d = a%26; a/=26;        if (d==0) {d=26; a--;}        s3 = Character.toUpperCase(Character.forDigit(9+d,36)) + s3;          }       System.out.println(s3+s1);       }  } } }
2	public class Code3 {  public static void main(String[] args) {  InputReader in = new InputReader(System.in);  PrintWriter pw = new PrintWriter(System.out);   long x = in.nextLong();  long k = in.nextLong();   if(x==0)  pw.println(0);  else  {  long mul = modularExponentiation(2L, k, mod);  x = (x%mod * 2L%mod)%mod;  x = (x%mod - 1L%mod + mod)%mod;  x = (x%mod * mul%mod)%mod;  x = (x%mod + 1%mod)%mod;   pw.print(x);  }  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 long nextLong()  {  int c = snext();  while (isSpaceChar(c))   {   c = snext();  }  int sgn = 1;  if (c == '-')   {   sgn = -1;   c = snext();  }  long res = 0;  do   {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = snext();  } while (!isSpaceChar(c));  return res * sgn;  }   public int[] nextIntArray(int n)  {  int a[] = new int[n];  for (int i = 0; i < n; i++)   {   a[i] = nextInt();  }  return a;  }   public String readString()  {  int c = snext();  while (isSpaceChar(c))   {   c = snext();  }  StringBuilder res = new StringBuilder();  do   {   res.appendCodePoint(c);   c = snext();  } while (!isSpaceChar(c));  return res.toString();  }   public String nextLine()  {  int c = snext();  while (isSpaceChar(c))   c = snext();  StringBuilder res = new StringBuilder();  do   {   res.appendCodePoint(c);   c = snext();  } while (!isEndOfLine(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;  }   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[] suffle(int[] a,Random gen) {  int n = a.length;  for(int i=0;i<n;i++)  {  int ind = gen.nextInt(n-i)+i;  int temp = a[ind];  a[ind] = a[i];  a[i] = temp;  }  return a; }  public static void swap(int a, int b){  int temp = a;  a = b;  b = temp; }  public static HashSet<Integer> primeFactorization(int n) {  HashSet<Integer> a =new HashSet<Integer>();  for(int i=2;i*i<=n;i++)  {  while(n%i==0)  {   a.add(i);   n/=i;  }  }  if(n!=1)  a.add(n);  return a; }  public static void sieve(boolean[] isPrime,int n) {  for(int i=1;i<n;i++)  isPrime[i] = true;   isPrime[0] = false;  isPrime[1] = false;   for(int i=2;i*i<n;i++)  {  if(isPrime[i] == true)  {   for(int j=(2*i);j<n;j+=i)   isPrime[j] = false;  }  } }  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 long LCM(long a,long b) {  return (a*b)/GCD(a,b); }  public static int LCM(int a,int b) {  return (a*b)/GCD(a,b); }  public static int binaryExponentiation(int x,int n) {  int result=1;  while(n>0)  {   if(n % 2 ==1)    result=result * x;   x=x*x;   n=n/2;  }  return result; }  public static long binaryExponentiation(long x,long n) {  long result=1;  while(n>0)  {   if(n % 2 ==1)    result=result * x;   x=x*x;   n=n/2;  }  return result; }  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; }  public static int modInverse(int A,int M) {  return modularExponentiation(A,M-2,M); }  public static long modInverse(long A,long M) {  return modularExponentiation(A,M-2,M); }  public static boolean isPrime(int n) {    if (n <= 1) return false;  if (n <= 3) return true;    if (n%2 == 0 || n%3 == 0)   return false;    for (int i=5; i*i<=n; i=i+6)  {   if (n%i == 0 || n%(i+2) == 0)    return false;  }    return true; }  static class pair implements Comparable<pair> {  Integer x, y;  pair(int x,int y)  {  this.x=x;  this.y=y;  }   public int compareTo(pair o) {  int result = x.compareTo(o.x);  if(result==0)   result = y.compareTo(o.y);    return result;  }    public String toString()  {  return x+" "+y;  }   public boolean equals(Object o)  {  if (o instanceof pair)   {   pair p = (pair)o;   return p.x == x && p.y == y ;  }  return false;  }   public int hashCode()  {  return new Long(x).hashCode()*31 + new Long(y).hashCode();  } } }
5	public class Solution { public static void main(String[] args) {  Scanner scanner = new Scanner(System.in);  Comp c1 = getComp(scanner);  Comp c2 = getComp(scanner);  c1.sortByPrice();  c2.sortByPrice();  int i = 0;  int j = 0;  while(i < c1.num || j < c2.num) {  Elem xi = (i < c1.num) ? c1.elems.get(i) : null;  Elem yj = (j < c2.num) ? c2.elems.get(j) : null;  if(xi != null && yj != null) {   if(xi.price >= yj.price) {   if(!c2.resultSet.contains(xi)) {    c1.resultSet.add(xi);   }   i++;   } else {   if(!c1.resultSet.contains(yj)) {    c2.resultSet.add(yj);   }   j++;   }  } else  if(xi != null) {   if(!c2.resultSet.contains(xi)) {   c1.resultSet.add(xi);   }   i++;  } else {   if(!c1.resultSet.contains(yj)) {   c2.resultSet.add(yj);   }   j++;  }    }   long result = c1.getResultPrice() + c2.getResultPrice();  System.out.println(result);  }   private static Comp getComp(Scanner scanner) {  Comp c = new Comp();  c.num = scanner.nextInt();  for(int i = 0; i < c.num; i++) {   c.addElem(scanner.nextLong(), scanner.nextLong());  }  return c;  } } class Comp { int num; List<Elem> elems = new ArrayList<>(); Set<Elem> resultSet = new HashSet<>();  void addElem(long el, long pr) {  Elem elem = new Elem(el, pr);  elems.add(elem); }  void sortByPrice() {  Collections.sort(elems); }  long getResultPrice() {  long sumPrice = 0;  for(Elem elem : resultSet) {  sumPrice += elem.price;  }   return sumPrice; } } class Elem implements Comparable<Elem> { long elem; long price;  public Elem(long el, long pr) {  this.elem = el;  this.price = pr; }  public int compareTo(Elem other) {  return (int) (other.price - price); }  public boolean equals(Object o) {  if(!(o instanceof Elem)) {  return false;  }   Elem other = (Elem) o;  return (other.elem == elem); }  public int hashCode() {  return (int) elem; }  public String toString() {  return "(" + elem + ", " + price + ")"; } }
2	public class TaskC {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  BigInteger x = new BigInteger(sc.next());  BigInteger k = new BigInteger(sc.next());  BigInteger mod = new BigInteger(String.valueOf((int) (Math.pow(10, 9) + 7)));  BigInteger two = new BigInteger("2");  BigInteger interm = two.modPow(k, mod);  BigInteger res = interm.multiply(x).add(interm.multiply(x)).subtract(interm).add(BigInteger.ONE).mod(mod);  if(x.equals(BigInteger.ZERO)) {  System.out.println("0");  return;  }  System.out.println(res); } }
1	public class C {  public static void main(String[] args) throws Exception {   BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));     PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));   int n = Integer.parseInt(bf.readLine());   int counter = 0;   for(int i=0; i<2*n/3; i++) System.out.println("0 " + i);   for(int i=0; i<n-2*n/3; i++) System.out.println("3 " + (2*i+1));  } }
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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, InputReader in, OutputWriter out) {    try {     int n = in.readInt();     int[] x = new int[n], w = new int[n];     in.readIntArrays(x, w);     int[] begin = new int[n], end = new int[n];     Arrays.setAll(begin, i -> x[i] - w[i]);     Arrays.setAll(end, i -> x[i] + w[i]);     int m = ArrayUtils.compress(begin, end).length;     int[] dp = new int[m + 1], order = ArrayUtils.order(end);     int idx = 0;     for (int i = 0; i < m; i++) {      if (i > 0) {       dp[i] = dp[i - 1];      }      while (idx < n && end[order[idx]] == i) {       dp[i] = Math.max(dp[i], dp[begin[order[idx]]] + 1);       idx++;      }     }     int res = dp[m - 1];     out.printLine(res);    } catch (Exception e) {     e.printStackTrace();    }   }  }  static class Sorter {   private static final int INSERTION_THRESHOLD = 16;   private Sorter() {   }   public static void sort(IntList list, IntComparator comparator) {    quickSort(list, 0, list.size() - 1, (Integer.bitCount(Integer.highestOneBit(list.size()) - 1) * 5) >> 1,      comparator);   }   private static void quickSort(IntList list, int from, int to, int remaining, IntComparator comparator) {    if (to - from < INSERTION_THRESHOLD) {     insertionSort(list, from, to, comparator);     return;    }    if (remaining == 0) {     heapSort(list, from, to, comparator);     return;    }    remaining--;    int pivotIndex = (from + to) >> 1;    int pivot = list.get(pivotIndex);    list.swap(pivotIndex, to);    int storeIndex = from;    int equalIndex = to;    for (int i = from; i < equalIndex; i++) {     int value = comparator.compare(list.get(i), pivot);     if (value < 0) {      list.swap(storeIndex++, i);     } else if (value == 0) {      list.swap(--equalIndex, i--);     }    }    quickSort(list, from, storeIndex - 1, remaining, comparator);    for (int i = equalIndex; i <= to; i++) {     list.swap(storeIndex++, i);    }    quickSort(list, storeIndex, to, remaining, comparator);   }   private static void heapSort(IntList list, int from, int to, IntComparator comparator) {    for (int i = (to + from - 1) >> 1; i >= from; i--) {     siftDown(list, i, to, comparator, from);    }    for (int i = to; i > from; i--) {     list.swap(from, i);     siftDown(list, from, i - 1, comparator, from);    }   }   private static void siftDown(IntList list, int start, int end, IntComparator comparator, int delta) {    int value = list.get(start);    while (true) {     int child = ((start - delta) << 1) + 1 + delta;     if (child > end) {      return;     }     int childValue = list.get(child);     if (child + 1 <= end) {      int otherValue = list.get(child + 1);      if (comparator.compare(otherValue, childValue) > 0) {       child++;       childValue = otherValue;      }     }     if (comparator.compare(value, childValue) >= 0) {      return;     }     list.swap(start, child);     start = child;    }   }   private static void insertionSort(IntList list, int from, int to, IntComparator comparator) {    for (int i = from + 1; i <= to; i++) {     int value = list.get(i);     for (int j = i - 1; j >= from; j--) {      if (comparator.compare(list.get(j), value) <= 0) {       break;      }      list.swap(j, j + 1);     }    }   }  }  static interface IntList extends IntReversableCollection {   public abstract int get(int index);   public abstract void set(int index, int value);   public abstract void addAt(int index, int value);   public abstract void removeAt(int index);   default public void swap(int first, int second) {    if (first == second) {     return;    }    int temp = get(first);    set(first, get(second));    set(second, temp);   }   default public IntIterator intIterator() {    return new IntIterator() {     private int at;     private boolean removed;     public int value() {      if (removed) {       throw new IllegalStateException();      }      return get(at);     }     public boolean advance() {      at++;      removed = false;      return isValid();     }     public boolean isValid() {      return !removed && at < size();     }     public void remove() {      removeAt(at);      at--;      removed = true;     }    };   }   default public void add(int value) {    addAt(size(), value);   }   default public IntList sort(IntComparator comparator) {    Sorter.sort(this, comparator);    return this;   }   default IntList unique() {    int last = Integer.MIN_VALUE;    IntList result = new IntArrayList();    int size = size();    for (int i = 0; i < size; i++) {     int current = get(i);     if (current != last) {      result.add(current);      last = current;     }    }    return result;   }   default public IntList subList(final int from, final int to) {    return new IntList() {     private final int shift;     private final int size;     {      if (from < 0 || from > to || to > IntList.this.size()) {       throw new IndexOutOfBoundsException("from = " + from + ", to = " + to + ", size = " + size());      }      shift = from;      size = to - from;     }     public int size() {      return size;     }     public int get(int at) {      if (at < 0 || at >= size) {       throw new IndexOutOfBoundsException("at = " + at + ", size = " + size());      }      return IntList.this.get(at + shift);     }     public void addAt(int index, int value) {      throw new UnsupportedOperationException();     }     public void removeAt(int index) {      throw new UnsupportedOperationException();     }     public void set(int at, int value) {      if (at < 0 || at >= size) {       throw new IndexOutOfBoundsException("at = " + at + ", size = " + size());      }      IntList.this.set(at + shift, value);     }     public IntList compute() {      return new IntArrayList(this);     }    };   }  }  static interface IntComparator {   IntComparator DEFAULT = Integer::compare;   int compare(int first, int second);  }  static class Range {   public static IntList range(int from, int to) {    int[] result = new int[Math.abs(from - to)];    int current = from;    if (from <= to) {     for (int i = 0; i < result.length; i++) {      result[i] = current++;     }    } else {     for (int i = 0; i < result.length; i++) {      result[i] = current--;     }    }    return new IntArray(result);   }  }  static interface IntReversableCollection extends IntCollection {  }  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 interface IntStream extends Iterable<Integer>, Comparable<IntStream> {   IntIterator intIterator();   default Iterator<Integer> iterator() {    return new Iterator<Integer>() {     private IntIterator it = intIterator();     public boolean hasNext() {      return it.isValid();     }     public Integer next() {      int result = it.value();      it.advance();      return result;     }    };   }   default int compareTo(IntStream c) {    IntIterator it = intIterator();    IntIterator jt = c.intIterator();    while (it.isValid() && jt.isValid()) {     int i = it.value();     int j = jt.value();     if (i < j) {      return -1;     } else if (i > j) {      return 1;     }     it.advance();     jt.advance();    }    if (it.isValid()) {     return 1;    }    if (jt.isValid()) {     return -1;    }    return 0;   }  }  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 void readIntArrays(int[]... arrays) {    for (int i = 0; i < arrays[0].length; i++) {     for (int j = 0; j < arrays.length; j++) {      arrays[j][i] = readInt();     }    }   }   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 {    boolean isSpaceChar(int ch);   }  }  static interface IntCollection extends IntStream {   public int size();   default public void add(int value) {    throw new UnsupportedOperationException();   }   default public int[] toArray() {    int size = size();    int[] array = new int[size];    int i = 0;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     array[i++] = it.value();    }    return array;   }   default public IntCollection addAll(IntStream values) {    for (IntIterator it = values.intIterator(); it.isValid(); it.advance()) {     add(it.value());    }    return this;   }  }  static class IntArray extends IntAbstractStream implements IntList {   private int[] data;   public IntArray(int[] arr) {    data = arr;   }   public int size() {    return data.length;   }   public int get(int at) {    return data[at];   }   public void addAt(int index, int value) {    throw new UnsupportedOperationException();   }   public void removeAt(int index) {    throw new UnsupportedOperationException();   }   public void set(int index, int value) {    data[index] = value;   }  }  static class ArrayUtils {   public static int[] range(int from, int to) {    return Range.range(from, to).toArray();   }   public static int[] createOrder(int size) {    return range(0, size);   }   public static int[] sort(int[] array, IntComparator comparator) {    return sort(array, 0, array.length, comparator);   }   public static int[] sort(int[] array, int from, int to, IntComparator comparator) {    if (from == 0 && to == array.length) {     new IntArray(array).sort(comparator);    } else {     new IntArray(array).subList(from, to).sort(comparator);    }    return array;   }   public static int[] order(final int[] array) {    return sort(createOrder(array.length), (first, second) -> Integer.compare(array[first], array[second]));   }   public static int[] unique(int[] array) {    return new IntArray(array).unique().toArray();   }   public static int[] compress(int[]... arrays) {    int totalLength = 0;    for (int[] array : arrays) {     totalLength += array.length;    }    int[] all = new int[totalLength];    int delta = 0;    for (int[] array : arrays) {     System.arraycopy(array, 0, all, delta, array.length);     delta += array.length;    }    sort(all, IntComparator.DEFAULT);    all = unique(all);    for (int[] array : arrays) {     for (int i = 0; i < array.length; i++) {      array[i] = Arrays.binarySearch(all, array[i]);     }    }    return all;   }  }  static interface IntIterator {   public int value() throws NoSuchElementException;   public boolean advance();   public boolean isValid();  }  static class IntArrayList extends IntAbstractStream implements IntList {   private int size;   private int[] data;   public IntArrayList() {    this(3);   }   public IntArrayList(int capacity) {    data = new int[capacity];   }   public IntArrayList(IntCollection c) {    this(c.size());    addAll(c);   }   public IntArrayList(IntStream c) {    this();    if (c instanceof IntCollection) {     ensureCapacity(((IntCollection) c).size());    }    addAll(c);   }   public IntArrayList(IntArrayList c) {    size = c.size();    data = c.data.clone();   }   public IntArrayList(int[] arr) {    size = arr.length;    data = arr.clone();   }   public int size() {    return size;   }   public int get(int at) {    if (at >= size) {     throw new IndexOutOfBoundsException("at = " + at + ", size = " + size);    }    return data[at];   }   private void ensureCapacity(int capacity) {    if (data.length >= capacity) {     return;    }    capacity = Math.max(2 * data.length, capacity);    data = Arrays.copyOf(data, capacity);   }   public void addAt(int index, int value) {    ensureCapacity(size + 1);    if (index > size || index < 0) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    if (index != size) {     System.arraycopy(data, index, data, index + 1, size - index);    }    data[index] = value;    size++;   }   public void removeAt(int index) {    if (index >= size || index < 0) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    if (index != size - 1) {     System.arraycopy(data, index + 1, data, index, size - index - 1);    }    size--;   }   public void set(int index, int value) {    if (index >= size) {     throw new IndexOutOfBoundsException("at = " + index + ", size = " + size);    }    data[index] = value;   }   public int[] toArray() {    return Arrays.copyOf(data, size);   }  }  static abstract class IntAbstractStream implements IntStream {   public String toString() {    StringBuilder builder = new StringBuilder();    boolean first = true;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     if (first) {      first = false;     } else {      builder.append(' ');     }     builder.append(it.value());    }    return builder.toString();   }   public boolean equals(Object o) {    if (!(o instanceof IntStream)) {     return false;    }    IntStream c = (IntStream) o;    IntIterator it = intIterator();    IntIterator jt = c.intIterator();    while (it.isValid() && jt.isValid()) {     if (it.value() != jt.value()) {      return false;     }     it.advance();     jt.advance();    }    return !it.isValid() && !jt.isValid();   }   public int hashCode() {    int result = 0;    for (IntIterator it = intIterator(); it.isValid(); it.advance()) {     result *= 31;     result += it.value();    }    return result;   }  } }
6	public class Main implements Runnable { StreamTokenizer ST;  PrintWriter out;  BufferedReader br;  Scanner in; static final int inf = 1000000000+10;  int nextInt() throws IOException{   ST.nextToken();   return (int)ST.nval;  } long nextLong() throws IOException{   ST.nextToken();   return (long)ST.nval;  }  String next() throws IOException{   ST.nextToken();   return ST.sval;  }  double nextD() throws IOException{   ST.nextToken();   return ST.nval;  }  public static void main(String[] args) throws IOException {    new Thread(new Main()).start(); }  public void run() {   try {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));          ST = new StreamTokenizer(br);    solve();    out.close();     br.close();   }    catch (IOException e) {    e.printStackTrace();  throw new IllegalStateException(e);  }  }  public void solve() throws IOException { int[] x = new int[32]; int[] y = new int[32]; x[0] = nextInt(); y[0] = nextInt();  int n = nextInt(); for (int i=1; i<=n; i++) {  x[i] = nextInt();  y[i] = nextInt(); } n++; int[][] a = new int[n][n]; int[][] b = new int[n-1][n-1]; for (int i=0; i<n; i++)  for (int j=0; j<n; j++)  a[i][j] = (x[i]-x[j])*(x[i]-x[j])+ (y[i]-y[j])*(y[i]-y[j]); for (int i=1; i<n; i++)  for (int j=1; j<n; j++)  if (i!=j) b[i-1][j-1] = a[0][i]+a[i][j]+a[j][0]; else b[i-1][j-1] = 2*a[0][i]; n--;  int sz = 1<<n; int[] d = new int[sz]; int[] p = new int[sz]; d[1] = 0; for (int msk=1; msk<sz; msk++) {  int j = 0;  while ((msk&(1<<j))==0) j++;  int t = inf;   for (int i=0; i<n; i++)  if ((msk&(1<<i))>0)  if (t>d[msk^((1<<i)|(1<<j))]+b[i][j]) {   t = d[msk^((1<<i)|(1<<j))]+b[i][j];   p[msk] = i*n+j;  }  d[msk] = t;   } out.println(d[sz-1]); out.print("0 "); int t = sz-1; while (t>0) {  int hz = p[t];  int i = hz/n;  int j = hz%n;  if (i!=j) out.print((i+1)+" "+(j+1)+" 0 ");else out.print((i+1)+" 0 ");  t ^= (1<<i)|(1<<j); }  }  }
3	public class Main {  public static void main(String[] args) {   Scanner scn = new Scanner(System.in);   int n = scn.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) a[i] = scn.nextInt();   scn.close();   Arrays.sort(a);   ArrayList<Integer> cyka = new ArrayList<>();   for (int i = 0; i < n; i++) {    for (int j = 0; j < n; j++) {     if (a[j] % a[i] == 0) {      boolean add = true;      for (int k : cyka) {       if (a[i] % k == 0) {        add = false;        break;       }      }      if (add) {       cyka.add(a[i]);      }     }    }   }   System.out.println(cyka.size());  } }
3	public class Main {  public static void main(String [] args) {   Scanner scanner = new Scanner(System.in);   int n = scanner.nextInt();   int numbers[] = new int[n];   for (int i = 0; i < n; i++) {    numbers[i] = scanner.nextInt();   }   scanner.close();   Arrays.sort(numbers);   boolean[] colored = new boolean[n];   int res = 0;   for (int i = 0; i < n; i++) {    if (!colored[i]) {     res += 1;    }    for (int j = i; j < n; j++) {     if (numbers[j] % numbers[i] == 0) {      colored[j] = true;     }    }   }   System.out.println(res);  } }
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();  } }
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> {  public int compare(B b1,B b2)  {    if(b1.x>b2.x)    return 1;    else if(b1.x==b2.x)    {    if(b1.y>b2.y)    return 1;    else if(b1.y==b2.y)    return 0;    else    return -1;    }    else    return -1;  } } class B {  long x=(long)1;  long y=(long)1;  public B(long l1,long l2)  { x=l1; y=l2; } }
5	public class C implements Runnable {  private void Solution() throws IOException {  int n = nextInt(), max = 0, maxi = 0;  ArrayList<Integer> mas = new ArrayList<Integer>();  for (int i = 0; i < n; i++) {  int num = nextInt();  if (num > max) {   max = num;   maxi = i;  }  mas.add(num);  }  mas.remove(maxi);  mas.add(max == 1 ? 2 : 1);  Collections.shuffle(mas);  Collections.sort(mas);  for (int i = 0; i < n; i++)  System.out.print(mas.get(i) + " "); }  public static void main(String[] args) {  new C().run(); }  BufferedReader in; StringTokenizer tokenizer;  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  tokenizer = null;  Solution();  in.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(in.readLine());  return tokenizer.nextToken(); } }
3	public class Main {  static FastScanner sc = new FastScanner(); static Output out = new Output(System.out);  static final int[] dx = {0, 1, 0, -1}; static final int[] dy = {-1, 0, 1, 0};  static final long MOD = (long) (1e9 + 7); static final long INF = Long.MAX_VALUE / 2;  static final int e5 = (int) 1e5;  public static class Solver {  public Solver() {   int N = sc.nextInt();   boolean[] flag = new boolean[101];  for (int i=0; i<N; i++) {   flag[sc.nextInt()] = true;  }   int ans = 0;  for (int i=1; i<=100; i++) {   if (flag[i]) {   ans++;   for (int j=i*2; j<=100; j+=i) {    flag[j] = false;   }   }  }   out.println(ans);  }  public static void sort(int[] a) {  shuffle(a);  Arrays.sort(a);  }  public static void sort(long[] a) {  shuffle(a);  Arrays.sort(a);  }  public static void shuffle(int[] arr){  int n = arr.length;  Random rnd = new Random();  for(int i=0; i<n; ++i){   int tmp = arr[i];   int randomPos = i + rnd.nextInt(n-i);   arr[i] = arr[randomPos];   arr[randomPos] = tmp;  }  }  public static void shuffle(long[] arr){  int n = arr.length;  Random rnd = new Random();  for(int i=0; i<n; ++i){   long tmp = arr[i];   int randomPos = i + rnd.nextInt(n-i);   arr[i] = arr[randomPos];   arr[randomPos] = tmp;  }  } }  public static void main(String[] args) {  new Solver();  out.flush(); }  static class FastScanner {  private InputStream in = System.in;  private final byte[] buffer = new byte[1024];  private int ptr = 0;  private int buflen = 0;   public void load() {  try {   in = new FileInputStream(next());  } catch (Exception e) {   e.printStackTrace();  }  }  private boolean hasNextByte() {  if (ptr < buflen) {   return true;  } else {   ptr = 0;   try {   buflen = in.read(buffer);   } catch (IOException e) {   e.printStackTrace();   }   if (buflen <= 0) {   return false;   }  }  return true;  }  private int readByte() {  if (hasNextByte()) return buffer[ptr++];  else return -1;  }  private static boolean isPrintableChar(int c) {  return 33 <= c && c <= 126;  }  private void skipUnprintable() {  while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;  }  public boolean hasNext() {  skipUnprintable();  return hasNextByte();  }  public String next() {  if (!hasNext()) throw new NoSuchElementException();  StringBuilder sb = new StringBuilder();  int b = readByte();  while (isPrintableChar(b)) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }  public long nextLong() {  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() {  return (int) nextLong();  }  public int[] nextIntArray(int N, boolean oneBased) {  if (oneBased) {   int[] array = new int[N + 1];   for (int i = 1; i <= N; i++) {   array[i] = sc.nextInt();   }   return array;  } else {   int[] array = new int[N];   for (int i = 0; i < N; i++) {   array[i] = sc.nextInt();   }   return array;  }  }  public long[] nextLongArray(int N, boolean oneBased) {  if (oneBased) {   long[] array = new long[N + 1];   for (int i = 1; i <= N; i++) {   array[i] = sc.nextLong();   }   return array;  } else {   long[] array = new long[N];   for (int i = 0; i < N; i++) {   array[i] = sc.nextLong();   }   return array;  }  } }  static class Output extends PrintWriter {  private long startTime;  public Output(PrintStream ps) {  super(ps);  }  public void print(int[] a, String separator) {  for (int i = 0; i < a.length; i++) {   if (i == 0) print(a[i]);   else print(separator + a[i]);  }  println();  }  public void print(long[] a, String separator) {  for (int i = 0; i < a.length; i++) {   if (i == 0) print(a[i]);   else print(separator + a[i]);  }  println();  }  public void print(String[] a, String separator) {  for (int i = 0; i < a.length; i++) {   if (i == 0) print(a[i]);   else print(separator + a[i]);  }  println();  }  public void print(ArrayList a, String separator) {  for (int i = 0; i < a.size(); i++) {   if (i == 0) print(a.get(i));   else print(separator + a.get(i));  }  println();  }  public void start() {  startTime = System.currentTimeMillis();  }  public void time(String s) {  long time = System.currentTimeMillis() - startTime;  println(s + "(" + time + ")");  }  } }
5	public class codeforces {  public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  int n=sc.nextInt();  int[] data=new int[n];  for(int i=0;i<n;i++)  data[i]=sc.nextInt();  Arrays.sort(data);  if(data[n-1]!=1)  data[n-1]=1;  else  data[n-1]=2;  Arrays.sort(data);  for(int i=0;i<n;i++)  {  System.out.print(data[i]);  if(i!=n-1)   System.out.print(" ");  }     return; } }
1	public class TaskB {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);     int n = s.nextInt();   int k = s.nextInt();   int[] nums = new int[100000 + 10];     int first = -1, last = -1;   Set<Integer> dif = new TreeSet<Integer>();     s.nextLine();   for (int i = 0; i < n; i++) {    nums[i] = s.nextInt();    dif.add(nums[i]);    if (dif.size() == k) {     last = i;     break;    }   }   dif.clear();   for (int i = last; i >= 0; i--) {    dif.add(nums[i]);    if (dif.size() == k) {     first = i;     break;    }   }     if (last == -1)    System.out.print("-1 -1");   else    System.out.print(Integer.toString(first + 1) + " " + Integer.toString(last + 1));  } }
0	public class S { public static void main (String[] args) {  Scanner in=new Scanner(System.in);  int t=in.nextInt();  while(t--!=0)  {   int a=in.nextInt();   int b=in.nextInt();   int min=Math.min(a,b);   int max=Math.max(a,b);   int res=0;   while(min!=0)   {    res=res+max/min;    int temp=min;    min=max%min;    max=temp;   }   System.out.println(res);  } }  }
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();  } } }
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 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;  } } 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)); } }
1	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();    String s = in.next();    HashMap<Character, Integer> indexMap = new HashMap<>();    for (int i = 0; i < n; i++) {     char c = s.charAt(i);     if (!indexMap.containsKey(c)) {      indexMap.put(c, indexMap.size());     }    }    int[] last = new int[indexMap.size()];    Arrays.fill(last, -1_000_000);    int answer = n;    for (int i = 0; i < n; i++) {     int index = indexMap.get(s.charAt(i));     last[index] = i;     int first = i;     for (int a : last) first = Math.min(first, a);     int visits = i - first + 1;     answer = Math.min(answer, visits);    }    out.println(answer);   }  } }
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;     }    }   }  } }
3	public class F {  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();   int[][] sub = new int[n][n];   for (int i = 0; i < n; i++) {    sub[i][i] = arr[i];    for (int j = i + 1; j < n; j++) {     sub[i][j] = sub[i][j - 1] + arr[j];    }   }   HashMap<Integer, List<P>> hm = new HashMap<>();     for(int stop=0; stop<n; stop++) {    for(int start=0; start<=stop; start++) {     if (hm.containsKey(sub[start][stop])) {      hm.get(sub[start][stop]).add(new P(start, stop));     } else {      List<P> temp = new ArrayList<>();      temp.add(new P(start, stop));      hm.put(sub[start][stop], temp);     }    }   }   int ans = Integer.MIN_VALUE;      List<P> ansList = null;   for (List<P> it : hm.values()) {    int or = overlap(it);    if(or>ans) {     ans = or;     ansList = it;    }   }   List<P> processedList = extractOverlapping(ansList);   System.out.println(ans);   for(int i=0; i<processedList.size(); i++) {    int A = processedList.get(i).a + 1;    int B = processedList.get(i).b + 1;    System.out.println(A + " " + B);   }  }  public static int overlap(List<P> listOfPair) {     List<P> sortedList = listOfPair;   int cnt = 0;   int end = sortedList.get(0).b;   for (int i = 1; i < sortedList.size(); i++) {    if (sortedList.get(i).a <= end) {     cnt++;    } else {     end = sortedList.get(i).b;    }   }   return sortedList.size() - cnt;  }  public static List<P> extractOverlapping(List<P> ansList) {   List<P> sortedList = ansList.stream()     .sorted((pair1, pair2) -> pair1.getB().compareTo(pair2.getB()))     .collect(Collectors.toList());   List<P> finalList = new ArrayList<>();   finalList.add(sortedList.get(0));   int end = sortedList.get(0).b;   for (int i = 1; i < sortedList.size(); i++) {    if (sortedList.get(i).a <= end) {     continue;    } else {     finalList.add(sortedList.get(i));     end = sortedList.get(i).b;    }   }   return finalList;  } } class P implements Comparable<P> {  Integer a;  Integer b;  public P(int a, int b) {   this.a = a;   this.b = b;  }  public Integer getA() {   return a;  }  public Integer getB() {   return b;  }  @Override  public int compareTo(P that) {   return this.b.compareTo(that.b);  } }
3	public class Loader {  private final static Scanner in = new Scanner(System.in);  public static void main(String[] args) {   int n = in.nextInt();   ArrayList<Integer> l = new ArrayList<>();   for (int i = 0; i < n; i++) {    l.add(in.nextInt());   }   Collections.sort(l);    int k = 0;   for (int i = 0; i < l.size(); i++) {    if (l.get(i) == 0) continue;    for (int j = i + 1; j < l.size(); j++) {     if (l.get(j) == 0) continue;     if (l.get(j) % l.get(i) == 0) {      l.set(j, 0);     }    }    l.set(i, 0);    k++;   }   System.out.println(k);  } }
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  @SuppressWarnings("Duplicates")  class TaskD {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int[] a = in.nextIntArray(n);    int m = in.nextInt();    int count = 0;    for (int i = 0; i < n; i++) {     for (int j = i + 1; j < n; j++) {      if (a[i] > a[j]) count++;     }    }    StringBuilder res = new StringBuilder();    int l, r, temp, c1, c2;    while (m-- > 0) {     l = in.nextInt() - 1;     r = in.nextInt() - 1;     c1 = c2 = 0;     for (int i = 0; i < (r - l + 1) / 2; i++) {      if (a[l + i] > a[r - i]) c1++;      else c2++;      temp = a[l + i];      a[l + i] = a[r - i];      a[r - i] = temp;     }     count = count + c1 - c2;     res.append(Math.abs(count) % 2 == 1 ? "odd" : "even").append('\n');    }    out.print(res);   }  }  static class InputReader {   private final BufferedReader reader;   private StringTokenizer tokenizer;   public InputReader(InputStream in) {    reader = new BufferedReader(new InputStreamReader(in));   }   public int[] nextIntArray(int size) {    int[] array = new int[size];    for (int i = 0; i < size; ++i) {     array[i] = nextInt();    }    return array;   }   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;   }  } }
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 long nextLong() {  return Long.parseLong(next());  }  public int nextInt() {  return Integer.parseInt(next());  }  public double nextDouble() {  return Double.parseDouble(next());  }  public double nextShort() {  return Short.parseShort(next());  }  public double nextByte() {  return Byte.parseByte(next());  }  public double nextFloat() {  return Float.parseFloat(next());  } } }
2	public class CF256B extends PrintWriter { CF256B() { super(System.out, true); } Scanner sc = new Scanner(System.in); public static void main(String[] $) {  CF256B o = new CF256B(); o.main(); o.flush(); }  long count(int n, int x, int y, int r) {  long a = 2L * r * r + 2 * r + 1;  int w;  if ((w = 1 - (x - r)) > 0)  a -= (long) w * w;  if ((w = 1 - (y - r)) > 0)  a -= (long) w * w;  if ((w = (x + r) - n) > 0)  a -= (long) w * w;  if ((w = (y + r) - n) > 0)  a -= (long) w * w;  if ((w = r - 1 - (x - 1) - (y - 1)) > 0)  a += (long) w * (w + 1) / 2;  if ((w = r - 1 - (x - 1) - (n - y)) > 0)  a += (long) w * (w + 1) / 2;  if ((w = r - 1 - (n - x) - (y - 1)) > 0)  a += (long) w * (w + 1) / 2;  if ((w = r - 1 - (n - x) - (n - y)) > 0)  a += (long) w * (w + 1) / 2;  return a; } void main() {  int n = sc.nextInt();  int x = sc.nextInt();  int y = sc.nextInt();  int c = sc.nextInt();  int lower = -1, upper = c;  while (upper - lower > 1) {  int r = (lower + upper) / 2;  if (count(n, x, y, r) >= c)   upper = r;  else   lower = r;  }  println(upper); } }
3	public class Main {  private static int REM = 1000000007;  private static int dig;  private static 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);  }  private static 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;  } }
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());   }  } }
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 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;  } } 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) {   InputScanner scanner = new InputScanner();   try {    long l = scanner.nextLong();    long r = scanner.nextLong();    if ((r - l) < 2) {     System.out.println("-1");     return;    }    if (l % 2 == 0) {     long a = l;     long b = l + 1;     long c = l + 2;     System.out.println(a + " " + b + " " + c);    } else if (r%2==0){     long a = r;     long b = r-1;     long c = r-2;     System.out.println(c + " " + b + " " + a);    } else {     l++;     if ((r - l) < 2) {      System.out.println("-1");      return;     }     long a = l;     long b = l + 1;     long c = l + 2;     System.out.println(a + " " + b + " " + c);    }   } catch (IOException e) {   }   }  static class InputScanner {   BufferedReader br;   StringTokenizer st;   public InputScanner() {    br = new BufferedReader(new InputStreamReader(System.in));   }   public String next() throws IOException {    if (st == null || !st.hasMoreTokens()) {     String line = br.readLine();     st = new StringTokenizer(line);    }    return st.nextToken();   }   public int nextInt() throws IOException {    String next = next();    next.length();    return Integer.parseInt(next);   }   public long nextLong() throws IOException {    String next = next();    next.length();    return Long.parseLong(next);   }  } }
4	public class Main{  public static void main(String[] Args) throws Exception {   Scanner sc = new Scanner(new FileReader("input.txt"));   int n,m,k;   Integer lx,ly;   boolean d[][];   n = sc.nextInt(); m = sc.nextInt(); k = sc.nextInt();   d = new boolean [n+1][m+1];   for(int i=0;i<=n;++i)   for(int j=0;j<=m;++j)   d[i][j]=false;     Queue< pair > q = new LinkedList< pair >();   lx = ly = -1;   for(int i=0;i<k;++i){   int x,y; x = sc.nextInt(); y = sc.nextInt();   q.add(new pair(x,y)); lx = x; ly = y;   d[x][y]=true;   }     int dx [] = {0,0,1,-1};   int dy [] = {-1,1,0,0};        while(!q.isEmpty()){    pair tp = q.remove();    int x = tp.x; int y = tp.y;    for(int i=0;i<4;++i){     int nx = x+dx[i]; int ny = y+dy[i];     if(nx<1 || nx>n || ny<1 || ny>m || d[nx][ny] ) continue;     d[nx][ny]=true;     q.add(new pair(nx,ny));     lx = nx; ly = ny;    }   }   FileWriter fw = new FileWriter("output.txt");   fw.write(lx.toString()); fw.write(" "); fw.write(ly.toString());;   fw.flush();    } } class pair {  public int x,y; public pair(int _x,int _y){ x = _x; y = _y; } }
5	public class Blah {  public static void main(String args[])  { Scanner c = new Scanner(System.in); String number = c.nextLine(); int i = Integer.parseInt(number); if (i == 1)  {  System.out.println("NO");  return;  } String line = c.nextLine(); String[] arr = line.split(" "); int[] array = new int[i]; for (int j = 0; j < i; j++)  {  array[j] = Integer.parseInt(arr[j]);  }   int min = array[0]; int second = 0; boolean thing = false; for (int j = 0; j < i; j++)  {  if (!thing && array[j] > min)   {  second = array[j];  thing = true;   }  if (array[j] < min)   {  second = min;  min = array[j];  thing = true;   }  else if (thing && array[j] > min && array[j] < second)   second = array[j];  } if (!thing)  System.out.println("NO"); else  System.out.println(second); return;    } }
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));   }  } }
0	public class Main {  final int INF = Integer.MAX_VALUE / 2;  private void doit(){   Scanner sc = new Scanner(System.in);      int n = sc.nextInt();    if(n == 0){     System.out.println("0 0 0");    }    else if(n == 1){     System.out.println("0 0 1");    }    else{         ArrayList<Integer> fibList = new ArrayList<Integer>();     int pre = 0;     int next = 1;     fibList.add(pre);     fibList.add(next);     while(next != n){      int temp = next;      next +=pre;      fibList.add(next);      pre = temp;     }     int len = fibList.size();     int a = fibList.get(len-4);     int b = fibList.get(len-3);     int c = fibList.get(len-3);     System.out.println(a + " " + b + " " + c);    }    }  public static void main(String[] args) {   Main obj = new Main();   obj.doit();  } }
4	public class Solution implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer("");  @Override public void run() {  try {  init();  } catch (FileNotFoundException e) {  e.printStackTrace();  }  long time = System.currentTimeMillis();  try {  solve();  } catch (Exception e) {  e.printStackTrace();  }  out.close();   }  private void init() throws FileNotFoundException {  String file = "123";  if (!file.equals("")) {  in = new BufferedReader(new FileReader("input.txt"));  out = new PrintWriter("output.txt");  } else {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  } }  public static void main(String[] args) {  new Thread(new Solution()).start(); }  private String readString() {  while (!tok.hasMoreTokens()) {  try {   tok = new StringTokenizer(in.readLine());  } catch (IOException e) {   e.printStackTrace();  }  }  return tok.nextToken(); }  private int readInt() {  return Integer.parseInt(readString()); }  int[] counts = new int[1000];  private long readLong() {  return Long.parseLong(readString()); }  private void solve() {  int n = readInt()+2;  int m = readInt()+2;  boolean[][] graph = new boolean[n][m];  for (int i = 0; i < n; i++) {  graph[i][m-1] = true;  graph[i][0] = true;  }  for (int i = 0; i < m; i++) {  graph[n-1][i] = true;  graph[0][i] = true;  }  int k = readInt();  int inFire = 0;  Queue<Point> q = new ArrayDeque<>();  for (int i = 0; i < k; i++) {  int x = readInt();  int y = readInt();  Point p = new Point(x, y);  graph[x][y] = true;  q.add(p);  }  while (!q.isEmpty()) {  Point current = q.poll();  inFire++;  if(!graph[current.x+1][current.y]) {   graph[current.x+1][current.y] = true;   q.add(new Point(current.x+1, current.y));  }  if(!graph[current.x-1][current.y]) {   graph[current.x-1][current.y] = true;   q.add(new Point(current.x-1, current.y));  }  if(!graph[current.x][current.y+1]) {   graph[current.x][current.y+1] = true;   q.add(new Point(current.x, current.y+1));  }  if(!graph[current.x][current.y-1]) {   graph[current.x][current.y-1] = true;   q.add(new Point(current.x, current.y-1));  }  if(q.isEmpty()) {   out.print(current.x+" "+current.y);   return;  }  }  }  class Point{  int x, y;  public Point(int x, int y) {  this.x = x;  this.y = y;  } } }
5	public class Main {  private static IO io;  public static void main(String[] args) throws IOException {   new Main().run();  }  private void run() throws IOException {   io = new IO(System.getProperty("ONLINE_JUDGE")!=null);   solve();   io.flush();  }   private void solve() throws IOException {   int n = io.nI(), a = io.nI(), b = io.nI(), h[] = new int[n], i;   for(i = 0; i<n; i++)h[i] = io.nI(); Arrays.sort(h);   io.wln(h[b]-h[b-1]);  }   private int gcd(int a, int b) {   while(b>0) b^=a^=b^=a%=b;   return a;  }   @SuppressWarnings("unused")  private class IO{   StreamTokenizer in; PrintWriter out; BufferedReader br; Reader reader; Writer writer;   public IO(boolean oj) throws IOException{    Locale.setDefault(Locale.US);    reader = oj ? new InputStreamReader(System.in) : new FileReader("input.txt");    writer = oj ? new OutputStreamWriter(System.out) : new FileWriter("output.txt");    br = new BufferedReader(reader);    in = new StreamTokenizer(br);    out = new PrintWriter(writer);   }   public void wln(){out.println();}   public void wln(int arg){out.println(arg);}   public void wln(long arg){out.println(arg);}   public void wln(double arg){out.println(arg);}   public void wln(String arg){out.println(arg);}   public void wln(boolean arg){out.println(arg);}   public void wln(char arg){out.println(arg);}   public void wln(float arg){out.println(arg);}   public void wln(Object arg){out.println(arg);}   public void w(int arg){out.print(arg);}   public void w(long arg){out.print(arg);}   public void w(double arg){out.print(arg);}   public void w(String arg){out.print(arg);}   public void w(boolean arg){out.print(arg);}   public void w(char arg){out.print(arg);}   public void w(float arg){out.print(arg);}   public void w(Object arg){out.print(arg);}   public void wf(String format, Object...args){out.printf(format, args);}   public void flush(){out.flush();}   public int nI() throws IOException {in.nextToken(); return(int)in.nval;}   public long nL() throws IOException {in.nextToken(); return(long)in.nval;}   public String nS() throws IOException {in.nextToken(); return in.sval;}   public double nD() throws IOException {in.nextToken(); return in.nval;}   public float nF() throws IOException {in.nextToken(); return (float)in.nval;}   public void wc(char...a){for(char c : a){in.ordinaryChar(c);in.wordChars(c, c);}}   public void wc(char c1, char c2){in.ordinaryChars(c1, c2); in.wordChars(c1, c2);}  } }
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;    }    public String toString() {     return from + " " + to + " " + 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 Main {  static PrintWriter out; static InputReader ir;  static void solve() {  int t = ir.nextInt();  while (t-- > 0) {  int n = ir.nextInt();  int m = ir.nextInt();  int[][] a = new int[n][];  for (int i = 0; i < n; i++) {   a[i] = ir.nextIntArray(m);  }  int[][][] comx = new int[n + 1][m][2];  for (int i = 0; i < m; i++) {   int[] b = new int[n];   for (int j = 0; j < n; j++) {   b[j] = a[j][i];   }   Arrays.sort(b);   for (int j = 0; j < n; j++) {   comx[j + 1][i][0] = comx[j][i][0] + b[n - 1 - j];   comx[j + 1][i][1] = i;   }  }  int[][][] org = new int[n + 1][m][2];  for (int i = 0; i <= n; i++)   for (int j = 0; j < m; j++) {   for (int k = 0; k < 2; k++) {    org[i][j][k] = comx[i][j][k];   }   }  for (int i = 1; i <= n; i++)   Arrays.sort(comx[i], new Comparator<int[]>() {   public int compare(int[] A, int[] B) {    return A[0] - B[0];   }   });      if (n == 1) {   out.println(comx[1][m - 1][0]);  } else if (n == 2) {   out.println(Math.max(comx[2][m - 1][0], m >= 2 ? comx[1][m - 1][0] + comx[1][m - 2][0] : 0));  } else if (n == 3) {   int res = Math.max(comx[3][m - 1][0],    m >= 3 ? comx[1][m - 1][0] + comx[1][m - 2][0] + comx[1][m - 3][0] : 0);   if (m >= 2) {   for (int i = 0; i < m; i++) {    int p = comx[2][i][0];    int ma = 0;    for (int j = 0; j < m; j++) {    if (comx[2][i][1] == j)     continue;    ma = Math.max(org[1][j][0], ma);    }    res = Math.max(res, p + ma);   }   }   out.println(res);  } else {   int res = Math.max(comx[4][m - 1][0],    m >= 4 ? comx[1][m - 1][0] + comx[1][m - 2][0] + comx[1][m - 3][0] + comx[1][m - 4][0] : 0);   if (m >= 2) {   for (int i = 0; i < m; i++) {    int p = comx[3][i][0];    int ma = 0;    for (int j = 0; j < m; j++) {    if (comx[3][i][1] == j)     continue;    ma = Math.max(org[1][j][0], ma);    }    res = Math.max(res, p + ma);   }   }   if (m >= 3) {   for (int i = 0; i < m; i++) {    int p = comx[2][i][0];    PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());    for (int j = 0; j < m; j++) {    if (comx[2][i][1] == j)     continue;    pq.add(org[1][j][0]);    }    res = Math.max(res, p + pq.poll() + pq.poll());   }   }   if (m >= 2) {   for (int i = 0; i < m; i++) {    int p = 0;    for (int j = 0; j < 4; j++) {    p = Math.max(p, a[j][i] + a[(j + 1) % 4][i]);    }    int ma = 0;    for (int j = 0; j < m; j++) {    if (i == j)     continue;    for (int k = 0; k < 4; k++) {     ma = Math.max(ma, a[k][j] + a[(k + 1) % 4][j]);    }    }    res = Math.max(res, p + ma);   }   for (int i = 0; i < m; i++) {    int p = 0;    for (int j = 0; j < 4; j++) {    p = Math.max(p, a[j][i] + a[(j + 2) % 4][i]);    }    int ma = 0;    for (int j = 0; j < m; j++) {    if (i == j)     continue;    for (int k = 0; k < 4; k++) {     ma = Math.max(ma, a[k][j] + a[(k + 2) % 4][j]);    }    }    res = Math.max(res, p + ma);   }   }   out.println(res);  }  }  }  public static void main(String[] args) {  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 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;  }  public long[] nextLongArray(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  public char[][] nextCharMap(int n, int m) {  char[][] map = new char[n][m];  for (int i = 0; i < n; i++)   map[i] = next().toCharArray();  return map;  } }  static void tr(Object... o) {  out.println(Arrays.deepToString(o)); } }
5	public class R015A {  final double EPS = 1e-9;   boolean isEqual(double x, double y) {   return Math.abs(x-y) <= EPS * Math.max(Math.abs(x), Math.abs(y));  }  class Pair implements Comparable<Pair>{   double left;   double right;   Pair(double left, double right) {    this.left = left;    this.right = right;   }   public String toString() {    return "(" + left + "," + right + ")";   }   public int hashCode() {    return (int)(left * 17 + right * 31);   }   public boolean equals(Object o) {    if(!(o instanceof Pair)) return false;    Pair that = (Pair)o;    return isEqual(this.left, that.left) && isEqual(this.right, that.right);   }   public int compareTo(Pair that) {    if(this.left != that.left)     return (int)(this.left - that.left);    return (int)(this.right - that.right);   }  }  public R015A() {  }   private void process() {   Scanner scanner = new Scanner(System.in);   int n = scanner.nextInt();   int t = scanner.nextInt();   int[] x = new int[n];   int[] a = new int[n];   for(int i=0; i<n; i++) {    x[i] = scanner.nextInt();    a[i] = scanner.nextInt();   }   List<Pair> pairs = new ArrayList<Pair>();   for(int i=0; i<n; i++) {    double left = x[i] - a[i] / 2.0;    double right= x[i] + a[i] / 2.0;    pairs.add(new Pair(left, right));   }   Collections.sort(pairs);   Set<Pair> newPairs = new HashSet<Pair>();   newPairs.add(new Pair(pairs.get(0).left - t, pairs.get(0).left));   for(int i=0; i<pairs.size()-1; i++) {    if(pairs.get(i+1).left - pairs.get(i).right >= t) {     newPairs.add(new Pair(pairs.get(i).right, pairs.get(i).right + t));     newPairs.add(new Pair(pairs.get(i+1).left - t, pairs.get(i+1).left));    }   }   newPairs.add(new Pair(pairs.get(pairs.size()-1).right, pairs.get(pairs.size()-1).right + t));   System.out.println(newPairs.size());  }   public static void main(String[] args) {   new R015A().process();  } }
1	public class ProblemC {  public static void main(String[] args) throws IOException {  init();  new ProblemC().run();  out.flush();  out.close(); }  static void init() throws IOException {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(new OutputStreamWriter(System.out));  in.ordinaryChars(0, 65535);  in.wordChars(0, 65535);  in.whitespaceChars(' ', ' ');  in.whitespaceChars('\n', '\n');  in.whitespaceChars('\r', '\r'); }   class Pair<L, R> {  private final L X;  private final R Y;   public Pair(L X, R Y) {  this.X = X;  this.Y = Y;  }   public L getX() {  return X;  }   public R getY() {  return Y;  }   @Override  public int hashCode() {  return X.hashCode() ^ Y.hashCode();  }   @Override  public boolean equals(Object o) {  if (!(o instanceof Pair)) return false;  Pair pairo = (Pair) o;  return X.equals(pairo.getX()) && Y.equals(pairo.getY());  } }  static final long INFL = 200000000000000000L; static final int INF = 2000000000; static final boolean DEBUG = true;  static StreamTokenizer in; static PrintWriter out;  static void print(String s) {  print(s, 0); }  static void print(String s, int debug) {  if (debug == 0 || DEBUG) {  out.print(s);  } }  static void println(String s) {  println(s, 0); }  static void println(String s, int debug) {  if (debug == 0 || DEBUG) {  out.println(s);  } }  static void printArray(int[] arr) {  println(Arrays.toString(arr)); }  static void printArray(char[] arr) {  println(Arrays.toString(arr)); }  static void printArray(String[] arr) {  println(Arrays.toString(arr)); }  static void sort(int[] a) {  Random rnd = new Random();  for (int i = a.length - 1; i > 0; i--) {  int index = rnd.nextInt(i);  a[i] ^= a[index];  a[index] ^= a[i];  a[i] ^= a[index];  }  Arrays.sort(a); }  static char[] inChars; static int inCharsInd;  static String next() throws IOException {  in.nextToken();  return in.sval; }  static char nextChar() throws IOException {  while (inChars == null || inCharsInd >= inChars.length) {  inChars = next().toCharArray();  inCharsInd = 0;  }  return inChars[inCharsInd++]; }  static int nextInt() throws IOException {  return Integer.valueOf(next()); }  static double nextDouble() throws IOException {  return Double.valueOf(next()); }  static long nextLong() throws IOException {  return Long.valueOf(next()); }  private void run() throws IOException {  solve(); }  int K, L, M, N, P;  private void solve() throws IOException {  int[] countChars = new int['z' + 1];  boolean[] gotIt = new boolean['z' + 1];  int N = nextInt();  int fullCount = 0;  char[] chars = next().toCharArray();  for (int i = 0; i < N; i++) {  if (countChars[chars[i]] == 0) fullCount++;  countChars[chars[i]]++;  }    countChars = new int['z' + 1];  int answer = N;  int start = 0, finish = 0;  countChars[chars[start]]++;  fullCount--;   while (finish+1 < N){  finish++;  if (countChars[chars[finish]] == 0) {   fullCount--;  }  countChars[chars[finish]]++;  while (countChars[chars[start]] > 1){   countChars[chars[start]]--;   start++;  }  while (fullCount == 0){    answer = Math.min(answer, finish-start+1);   countChars[chars[start]]--;   if (countChars[chars[start]] == 0) fullCount++;   start++;  }  }   out.println(answer); }  }
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());   }  } }
0	public class Main { final int INF = 1000000000; final int MAXN = 100100;   Scanner input = new Scanner(System.in); BufferedReader inp = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {  new Main().run(); }  double a, v; double l, d, w;  void run() throws IOException {  a = input.nextDouble();  v = input.nextDouble();  l = input.nextDouble();  d = input.nextDouble();  w = input.nextDouble();  if (v <= w) {  out.println(timeTravel(l, 0));  } else {  double tw = w / a;  double dw = dist(tw, 0);  if (dw >= d) {   out.println(timeTravel(l, 0));  } else {   double tSym = timeTravel((d - dw) / 2, w);   out.println(tw + 2 * tSym + timeTravel(l - d, w));  }  }  out.close(); }   double dist(double time, double speed) {  return speed * time + a * time * time / 2;  }  double timeTravel(double distance, double speed) {  double delta = speed * speed + 2 * a * distance;  double tAll = (Math.sqrt(delta) - speed) / a;  double tMax = (v - speed) / a;  if (tMax >= tAll) {  return tAll;  } else {  return tMax + (distance - dist(tMax, speed)) / v;  } } }
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  {   final private 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 char nextChar() throws Exception   {    byte c=read();    while(c<=' ') c= read();    return (char)c;   }   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++];   }  }
5	public class R113_D2_A {  public static void main(String[] args) throws NumberFormatException,    IOException {        InputReader4 in = new InputReader4(System.in);   int n = in.readInt();   int k = in.readInt();   p[] inp = new p[n];   for (int i = 0; i < inp.length; i++) {    inp[i] = new p(in.readInt(), in.readInt());   }   Arrays.sort(inp);   for (int i = 0; i < inp.length;) {    int j = i + 1;    while (j < inp.length && inp[i].x == inp[j].x      && inp[i].y == inp[j].y) {     j++;    }    int num = j - i;    if (k <= num) {     System.out.println(num);     return;    } else     k -= num;    i = j;   }  }  static class p implements Comparable<p> {   int x;   int y;   public p(int a, int b) {    x = a;    y = b;   }   public int compareTo(p o) {    if (x > o.x)     return -1;    if (x < o.x)     return 1;    return y - o.y;   }  }  static class InputReader4 {   private InputStream stream;   private byte[] buf = new byte[1000];   private int curChar, numChars;   public InputReader4(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;   }   public long readLong() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public String readString() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuffer res = new StringBuffer();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   private String readLine0() {    StringBuffer buf = new StringBuffer();    int c = read();    while (c != '\n' && c != -1) {     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 char readCharacter() {    int c = read();    while (isSpaceChar(c))     c = read();    return (char) c;   }   public double readDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, readInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, readInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }  } }
3	public class Codeforces911D { public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String[] sp = br.readLine().split(" ");  int n = Integer.parseInt(sp[0]);  int[] a = new int[n];  sp = br.readLine().split(" ");  for (int i = 0; i < n; i++) {  a[i] = Integer.parseInt(sp[i]);  }  int inversions = 0;  for (int i = 0; i < n-1; i++) {  for (int j = i+1; j < n; j++) {   if (a[i] > a[j]) {   inversions++;   }  }  }  inversions = inversions%2;   sp = br.readLine().split(" ");  int m = Integer.parseInt(sp[0]);  for (int i = 0; i < m; i++) {  sp = br.readLine().split(" ");  int l = Integer.parseInt(sp[0]);  int r = Integer.parseInt(sp[1]);  if ((r-l+1)%4 == 2 || (r-l+1)%4 == 3) {   inversions = 1-inversions;  }  if (inversions == 1) {   System.out.println("odd");  }  else {   System.out.println("even");  }  } } }
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());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  String nextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return st.nextToken();  } }
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 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;  } } 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)); } }
1	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() {  public void run() {   try {   new Main().run();   } catch (IOException e) {   }  }  }.start(); }  BufferedReader in; PrintWriter out; StringTokenizer st = new StringTokenizer("");  int MAXDEG = 5;  private void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  int n = nextInt();  int[] sumDegs = new int[MAXDEG + 1];  sumDegs[0] = 1;  int deg = 1;  for (int i = 1; i <= MAXDEG; i++) {  deg *= 26;  sumDegs[i] = sumDegs[i - 1] + deg;  }  for (int i = 0; i < n; i++) {  String s = nextLine();  String pref = "";  int endPos = -1;  for (int j = 0; j < s.length(); j++) {   if (!isLet(s.charAt(j))) {   endPos = j;   break;   }   pref += s.charAt(j);  }  int num = -1;  try {   num = Integer.parseInt(s.substring(endPos));  } catch (Exception e) {  }  if (num != -1) {   int col = sumDegs[pref.length() - 1];   int val = 0;   for (int j = 0; j < pref.length(); j++) {   val = val * 26 + (pref.charAt(j) - 'A');   }   col += val;   out.println("R" + num + "C" + col);  } else {   int row = Integer.parseInt(s.substring(1, s.indexOf('C')));   int col = Integer.parseInt(s.substring(s.indexOf('C') + 1));   int len = MAXDEG;   while (col < sumDegs[len])   len--;   len++;   col -= sumDegs[len - 1];   String res = "";   while (col > 0) {   res = (char) (col % 26 + 'A') + res;   col /= 26;   }   while (res.length() < len)   res = "A" + res;   out.println(res + row);  }  }  in.close();  out.close(); }  private boolean isLet(char c) {  return c >= 'A' && c <= 'Z'; }  void chk(boolean b) {  if (b)  return;  System.out.println(new Error().getStackTrace()[1]);  exit(999); } void deb(String fmt, Object... args) {  System.out.printf(Locale.US, fmt + "%n", args); } 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()); } String nextLine() throws IOException {  st = new StringTokenizer("");  return in.readLine(); } boolean EOF() throws IOException {  while (!st.hasMoreTokens()) {  String s = in.readLine();  if (s == null)   return true;  st = new StringTokenizer(s);  }  return false; } }
1	public class ErrorCorrectSystem {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  String a = scan.next();  String b = scan.next();   int[][] mismatch = new int[26][26];  for(int i = 0; i < 26; i++) Arrays.fill(mismatch[i], -1);  int[][] pair = new int[2][26];  for(int i = 0; i < 2; i++) Arrays.fill(pair[i], -1);  int hd = 0;  for(int i = 0; i < n; i++) {  if(a.charAt(i) != b.charAt(i)) {   hd++;   mismatch[a.charAt(i)-'a'][b.charAt(i)-'a'] = i;   pair[0][a.charAt(i)-'a'] = i;   pair[1][b.charAt(i)-'a'] = i;  }  }  for(int i = 0; i < 26; i++) {  for(int j = i+1; j < 26; j++) {   if(mismatch[i][j] > -1 && mismatch[j][i] > -1) {   System.out.println(hd-2);   System.out.println((mismatch[i][j]+1)+" "+(mismatch[j][i]+1));   return;   }  }  }  for(int i = 0; i < n; i++) {  if(a.charAt(i) != b.charAt(i)) {     if(pair[0][b.charAt(i)-'a'] > -1) {   System.out.println(hd-1);   System.out.println((i+1)+" "+(pair[0][b.charAt(i)-'a']+1));   return;   }  }  }   System.out.println(hd);  System.out.println("-1 -1"); } }
4	public class Codeforces {  public static void main(String args[])throws Exception  {   BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));   StringBuilder sb=new StringBuilder();   String s[]=bu.readLine().split(" ");   int n=Integer.parseInt(s[0]),m=Integer.parseInt(s[1]),k=Integer.parseInt(s[2]);   int i,j,max=n*m,in[][]=new int[n][m],x=0;   if(k%2==1)   {    for(i=0;i<n;i++)    {     for(j=0;j<m;j++) sb.append("-1 ");     sb.append("\n");    }    System.out.print(sb);    return;   }   for(i=0;i<n;i++)   for(j=0;j<m;j++) in[i][j]=x++;   ArrayList<Edge> g[]=new ArrayList[max];   for(i=0;i<max;i++) g[i]=new ArrayList<>();   for(i=0;i<n;i++)   {    s=bu.readLine().split(" ");    for(j=0;j<m-1;j++)    {     int u=in[i][j],v=in[i][j+1],w=Integer.parseInt(s[j]);     g[u].add(new Edge(v,w));     g[v].add(new Edge(u,w));    }   }   for(i=0;i<n-1;i++)   {    s=bu.readLine().split(" ");    for(j=0;j<m;j++)    {     int u=in[i][j],v=in[i+1][j],w=Integer.parseInt(s[j]);     g[u].add(new Edge(v,w));     g[v].add(new Edge(u,w));    }   }   k/=2;   int dp[][]=new int[k][max];   for(i=0;i<max;i++)   {    dp[0][i]=Integer.MAX_VALUE;    for(Edge e:g[i])    dp[0][i]=Math.min(dp[0][i],2*e.w);   }   for(i=1;i<k;i++)   for(j=0;j<max;j++)   {    dp[i][j]=Integer.MAX_VALUE;    for(Edge e:g[j])    dp[i][j]=Math.min(dp[i][j],dp[i-1][e.v]+2*e.w);   }   for(i=0;i<n;i++)   {    for(j=0;j<m;j++)    sb.append(dp[k-1][in[i][j]]+" ");    sb.append("\n");   }   System.out.print(sb);  }  static class Edge  {   int v,w,d;   Edge(int a,int b)   {    v=a;    w=b;    d=0;   }  } }
5	public class Main {  static Long[] a = new Long[205000];  static Long[] postfix=new Long[205000];  static HashMap<Long,Long> check=new HashMap<Long,Long>();  public static void main(String args[]) {   Scanner cin = new Scanner(System.in);   long k, j, p,sum,equal,bigone,lessone,cnt;   BigInteger ans;   int i,n;   while (cin.hasNext()) {    n=cin.nextInt();    check.clear();    for(i=1;i<=n;i++)    {     a[i]=cin.nextLong();    }    postfix[n+1]=0L;    for(i=n;i>=1;i--) {     postfix[i] = postfix[i + 1] + a[i];     if (check.containsKey(a[i]) == true) {      Long v = check.get(a[i]);      v += 1;      check.put(a[i], v);     }     else      check.put(a[i],1L);    }    ans=BigInteger.ZERO;    for(i=1;i<n;i++){     Long v=check.get(a[i]);     v--;     check.put(a[i],v);     equal=check.get(a[i]);     bigone=0L;     lessone=0L;     if(check.containsKey(a[i]+1L)==true)     bigone=check.get(a[i]+1L);     if(check.containsKey(a[i]-1L)==true)     lessone=check.get(a[i]-1L);     sum=postfix[i]-bigone*(a[i]+1L)-lessone*(a[i]-1L)-equal*a[i]-a[i];     cnt=n-i-bigone-lessone-equal;     ans=ans.add(BigInteger.valueOf(a[i]*cnt).subtract(BigInteger.valueOf(sum)));    }    System.out.println(ans.multiply(BigInteger.valueOf(-1)));   }  } }
4	public class Main {  public static void main(String[] args) throws IOException {        InputReader in = new InputReader(new FileReader(new File("input.txt")));   PrintWriter out = new PrintWriter(new FileWriter(new File("output.txt")));        Solution s = new Solution();   s.solve(1, in, out);   out.close();  }  static class Solution {      double EPS = 0.0000001;   public void solve(int cs, InputReader in, PrintWriter out) {    int n = in.nextInt(), m = in.nextInt();    Graph g = new Graph(n, m);    int k = in.nextInt();    for (int[] v : g.vis)     Arrays.fill(v, -1);    while (k-- > 0) {     Pair start = new Pair(in.nextInt()-1, in.nextInt()-1);     g.bfs(start);    }    int idx1 = 0, idx2 = 0, max = 0;    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; ++j) {      if (g.vis[i][j] > max) {       idx1 = i;       idx2 = j;       max = g.vis[i][j];      }     }    }    out.println((idx1+1) + " " + (idx2+1));   }   static class Pair {    int x, y;    public Pair(int x, int y) {     this.x = x ;     this.y = y;    }   }   static class Graph {    LinkedList<Integer> adj[];    int n, e;    int[][] vis;    @SuppressWarnings("unchecked")    public Graph(int n, int e) {     this.n = n;     this.e = e;     adj = new LinkedList[n];     for (int i = 0; i < n; ++i)      adj[i] = new LinkedList<>();     vis = new int[n][e];    }       int[] dx = {0, 0, 1, -1};    int[] dy = {1, -1, 0, 0};    void bfs(Pair src) {     Queue<Pair> q = new LinkedList<>();     vis[src.x][src.y] = 0;     q.add(src);     while (!q.isEmpty()) {      Pair p = q.poll();      for (int k = 0; k < 4; k++) {       int ni = p.x+dx[k];       int nj = p.y+dy[k];       if (isValid(ni, nj) && (vis[ni][nj] == -1 || vis[p.x][p.y]+1 < vis[ni][nj])) {        vis[ni][nj] = vis[p.x][p.y]+1;        q.add(new Pair(ni, nj));       }      }          }    }    boolean isValid(int i, int j) {     return i >= 0 && i < n && j >= 0 && j < e;    }   }  }  static class InputReader {   BufferedReader br;   StringTokenizer st;     public InputReader(InputStream i) {    br = new BufferedReader(new InputStreamReader(i), 32768);    st = null;   }   public InputReader(FileReader s) {    br = new BufferedReader(s);    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());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    try {     return br.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }  }  static class Reader {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;   public Reader(){    din=new DataInputStream(System.in);    buffer=new byte[BUFFER_SIZE];    bufferPointer=bytesRead=0;   }   public Reader(String file_name) throws IOException{    din=new DataInputStream(new FileInputStream(file_name));    buffer=new byte[BUFFER_SIZE];    bufferPointer=bytesRead=0;   }   public String readLine() throws IOException{    byte[] buf=new byte[64];    int cnt=0,c;    while((c=read())!=-1){     if(c=='\n')break;     buf[cnt++]=(byte)c;    }    return new String(buf,0,cnt);   }   public int nextInt() throws IOException{    int ret=0;byte c=read();    while(c<=' ')c=read();    boolean neg=(c=='-');    if(neg)c=read();    do{ret=ret*10+c-'0';}while((c=read())>='0'&&c<='9');    if(neg)return -ret;    return ret;   }   public long nextLong() throws IOException{    long ret=0;byte c=read();    while(c<=' ')c=read();    boolean neg=(c=='-');    if(neg)c=read();    do{ret=ret*10+c-'0';}while((c=read())>='0'&&c<='9');    if(neg)return -ret;    return ret;   }   public double nextDouble() throws IOException{    double ret=0,div=1;byte c=read();    while(c<=' ')c=read();    boolean neg=(c=='-');    if(neg)c = read();    do {ret=ret*10+c-'0';}while((c=read())>='0'&&c<='9');    if(c=='.')while((c=read())>='0'&&c<='9')     ret+=(c-'0')/(div*=10);    if(neg)return -ret;    return ret;   }   private void fillBuffer() throws IOException{    bytesRead=din.read(buffer,bufferPointer=0,BUFFER_SIZE);    if(bytesRead==-1)buffer[0]=-1;   }   private byte read() throws IOException{    if(bufferPointer==bytesRead)fillBuffer();    return buffer[bufferPointer++];   }   public void close() throws IOException{    if(din==null) return;    din.close();   }  } }
0	public class CodeForcesW8P2 {  public static void main(String [] args){   Scanner sc = new Scanner(System.in);   int tests = Integer.valueOf(sc.nextLine());    while(tests > 0){    int count = 0;    String [] input = sc.nextLine().split(" ");    int x = Integer.valueOf(input[0]);    int y = Integer.valueOf(input[1]);     if (x == y){     count += 1;    }    else {     if (x > y){      int temp = x;      x = y;      y = temp;     }         while (x != 1 && x != 0 && y != 1){      count += (y / x);      int temp = x;      x = (y % x);      y = temp;     }     if (x != 0)      count += y;     }     System.out.println(count);    tests --;   }  } }
6	public class G1 {  static final int mod = (int) (1e9 + 7);  static final int UNCALC = -1;  static int[][][] memo;  static int n, t[], genre[];  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   n = sc.nextInt();   t = new int[n];   int T = sc.nextInt();   genre = new int[n];   for (int i = 0; i < n; i++) {    t[i] = sc.nextInt();    genre[i] = sc.nextInt();   }   memo = new int[4][1 << n][T+1];   for (int[][] a : memo)    for (int[] b : a)     Arrays.fill(b, UNCALC);   out.println(dp(0, 0, T));   out.flush();   out.close();  }  static int dp(int last, int mask, int rem) {   if (rem==0) return 1;   if (memo[last][mask][rem] != UNCALC) return memo[last][mask][rem];   int cnt = 0;   for (int i = 0; i < n; i++) {    if (genre[i] == last || t[i] > rem || (mask & 1 << i) != 0) continue;    cnt = (cnt + dp(genre[i], mask | 1 << i, rem - t[i]))%mod;   }   return memo[last][mask][rem] = 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 String nextLine() throws IOException {    return br.readLine();   }   public int nextInt() throws IOException {    return Integer.parseInt(next());   }   public double nextDouble() throws IOException {    return Double.parseDouble(next());   }   public char nextChar() throws IOException {    return next().charAt(0);   }   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;   }   public long[] nextLongArray(int n) throws IOException {    long[] a = new long[n];    for (int i = 0; i < n; i++)     a[i] = nextLong();    return a;   }    public Integer[] nextIntegerArray(int n) throws IOException {    Integer[] a = new Integer[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }   public double[] nextDoubleArray(int n) throws IOException {    double[] ans = new double[n];    for (int i = 0; i < n; i++)     ans[i] = nextDouble();    return ans;   }   public short nextShort() throws IOException {    return Short.parseShort(next());   }  } }
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 test {  static boolean DEBUG_FLAG = false;  int INF = (int)1e9;  long MOD = 1000000007;   static void debug(String s) {   if(DEBUG_FLAG) {    System.out.print(s);   }  }   long pow(long a, long n, long mod) {   if (n == 0) {    return 1;   }   long rs = 1;   while (n != 0) {    if (n % 2 == 1) {     rs *= a;    }    rs %= mod;    n >>= 1;    a *= a;    a %= mod;   }   return rs;  }   void solve(InputReader in, PrintWriter out) throws IOException {   long x = in.nextLong();   long k = in.nextLong();   if(x==0) {    out.println(0);    return;   }   long a = (2 * x - 1) % MOD;   long b = pow(2, k, MOD);   a = (a * b) % MOD;   a += 1;   a %= MOD;   out.println(a);  }     public static void main(String[] args) throws IOException {   if(args.length>0 && args[0].equalsIgnoreCase("d")) {    DEBUG_FLAG = true;   }   InputReader in = new InputReader();   PrintWriter out = new PrintWriter(System.out);   int t = 1;   long start = System.nanoTime();   while(t-- >0) {    new test().solve(in, out);   }   long end = System.nanoTime();   debug("\nTime: " + (end-start)/1e6 + " \n\n");   out.close();  }   static class InputReader {   static BufferedReader br;   static StringTokenizer st;    public InputReader() {    br = new BufferedReader(new InputStreamReader(System.in));   }     String next() {    while (st == null || !st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }     int nextInt() {    return Integer.parseInt(next());   }     long nextLong() {    return Long.parseLong(next());   }     double nextDouble() {    return Double.parseDouble(next());   }  } }
6	public class Main { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  while ( sc.hasNextInt() ) {  int n = sc.nextInt();  long m = sc.nextInt();  boolean edge[][] = new boolean[n][n];  long dp[][] = new long[1<<n][n];  for ( long i = 1 ; i<=m ; ++i ) {   int u = sc.nextInt();    int v = sc.nextInt();   -- u;   -- v;   edge[u][v] = edge[v][u] = true;  }  for ( int i = 0 ; i<n ; ++i ) {   dp[1<<i][i] = 1;  }  long res = 0;  for ( int i = 1 ; i<(1<<n) ; ++i ) {   int first = cal(i);   for ( int j = 0 ; j<n ; ++j ) {   if ( dp[i][j]==0 ) {    continue;   }   for ( int k = first ; k<n ; ++k ) {    if ( j==k || !edge[j][k] ) {    continue;    }    if ( k==first && (i&(1<<k))!=0 ) {    res += dp[i][j];    }    if ( (i&(1<<k))==0 ) {    dp[i|(1<<k)][k] += dp[i][j];    }   }   }  }  res -= m;  System.out.println(res/2);   } } public static int cal( int x ) {  int ord = 0;  while ( true ) {  if ( (x&(1<<ord))!=0 ) {   break;  }  ++ ord;  }  return ord; } public static boolean judge( int x ) {  int cnt = 0;  while ( x>=1 ) {  if ( (x&1)==1 ) {   ++ cnt;  }  x >>= 1;  }  return cnt >= 3; } }
5	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ReaderFastIO in = new ReaderFastIO(inputStream);   PrintWriter out = new PrintWriter(outputStream);   DConcatenatedMultiples solver = new DConcatenatedMultiples();   solver.solve(1, in, out);   out.close();  }  static class DConcatenatedMultiples {   public void solve(int testNumber, ReaderFastIO in, PrintWriter out) {    Map<Integer, Integer>[] mapMods = new HashMap[11];    int n = in.nextInt();    int k = in.nextInt();    int[] a = in.readArrayInt(n);    for (int i = 0; i < 11; i++) {     mapMods[i] = new HashMap<>();    }    for (int i = 0; i < n; i++) {     int pot = getPot(a[i]);     mapMods[pot].put(a[i] % k, mapMods[pot].getOrDefault(a[i] % k, 0) + 1);    }    long ct = 0;    for (int i = 0; i < n; i++) {     int ownPot = getPot(a[i]);     long suffix = a[i] * 10L;     for (int j = 1; j <= 10; j++) {      int mod = (int) (suffix % k);      int comMod = (k - mod) % k;      int qt = mapMods[j].getOrDefault(comMod, 0);      if (j == ownPot && (a[i] % k) == comMod) {       qt--;      }      ct += qt;      suffix = (suffix * 10L) % k;     }    }    out.println(ct);   }   public int getPot(int x) {    int ct = 0;    while (x != 0) {     x /= 10;     ct++;    }    return ct;   }  }  static class ReaderFastIO {   BufferedReader br;   StringTokenizer st;   public ReaderFastIO() {    br = new BufferedReader(new InputStreamReader(System.in));   }   public ReaderFastIO(InputStream input) {    br = new BufferedReader(new InputStreamReader(input));   }   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 int[] readArrayInt(int n) {    int[] array = new int[n];    for (int i = 0; i < n; i++) {     array[i] = nextInt();    }    return array;   }  } }
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); } }
3	public class SameSumBlocks {  public static void main(String[] args) {   BufferedReader input = new BufferedReader(new InputStreamReader(System.in));   String[] numbersAsString = input.lines()           .skip(1)           .findFirst()           .get()           .split(" ");   int[] numbers = Arrays.stream(numbersAsString).mapToInt(Integer::parseInt).toArray();   List<PairOfInt> sameSumBlocks = findSameSumBlocks(numbers);   System.out.println(sameSumBlocks.size());   sameSumBlocks.forEach(System.out::println);  }  static List<PairOfInt> findSameSumBlocks(int[] numbers) {   List<List<PairOfInt>> potentials = buildPotentialsSum(numbers);   List<List<PairOfInt>> sortedPairList = potentials.stream()               .filter(p -> p.size() > 0)               .sorted((l1, l2) -> compare(l2.size(), l1.size()))               .collect(Collectors.toList());   List<PairOfInt> max = new ArrayList<>();   max.add(PairOfInt.of(1, 1));   for (int i = 0; i < sortedPairList.size(); i++) {    List<PairOfInt> result = sortedPairList.get(i);    result.sort(comparingInt(p -> p.b));    List<PairOfInt> maxDisjoint = maxDisjointPair(result);    if (maxDisjoint.size() > max.size()) {     max = maxDisjoint;     if (i + 1 < sortedPairList.size() && maxDisjoint.size() >= sortedPairList.get(i + 1).size()) {      return maxDisjoint;     }    }   }   return max;  }  public static List<PairOfInt> maxDisjointPair(List<PairOfInt> result) {   if (result.size() == 0)    return result;   boolean over = false;   while (!over) {    int i;    for (i = 1; i < result.size(); i++) {     if (result.get(i).a <= result.get(i - 1).b) {      result.remove(result.get(i));      break;     }    }    if (i == result.size()) {     over = true;    }   }   return result;  }  private static List<List<PairOfInt>> buildPotentialsSum(int[] numbers) {   Map<Integer, List<PairOfInt>> result = new HashMap<>();   for (int i = 0; i < numbers.length; i++) {    int blockSum = 0;    for (int j = i; j < numbers.length; j++) {     blockSum += numbers[j];     final int tmpi = i, tmpj = j;     result.compute(blockSum, (k, l) -> {      if (l == null) {       l = new ArrayList<>();      }      l.add(PairOfInt.of(tmpi + 1, tmpj + 1));      return l;     });     if(blockSum == 0) {      break;     }    }   }   return new ArrayList<>(result.values());  }  public static class PairOfInt {   final int a, b;   public static PairOfInt of(int a, int b) {    return new PairOfInt(a, b);   }   private PairOfInt(int a, int b) {    this.a = a;    this.b = b;   }   @Override   public String toString() {    return a + " " + b;   }   @Override   public boolean equals(Object o) {    if (this == o) return true;    if (o == null || getClass() != o.getClass()) return false;    PairOfInt pairOfInt = (PairOfInt) o;    return a == pairOfInt.a &&      b == pairOfInt.b;   }   @Override   public int hashCode() {    return Objects.hash(a, b);   }  } }
1	public class tr { static int[][] ad;  static boolean []vis;  static int []goods;  static int[][]sol; 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 []a=new int [n];  int max=0;  for(int i=0;i<n;i++)  a[i]=sc.nextInt();  Stack<Integer> s=new Stack<>();  boolean f=true;   for(int i=0;i<n;i++) {   max=Math.max(max,a[i]);   if(!s.isEmpty() && a[i]>s.peek())    f=false;   s.push(a[i]);   while(!s.isEmpty()) {    int high=s.pop();    if(s.isEmpty() || s.peek()!=high) {    s.push(high);    break;    }    s.pop();   }     }     if(f && s.size()==0)   out.println("YES");   else if(f && s.size()==1 && s.peek()==max)   out.println("YES");   else   out.println("NO");  out.flush(); } static int gcd(int a, int b) {  if (b == 0) {  return a;  }  return gcd(b, a % b); }  static class pair implements Comparable<pair> {  int a;  int b;  pair(int a, int b) {  this.a = a;  this.b = b;  }  public String toString() {  return a + " " + b;  }  @Override  public int compareTo(pair o) {  return o.a-a ;  } }  static class Scanner {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream system) {  br = new BufferedReader(new InputStreamReader(system));  }  public Scanner(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 String nextLine() throws IOException {  return br.readLine();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public char nextChar() throws IOException {  return next().charAt(0);  }  public Long nextLong() throws IOException {  return Long.parseLong(next());  }  public boolean ready() throws IOException {  return br.ready();  }  public void waitForInput() throws InterruptedException {  Thread.sleep(3000);  } } }
0	public class Main {  public static class pair implements Comparable<pair> {  int a;  int b;  public pair(int pa, int pb)  {  a = pa; b= pb;  }  @Override  public int compareTo(pair o) {  if(this.a < o.a)   return -1;  if(this.a > o.a)   return 1;  return Integer.compare(o.b, this.b);  } }       public static void main (String[] args) throws Exception {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  String[] spl = in.readLine().split(" ");  long l = Long.parseLong(spl[0]);  long r = Long.parseLong(spl[1]);  if(l+2 <= r && l%2==0)  {  System.out.println(l+" "+(l+1)+" "+(l+2));  }  else if(l+3<=r && (l+1)%2==0)  {  System.out.println((l+1)+" "+(l+2)+" "+(l+3));  }  else System.out.println(-1); } }
3	public class Main {  static int inf = (int) 1e9 + 7;  public static void main(String[] args) throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));   pw = new PrintWriter(System.out);   int n = nextInt();   int a[] = new int [n];   for(int i = 0;i < n;i++) a[i] = nextInt();   int ans = 0;   boolean b[] = new boolean[n];   Arrays.sort(a);   for(int i = 0;i < n;i++) {    if (!b[i]) {     for(int j = i;j < n;j++) {      if (a[j] % a[i] == 0) b[j] = true;     }     ans++;    }   }   pw.println(ans);   pw.close();  }  static BufferedReader br;  static StringTokenizer st = new StringTokenizer("");  static PrintWriter pw;  static String next() throws IOException {   while (!st.hasMoreTokens()) st = new StringTokenizer(br.readLine());   return st.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt(next());  }  static long nextLong() throws IOException {   return Long.parseLong(next());  } }
6	public class G_PlaylistForPolycarp {  static final int mod = 1000000007;  static int dp[][];  public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));  String[] dat = br.readLine().split(" ");  int n = Integer.parseInt(dat[0]);  int T = Integer.parseInt(dat[1]);  int[] st = new int[n];  byte[] sg = new byte[n];  dp = new int[1 << (n + 1)][4];  for (int j = 0; j < 1 << (n + 1); j++) {  for (int k = 0; k < 4; k++) {   dp[j][k] = -1;  }  }  for (int i = 0; i < n; i++) {  dat = br.readLine().split(" ");  st[i] = Integer.parseInt(dat[0]);  sg[i] = Byte.parseByte(dat[1]);  }  short visited = 0;  int count = recur(0, visited, st, sg, T, 0);  bw.write(count + "\n");  bw.close();  }  private static int recur(int time, short visited, int[] st, byte[] sg, int T, int last) {  int count = 0;  if (dp[visited][last] != -1) {  return dp[visited][last];  }  for (int i = 0; i < st.length; i++) {   if ((visited & (1 << i)) == 0 && sg[i] != last) {   if (time + st[i] == T) {   count += 1;   } else if (time + st[i] < T) {   short visitedc = (short) (visited | (1 << i));   count += recur(time + st[i], visitedc, st, sg, T, sg[i]);   if (count > mod) {    count = count % mod;   }   }   }  }  return dp[visited][last] = count % mod; } }
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();   }  }  static class IOUtils {   public static void readIntArrays(InputReader in, int[]... arrays) {    for(int i = 0; i < arrays[0].length; i++) {     for(int j = 0; j < arrays.length; j++)      arrays[j][i] = in.readInt();    }   }  } }
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]+" ");  } } }
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[center][center]) ? 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 int fordFulkerson(int[][] graph, int s, int t) {  int V = graph.length;  int[][] resid = new int[V][V];  int[] parent = new int[V];  int maxFlow = 0;    for (int u = 0; u < V; u++) {   for (int v = 0; v < V; v++) {   resid[u][v] = graph[u][v];   }  }    while (fordFulkersonHelper(resid, s, t, parent)) {   int pathFlow = Integer.MAX_VALUE;   for (int v = t; v != s; v = parent[v]) {   int u = parent[v];   pathFlow = Math.min(pathFlow, resid[u][v]);   }   for (int v = t; v != s; v = parent[v]) {   int u = parent[v];   resid[u][v] -= pathFlow;   resid[v][u] += pathFlow;   }   maxFlow += pathFlow;  }    return maxFlow;  }     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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   String nextLine() {    String str = "";    try { str = br.readLine(); }    catch (IOException e) { e.printStackTrace(); }    return str;   }  } }
5	public class Village { static Scanner in = new Scanner( new BufferedReader( new InputStreamReader( System.in ) ) );  public static void main( String[] args ) {  int n = in.nextInt(), t = 2*in.nextInt(), h[][] = new int[n][2], ans = 2;  for( int i = 0; i < n; i++ )  {  h[i][0] = 2*in.nextInt();  h[i][1] = in.nextInt();  }  Arrays.sort( h, new Comp() );  for( int i = 1; i < n; i++ )  {  int d = (h[i][0]-h[i][1])-(h[i-1][0]+h[i-1][1]);  if( d > t ) ans += 2;  else if( d == t ) ans++;  }  System.out.println( ans ); }  static class Comp implements Comparator<int[]> { public int compare( int[] a, int[] b ) { return a[0]-b[0]; } } }
1	public class Main {  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 String nextLine() {    String line = "";    if(st.hasMoreTokens()) line = st.nextToken();    else try {return br.readLine();}catch(IOException e){e.printStackTrace();}    while(st.hasMoreTokens()) line += " "+st.nextToken();    return line;   }  }  public static void main(String[] args) {   FastScanner sc = new FastScanner();   PrintWriter pw = new PrintWriter(System.out);   int n = sc.nextInt();   int best = 1;   int bestTime = Integer.MAX_VALUE;   for(int i=0;i<n;i++) {    int time;    int a = sc.nextInt();    time = (a%n==0 || a%n<=i) ? a/n : (a+n)/n;    if(time < bestTime) {     best = i + 1;     bestTime = time;    }   }   pw.println(best);   pw.close();  } }
1	public class B { private Scanner in; private PrintWriter out;  public void solve() {  String str = in.next();   List<String> sp = new ArrayList<String>();  StringBuilder sb = null;  int kind = -1;  for(int i = 0;i < str.length();i++){  char c = str.charAt(i);  if(c >= 'A' && c <= 'Z' && kind != 0){   if(sb != null){   sp.add(sb.toString());   }   sb = new StringBuilder();   kind = 0;  }  if(c >= '0' && c <= '9' && kind != 1){   if(sb != null){   sp.add(sb.toString());   }   sb = new StringBuilder();   kind = 1;  }  sb.append(c);  }  sp.add(sb.toString());  if(sp.size() == 2){    String bc = sp.get(0);  int v = 0;  for(int i = 0;i < bc.length();i++){   v = 26 * v + (bc.charAt(i) - 'A' + 1);  }    out.println("R" + sp.get(1) + "C" + Integer.toString(v));  }else{      int v = Integer.parseInt(sp.get(3));  StringBuilder sbb = new StringBuilder();  for(;v > 0;v/=26){   v--;   sbb.append((char)((v % 26) + 'A'));  }  sbb.reverse();    out.println(sbb.toString() + sp.get(1));  }   out.flush(); }  public void run() throws Exception {   in = new Scanner(System.in);  out = new PrintWriter(System.out);   int n = in.nextInt();  for(int i = 1;i <= n;i++){  long t = System.currentTimeMillis();  solve();  } }   public static void main(String[] args) throws Exception {  new B().run(); }  private int ni() { return Integer.parseInt(in.next()); } private static void tr(Object... o) { System.out.println(o.length == 1 ? o[0] : Arrays.toString(o)); } private void tra(int[] a) {System.out.println(Arrays.toString(a));} private void tra(int[][] a) {  for(int[] e : a){  System.out.println(Arrays.toString(e));  } }  }
3	public class A{  void solve(){   int n=ni();   s=new char[n+1];   s[0]='.';   for(int i=1;i<=n;i++) s[i]=ns().charAt(0);   dp=new long[5001][5001];   dp[1][0]=1;   long sum[]=new long[n+2];   sum[0]=1;   for(int i=2;i<=n;i++){    for(int j=0;j<=n;j++) {     if (s[i - 1] == 'f') {       if(j-1>=0) dp[i][j]=dp[i-1][j-1];       else dp[i][j]=0;     }else {      dp[i][j]=sum[j];     }    }    for(int j=n;j>=0;j--){     sum[j]=(sum[j+1]+dp[i][j])%M;    }   }   long ans=0;   for(int i=0;i<=n;i++){    ans+=dp[n][i];    if(ans>=M) ans%=M;   }   pw.println(ans);  }  char s[];  long dp[][];  long go(int x,int cnt,int n){    if(x>n) return 1;   long cc=0;   if(dp[x][cnt]!=-1) return dp[x][cnt];   if(s[x]=='f'){    cc=(cc+go(x+1,cnt+1,n))%M;   }else {    for(int j=cnt;j>=0;j--) cc=(cc+go(x+1,j,n))%M;    if(x==n) cc=(cc-cnt+M)%M;   }   cc%=M;   dp[x][cnt]=cc;   return cc;  }   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 double nd() { return Double.parseDouble(ns()); }  private char nc() { return (char)skip(); }  private String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b))){    sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }  private char[] ns(int n) {   char[] buf = new char[n];   int b = skip(), p = 0;   while(p < n && !(isSpaceChar(b))){    buf[p++] = (char)b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }  private char[][] nm(int n, int m) {   char[][] map = new char[n][];   for(int i = 0;i < n;i++)map[i] = ns(m);   return map;  }  private int[] na(int n) {   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = ni();   return a;  }  private int ni() {   int num = 0, b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private long nl() {   long num = 0;   int b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); } }
5	public class A {  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  int n = s.nextInt();  int[] a = new int[n];  for(int i=0;i<n;i++) a[i] = s.nextInt();  int r = 0, an = 0;  Arrays.sort(a);  int t = 0;  for(int z : a) t += z;  for(int i=a.length-1;i>=0;i--){  r += a[i];  an++;  if (r > t - r) break;  }  System.out.println(an); } }
2	public class Contest {  public static void main(String[] args)throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   String[] s=br.readLine().split(" ");  BigInteger x = new BigInteger(s[0]);  BigInteger k = new BigInteger(s[1]);  BigInteger mod = new BigInteger(String.valueOf((int) (Math.pow(10, 9) + 7)));  BigInteger two = new BigInteger("2");  BigInteger interm = two.modPow(k, mod);  BigInteger res = interm.multiply(x).add(interm.multiply(x)).subtract(interm).add(BigInteger.ONE).mod(mod);  if(x.equals(BigInteger.ZERO)) {  System.out.println("0");  return;  }  System.out.println(res); } }
6	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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, QuickScanner in, PrintWriter out) {    int n = in.nextInt();    int m = in.nextInt();    boolean[][] is = new boolean[n][n];    for (int i = 0; i < n; i++) {     is[i][i] = true;    }    long[][] dp = new long[1 << n | 1][n];    for (int i = 0; i < m; i++) {     int u = in.nextInt() - 1;     int v = in.nextInt() - 1;     is[u][v] = is[v][u] = true;     dp[(1 << u) + (1 << v)][v] = 1;     dp[(1 << u) + (1 << v)][u] = 1;    }    int k = 0;    long res = 0;    for (int mask = 1; mask < 1 << n; ++mask) {     boolean f = true;     for (int i = 0; i < n; i++) {      if ((mask & (1 << i)) != 0 && dp[mask][i] == 0) {       if (f) {        f = false;        k = i;       } else {        for (int j = k + 1; j < n; j++) {         if ((mask & (1 << j)) != 0 && is[i][j]) {          dp[mask][i] += dp[mask - (1 << i)][j];         }        }       }       if (is[k][i]) res += dp[mask][i];      }     }    }    out.println(res >> 1);   }  }  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();   }   int nextInt() {    return Integer.parseInt(nextToken());   }  } }
3	public class PythonIndentation { public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  int N = Integer.parseInt(in.readLine());  int[][] dp = new int[N][N];  dp[0][0] = 1;  for(int i = 1; i < N; ++i) {  char lastCmd = in.readLine().charAt(0);  int[] sum = new int[N];  sum[N - 1] = dp[i - 1][N - 1];  for(int j = N - 2; j >= 0; --j)   sum[j] = (sum[j + 1] + dp[i - 1][j]) % 1000000007;  for(int j = 0; j < N; ++j) {   if(lastCmd == 'f' && j > 0)   dp[i][j] = dp[i - 1][j - 1];   else if(lastCmd == 's')   dp[i][j] = sum[j];  }  }  int ans = 0;  for(int i = 0; i < N; ++i)  ans = (ans + dp[N - 1][i]) % 1000000007;  System.out.println(ans); } }
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]+" " );  } } }
2	public class Main {  private static final long MOD = 998244353;  static int[] readArray(int size, InputReader in, boolean subOne) {   int[] a = new int[size];   for (int i = 0; i < size; i++) {    a[i] = in.nextInt() + (subOne ? -1 : 0);   }   return a;  }  static long[] readLongArray(int size, InputReader in) {   long[] a = new long[size];   for (int i = 0; i < size; i++) {    a[i] = in.nextLong();   }   return a;  }  static void sortArray(int[] a) {   Random random = new Random();   for (int i = 0; i < a.length; i++) {    int randomPos = random.nextInt(a.length);    int t = a[i];    a[i] = a[randomPos];    a[randomPos] = t;   }   Arrays.sort(a);  }   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();  }  private static 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();   }  }   private static boolean check(long x, long s, long a, List<Long> divA) {   int ind = binSearchRight(divA, x, 0, divA.size());   if (ind >= 0 && ind < divA.size()) {    long y = a / divA.get(ind);    return y <= s / x;   }   return false;  }  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;  }  private static void outputArray(int[] ans, PrintWriter out, boolean addOne) {   StringBuilder str = new StringBuilder();   for (int i = 0; i < ans.length; i++) {    long an = ans[i] + (addOne ? 1 : 0);    str.append(an).append(' ');   }   out.println(str);  }  private static void outputArray(List<Integer> ans, PrintWriter out, boolean addOne) {   StringBuilder str = new StringBuilder();   for (int j = 0; j < ans.size(); j++) {    long i = ans.get(j);    long an = i + (addOne ? 1 : 0);    str.append(an);    if (j < ans.size() - 1) {     str.append(' ');    }   }   out.println(str);  }  private 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 String nextString() {    try {     return reader.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public char nextChar() {    return next().charAt(0);   }   public String nextWord() {    return next();   }   private List<Integer>[] readTree(int n) {    return readGraph(n, n - 1);   }   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;   }   private Map<Integer, Long>[] readWeightedGraph(int n, int m) {    Map<Integer, Long>[] result = new HashMap[n];    for (int i = 0; i < n; i++) {     result[i] = new HashMap<>();    }    for (int i = 0; i < m; i++) {     int u = nextInt() - 1;     int v = nextInt() - 1;     long w = nextLong();     result[u].put(v, Math.min(w, result[u].getOrDefault(v, Long.MAX_VALUE)));     result[v].put(u, Math.min(w, result[v].getOrDefault(u, Long.MAX_VALUE)));    }    return result;   }  } }
6	public class MaeDosDragoes { public static PrintWriter saida = new PrintWriter(System.out, false); public static class Escanear {   BufferedReader reader;   StringTokenizer tokenizer;  public Escanear() {    this(new InputStreamReader(System.in));   }  public Escanear(Reader in) {    reader = new BufferedReader(in);   }   String proximo() {    while (tokenizer == null || !tokenizer.hasMoreElements()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return tokenizer.nextToken();   }     int nextInt() {    return Integer.parseInt(proximo());   }  }   public static void main(String[] args) {  Escanear fastScanner = new Escanear();   int proximoInt = fastScanner.nextInt();   double proximoDouble = fastScanner.nextInt();   long[] graph = new long[proximoInt];   for(Integer i = 0; i < proximoInt; i++) {    for(Integer j =0; j < proximoInt; j++) {     Integer val = fastScanner.nextInt();     if (val.equals(1) || i.equals(j)) {   graph[i] |= 1L << j;   }    }   }   int szLeft = proximoInt/2;   int szRight = proximoInt - szLeft;   int[] dp = new int[1 << szLeft];   int maxMask = 1 << szLeft;   for(int mask = 1; mask <maxMask; mask++) {    int curMask = mask;    for(int j = 0; j < szLeft; j++) {     if (((1 << j) & mask) > 0) {      curMask &= graph[j + szRight] >> szRight;      dp[mask] = Math.max(dp[mask], dp[mask ^ (1 << j)]);     }    }    if (mask == curMask) {     dp[mask] = Math.max(dp[mask],Integer.bitCount(mask));    }   }   int ans = 0;   int rmaxMask = 1 << szRight;   for(int mask = 0; mask < rmaxMask; mask++) {    int curMask = mask;    int oMask = maxMask -1;    for(int j = 0; j < szRight; j++) {     if (((1 << j) & mask) > 0) {      curMask &= (graph[j] & (rmaxMask-1));      oMask &= graph[j] >> szRight;     }    }    if (curMask != mask) continue;    ans = Math.max(ans, Integer.bitCount(mask) + dp[oMask]);   }   proximoDouble/=ans;   saida.println(proximoDouble * proximoDouble * (ans * (ans-1))/2);   saida.flush();  } }
3	public class A { public static void main(String[] args) throws IOException {    Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));     int n = sc.nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = sc.nextInt();  Arrays.sort(a);  int ans = 0;  boolean[] v = new boolean[n];  for (int i = 0; i < n; i++) {  if (v[i])   continue;  v[i] = true;  ans++;  for (int j = i; j < n; j++) {   if (a[j]%a[i]==0)   v[j] = true;  }  }  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(){  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[]>() {  public int compare(int[] arr1,int[] arr2) {   return arr2[0]-arr1[0];  }  });  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()); }  public long nextLong() {  return Long.parseLong(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);  } }
4	public class Main {  static FastReader sc=new FastReader();  static long dp[][][];  static int mod=1000000007;   public static void main(String[] args) throws IOException {                   PrintWriter out=new PrintWriter(System.out);    int ttt=1;       outer :while (ttt-- > 0)   {    int n=i();    int m=i();    int k=i();    int A[][]=input(n,m-1);    int B[][]=input(n-1, m);    dp=new long[n+1][m+1][k+1];    for(int ii=0;ii<n;ii++) {    for(int jj=0;jj<m;jj++) {     Arrays.fill(dp[ii][jj],-1);    }    }    if(k%2!=0) {    for(int i=0;i<n;i++) {     for(int j=0;j<m;j++) {     System.out.print("-1 ");     }     System.out.println();    }    }    else {    go(A, B, 0, 0, k/2, n, m);    for(int i=0;i<n;i++) {    for(int j=0;j<m;j++) {     System.out.print(dp[i][j][k/2]*2+" ");    }    System.out.println();    }    }      }   out.close();                          }  static long go(int A[][],int B[][],int i,int j,int k,int l,int p) {  if(k==0)   return 0;  if(i>=l || j>=p)   return Integer.MAX_VALUE;  if(dp[i][j][k]!=-1)   return dp[i][j][k];    long op1=Long.MAX_VALUE;  if(i+1<l)  op1=Math.min(op1,go(A, B, i+1, j, k-1,l,p)+B[i][j]);  if(i-1>=0)  op1=Math.min(op1,go(A, B, i-1, j, k-1,l,p)+B[i-1][j]);  if(j+1<p)  op1=Math.min(op1,go(A, B, i, j+1, k-1,l,p)+A[i][j]);  if(j-1>=0)   op1=Math.min(op1,go(A, B, i, j-1, k-1,l,p)+A[i][j-1]);  go(A, B, i+1, j, k, l, p);  go(A, B, i, j+1, k, l, p);  return dp[i][j][k]=op1;  }         static int[] input(int n) { int A[]=new int[n];  for(int i=0;i<n;i++) {   A[i]=sc.nextInt();  }  return A;  } static long[] inputL(int n) { long A[]=new long[n];  for(int i=0;i<n;i++) {   A[i]=sc.nextLong();  }  return A;  } static String[] inputS(int n) { String A[]=new String[n];  for(int i=0;i<n;i++) {   A[i]=sc.next();  }  return A;  } static long sum(int A[]) { long sum=0; for(int i : A) {  sum+=i; } return sum; } static long sum(long A[]) { long sum=0; for(long i : A) {  sum+=i; } return sum; } static void reverse(long A[]) { int n=A.length; long B[]=new long[n]; for(int i=0;i<n;i++) {  B[i]=A[n-i-1]; } for(int i=0;i<n;i++)  A[i]=B[i];  } static void reverse(int A[]) { int n=A.length; int B[]=new int[n]; for(int i=0;i<n;i++) {  B[i]=A[n-i-1]; } for(int i=0;i<n;i++)  A[i]=B[i];  } static void input(int A[],int B[]) {  for(int i=0;i<A.length;i++) {   A[i]=sc.nextInt();   B[i]=sc.nextInt();  } } static int[][] input(int n,int m){ int A[][]=new int[n][m]; for(int i=0;i<n;i++) {  for(int j=0;j<m;j++) {  A[i][j]=i();  } } return A; } static char[][] charinput(int n,int m){ char A[][]=new char[n][m]; for(int i=0;i<n;i++) {  String s=s();  for(int j=0;j<m;j++) {  A[i][j]=s.charAt(j);  } } return A; } static int max(int A[]) { int max=Integer.MIN_VALUE; for(int i=0;i<A.length;i++) {  max=Math.max(max, A[i]); } return max; } static int min(int A[]) { int min=Integer.MAX_VALUE; for(int i=0;i<A.length;i++) {  min=Math.min(min, A[i]); } return min; } static long max(long A[]) { long max=Long.MIN_VALUE; for(int i=0;i<A.length;i++) {  max=Math.max(max, A[i]); } return max; } static long min(long A[]) { long min=Long.MAX_VALUE; for(int i=0;i<A.length;i++) {  min=Math.min(min, A[i]); } return min; } static long [] prefix(long A[]) { long p[]=new long[A.length]; p[0]=A[0]; for(int i=1;i<A.length;i++)  p[i]=p[i-1]+A[i]; return p; } static long [] prefix(int A[]) { long p[]=new long[A.length]; p[0]=A[0]; for(int i=1;i<A.length;i++)  p[i]=p[i-1]+A[i]; return p; } static long [] suffix(long A[]) { long p[]=new long[A.length]; p[A.length-1]=A[A.length-1]; for(int i=A.length-2;i>=0;i--)  p[i]=p[i+1]+A[i]; return p; } static long [] suffix(int A[]) { long p[]=new long[A.length]; p[A.length-1]=A[A.length-1]; for(int i=A.length-2;i>=0;i--)  p[i]=p[i+1]+A[i]; return p; } static void print(int A[]) { for(int i : A) {  System.out.print(i+" "); } System.out.println(); } static void print(long A[]) { for(long i : A) {  System.out.print(i+" "); } System.out.println(); } static long mod(long x) {  int mod=1000000007;  return ((x%mod + mod)%mod); } static String reverse(String s) { StringBuffer p=new StringBuffer(s); p.reverse(); return p.toString(); }   static int i() {   return sc.nextInt();  }  static String s() {   return sc.next();  }  static long l() {   return sc.nextLong();  }   static void sort(int[] A){   int n = A.length;   Random rnd = new Random();   for(int i=0; i<n; ++i){    int tmp = A[i];    int randomPos = i + rnd.nextInt(n-i);    A[i] = A[randomPos];    A[randomPos] = tmp;   }   Arrays.sort(A);  }  static void sort(long[] A){   int n = A.length;   Random rnd = new Random();   for(int i=0; i<n; ++i){    long tmp = A[i];    int randomPos = i + rnd.nextInt(n-i);    A[i] = A[randomPos];    A[randomPos] = tmp;   }   Arrays.sort(A);   } static String sort(String s) {  Character ch[]=new Character[s.length()];  for(int i=0;i<s.length();i++) {   ch[i]=s.charAt(i);  }  Arrays.sort(ch);  StringBuffer st=new StringBuffer("");  for(int i=0;i<s.length();i++) {   st.append(ch[i]);  }  return st.toString(); } static HashMap<Integer,Integer> hash(int A[]){  HashMap<Integer,Integer> map=new HashMap<Integer, Integer>();  for(int i : A) {  if(map.containsKey(i)) {   map.put(i, map.get(i)+1);  }  else {   map.put(i, 1);  }  }  return map; } static TreeMap<Integer,Integer> tree(int A[]){  TreeMap<Integer,Integer> map=new TreeMap<Integer, Integer>();  for(int i : A) {  if(map.containsKey(i)) {   map.put(i, map.get(i)+1);  }  else {   map.put(i, 1);  }  }  return map; }  static boolean prime(int n)   {    if (n <= 1)     return false;    if (n <= 3)     return true;    if (n % 2 == 0 || n % 3 == 0)     return false;    double sq=Math.sqrt(n);     for (int i = 5; i <= sq; i = i + 6)     if (n % i == 0 || n % (i + 2) == 0)      return false;    return true;   }   static boolean prime(long n)   {    if (n <= 1)     return false;    if (n <= 3)     return true;    if (n % 2 == 0 || n % 3 == 0)     return false;    double sq=Math.sqrt(n);     for (int i = 5; i <= sq; i = i + 6)     if (n % i == 0 || n % (i + 2) == 0)      return false;    return true;   }   static int gcd(int a, int b)   {    if (a == 0)     return b;    return gcd(b % a, a);   }   static long gcd(long a, long b)   {    if (a == 0)     return b;    return gcd(b % a, a);   }   static class Pair implements Comparable<Pair>  {   int x;   int y;   int z;   Pair(int x,int y,int z){   this.x=x;   this.y=y;   this.z=z;   }  @Override            public int compareTo(Pair o) {  int p=this.x-this.y;  int q=o.x-o.y;  if(p>q)  return 1;  else if(p<q)  return -1;     return 0;   }  }    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());   }    double nextDouble()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  } }
3	public class inversion__count {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   int n=s.nextInt();   int[] a = new int[n+1];   for(int i=1;i<=n;i++){  a[i]=s.nextInt();  }   int m=s.nextInt();  int count=0;   for(int i=1;i<=n;i++){  for(int j=i+1;j<=n;j++){   if(a[i]>a[j]){   count++;   }  }  }   if(count%2==0){  count=0;  }else{  count=1;  }     for(int i=0;i<m;i++){  int l=s.nextInt();  int r=s.nextInt();    if(l==r){   if((count&1)==1){   System.out.println("odd");   }else{   System.out.println("even");   }   continue;  }     int d=r-l+1;   int segcount = 0;         int temp = (d*(d-1))/2;      if((temp&1)==1 && (count&1)==1){   count=0;   System.out.println("even");   }else if((temp&1)==1 && (count&1)==0){   count=1;   System.out.println("odd");   }else{   if((count&1)==1){    System.out.println("odd");   }else{   System.out.println("even");   }   }  } } }
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;    }     public int compareTo(Col o) {     if (o.maxVal != this.maxVal) return this.maxVal > o.maxVal ? -1 : 1;     if (o.colID != this.colID) return this.colID < o.colID ? -1 : 1;     return 0;    }   }  }  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;   }  } }
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; }  String NextString() {  String n = inputParser.nextToken();  return n; }  void closeInput() {  try {  is.close();  } catch (IOException e) {  System.err.println("Unexpected IO ERROR: " + e);  }   }  public void readFInput() {  for(;;)  {  try  {   readNextLine();   FInput+=line+" ";  }  catch(Exception e)  {   break;  }  }  inputParser = new StringTokenizer(FInput, " "); }  long NextLong()  {    String n = inputParser.nextToken();       long val = Long.parseLong(n);       return val;  }  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; }  }
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;  }  } }
1	public class Main {   public static void main(String[] args) throws Exception {   int i,j,k;   int counter[] = new int[2];   int a[] = new int[200];   int needed;     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));     int N = Integer.parseInt(br.readLine());   StringTokenizer st = new StringTokenizer(br.readLine());     for (i=1;i<=N;i++) {    a[i] = Integer.parseInt(st.nextToken());    counter[a[i]%2]++;   }     if (counter[0] == 1) {    needed = 0;   } else {    needed = 1;   }     for (i=1;i<=N;i++) {    if (a[i]%2 == needed) {     System.out.println(i);     return;    }   }    } }
2	public class ReallyBigNumbers817c {  static long sd(String s) {   long c = 0;   for (int i = 0; i < s.length(); i++) {    c += s.charAt(i);   }   return c - s.length() * 0x30;  }  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(in.readLine());   long n = Long.parseLong(st.nextToken());   long s = Long.parseLong(st.nextToken());   long i = (s / 10 + 1) * 10;   if (n < 10 || n - sd(n + "") < s) {    System.out.println(0);    return;   }   while (!(i - sd(""+i) >= s)) {    i += 10;   }   System.out.println(n - i + 1);  } }
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; }  private static 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();  }  String nextLine() throws IOException {  return br.readLine();  }  int nextInt() throws IOException {  return Integer.parseInt(next());  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(next());  }  boolean ready() throws IOException {  return br.ready();  }  } }
4	public class A {  private static final int INF = (int) 1e9 + 7;  public static void main(String[] args) {   FastScanner fs=new FastScanner();   PrintWriter pr = new PrintWriter(System.out);     int n = fs.nextInt(), m = fs.nextInt(), k = fs.nextInt();    int[][] right = new int[n][m -1], down = new int[n - 1][m];    for(int i = 0; i < n; i++) right[i] = fs.readArray(m - 1);    for(int i = 0; i < n - 1; i++) down[i] = fs.readArray(m);    if (k % 2 == 1) {     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) pr.print(-1 + " ");      pr.println();     }    } else {     int[][][] dp = new int[k / 2 + 1][n][m];     for(int r = 1; 2 * r <= k; r++) {      for(int i = 0; i < n; i++) Arrays.fill(dp[r][i], INF);      for(int i = 0; i < n; i++)       for(int j = 0; j + 1 < m; j++) {        int cost = right[i][j];        dp[r][i][j] = Integer.min(dp[r][i][j], dp[r - 1][i][j + 1] + cost);        dp[r][i][j + 1] = Integer.min(dp[r][i][j + 1], dp[r - 1][i][j] + cost);       }      for(int i = 0; i + 1 < n; i++)       for(int j = 0; j < m; j++) {        int cost = down[i][j];        dp[r][i][j] = Integer.min(dp[r][i][j], dp[r - 1][i + 1][j] + cost);        dp[r][i + 1][j] = Integer.min(dp[r][i + 1][j], dp[r - 1][i][j] + cost);       }     }     for(int i = 0; i < n; i++) {      for(int j = 0; j < m; j++) {       pr.print(2 * dp[k/2][i][j] + " ");      }      pr.println();     }    }     pr.flush();   pr.close();  }  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());   }   int[] readArray(int n) {    int[] a=new int[n];    for (int i=0; i<n; i++) a[i]=nextInt();    return a;   }   long[] readLongArray(int n) {    long[] a=new long[n];    for (int i=0; i<n; i++) a[i]=nextLong();    return a;   }   long nextLong() {    return Long.parseLong(next());   }  } }
0	public class Main {  public static void main(String[] args) {   Scanner r = new Scanner(System.in);     int N = r.nextInt();     System.out.println(N + " " + 0 + " " + 0);  } }
1	public class BT {  static BufferedReader in = new BufferedReader(new InputStreamReader(    System.in));  static StringTokenizer str;  static String SK;  static String next() throws IOException {   while ((str == null) || (!str.hasMoreTokens())) {    SK = in.readLine();    if (SK == null)     return null;    str = new StringTokenizer(SK);   }   return str.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt(next());  }  public static void main(String[] args) throws IOException {   int n, k;   n = nextInt();   k = nextInt();   HashSet<Integer> hs = new HashSet<Integer>();   HashMap<Integer, Integer> hm = new HashMap<Integer, Integer>();   int[] ar = new int[n];   int ii = 0, jj = -1;   for (int i = 0; i < n; i++) {    ar[i] = nextInt();    Integer iii = hm.get(ar[i]);    if(iii!=null)    hm.put(ar[i], ++iii); else hm.put(ar[i], 1);    hs.add(ar[i]);    if (hs.size() == k) {     jj = i;     break;    }   }   if (jj == -1) {    System.out.println(-1 + " " + (-1));    System.exit(0);   }   for (int i = 0; i < ar.length; i++) {    Integer iii = hm.get(ar[i]);    if (iii != null && iii - 1 > 0) {     hm.put(ar[i], --iii);     ii++;    } else {     break;    }   }   System.out.println((ii+1) + " " + (jj+1));  } }
5	public class A015 {  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt(), t = in.nextInt();  int[] centers = new int[n], sides = new int[n];  for (int x = 0; x < n; x++) {  centers[x] = in.nextInt();  sides[x] = in.nextInt();  }  int count = 0;  big: for (int x = -4000; x <= 4000; x++) {  boolean touch = false;  for (int i = 0; i < n; i++) {   int d = 2*centers[i] - x;   d = d > 0 ? d : -d;   int s = t + sides[i];   if (s == d) {   touch = true;   } else if (s > d) {   continue big;   }  }  if (touch)   count++;  }  System.out.println(count); } }
2	public class Main {  long mod = (long) (1e9 + 7);  void solve() throws Throwable {   long x = readLong(), k = readLong();   if (x == 0) {    System.out.println(0);    return;   }   long r = solveFast(x, k);     System.out.println(r);    }  private long solveSlow(long x, long k) {   List<Long> a = new ArrayList<>();   a.add(x);   for (int i = 0; i < k; i++) {    dodouble(a);    a = eat(a);   }   dodouble(a);   long sum = 0;   for (Long v : a) {    sum = (sum + v) % mod;   }   return sum * rev(a.size(), mod) % mod;  }  private List<Long> eat(List<Long> a) {   List<Long> r = new ArrayList<>();   for (Long v : a) {    r.add(v);    r.add((v - 1 + mod) % mod);   }   return r;  }  private void dodouble(List<Long> a) {   for (int i = 0; i < a.size(); i++) {    a.set(i, a.get(i) * 2 % mod);   }  }  private long solveFast(long x, long k) {   long n = binpow(2, k, mod);   long ma = (binpow(2, k + 1, mod) * (x % mod)) % mod;   long mi = (ma - n * 2 + 2 + mod * 100) % mod;   return ((ma + mi) * rev(2, mod)) % mod;  }  private long rev(long a, long mod) {   return binpow(a, mod - 2, mod);  }    final boolean ONLINE_JUDGE = !new File("input.txt").exists();  BufferedReader in;  PrintWriter out;  StringTokenizer tok;  public void run() {   Runnable run = () -> {    try {     long startTime = System.currentTimeMillis();     Locale.setDefault(Locale.US);     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");     }     tok = new StringTokenizer("");     solve();     in.close();     out.close();     long endTime = System.currentTimeMillis();     long totalMemory = Runtime.getRuntime().totalMemory();     long freeMemory = Runtime.getRuntime().freeMemory();     System.err.println();     System.err.println("Time = " + (endTime - startTime) + " ms");        } catch (Throwable e) {     e.printStackTrace(System.err);     System.exit(-1);    }   };   new Thread(null, run, "run", 256 * 1024 * 1024).start();   min(0, 0);  }  String readString() {   while (!tok.hasMoreTokens()) {    String line;    try {     line = in.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }    if (line == null) return null;    tok = new StringTokenizer(line);   }   return tok.nextToken();  }  int readInt() {   return Integer.parseInt(readString());  }  long readLong() throws IOException {   return Long.parseLong(readString());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  void debug(Object... o) {   if (!ONLINE_JUDGE) {    System.err.println(Arrays.deepToString(o));   }  }    long binpow(long a, long n, long mod) {   long r = 1;   while (n > 0) {    if ((n & 1) > 0) {     r = (r * a) % mod;    }    a = (a * a) % mod;    n /= 2;   }   return r;  }  static long gcd(long x, long y) {   return y == 0 ? x : gcd(y, x % y);  }  private long[] readLongArray(int n) throws IOException {   long[] a = new long[n];   for (int i = 0; i < n; i++) {    a[i] = readLong();   }   return a;  }  public static void main(String[] args) {   new Main().run();  } }
2	public class B1195 {  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);  long x =sc.nextInt();  long y =sc.nextInt();  long m = (-3+Math.round(Math.sqrt(9+8*(x+y))))/2;  long e = x-m;  pw.println(e);  pw.flush(); }  static class Scanner {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s));  }  public Scanner(FileReader r) {  br = new BufferedReader(r);  }  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 String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-') {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.') {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public boolean ready() throws IOException {  return br.ready();  }  } }
6	public class Test { static PrintWriter writer =  new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  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; }  static long readLong() {  long 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; }  static String readLine() {  StringBuilder b = new StringBuilder();  try {  boolean start = false;  for (int c = 0; (c = System.in.read()) != -1; ) {   if (Character.isLetterOrDigit(c)) {   start = true;   b.append((char) c);   } else if (start) break;  }  } catch (IOException e) {  }  return b.toString(); }  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();  int[][] a = new int[n][m];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++)   a[i][j] = readInt();  int[] dp = new int[1<<n];  Arrays.fill(dp, -1);  dp[0] = 0;  for (int c = 0; c < m; c++) {   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) {    for (int r = 0; r < n; r++) {     int sum = 0;     for (int j = 0; j < n; j++) if (((p >> j) & 1) != 0) sum += a[(j + r) % n][c];     dp[i | p] = Math.max(dp[i | p], dp[i] + sum);     }    p = (p - 1) & u;    }   }  }  writer.println(dp[(1<<n) - 1]);  } } }
2	public class ReallyBigNumbers1 {   public static void main(String[] args)  {   Scanner sc = new Scanner(System.in);   long n = sc.nextLong();   long s = sc.nextLong();     int r = 0 ;     long l = 0L ;   long u = n ;     if( (l-sumDigits(l)< s ) && (u-sumDigits(u)< s ) )   {    System.out.println(0);    return ;   }     long specified = 0L ;   while( true )   {    long m = (l + u) / 2L ;       if( ( m - sumDigits(m) ) >= s && ( (m-1) - sumDigits(m-1) ) < s )    {     specified = m ;     break ;    }       if( l > u )     break ;       else    {     if( ( m - sumDigits(m) ) >= s )      u = m-1 ;     else      l = m+1 ;    }   }     System.out.println( n-specified+1 );       }   public static int sumDigits(long n)  {   char [] a = (n+"").toCharArray();   int sum = 0 ;   for(int k = 0 ; k < a.length ; k++)   {    sum += Integer.parseInt(a[k]+"") ;   }   return sum ;  }  }
1	public class IQTest implements Runnable { public static void main(String[] args) throws Exception {  new IQTest().run(); }  private void solve() throws Exception {  int n = nextInt();  int a[] = new int[n];  for (int i = 0; i < a.length; i++)  {  a[i] = nextInt();  }  int c0 = 0, c1 = 0;  for (int i = 0; i < a.length; i++)  {  a[i] = a[i] % 2;  if (a[i] == 0)   c0++;  else   c1++;  }  int f = 0;  if (c0 > c1)  f = 1;  else  f = 0;  int r = 0;  for (int i = 0; i < a.length; i++)  {  if (a[i] == f)  {   r = i + 1;   break;  }  }  out.println(r); }   private BufferedReader in; PrintWriter out; StringTokenizer tokenizer;  public void run() {   try  {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new BufferedOutputStream(System.out));  solve();  out.flush();  in.close();  out.close();  }  catch (Exception e)  {  e.printStackTrace();    } }  String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens())  {  tokenizer = new StringTokenizer(in.readLine());  }  return tokenizer.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()); } }
4	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader            (new FileReader("input.txt"));   StringBuilder out = new StringBuilder();   StringTokenizer tk;   PrintWriter pw = new PrintWriter("output.txt", "UTF-8");     int [] dx = {-1,1,0,0},dy = {0,0,-1,1};     tk = new StringTokenizer(in.readLine());   int n = parseInt(tk.nextToken()),m = parseInt(tk.nextToken());   int k = parseInt(in.readLine());     int [][] dist = new int[n][m];   for(int i=0; i<n; i++)    Arrays.fill(dist[i], -1);     int ans = -1,atx = -1,aty = -1;     Queue<point> q = new LinkedList<point>();     tk = new StringTokenizer(in.readLine());   while(k-- > 0) {    int x = parseInt(tk.nextToken())-1,y = parseInt(tk.nextToken())-1;       dist[x][y] = 0;    q.add(new point(x,y));   }     while(!q.isEmpty()) {    point p = q.remove();       if(dist[p.x][p.y]>ans) {     ans = dist[p.x][p.y];     atx = p.x+1;     aty = p.y+1;    }       for(int i=0; i<4; i++) {     int nx = p.x + dx[i];     int ny = p.y + dy[i];         if(nx>=0 && nx<n && ny>=0 && ny<m && dist[nx][ny]==-1) {      dist[nx][ny] = dist[p.x][p.y] + 1;      q.add(new point(nx,ny));     }    }   }     pw.println(atx+" "+aty);   pw.close();  }  } class point {  int x,y;   public point(int x,int y) {   this.x = x;   this.y = y;  } }
4	public class FireAgain {  Point coordinate; Queue<Point> q = new LinkedList<Point>(); int m, n; boolean[][] arr; PrintStream out ;  void bfs(Point start) {  while (!q.isEmpty()) {  Point front = q.poll();  Point p = new Point();   p.x = front.x - 1;  p.y = front.y;  if (p.x >= 1 && p.x <= n && p.y <= m && p.y >= 1) {   if (!arr[p.x][p.y]) {   arr[p.x][p.y] = true;   q.add(p);   }  }    p = new Point();  p.x = front.x + 1;  p.y = front.y;  if (p.x >= 1 && p.x <= n && p.y <= m && p.y >= 1)   if (!arr[p.x][p.y]) {   arr[p.x][p.y] = true;   q.add(p);   }   p = new Point() ;  p.x = front.x;  p.y = front.y + 1;  if (p.x >= 1 && p.x <= n && p.y <= m && p.y >= 1)   if (!arr[p.x][p.y]) {   arr[p.x][p.y] = true;   q.add(p);   }   p = new Point() ;  p.x = front.x;  p.y = front.y - 1;  if (p.x >= 1 && p.x <= n && p.y <= m && p.y >= 1)   if (!arr[p.x][p.y]) {   arr[p.x][p.y] = true;   q.add(p);   }   if (q.size() == 0)   out.print(front.x + " " + front.y);  } }   public static void main(String[] args) throws FileNotFoundException {   FireAgain fa = new FireAgain();  Scanner Scan = new Scanner(new FileInputStream("input.txt"));  fa.out = new PrintStream(new File("output.txt"));  fa.n = Scan.nextInt();  fa.m = Scan.nextInt();  int k = Scan.nextInt();  fa.arr = new boolean[2001][2001];  for (int i = 0; i < k; i++) {  fa.coordinate = new Point();  fa.coordinate.x = Scan.nextInt();  fa.coordinate.y = Scan.nextInt();  fa.q.add(fa.coordinate);  fa.arr[fa.coordinate.x][fa.coordinate.y] = true;  }  fa.bfs(fa.q.peek());  } }
1	public class Main {   public static void main(String[] args) {   Scanner cin = new Scanner(System.in);  int n;  n = cin.nextInt();  String s = cin.next();  int ans = n;  int cntH = 0,cntT = 0;  for(int i=0;i<n;i++)  {  if(s.charAt(i)=='H')cntH++;  }  cntT = n - cntH;  for(int i=0;i+cntH<n;i++)  {  int tmp = 0;  for(int j=i;j<i+cntH;j++)   if(s.charAt(j)=='T')tmp++;  if(ans>tmp)ans = tmp;  }  for(int i=0;i+cntT<n;i++)  {  int tmp = 0;  for(int j=i;j<i+cntT;j++)   if(s.charAt(j)=='H')tmp++;  if(ans>tmp)ans = tmp;  }  System.out.println(ans); } }
0	public class Subtractions {     public static void main(String[]args){  Scanner sc=new Scanner(System.in);  int test=sc.nextInt();  while(test-->0){  long a=sc.nextLong();  long b=sc.nextLong();  long count=0;  long cnt=0;  while(a>0&&b>0){   count=0;     if(a>b){  count+=(a-b)/b;  if(count!=0){  cnt+=count;  a-=b*count;}  else {   cnt++;   a-=b;  }  }  else{   count+=(b-a)/a;   if(count!=0){   cnt+=count;  b-=a*count;}   else {   cnt++;   b-=a;   }  }  }  System.out.println(cnt);  }      } }
4	public class j { public static void main(String a[])throws IOException { BufferedReader b=new BufferedReader(new InputStreamReader(System.in)); int n=0,i=0,k=2; String s="\0",r="\0"; s=b.readLine(); n=s.length()-1; while(k<=s.length()) { for(i=0;i<k;i++) { r=s.substring(i,i+n); if(s.indexOf(r)!=s.lastIndexOf(r)) { System.out.print(n); System.exit(0); } } k++; n--; } System.out.print("0"); } }
1	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("");  boolean[] erat = new boolean [1000 + 1]; int[] primes = new int [1000 + 1]; int pNum = 0;  void run() throws IOException {   for (int i = 2; i <= 1000; i++) {  if (!erat[i]) {   primes[pNum++] = i;   for (int j = i * i; j <= 1000; j += i)   erat[j] = true;  }  }   int[] cnt = new int [1000 + 1];  cnt[2] = 0;   for (int i = 3; i <= 1000; i++) {  cnt[i] = cnt[i - 1];  if (!erat[i]) {   int r = i - 1;   for (int j = 1; j < pNum; j++) {   if (r == primes[j - 1] + primes[j]) {    cnt[i]++;    break;   }   }  }  }  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   int n = nextInt();  int k = nextInt();   out.println(k <= cnt[n] ? "YES" : "NO");   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()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  String nextLine() throws IOException {  st = new StringTokenizer("");  return in.readLine(); }  boolean EOF() throws IOException {  while (!st.hasMoreTokens()) {  String s = in.readLine();  if (s == null)   return true;  st = new StringTokenizer(s);  }  return false; } }
5	public class Main {  static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));  static StringTokenizer tok;  static boolean hasNext()  {   while(tok==null||!tok.hasMoreTokens())    try{     tok=new StringTokenizer(in.readLine());    }    catch(Exception e){     return false;    }   return true;  }  static String next()  {   hasNext();   return tok.nextToken();  }  static long nextLong()  {   return Long.parseLong(next());  }  static int nextInt()  {   return Integer.parseInt(next());  }  static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));  public static void main(String[] args) {   Map<Integer,Integer> map = new HashMap();   map.put(0,1);   int n = nextInt();   int m = nextInt();   int index = -1;   int a[] = new int[n];   for(int i=0;i<n;i++){    a[i]=nextInt();    if(a[i]==m)     index=i;   }   int sum = 0;   for(int i=0;i<index;i++){    if (a[i]<m)     sum--;    else     sum++;    if (map.containsKey(sum)){     map.put(sum,map.get(sum)+1);    }else {     map.put(sum,1);    }   }   long ans = 0;   for(int i=index;i<n;i++){    if (a[i]<m)     sum--;    else if(a[i]>m)     sum++;    if (map.containsKey(sum))     ans+=map.get(sum);    if (map.containsKey(sum-1))     ans+=map.get(sum-1);   }   out.print(ans);   out.flush();  } }
2	public class B_574 {  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   String[] input = br.readLine().split(" ");   int N = Integer.valueOf(input[0]);   int K = Integer.valueOf(input[1]);   long sum = 0;   for(int i = 0; i < N; i++){    if(sum - (N - i) == K){     System.out.println(Integer.valueOf(N-i));     return;    }    sum += (i+1);   }   System.out.println("0");  } }
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 {   String[] str;   long mod = (long) 1e9 + 7;   long[][] dp;   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    str = new String[n];    dp = new long[n + 2][n + 2];    for (int i = 0; i < dp.length; i++) {     Arrays.fill(dp[i], -1);    }    for (int i = 0; i < n; i++) {     str[i] = in.readString();    }    if (str[0].charAt(0) == 'f') {     out.print(solve(1, 1));    } else {     out.print(solve(1, 0));    }   }   long solve(int n, int horiz) {    if (horiz < 0)     return 0;    if (n >= str.length - 1) {     return 1;    }    if (dp[n][horiz] != -1) {     return dp[n][horiz];    }    if (str[n].charAt(0) == 'f') {     return dp[n][horiz] = solve(n + 1, horiz + 1);    } else {     long ans1 = solve(n, horiz - 1);         ans1 += solve(n + 1, horiz);         ans1 = ans1 % mod;     return dp[n][horiz] = ans1;    }   }  }  static class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar;   private int snumChars;   public InputReader(InputStream st) {    this.stream = st;   }   public int read() {        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 = read();    while (isSpaceChar(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     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) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
1	public class SFly {  public static void main(String[] args) throws IOException {   BufferedReader lector = new BufferedReader(new InputStreamReader(System.in));  int planet = Integer.parseInt(lector.readLine());  int ini = Integer.parseInt(lector.readLine());  double peso = ini;  int[] desp = new int[planet];  int[] ater = new int[planet];  String[] temp = lector.readLine().split(" ");   for(int i=0; i<planet; i++) {  desp[i] = Integer.parseInt(temp[i]);  if(desp[i] == 1) {   System.out.println(-1);   lector.close();   return;  }  }  temp = lector.readLine().split(" ");   for(int i=0; i<planet; i++) {  ater[i] = Integer.parseInt(temp[i]);  if(ater[i] == 1) {   System.out.println(-1);   lector.close();   return;  }  }  temp = null;  int i=planet-1;  peso = (peso*ater[0])/(ater[0]-1);  while(i>0) {  peso = (peso*desp[i])/(desp[i]-1);  peso = (peso*ater[i])/(ater[i]-1);  i--;  }  peso = (peso*desp[0])/(desp[0]-1);  peso = peso - ini;  System.out.println(peso);  lector.close(); } }
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);  }  static int reset(int N, int pos) {   return N = N & ~(1 << pos);  }  static void debug(Object... obj) {   System.err.println(Arrays.deepToString(obj));  } }
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");    } }
5	public class Main {           private void solve() throws IOException {  int n = nextInt();  int[] arr = new int[n];  int count = 0;  for (int x = 0; x < n; x++) {  arr[x] = nextInt();  count+= arr[x];  }  Arrays.sort(arr);  count /=2;  int result = 0, sum = 0;  for (int x = arr.length - 1; x >= 0; x--) {  sum += arr[x];  result++;  if (sum > count) {   break;  }  }  System.out.println(result); }  public static void main(String[] args) {  try {  br = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    new Main().solve();  out.close();  } catch (Throwable e) {  System.out.println(e);  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()); }  static long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  static double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  static int[] nextIntArray(int n) throws IOException {  int[] temp = new int[n];  for (int x = 0; x < n; x++) {  temp[x] = nextInt();  }  return temp; }  static long[] nextLongArray(int n) throws IOException {  long[] temp = new long[n];  for (int x = 0; x < n; x++) {  temp[x] = nextLong();  }  return temp; }  static String[] nextArray(int n) throws IOException {  String[] temp = new String[n];  for (int x = 0; x < n; x++) {  temp[x] = nextToken();  }  return temp; } }
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 D implements Runnable { public static void main(String[] args) {  new Thread(new D()).start(); }  BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof;  String nextToken() {  while (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(br.readLine());  } catch (Exception e) {   eof = true;   return "0";  }  }  return st.nextToken(); }  public void run() {  try {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  out.flush();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  int nextInt() {  return Integer.parseInt(nextToken()); }  long nextLong() {  return Long.parseLong(nextToken()); }  double nextDouble() {  return Double.parseDouble(nextToken()); }  static final double EPS = 1e-9;  static double qEq(double a, double b, double c) {  double d = b * b - 4 * a * c;  if (d < -EPS) {  return Double.NaN;  }  return Math.max((-b + Math.sqrt(d)) / (2 * a), (-b - Math.sqrt(d))   / (2 * a)); }  static int compare(double a, double b) {  return Math.abs(a - b) < EPS ? 0 : Double.compare(a, b); }  void solve() {  double a = nextDouble();  double v = nextDouble();  double l = nextDouble();  double d = nextDouble();  double w = nextDouble();  if (compare(w, v) >= 0) {  double t1 = v / a;  double d1 = a * t1 * t1 * .5;  if (compare(d1, l) >= 0) {   out.println(Math.sqrt(2 * l / a));  } else {   out.println(t1 + (l - d1) / v);  }  return;  }  double t1 = w / a;  double d1 = a * t1 * t1 * .5;  if (compare(d1, d) >= 0) {  double t2 = v / a;  double d2 = a * t2 * t2 * .5;  if (compare(d2, l) >= 0) {   out.println(Math.sqrt(2 * l / a));  } else {   out.println(t2 + (l - d2) / v);  }  return;  }  double left = d - d1;  double timeToV = (v - w) / a;  double distToV = a * timeToV * timeToV * .5 + w * timeToV;     if (compare(distToV, left * .5) >= 0) {  double t2 = qEq(a * .5, w, -left * .5);    t2 += t1 + t2;  if (compare(distToV, l - d) >= 0) {   out.println(t2 + qEq(a * .5, w, d - l));  } else {   out.println(t2 + timeToV + (l - d - distToV) / v);  }  return;  }  double t2 = t1 + 2 * timeToV + (left - 2 * distToV) / v;  if (compare(distToV, l - d) >= 0) {  out.println(t2 + qEq(a * .5, w, d - l));  } else {  out.println(t2 + timeToV + (l - d - distToV) / v);  } } }
1	public class Solution {  public static void main(String [] args) throws IOException  {   PrintWriter pw=new PrintWriter(System.out);   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());   st=new StringTokenizer(br.readLine());   String str=st.nextToken();   char [] arr=str.toCharArray();   Arrays.sort(arr);   int weight=arr[0]-96;   char a=arr[0];   int included=1;   for(int i=1;i<arr.length;++i)   {    if(included==k)     break;    char c=arr[i];    if(c-a<2)     continue;       weight+=arr[i]-96;    ++included;    a=arr[i];      }   if(included==k)    pw.println(weight);   else    pw.println(-1);   pw.close();  } }
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]+" ");   }  }   class Permutation{      int n;  int max;  BitSet used;  int[] p;  public Permutation(int n, int max){   this.n = n;   this.max = max;   used = new BitSet(n);   p = new int[n];  }   public boolean next(){   if(used.cardinality() == 0){    for(int i=0; i<n; i++){     p[i] = i;    }    used.set(0, n);    return true;   }   int i;   for(i=n-1; i>=0; i--){    used.clear(p[i]);    if((used.nextClearBit(p[i]+1)) < max) break;   }   if(i<0) return false;   p[i] = used.nextClearBit(p[i]+1);   used.set(p[i]);   int idx = i+1;   for(i=used.nextClearBit(0); i<max && idx<n; i=used.nextClearBit(i+1)){    p[idx++] = i;    used.set(i);   }   return true;  }   public String toString(){   StringBuilder sb = new StringBuilder();   for(int i=0; i<n; i++){    sb.append(p[i]+" ");   }   return sb.toString();  } }  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 double nd() { return Double.parseDouble(ns()); }  private char nc() { return (char)skip(); }   private String ns()  {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b) && b != ' ')){    sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }   private char[] ns(int n)  {   char[] buf = new char[n];   int b = skip(), p = 0;   while(p < n && !(isSpaceChar(b))){    buf[p++] = (char)b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }   private char[][] nm(int n, int m)  {   char[][] map = new char[n][];   for(int i = 0;i < n;i++)map[i] = ns(m);   return map;  }   private int[] na(int n)  {   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = ni();   return a;  }   private int ni()  {   int num = 0, b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }     while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }   private long nl()  {   long num = 0;   int b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }     while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }   private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }  }
0	public class TwentyFive {  public static void main(String[] args) {   System.out.println(25);  } }
4	public class A_GENERAL {     static StringBuilder sb = new StringBuilder(); static long seive_size = (long) 1e6; static String alpha = "abcdefghijklmnopqrstuvwxyz";  static ArrayList<Integer> primes = new ArrayList<>();  static boolean[] seive_set = new boolean[(int) seive_size+1];  static int n, m, k;  static ArrayList<Integer>[] adj;  static boolean[] vis;  static ArrayDeque<Integer> q = new ArrayDeque<>();  static final long MOD = 998244353;  static int[] dx = new int[] {1, 0, -1, 0, 1, -1, 1, -1};  static int[] dy = new int[] {0, 1, 0, -1, -1, 1, 1, -1};  static long[][] arr;  static int[] rank;  static int[] parent;  static int[] s;  static long[] a;  public static void main(String[] args) throws FileNotFoundException {   Scanner sc = new Scanner(new File("input.txt"));  PrintWriter out = new PrintWriter("output.txt");  n = sc.nextInt();  m = sc.nextInt();  k = sc.nextInt();  ArrayDeque<iPair> qq = new ArrayDeque<>();  boolean[][] vis = new boolean[n+1][m+1];  for(int i = 0; i < k; i++) {  int u = sc.nextInt();  int v = sc.nextInt();  qq.add(new iPair(u, v));  vis[u][v] = true;  }  iPair last = null;  while(!qq.isEmpty()) {  iPair pp = qq.poll();  int i = pp.f;  int j = pp.s;  if(isValid(i-1, j) && !vis[i-1][j]) {   qq.add(new iPair(i-1, j));   vis[i-1][j] = true;  }  if(isValid(i+1, j) && !vis[i+1][j]) {   qq.add(new iPair(i+1, j));   vis[i+1][j] = true;  }  if(isValid(i, j-1) && !vis[i][j-1]) {   qq.add(new iPair(i, j-1));   vis[i][j-1] = true;  }  if(isValid(i, j+1) && !vis[i][j+1]) {   qq.add(new iPair(i, j+1));   vis[i][j+1] = true;  }  last = pp;  }  out.println(last.f + " " + last.s);  sc.close();  out.close(); }  public static boolean isValid(int i, int j) {  if(i < 1 || i > n || j < 1 || j > m) return false;  return true;  }  public static class Triplet implements Comparable<Triplet> {  int x;  int y;  int z;  Triplet(int x, int y, int z) {   this.x = x;   this.y = y;   this.z = z;  }  public int compareTo(Triplet o) {   return Integer.compare(this.x, o.x);  }  }  public static class iPair implements Comparable<iPair> {  int f;  int s;  iPair(int f, int s) {   this.f = f;   this.s = s;  }  public int compareTo(iPair o) {   return Integer.compare(this.f, o.f);  }  }   public static class Pair implements Comparable<Pair>{  long f;  long s;  Pair(long f, long s) {  this.f = f;  this.s = s;  }  public int compareTo(Pair o) {  return Long.compare(this.f, o.f);  } } public static void init(int n) {  adj = new ArrayList[n+1];  vis = new boolean[n+1];  parent = new int[n+1];  rank = new int[n+1];  for(int i = 0; i <= n; i++) {   adj[i] = new ArrayList<>();   parent[i] = i;  rank[i] = 0;  }  }   public static String mp(String s, int times) {  return String.valueOf(new char[times]).replace("\0", s); }   public static long log2(long k) {  return 63-Long.numberOfLeadingZeros(k);  }    public static void lambdaSort() {   Arrays.sort(arr, (a, b) -> Double.compare(a[0], b[0]));  }     public static long choose(long n, long k) {  return (k == 0) ? 1 : (n*choose(n-1, k-1))/k;  }    public static long gcd(long a, long b) {  return (a == 0) ? b : gcd(b%a, a);  }   public static long max(long... as) {   long max = Long.MIN_VALUE;   for (long a : as) max = Math.max(a, max);   return max;  }  public static long min(int... as) {   long min = Long.MAX_VALUE;   for (long a : as) min = Math.min(a, min);   return min;  }   public static long modpow(long x, long n, long mod) {  if(n == 0) return 1%mod;  long u = modpow(x, n/2, mod);  u = (u*u)%mod;  if(n%2 == 1) u = (u*x)%mod;  return u;  }   public static int lowerBound(long[] a, int x) {  int lo = 0;  int hi = a.length-1;  int ans = -1;  while(lo <= hi) {   int mid = (lo+hi)/2;   if(x < a[mid]) {   hi = mid-1;   } else if(x > a[mid]) {   lo = mid+1;   } else if(lo != hi) {    hi = mid-1;     ans = mid;   } else {   return mid;   }  }  return ans; }  public static int upperBound(long[] a, long x) {  int lo = 0;  int hi = a.length-1;  int ans = -1;  while(lo <= hi) {  int mid = (lo+hi)/2;  if(x < a[mid]) {   hi = mid-1;  } else if(x > a[mid]) {   lo = mid+1;  } else if(lo != hi) {   lo = mid+1;    ans = mid;  } else {   return mid;  }  }  return ans; }     public static void generatePrimes() {     Arrays.fill(seive_set, true);  seive_set[0] = false;  seive_set[1] = false;  for(int i = 2; i <= seive_size; i++) {  if(seive_set[i]) {   for(long j = (long) i*i; j <= seive_size; j+=i)    seive_set[(int)j] = false;   primes.add(i);  }  } }  public static boolean isPrime(long N) {  if(N <= seive_size) return seive_set[(int)N];  for (int i = 0; i < (int)primes.size(); i++)  if (N % primes.get(i) == 0) return false;  return true; }     public static void permute(String str) {  permute(str, 0, str.length()-1);  }  public static void permute(String str, int l, int r)  {   if (l == r)    System.out.println(str);   else   {    for (int i = l; i <= r; i++)    {     str = swap(str,l,i);     permute(str, l+1, r);     str = swap(str,l,i);    }   }  } public static String swap(String a, int i, int j)  {   char temp;   char[] charArray = a.toCharArray();   temp = charArray[i] ;   charArray[i] = charArray[j];   charArray[j] = temp;   return String.valueOf(charArray);  }        public static int find(int u) {  if(parent[u] == u) return u;  int v = find(parent[u]);  parent[u] = v;  return v;  } public static boolean connected(int u, int v) {  return find(u) == find(v); } public static void Union(int u, int v) {  int x = find(u);    int y = find(v);    if(x == y) return;  if(rank[x] == rank[y]) {  parent[y] = x;  rank[x]++;  }  else if(rank[x] > rank[y]) {  parent[y] = x;  }  else {  parent[x] = y;  }  }               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());}  String nextLine(){String str = "";  try {str = br.readLine();}  catch (IOException e) {e.printStackTrace();}  return str;}  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;   }   long[] nextLongArray(int n) {    long[] a = new long[n];    for (int i = 0; i < n; i++)     a[i] = nextLong();    return a;   } } }
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) {    String[] response = {"even", "odd"};    int n = in.nextInt();    int[] arr = in.nextIntArray(0, n);    int swaps = 0;    for (int i = 0; i < n; i++) {     for (int j = i + 1; j < n; j++) {      if (arr[i] > arr[j]) swaps = (swaps + 1) % 2;     }    }    int m = in.nextInt();    for (int i = 0; i < m; i++) {     int l = in.nextInt(), r = in.nextInt(), combinaisons = ((r - l) * (r - l + 1)) / 2;     if (combinaisons % 2 == 1) {      swaps ^= 1;     }     out.println(response[swaps]);    }   }  }  static class InputReader {   private StringTokenizer tokenizer;   private BufferedReader reader;   public InputReader(InputStream inputStream) {    reader = new BufferedReader(new InputStreamReader(inputStream));   }   private void fillTokenizer() {    if (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (Exception e) {      throw new RuntimeException(e);     }    }   }   public String next() {    fillTokenizer();    return tokenizer.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }   public int[] nextIntArray(int offset, int length) {    int[] arr = new int[offset + length];    for (int i = offset; i < offset + length; i++) {     arr[i] = nextInt();    }    return arr;   }  } }
1	public class C {  void solve(){   int n = readInt();   int q = readInt();   int max = 0;   int[] a = new int[n];   Deque<Integer> deque = new ArrayDeque<>();   for(int i = 0;i<n;i++){    a[i] = readInt();    deque.addLast(a[i]);    max = Math.max(max, a[i]);   }   List<String> ans = new ArrayList<>();   while(deque.peekFirst() != max){    int one = deque.pollFirst();    int two = deque.pollFirst();    ans.add(one + " " + two);    deque.addFirst(one > two ? one : two);    deque.addLast(one > two ? two : one);    if(one == max) break;   }   for(int i = 0;i<n;i++){    a[i] = deque.pollFirst();   }   for(int i = 0;i<q;i++){   long x = readLong();    if(x <= ans.size()){     out.println(ans.get((int)x - 1));     continue;    }    x -= ans.size();    int y =(int) (x%(n - 1) - 1%(n - 1) + (n - 1)) % (n - 1) + 1;    out.println(max + " " + a[y]);   }  }  public static void main(String[] args) {   new C().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();  }  int readInt(){   return Integer.parseInt(readString());  }  long readLong(){   return Long.parseLong(readString());  }  double readDouble(){   return Double.parseDouble(readString());  } }
1	public class B { static Set<Integer> A; static Set<Integer> B; static TreeSet<Integer> ts; static int a; static int b; static boolean noAns; public static void main(String[] args) throws Exception{  int n = readInt();  a = readInt();  b = readInt();  ts = new TreeSet<Integer>();  int[] table = new int[n];  for(int i = 0; i<n; i++){  table[i] = readInt();  ts.add(table[i]);  }  A = new HashSet<Integer>();  B = new HashSet<Integer>();  noAns = false;  for(Integer cur:ts){  boolean fitsA = false;  boolean fitsB = false;  if(A.contains(cur) || B.contains(cur)){   continue;  }  if(ts.contains(a-cur)){   fitsA = true;  }  if(ts.contains(b-cur)){   fitsB = true;  }  if(fitsA && fitsB){   continue;  }  else if(!(fitsA || fitsB)){   noAns = true;  }  else if(fitsA){   tour(cur, false);  }  else if(fitsB){   tour(cur, true);  }  }  for(Integer cur:ts){  if(A.contains(cur) || B.contains(cur)){   continue;  }  else{   A.add(cur);  }  }  if(!noAns){  System.out.println("YES");  StringBuilder sb = new StringBuilder();  for(int i = 0; i< n; i++){   if(A.contains(table[i])){   sb.append("0");   }   else{   sb.append("1");   }   sb.append(" ");  }  System.out.println(sb);  }  else{  System.out.println("NO");  } }  static void tour(Integer cur, boolean bb){  if(A.contains(cur) || B.contains(cur)){  return;  }  if(bb){  B.add(cur);  B.add(b-cur);    if(ts.contains(a-cur)){   B.add(a-cur);   if(ts.contains(b-(a-cur))){   tour(b-(a-cur), true);   }   else{   noAns = true;   }  }    if(ts.contains(a-(b-cur))){   B.add(a-(b-cur));   if(ts.contains(b-(a-(b-cur)))){   tour(b-(a-(b-cur)), true);   }   else{   noAns = true;   }  }  }  else{  A.add(cur);  A.add(a-cur);  if(ts.contains(b-cur)){   A.add(b-cur);   if(ts.contains(a-(b-cur))){   tour(a-(b-cur), false);   }   else{   noAns = true;   }  }  if(ts.contains(b-(a-cur))){   A.add(b-(a-cur));   if(ts.contains(a-(b-(a-cur)))){   tour(a-(b-(a-cur)), false);   }   else{   noAns = true;   }  }  } }  static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st = new StringTokenizer(" "); static String readString() throws Exception{  while(!st.hasMoreTokens()){  st = new StringTokenizer(stdin.readLine());  }  return st.nextToken(); } static int readInt() throws Exception {  return Integer.parseInt(readString()); } static long readLong() throws Exception {  return Long.parseLong(readString()); } }
3	public class A {  public static void main(String[] args) throws Exception {  FastScanner sc = new FastScanner(System.in);  FastPrinter out = new FastPrinter(System.out);  new A().run(sc, out);  out.close(); }  public void run(FastScanner sc, FastPrinter out) throws Exception {  int N = sc.nextInt();  int[] arr = sc.nextIntArray(N);  Arrays.sort(arr);  boolean[] done = new boolean[N];  int ans = 0;  for (int i = 0; i < N; i++) {  if (done[i]) continue;  ans++;  for (int j = i; j < N; j++) {   if (arr[j] % arr[i] == 0) {   done[j] = true;   }  }  }  out.println(ans); }  public void shuffle(int[] arr) {  for (int i = 0; i < arr.length; i++) {  int r = (int) (Math.random() * arr.length);  if (i != r) {   arr[i] ^= arr[r];   arr[r] ^= arr[i];   arr[i] ^= arr[r];  }  } }  static class FastScanner {  final private 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;  }  int[] nextIntArray(int N) throws IOException {  int[] arr = new int[N];  for (int i = 0; i < N; i++) {   arr[i] = nextInt();  }  return arr;  }  String nextLine() throws IOException {  int c = read();  while (c != -1 && isEndline(c))   c = read();  if (c == -1) {   return null;  }  StringBuilder res = new StringBuilder();  do {   if (c >= 0) {   res.appendCodePoint(c);   }   c = read();  } while (!isEndline(c));  return res.toString();  }  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;  }  public long nextLong() throws IOException {  long ret = 0;  byte c = read();  while (c <= ' ')   c = read();  boolean neg = (c == '-');  if (neg) c = read();  do {   ret = ret * 10 + c - '0';  } while ((c = read()) >= '0' && c <= '9');  if (neg) return -ret;  return ret;  }  public double nextDouble() throws IOException {  double ret = 0, div = 1;  byte c = read();  while (c <= ' ')   c = read();  boolean neg = (c == '-');  if (neg) c = read();   do {   ret = ret * 10 + c - '0';  } while ((c = read()) >= '0' && c <= '9');   if (c == '.') {   while ((c = read()) >= '0' && c <= '9') {   ret += (c - '0') / (div *= 10);   }  }   if (neg) return -ret;  return ret;  }  private void fillBuffer() throws IOException {  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();  }  public int[][] readGraph(int N, int M, boolean zeroIndexed, boolean bidirectional) throws Exception {  int[][] adj = new int[N][];  int[] numNodes = new int[N];  int[][] input = new int[M][2];  for (int i = 0; i < M; i++) {   int a = nextInt();   int b = nextInt();   if (zeroIndexed) {   a--;   b--;   }   input[i][0] = a;   input[i][1] = b;   numNodes[a]++;   if (bidirectional) numNodes[b]++;  }  for (int i = 0; i < N; i++) {   adj[i] = new int[numNodes[i]];   numNodes[i] = 0;  }  for (int i = 0; i < M; i++) {   int a = input[i][0];   int b = input[i][1];   adj[a][numNodes[a]++] = b;   if (bidirectional) adj[b][numNodes[b]++] = a;  }  return adj;  }  public int[][][] readWeightedGraph(int N, int M, boolean zeroIndexed, boolean bidirectional) throws Exception {  int[][][] adj = new int[N][][];  int[] numNodes = new int[N];  int[][] input = new int[M][3];  for (int i = 0; i < M; i++) {   int a = nextInt();   int b = nextInt();   if (zeroIndexed) {   a--;   b--;   }   int d = nextInt();   input[i][0] = a;   input[i][1] = b;   input[i][2] = d;   numNodes[a]++;   if (bidirectional) numNodes[b]++;  }  for (int i = 0; i < N; i++) {   adj[i] = new int[numNodes[i]][2];   numNodes[i] = 0;  }  for (int i = 0; i < M; i++) {   int a = input[i][0];   int b = input[i][1];   int d = input[i][2];   adj[a][numNodes[a]][0] = b;   adj[a][numNodes[a]][1] = d;   numNodes[a]++;   if (bidirectional) {   adj[b][numNodes[b]][0] = a;   adj[b][numNodes[b]][1] = d;   numNodes[b]++;   }  }  return adj;  } }  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 printf(String format, Object... args) {  buf.append(String.format(format, args));  }  public void close() {  pw.print(buf);  pw.close();  }  public void flush() {  pw.print(buf);  pw.flush();  buf.setLength(0);  }  } }
3	public class D {  static class FastWriter {   private final BufferedWriter bw;   public FastWriter() {    this.bw = new BufferedWriter(new OutputStreamWriter(System.out));   }   public void print(Object object) throws IOException {    bw.append("" + object);   }   public void println(Object object) throws IOException {    print(object);    bw.append("\n");   }   public void close() throws IOException {    bw.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();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   BigInteger nextBigInteger() {    try {     return new BigInteger(nextLine());    } catch (NumberFormatException e) {     throw new InputMismatchException();    }   }  }  public static void main(String[] args) throws IOException {   FastReader fr = new FastReader();   FastWriter fw = new FastWriter();   int n = fr.nextInt();   int m = fr.nextInt();   for (int r = 0; r < n / 2; r++) {    for (int c = 0; c < m; c++) {     fw.println((r + 1) + " " + (c + 1));     fw.println((n - r) + " " + (m - c));    }   }   if (n % 2 != 0) {    int r = n / 2;    for (int c = 0; c < m / 2; c++) {     fw.println((r + 1) + " " + (c + 1));     fw.println((r + 1) + " " + (m - c));    }    if (m % 2 != 0) fw.println((r + 1) + " " + (m / 2 + 1));   }   fw.close();  } }
0	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int in = sc.nextInt();   if(     in%4==0||     in%7==0||     in%44==0||     in%47==0||     in%74==0||     in%77==0||     in%444==0||     in%447==0||     in%474==0||     in%477==0||     in%744==0||     in%747==0||     in%774==0||     in%777==0       )    System.out.println("YES");   else System.out.println("NO");  } }
6	public class cf1209e1_2 {  public static void main(String[] args) throws IOException {   int t = ri();   while (t --> 0) {    int n = rni(), m = ni(), a[][] = new int[m][n], dp[] = new int[1 << n];    for (int i = 0; i < n; ++i) {     int[] row = ria(m);     for (int j = 0; j < m; ++j) {      a[j][i] = row[j];     }    }    for (int i = 0; i < m; ++i) {     for (int r = 0; r < 1 << n; ++r) {      for (int j = 0; j < n; ++j) {       if ((r & (1 << j)) == 0) {        continue;       }       dp[r] = max(dp[r], dp[r ^ (1 << j)] + a[i][j]);      }     }     for (int r = 0; r < 1 << n; ++r) {      int s = r;      for (int j = 0; j < n; ++j) {       if ((s & 1) != 0) {        s = (s >> 1) | (1 << (n - 1));       } else {        s >>= 1;       }       dp[s] = max(dp[s], dp[r]);      }     }    }    prln(dp[(1 << n) - 1]);   }   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 minof(int a, int b, int c) {return min(a, min(b, c));}  static int minof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); int min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static long minof(long a, long b, long c) {return min(a, min(b, c));}  static long minof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return min(x[0], x[1]); if (x.length == 3) return min(x[0], min(x[1], x[2])); long min = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] < min) min = x[i]; return min;}  static int maxof(int a, int b, int c) {return max(a, max(b, c));}  static int maxof(int... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); int max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static long maxof(long a, long b, long c) {return max(a, max(b, c));}  static long maxof(long... x) {if (x.length == 1) return x[0]; if (x.length == 2) return max(x[0], x[1]); if (x.length == 3) return max(x[0], max(x[1], x[2])); long max = x[0]; for (int i = 1; i < x.length; ++i) if (x[i] > max) max = x[i]; return max;}  static int powi(int a, int b) {if (a == 0) return 0; int ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static long powl(long a, int b) {if (a == 0) return 0; long ans = 1; while (b > 0) {if ((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}  static int fli(double d) {return (int) d;}  static int cei(double d) {return (int) ceil(d);}  static long fll(double d) {return (long) d;}  static long cel(double d) {return (long) ceil(d);}  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 lcm(int a, int b) {return a * b / gcf(a, b);}  static long lcm(long a, long b) {return a * b / gcf(a, b);}  static int randInt(int min, int max) {return __rand.nextInt(max - min + 1) + min;}  static long mix(long x) {x += 0x9e3779b97f4a7c15L; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9L; x = (x ^ (x >> 27)) * 0x94d049bb133111ebL; return x ^ (x >> 31);}   static void reverse(int[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {int swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(long[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {long swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(double[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {double swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  static void reverse(char[] a) {for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {char swap = a[i]; a[i] = a[n - i - 1]; a[n - i - 1] = swap;}}  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 void rsort(int[] a) {shuffle(a); sort(a);}  static void rsort(long[] a) {shuffle(a); sort(a);}  static void rsort(double[] a) {shuffle(a); sort(a);}  static int[] copy(int[] a) {int[] ans = new int[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static long[] copy(long[] a) {long[] ans = new long[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static double[] copy(double[] a) {double[] ans = new double[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}  static char[] copy(char[] a) {char[] ans = new char[a.length]; for (int i = 0; i < a.length; ++i) ans[i] = a[i]; return ans;}   static void r() throws IOException {input = new StringTokenizer(rline());}  static int ri() throws IOException {return Integer.parseInt(rline());}  static long rl() throws IOException {return Long.parseLong(rline());}  static double rd() throws IOException {return Double.parseDouble(rline());}  static int[] ria(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni(); return a;}  static int[] riam1(int n) throws IOException {int[] a = new int[n]; r(); for (int i = 0; i < n; ++i) a[i] = ni() - 1; return a;}  static long[] rla(int n) throws IOException {long[] a = new long[n]; r(); for (int i = 0; i < n; ++i) a[i] = nl(); return a;}  static double[] rda(int n) throws IOException {double[] a = new double[n]; r(); for (int i = 0; i < n; ++i) a[i] = nd(); return a;}  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 rnl() throws IOException {r(); return nl();}  static long nl() {return Long.parseLong(n());}  static double rnd() throws IOException {r(); return nd();}  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 pryes() {prln("yes");}  static void pry() {prln("Yes");}  static void prY() {prln("YES");}  static void prno() {prln("no");}  static void prn() {prln("No");}  static void prN() {prln("NO");}  static boolean pryesno(boolean b) {prln(b ? "yes" : "no"); return b;};  static boolean pryn(boolean b) {prln(b ? "Yes" : "No"); return b;}  static boolean prYN(boolean b) {prln(b ? "YES" : "NO"); return b;}  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 h() {prln("hlfd"); flush();}  static void flush() {__out.flush();}  static void close() {__out.close();} }
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 void run() {   try {    solve();   } catch (Throwable e) {    System.err.println(e.getMessage());    e.printStackTrace();    System.exit(666);   } finally {    output.flush();    output.close();   }  }   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());  }  private long nextLong() throws IOException {   return Long.parseLong(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; }
5	public class A {  public static void main(String[] args) {   Scanner s = new Scanner(new InputStreamReader(System.in));   int n = s.nextInt();   if (n == 1) {    System.out.println("NO");    System.exit(0);   }   int[] nums = new int[n];   for (int i = 0; i < n; i++) {    nums[i] = s.nextInt();   }   Arrays.sort(nums);   int x = 1;   while (x < n && nums[x] == nums[x - 1])    x++;   if (x == n) {    System.out.println("NO");    System.exit(0);   } else {    System.out.println(nums[x]);    System.exit(0);   }  } }
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);   F2SameSumBlocksHard solver = new F2SameSumBlocksHard();   solver.solve(1, in, out);   out.close();  }  static class F2SameSumBlocksHard {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    long[] a = in.nextLongArray(n);    long[] p = in.calculatePrefixSum(a);    Map<Long, Integer> map = new HashMap<>();    for (int i = 0; i < n; i++) {     long sum = 0;     for (int j = i; j < n; j++) {      sum += a[j];      map.merge(sum, 1, (x, y) -> x + y);     }    }     List<sum> sums = new ArrayList<>();    for (long sum : map.keySet()) {     sums.add(new sum(sum, map.get(sum)));    }    sums.sort((x, y) -> y.c - x.c);    int ans = -1;    int[] fca = null;    long mxsum = -1;    for (int i = 0; i < sums.size(); i++) {     sum cs = sums.get(i);     long sum = cs.sum;     long c = cs.c;     if (c < ans) {      continue;     }     Map<Long, Integer> lm = new HashMap<>();     int[] ca = new int[n];     lm.put(0l, -1);     for (int j = 0; j < n; j++) {      long val = p[j];      if (j > 0) {       ca[j] = ca[j - 1];      }      long req = val - sum;      if (lm.containsKey(req)) {       int li = lm.get(req);       if (li == -1)        ca[j] = Math.max(1, ca[j]);       else        ca[j] = Math.max(1 + ca[li], ca[j]);      }      lm.put(val, j);     }     if (ca[n - 1] > ans) {      ans = ca[n - 1];      mxsum = sum;      fca = ca;     }    }    List<Integer> al = new ArrayList<>();    long sum = 0;    for (int i = n - 1; i >= 0; i--) {     if (i > 0 && fca[i] != fca[i - 1]) {      sum = 0;      al.add(i + 1);      do {       sum += a[i];       i--;      } while (i >= 0 && sum != mxsum);      i++;      al.add(i + 1);     } else if (i == 0) {      if (a[i] == mxsum) {       al.add(i + 1);       al.add(i + 1);      }     }    }    out.println(al.size() / 2);    for (int i = al.size() - 1; i >= 0; i -= 2) {     out.println(al.get(i) + " " + al.get(i - 1));    }   }   class sum {    long sum;    int c;    public sum(long sum, int c) {     this.sum = sum;     this.c = c;    }   }  }  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 long[] nextLongArray(int n) {    long[] array = new long[n];    for (int i = 0; i < n; ++i) array[i] = nextLong();    return array;   }   public long[] calculatePrefixSum(long[] a) {    int n = a.length;    long[] prefixSum = new long[n];    prefixSum[0] = a[0];    for (int i = 1; i < n; i++) {     prefixSum[i] = prefixSum[i - 1] + a[i];    }    return prefixSum;   }   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 println(Object... objects) {    print(objects);    writer.println();   }   public void close() {    writer.close();   }   public void println(int i) {    writer.println(i);   }  } }
1	public class Main { BufferedReader in; PrintWriter out; StringTokenizer st;    void solve() throws IOException {  int n=ni();  int k=ni();  boolean[] t = new boolean[n+1];  for(int i=2;i<=n;i++){  t[i]=false;  }  int p=2;   while(true){  int pointer=2;  while(pointer*p<=n){  t[pointer*p]=true;  pointer++;  }  boolean flag=false;  for(int i=p+1;i<=n;i++){  if(!t[i]){p=i;flag=true;break;}  }  if(!flag)break;  }  List<Integer> lst=new ArrayList<Integer>();  int countN=0;  for(int i=1;i<=n;i++){  if(!t[i]){lst.add(i);countN++; }  }  int count=0;   String resulPO="NO";  for(int i=2;i<countN;i++){    boolean result=false;  for(int j=0;j<i;j++){   if(lst.get(j)+lst.get(j+1)+1==lst.get(i)){   result=true;      break;   }  }  if(result)count++;  }  if(count>=k)resulPO="YES";  else resulPO="NO";  out.print(resulPO);   }  public Main() throws IOException {  Locale.setDefault(Locale.US);  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  in.close();  out.close(); }  String ns() throws IOException {  while (st == null || !st.hasMoreTokens()) {  st = new StringTokenizer(in.readLine());  }  return st.nextToken(); }  int ni() throws IOException {  return Integer.valueOf(ns()); }  long nl() throws IOException {  return Long.valueOf(ns()); }  double nd() throws IOException {  return Double.valueOf(ns()); }  public static void main(String[] args) throws IOException {  new Main(); } }
1	public class F {  static void solve() throws Exception {  int n = scanInt();  long l[] = new long[n];  for (int i = 0; i < n; i++) {  l[i] = scanLong();  }  long e1 = 0, e2 = 0, ans = 0;  boolean water = false;  String types = scanString();  for (int i = 0; i < n; i++) {  long li = l[i], cur;  switch (types.charAt(i)) {  case 'G':   cur = min(e1, li);   e1 -= cur;   li -= cur;   e2 += 2 * cur;   ans += 2 * cur;   e2 += li;   ans += 3 * li;   break;  case 'W':   water = true;   e1 += li;   ans += 2 * li;   break;  case 'L':   cur = min(e1, li);   e1 -= cur;   li -= cur;   ans += 2 * cur;   cur = min(e2, li);   e2 -= cur;   li -= cur;   ans += 3 * cur;   ans += (water ? 4 : 6) * li;   break;  default:   throw new AssertionError();  }  }  out.print(ans); }  static int scanInt() throws IOException {  return parseInt(scanString()); }  static long scanLong() throws IOException {  return parseLong(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);  } } }
6	public class Main {  public static void main(String[] args) {   new Thread(null, new Runnable() {    public void run() {     new Main().solve();    }   }, "1", 1 << 26).start();  }  void solve() {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   FElongatedMatrix solver = new FElongatedMatrix();   solver.solve(1, in, out);   out.close();  }  static class FElongatedMatrix {   int[][] G;   int[][] G1;   public int findIt(int[] map, int n, int start) {    int[][] mask = new int[1 << n][n];    for (int i = 0; i < n; i++) mask[(1 << i)][i] = G[start][map[i]];    for (int i = 1; i < (1 << n); i++) {     for (int j = 0; j < n; j++) {      for (int k = 0; k < n; k++) {       if (k != j && (i & (1 << k)) == 0 && (i & (1 << j)) != 0) {        mask[(i | (1 << k))][k] = Math.max(mask[(i | (1 << k))][k], Math.min(mask[i][j], G[map[j]][map[k]]));       }      }     }    }    int ans = 0;    for (int i = 0; i < n; i++) ans = Math.max(ans, Math.min(mask[(1 << n) - 1][i], G1[start][map[i]]));    return ans;   }   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    int m = in.scanInt();    G = new int[n][n];    G1 = new int[n][n];    int[][] ar = new int[n][m];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      ar[i][j] = in.scanInt();     }    }    if (n == 1) {     int ans = Integer.MAX_VALUE;     for (int i = 0; i < m - 1; i++) ans = Math.min(ans, Math.abs(ar[0][i] - ar[0][i + 1]));     out.println(ans);     return;    }    for (int i = 0; i < n; i++) {     for (int j = i + 1; j < n; j++) {      int min = Integer.MAX_VALUE;      for (int k = 0; k < m; k++) min = Math.min(min, Math.abs(ar[i][k] - ar[j][k]));      G[i][j] = G[j][i] = min;     }    }    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      if (i == j) continue;      int min = Integer.MAX_VALUE;      for (int k = 1; k < m; k++) min = Math.min(min, Math.abs(ar[i][k] - ar[j][k - 1]));      G1[i][j] = min;     }    }    int[] map;    int ans = 0;    for (int i = 0; i < n; i++) {     map = new int[n - 1];     int tl = 0;     for (int temp = 0; temp < n; temp++) {      if (temp == i) continue;      map[tl++] = temp;     }     ans = Math.max(ans, findIt(map, n - 1, i));    }    out.println(ans);    }  }  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 P287B{ Scanner sc=new Scanner(System.in);  long n, k;  void run(){  n=sc.nextLong();  k=sc.nextLong();  solve(); }  void solve(){  long left=-1, right=k+1;  for(; right-left>1;){  long m=(left+right)/2;  long ub=k*(k+1)/2-(k-m)*(k-m+1)/2-(m-1);  if(ub>=n){   right=m;  }else{   left=m;  }  }  println(""+(right>k?-1:right)); }  void println(String s){  System.out.println(s); }  public static void main(String[] args){  Locale.setDefault(Locale.US);  new P287B().run(); } }
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 static boolean checkPrime(int n, int p) {   for (int i = 2; i <= Math.sqrt(n) && i <= p; i++) {    if (n % i == 0) {     return false;    }   }   return true;  }  public static void mergeArrays(int[] arr1, int[] arr2, int n1,    int n2, int[] arr3) {   int i = 0, j = 0, k = 0;   while (i < n1 && j < n2) {    if (arr1[i] < arr2[j]) {     arr3[k++] = arr1[i++];    } else {     arr3[k++] = arr2[j++];    }   }   while (i < n1) {    arr3[k++] = arr1[i++];   }   while (j < n2) {    arr3[k++] = arr2[j++];   }  }  public long GCD(long a, long b) {   if (b == 0) {    return a;   }   return GCD(b, a % b);  }  public static long nCr(int n, int r) {   return n * (n - 1) / 2;  }  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 double nextDouble() {    return Double.parseDouble(next());   }  } }
6	public class LookingOrder {  public static void main(String[] args) throws IOException{   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));   String[] line=in.readLine().split("\\s+");   int xs= Integer.parseInt(line[0]);   int ys= Integer.parseInt(line[1]);   int n=Integer.parseInt(in.readLine());   int []x=new int[n];   int []y=new int[n];   for(int i=0;i<n;++i){    line=in.readLine().split("\\s+");    x[i]= Integer.parseInt(line[0]);    y[i]= Integer.parseInt(line[1]);   }   int maxBitmap=1<<n;   long[] dis=new long[maxBitmap];   int[] last=new int[maxBitmap];   dis[0]=0;   int ci=0;   int[][] dismap=new int[n][n];     for(int i=0;i<n;++i){    for(int j=0;j<=i;++j){     int delx,dely;     if(i==j){      delx=x[i]-xs;      dely=y[i]-ys;     }else{      delx=x[i]-x[j];      dely=y[i]-y[j];     }     dismap[i][j]=delx*delx+dely*dely;    }   }     for(int i=1;i<maxBitmap;++i){    if((i&(1<<ci))==0)     ++ci;    int i2=i-(1<<ci);       long min=dis[i2]+2*dismap[ci][ci];    last[i]=ci;    for(int j=0;j<ci;++j){     if((i&(1<<j))!=0){      long m=dis[i2-(1<<j)]+dismap[ci][ci]+dismap[j][j]+dismap[ci][j];      if(m<min){       min=m;       last[i]=j;      }     }    }    dis[i]=min;   }     out.write(""+dis[maxBitmap-1]);   out.newLine();   out.write("0");     int bmap=maxBitmap-1;   ci=n-1;   while(bmap!=0){    while((bmap&(1<<ci))==0&&ci>=0)--ci;    int ci2=last[bmap];    if(ci2!=ci){     out.write(" "+(ci+1)+" "+(ci2+1)+ " 0");     bmap-=(1<<ci)+(1<<ci2);    }else{     out.write(" "+(ci+1)+" 0");     bmap-=1<<ci;    }   }   out.close();  } }
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]);  } }
0	public class A {   public static void main(String[] args) {  System.out.println(25); } }
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));   }  private static 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); } }
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);   }  }  private static 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);   }  } }
5	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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  } } class TaskA {  public void solve(int testNumber, MyScanner in, PrintWriter out) {   int n = in.nextInt();   int[] as = new int[n];   for (int i = 0; i < n; i++) as[i] = in.nextInt();   int[] sorted = as.clone();   ArrayUtils.sort(sorted);   int diff = 0;   for (int i = 0; i < n; i++)if(as[i]!=sorted[i])diff++;   if(diff<=2)out.println("YES");   else out.println("NO");  } } class MyScanner {  private final InputStream in;  public MyScanner(InputStream in){   this.in = in;  }  public int nextInt(){   try{    int c=in.read();    if(c==-1) return c;    while(c!='-'&&(c<'0'||'9'<c)){     c=in.read();     if(c==-1) return c;    }    if(c=='-') return -nextInt();    int res=0;    do{     res*=10;     res+=c-'0';     c=in.read();    }while('0'<=c&&c<='9');    return res;   }catch(Exception e){    return -1;   }  }   } class ArrayUtils {  public static void swap(int[] is, int i, int j) {   int t = is[i];   is[i] = is[j];   is[j] = t;  }  public static void shuffle(int[] S) {   Random rnd = r == null ? (r = new Random()) : r;   shuffle(S, rnd);  }  private static Random r;  private static void shuffle(int[] S, Random rnd) {   for (int i = S.length; i > 1; i--)    swap(S, i - 1, rnd.nextInt(i));  }   public static void sort(int[] a) {   shuffle(a);   Arrays.sort(a);  } }
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 SimpleCycles();   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++];  }  @Override  public void close() {   try {    stream.close();   } catch (IOException ignored) {   }  } } abstract class InputReader {  private boolean finished = false;  public abstract int read();  public int nextInt() {   return Integer.parseInt(nextToken());  }   public String nextToken() {   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;  }  public void setFinished(boolean finished) {   this.finished = finished;  }  public abstract void close(); } interface Solver {  public void solve(int testNumber, InputReader in, PrintWriter out); } class Exit {  private Exit() {  }  public static void exit(InputReader in, PrintWriter out) {   in.setFinished(true);   in.close();   out.close();  } } class SimpleCycles implements Solver {  public void solve(int testNumber, InputReader in, PrintWriter out) {   int n = in.nextInt();   int m = in.nextInt();   boolean[][] g = new boolean[n][n];   for (int i = 0; i < m; ++i) {    int u = in.nextInt();    int v = in.nextInt();    --u;    --v;    g[u][v] = g[v][u] = true;   }   HashMap<Integer, Integer> pointer = new HashMap<Integer, Integer> () ;   for (int i =0 ; i < n; ++i) {    pointer.put(1 << i, i);   }   long[][] dm = new long[1 << n][n];   for (int i = 0; i < n; ++i) {    dm[1 << i][i] = 1;   }   for (int i = 0; i < (1 << n); ++i) {    for (int j = 0; j < n; ++j) {     if (dm[i][j] == 0) continue;     int k = pointer.get(i - (i & (i - 1)));     for (int u = k + 1; u < n; ++u) {      if (g[j][u] && (i & (1 << u)) == 0) {       dm[i | (1 << u)][u] += dm[i][j];      }     }    }   }   long res = 0;   for (int i = 0; i < (1 << n); ++i) {    for (int j = 0; j < n; ++j)     if (Integer.bitCount(i) >= 3) {      int c = pointer.get(i - (i & (i - 1)));      if (g[c][j]) res += (long) dm[i][j];     }   }   out.print(res / 2);  } }
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();  }  static class PyraSort {   private static int heapSize;   public static void sort(int[] a) {    buildHeap(a);    while (heapSize > 1) {     swap(a, 0, heapSize - 1);     heapSize--;     heapify(a, 0);    }   }   private static void buildHeap(int[] a) {    heapSize = a.length;    for (int i = a.length / 2; i >= 0; i--) {     heapify(a, i);    }   }   private static void heapify(int[] a, int i) {    int l = 2 * i + 2;    int r = 2 * i + 1;    int largest = i;    if (l < heapSize && a[i] < a[l]) {     largest = l;    }    if (r < heapSize && a[largest] < a[r]) {     largest = r;    }    if (i != largest) {     swap(a, i, largest);     heapify(a, largest);    }   }   private static void swap(int[] a, int i, int j) {    a[i] ^= a[j] ^= a[i];    a[j] ^= a[i];   }  }  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 double nd() { return Double.parseDouble(ns()); }  private char nc() { return (char)skip(); }  private String ns()  {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b))){    sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }  private char[] ns(int n)  {   char[] buf = new char[n];   int b = skip(), p = 0;   while(p < n && !(isSpaceChar(b))){    buf[p++] = (char)b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }  private char[][] nm(int n, int m)  {   char[][] map = new char[n][];   for(int i = 0;i < n;i++)map[i] = ns(m);   return map;  }  private int[] na(int n)  {   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = ni();   return a;  }  private int ni()  {   int num = 0, b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private long nl()  {   long num = 0;   int b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  } }
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 swapBit(long x, int i, int j) {    int bi = bitAt(x, i);    int bj = bitAt(x, j);    x = setBit(x, i, bj == 1);    x = setBit(x, j, bi == 1);    return x;   }   public int swapBit(int x, int i, int j) {    int bi = bitAt(x, i);    int bj = bitAt(x, j);    x = setBit(x, i, bj == 1);    x = setBit(x, j, bi == 1);    return x;   }      public boolean subset(long x, long y) {    return intersect(x, y) == x;   }      public long merge(long x, long y) {    return x | y;   }   public long intersect(long x, long y) {    return x & y;   }   public long differ(long x, long y) {    return x - intersect(x, y);   }  }  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 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 long readLong() {    int sign = 1;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+' ? 1 : -1;     next = read();    }    long 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 double readDouble() {    boolean sign = true;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+';     next = read();    }    long val = 0;    while (next >= '0' && next <= '9') {     val = val * 10 + next - '0';     next = read();    }    if (next != '.') {     return sign ? val : -val;    }    next = read();    long radix = 1;    long point = 0;    while (next >= '0' && next <= '9') {     point = point * 10 + next - '0';     radix = radix * 10;     next = read();    }    double result = val + (double) point / radix;    return sign ? result : -result;   }   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 readLine(char[] data, int offset) {    int originalOffset = offset;    while (next != -1 && next != '\n') {     data[offset++] = (char) next;     next = read();    }    return offset - originalOffset;   }   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 char readChar() {    skipBlank();    char c = (char) next;    next = read();    return c;   }   public void flush() throws IOException {    os.write(cache.toString().getBytes(charset));    os.flush();    cache.setLength(0);   }   public boolean hasMore() {    skipBlank();    return next != -1;   }  }  public static class Debug {   private boolean allowDebug;   public Debug(boolean allowDebug) {    this.allowDebug = allowDebug;   }   public void assertTrue(boolean flag) {    if (!allowDebug) {     return;    }    if (!flag) {     fail();    }   }   public void fail() {    throw new RuntimeException();   }   public void assertFalse(boolean flag) {    if (!allowDebug) {     return;    }    if (flag) {     fail();    }   }   private void outputName(String name) {    System.out.print(name + " = ");   }   public void debug(String name, int x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, long x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, double x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, int[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, long[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, double[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, Object x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, Object... x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.deepToString(x));   }  } }
3	public class kosyaDetka {  public static void main(String[] args){   Scanner scan = new Scanner(System.in);   int t = scan.nextInt();   ArrayList<Integer> arr = new ArrayList<>();   for(int i = 0; i < t; i++){    arr.add( scan.nextInt());   }   int count = 0;   while (arr.size() != 0){    int min = Integer.MAX_VALUE;    for(int i = 0; i < arr.size(); i++){     int temp = arr.get(i);     if( temp < min){      min = temp;     }    }     for(int i = 0; i < arr.size(); i++){     int temp = arr.get(i);     if( temp % min == 0){      arr.remove(i);      i--;     }    }    count++;   }   System.out.println(count);  } }
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); } }
0	public class A {  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  long l = s.nextLong();  long r = s.nextLong();  s.close();   if (r-l<2 || (r-l==2 && l%2==1)) {  System.out.print("-1");  return;  }   long beg = l%2==0 ? l : l+1;  if (beg+2>r) System.out.print("-1");  else System.out.print(beg+" "+(beg+1)+" "+(beg+2)); } }
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 nextLine() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isEndOfLine(c));    return res.toString();   }   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();   }   double nextDouble()   {    return Double.parseDouble(next());   }   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 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;   }  } }
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));  }  }   }
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;   }  }  double nextDouble(){   return Double.parseDouble(next());  }  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;   }  }  String nextLine(){   try{    StringBuilder res = new StringBuilder("");    int c = System.in.read();    while(c == '\r' || c == '\n')     c = System.in.read();    do{     res.append((char)c);     c = System.in.read();    }while(c != '\r' && c != '\n');    return res.toString();   }catch(Exception e){    return null;   }  }  public static void main(String[] args){   new TaskC().run();  } }
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(); } }
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  @SuppressWarnings("Duplicates")  class TaskD {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int[] a = in.nextIntArray(n);    int m = in.nextInt();    int count = 0;    for (int i = 0; i < n; i++) {     for (int j = i + 1; j < n; j++) {      if (a[i] > a[j]) count = (count + 1) % 2;     }    }    StringBuilder res = new StringBuilder();    int l, r, temp;    while (m-- > 0) {     l = in.nextInt() - 1;     r = in.nextInt() - 1;     for (int i = 0; i < (r - l + 1) / 2; i++) {      temp = a[l + i];      a[l + i] = a[r - i];      a[r - i] = temp;     }     count = count ^ (((r - l + 1) * (r - l) / 2) % 2);     res.append(count == 1 ? "odd" : "even").append('\n');    }    out.print(res);   }  }  static class InputReader {   private final BufferedReader reader;   private StringTokenizer tokenizer;   public InputReader(InputStream in) {    reader = new BufferedReader(new InputStreamReader(in));   }   public int[] nextIntArray(int size) {    int[] array = new int[size];    for (int i = 0; i < size; ++i) {     array[i] = nextInt();    }    return array;   }   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 Main {  public static void main(String[] args) throws IOException {   InputStream input = System.in;   OutputStream output = System.out;   InputReader in = new InputReader(new FileReader(new File("input.txt")));   PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));   Solution s = new Solution();   s.solve(1, in, out);   out.close();  }  static class Solution {   static int[][] grid;   static int[] dx = {0, 0, 1, -1};   static int[] dy = {1, -1, 0, 0};   static int n, m;   public void solve(int cs, InputReader in, PrintWriter out) {    n = in.nextInt();    m = in.nextInt();    int k = in.nextInt();    grid = new int[n][m];    for (int[] d : grid)     Arrays.fill(d, -1);    for (int i = 0; i < k; i++) {     Pair tree = new Pair(in.nextInt()-1, in.nextInt()-1);     bfs(tree);    }    int max = 0, idx1 = 0, idx2 = 0;    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      if (grid[i][j] > max) {       max = grid[i][j];       idx1 = i;       idx2 = j;      }     }    }    out.printf("%d %d%n", idx1+1, idx2+1);    }   public boolean isValid(int i, int j) {    return i >= 0 && i < n && j >= 0 && j < m;   }    static class Pair {    int x, y;    public Pair(int x, int y) {     this.x = x;     this.y = y;    }   }   public void bfs(Pair src) {    Queue<Pair> q = new LinkedList<>();    grid[src.x][src.y] = 0;    q.add(src);    while (!q.isEmpty()) {     Pair p = q.poll();     for (int k = 0; k < 4; k++) {      int nx = p.x+dx[k];      int ny = p.y+dy[k];      if (isValid(nx, ny)) {       if (grid[nx][ny] > grid[p.x][p.y]+1 || grid[nx][ny] == -1) {        grid[nx][ny] = grid[p.x][p.y] + 1;        q.add(new Pair(nx, ny));       }      }     }    }   }  }  static class InputReader {   BufferedReader br;   StringTokenizer st;   public InputReader(InputStream i) {    br = new BufferedReader(new InputStreamReader(i), 32768);    st = null;   }     public InputReader(FileReader s) {    br = new BufferedReader(s);    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());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    try {     return br.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }   }  } }
5	public class A {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  void solve() throws IOException {   int n = nextInt();   int[] a = new int[n];   boolean onlyOnes = true;   for (int i = 0; i < n; i++) {    a[i] = nextInt();    if (a[i] != 1)     onlyOnes = false;   }   Arrays.sort(a);   if (onlyOnes) {    for (int i = 0; i < n - 1; i++)     out.print("1 ");    out.print(2);   } else {    out.print("1 ");    for (int i = 0; i < n - 1; i++)     out.print(a[i] + " ");   }  }  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 A().inp();  }  String nextToken() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return "0";    }   }   return st.nextToken();  }  String nextString() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return "0";    }   }   return st.nextToken("\n");  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, Scanner in, PrintWriter out) {    int n = in.nextInt();    int[] a = new int[n];    BigInteger sum = new BigInteger("0");    for (int i = 0; i < n; ++i) {     a[i] = in.nextInt();     long tmp = ((long) (2 * i + 1 - n)) * a[i];     sum = sum.add(BigInteger.valueOf(tmp));    }    Map<Integer, Integer> cnt = new HashMap<>();    for (int i = n - 1; i >= 0; --i) {     if (cnt.containsKey(a[i] + 1)) {      sum = sum.subtract(BigInteger.valueOf(cnt.get(a[i] + 1)));     }     if (cnt.containsKey(a[i] - 1)) {      sum = sum.add(BigInteger.valueOf(cnt.get(a[i] - 1)));     }     if (cnt.containsKey(a[i])) {      cnt.put(a[i], cnt.get(a[i]) + 1);     } else {      cnt.put(a[i], 1);     }    }    out.println(sum);   }  } }
5	public class Solution implements Runnable{  private static BufferedReader br = null;  private static PrintWriter out = null;  private static StringTokenizer stk = null;   public static void main(String[] args) {   br = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   (new Thread(new Solution())).start();  }   private void loadLine() {   try {    stk = new StringTokenizer(br.readLine());   }   catch (IOException e) {    e.printStackTrace();   }  }   private String nextLine() {   try {    return br.readLine();   }   catch (IOException e) {    e.printStackTrace();   }   return null;  }   private Integer nextInt() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return Integer.parseInt(stk.nextToken());  }   private Long nextLong() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return Long.parseLong(stk.nextToken());  }   private String nextWord() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return (stk.nextToken());  }   private Double nextDouble() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return Double.parseDouble(stk.nextToken());  }   public void run() {   int n = nextInt();   int t = nextInt();     double[] d = new double[2*n];   for (int i = 0; i < n; ++i) {    double x = nextDouble();    double a = nextDouble();    d[2*i] = x-a/2;    d[2*i+1] = x+a/2;   }     Arrays.sort(d);   int res = 2;   for (int i = 1; i < 2*n-1; i+=2) {    if (d[i+1] - d[i] >= t) {     ++res;    }    if (d[i+1] - d[i] > t) {     ++res;    }   }     out.println(res);   out.flush();  } }
5	public class Main { public static void main (String[]args) {  Scanner read = new Scanner (new BufferedInputStream (System.in));  int n = read.nextInt();  int[]arr = new int[n];  int sum=0;  int sum2=0;  int coin=0;  for(int i=0;i<n;i++)  {  arr[i] = read.nextInt();  sum+=arr[i];  }  Arrays.sort(arr);  for(int i=n-1;i>=0;i--)  {  sum2+=arr[i];  sum-=arr[i];  coin++;  if(sum2>sum)   break;  }  System.out.println(coin); } }
3	public class TaskA implements Runnable {  long m = (int) 1e9 + 7;  PrintWriter w;  InputReader c;    public void run() {   c = new InputReader(System.in);   w = new PrintWriter(System.out);   int n = c.nextInt();   int a[] = scanArrayI(n);   boolean vis[] = new boolean[n];   Arrays.sort(a);   int ans=0;   for(int i=0;i<n;i++){    if(vis[i]) continue;    vis[i] = true;    for(int j=i+1;j<n;j++){     if(a[j]%a[i] == 0){      vis[j] = true;     }    }    ans++;    boolean check = false;    for(int j=0;j<n;j++){     if(!vis[j]) check = true;    }    if(!check) break;   }   w.println(ans);   w.close();  }  class pair{   int x,y,step;   @Override   public String toString() {    return "pair{" +      "x=" + x +      ", y=" + y +      ", step=" + step +      '}';   }   public pair(int x, int y, int s) {    this.x = x;    this.y = y;    step = s;   }  }   class HashMapUtil<T, U> {   void addHash(HashMap<T, Integer> hm, T a) {    if (hm.containsKey(a)) hm.put(a, hm.get(a) + 1);    else hm.put(a, 1);   }   void iterateHashMap(HashMap<T, U> hm) {    for (Map.Entry<T, U> e : hm.entrySet()) {     T key = e.getKey();     U value = e.getValue();    }   }  }  public int search(int input[], int search) {   int low = 0;   int high = input.length - 1;   int mid;   while (low <= high) {    mid = low + ((high - low) / 2);    if (input[mid] == search) {     return mid;    } else if (input[mid] < search) {     low = mid + 1;    } else {     high = mid - 1;    }   }   return -1;  }  public void sort(int arr[]) {   int n = arr.length, mid, h, s, l, i, j, k;   int[] res = new int[n];   for (s = 1; s < n; s <<= 1) {    for (l = 0; l < n - 1; l += (s << 1)) {     h = min(l + (s << 1) - 1, n - 1);     mid = min(l + s - 1, n - 1);     i = l;     j = mid + 1;     k = l;     while (i <= mid && j <= h) res[k++] = (arr[i] <= arr[j] ? arr[i++] : arr[j++]);     while (i <= mid) res[k++] = arr[i++];     while (j <= h) res[k++] = arr[j++];     for (k = l; k <= h; k++) arr[k] = res[k];    }   }  }  public int nextPowerOf2(int num) {   if (num == 0) {    return 1;   }   if (num > 0 && (num & (num - 1)) == 0) {    return num;   }   while ((num & (num - 1)) > 0) {    num = num & (num - 1);   }   return num << 1;  }  static long gcd(long a, long b) {   if (b == 0)    return a;   return gcd(b, a % b);  }  public static void sortbyColumn(int arr[][], int col) {   Arrays.sort(arr, new Comparator<int[]>() {    public int compare(int[] o1, int[] o2) {     return (Integer.valueOf(o1[col]).compareTo(o2[col]));    }   });  }  public void printArray(int[] a) {   for (int i = 0; i < a.length; i++)    w.print(a[i] + " ");   w.println();  }  public int[] scanArrayI(int n) {   int a[] = new int[n];   for (int i = 0; i < n; i++)    a[i] = c.nextInt();   return a;  }  public long[] scanArrayL(int n) {   long a[] = new long[n];   for (int i = 0; i < n; i++)    a[i] = c.nextLong();   return a;  }  public void printArray(long[] a) {   for (int i = 0; i < a.length; i++)    w.print(a[i] + " ");   w.println();  }  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private SpaceCharFilter filter;   private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   public InputReader(InputStream stream) {    this.stream = stream;   }   public int read() {    if (numChars == -1)     throw new InputMismatchException();    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (numChars <= 0)      return -1;    }    return buf[curChar++];   }   public String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   public int nextInt() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));    return res * sgn;   }   public long nextLong() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));    return res * sgn;   }   public double nextDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, nextInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, nextInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }   public String readString() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    }    while (!isSpaceChar(c));    return res.toString();   }   public boolean isSpaceChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public String next() {    return readString();   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  public static void main(String args[]) throws Exception {   new Thread(null, new TaskA(), "TaskA", 1 << 26).start();  } }
5	public class round111A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int [] coins = new int [n];   for(int i = 0 ; i < n ; ++i)    coins[i] = sc.nextInt();   Arrays.sort(coins);   int ans = (int)1e9;   for(int i = 1 ; i <= n ; ++i){    int sum1 = 0;    int c = 0;    int j = n - 1;    for(j = n - 1 ; j >= 0 && c < i ; --j, ++c){     sum1 += coins[j];    }    int sum2 = 0;    for(int k = 0 ; k <= j ; ++k)     sum2 += coins[k];    if(sum1 > sum2){     System.out.println(i);     return;    }   }  } }
3	public class Main {  public static void main(String[] args) throws Exception {   Scanner sc = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int n = sc.nextInt();   Integer[] a = new Integer[n];   for (int i = 0; i < n; i++)    a[i] = sc.nextInt();   int ans = 0;   boolean[] taken = new boolean[n];   Arrays.sort(a);   for (int i = 0; i < n; i++) {    if (taken[i]) continue;    ans++;    for (int j = i; j < n; j++)     if (a[j] % a[i] == 0) taken[j] = true;   }   out.println(ans);   out.flush();   out.close();  }   static class Scanner {   StringTokenizer st;   BufferedReader br;   public Scanner(InputStream system) {    br = new BufferedReader(new InputStreamReader(system));   }   public Scanner(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 String nextLine() throws IOException {    return br.readLine();   }   public int nextInt() throws IOException {    return Integer.parseInt(next());   }   public double nextDouble() throws IOException {    return Double.parseDouble(next());   }   public char nextChar() throws IOException {    return next().charAt(0);   }   public Long nextLong() throws IOException {    return Long.parseLong(next());   }   public boolean ready() throws IOException {    return br.ready();   }   public void waitForInput() throws InterruptedException {    Thread.sleep(3000);   }  } }
1	public class ProblemA {  public static void main(String[] args) throws Exception{  BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  PrintWriter writer = new PrintWriter(System.out);  int n = Integer.parseInt(reader.readLine());  String [] split = reader.readLine().split("\\s+");  int value;  int [] count = new int[2];  int [] pos = new int[2];  for(int i = 0; i < split.length; i++){  value = Integer.parseInt(split[i]);  count[value % 2] ++;  pos[value % 2] = i + 1;  }  writer.println((count[0] == 1) ? pos[0] : pos[1]);  writer.flush();  writer.close(); } }
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 char nextChar() {  return next().charAt(0);  }    public int nextInt() {  return Integer.parseInt(next());  }   public long nextLong() {  return Long.parseLong(next());  }   public double nextDouble() {  return Double.parseDouble(next());  }   public String nextLine() {  line = null;  return readLine();  }   public String [] nextStrings() {  line = null;  return readLine().split(" ");  }   public char [] nextChars() {  return next().toCharArray();  }  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 cprint(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); }  void NO() {  throw new Error("NO!"); }    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(); } }
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());  }  public boolean hasNext() throws IOException {   int res=tokenizer.nextToken();   tokenizer.pushBack();   return res!=tokenizer.TT_EOF;  } }
6	public class c8 {  static int n;  static int[] ds;  static int[][] g; public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int x = input.nextInt(), y = input.nextInt();  int n = input.nextInt();  int[] xs = new int[n], ys = new int[n];  for(int i = 0; i<n; i++)  {   xs[i] = input.nextInt();   ys[i] = input.nextInt();  }  ds = new int[n];  g = new int[n][n];  for(int i = 0; i<n; i++)  {   ds[i] = (x - xs[i]) * (x - xs[i]) + (y - ys[i]) * (y - ys[i]);   for(int j = 0; j<n; j++)   {    g[i][j] = (xs[i] - xs[j]) * (xs[i] - xs[j]) + (ys[i] - ys[j]) * (ys[i] - ys[j]);   }  }  int[] dp = new int[1<<n];  Arrays.fill(dp, 987654321);  dp[0] = 0;  for(int i = 0; i<(1<<n); i++)  {   if(dp[i] == 987654321) continue;   for(int a = 0; a<n; a++)   {    if((i & (1<<a)) > 0) continue;    dp[i | (1<<a)] = Math.min(dp[i | (1<<a)], dp[i] + 2*ds[a]);    for(int b = a+1; b<n; b++)    {     if((i & (1<<b)) > 0) continue;     dp[i | (1<<a) | (1<<b)] = Math.min(dp[i | (1<<a) | (1<<b)], dp[i] + ds[a] + ds[b] + g[a][b]);    }    break;   }  }  Stack<Integer> stk = new Stack<Integer>();  stk.add(0);  int i = (1<<n) - 1;    trace:  while(i > 0)  {     for(int a = 0; a<n; a++)   {    if((i & (1<<a)) == 0) continue;    if( dp[i] == dp[i - (1<<a)] + 2*ds[a])    {     stk.add(a+1);     stk.add(0);     i -= (1<<a);     continue trace;    }    for(int b = a+1; b<n; b++)    {     if((i & (1<<b)) == 0) continue;     if(dp[i] == dp[i - (1<<a) - (1<<b)] + ds[a] + ds[b] + g[a][b])     {      stk.add(a+1);      stk.add(b+1);      stk.add(0);      i -= (1<<a) + (1<<b);      continue trace;     }    }      }  }  System.out.println(dp[(1<<n) - 1]);  while(!stk.isEmpty()) System.out.print(stk.pop()+" "); } }
2	public class ReallyBigNumbers {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  long n = scan.nextLong();  long s = scan.nextLong();  long ans = 0;  long l = 0;   long r = n;   while (l <= r) {       long mid = l + (r - l) / 2;    if(isReallyBig(mid, s)){    ans = mid;    r = mid-1;    }    else l = mid+1;   }   if(ans == 0) System.out.println(ans);   else   System.out.println(n-ans+1); }  static boolean isReallyBig(long m, long s){  String x = m+"";  long sum = 0;  for(int i = 0; i < x.length(); i++){  sum += x.charAt(i)-'0';  }  if(m-sum >= s) return true;  return false; } }
3	public class C {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   int n = s.nextInt();   List<String> commands = IntStream.range(0, n).boxed().map(x -> s.next()).collect(Collectors.toList());   List<Integer> ways = new ArrayList<>();   ways.add(1);   boolean lastWasS = false;   for (String command : commands) {    boolean isS = "s".equals(command);    if (lastWasS) {     for (int i = 1; i < ways.size(); ++i) {      int waysNumber = (ways.get(i-1) + ways.get(i)) % 1_000_000_007;      ways.set(i, waysNumber);     }    }    if (!isS) {     ways.add(0);    }    lastWasS = isS;   }   System.out.println(ways.stream().reduce(0, (a, b) -> (a + b) % 1_000_000_007));  } }
4	public class Main {  public static void process()throws IOException  {   int n=ni();   int[]A=new int[n];   int point = -1;   for(int _i=0;_i<n;_i++){    int x =ni();    if(x==1){     point++;     A[point]=1;    }    else{     while(x!=A[point]+1){      A[point]=0;      point--;     }    }    A[point]=x;    for(int i=0;i<point;i++)     p(A[i]+".");    pn(A[point]);   }  }   static AnotherReader sc;  static PrintWriter out;  public static void main(String[]args)throws IOException  {   boolean oj = System.getProperty("ONLINE_JUDGE") != null;   if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}   else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}   int t=1;   t=ni();   while(t-- > 0) {process();}   out.flush();out.close();  }  static void pn(Object o){out.println(o);}  static void p(Object o){out.print(o);}  static void pni(Object o){out.println(o);out.flush();}  static int ni()throws IOException{return sc.nextInt();}  static long nl()throws IOException{return sc.nextLong();}  static double nd()throws IOException{return sc.nextDouble();}  static String nln()throws IOException{return sc.nextLine();}  static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}  static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}  static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}  static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}  static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}   static class AnotherReader{BufferedReader br; StringTokenizer st;  AnotherReader()throws FileNotFoundException{  br=new BufferedReader(new InputStreamReader(System.in));}  AnotherReader(int a)throws FileNotFoundException{  br = new BufferedReader(new FileReader("input.txt"));}  String next()throws IOException{  while (st == null || !st.hasMoreElements()) {try{  st = new StringTokenizer(br.readLine());}  catch (IOException e){ e.printStackTrace(); }}  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()); }  String nextLine() throws IOException{ String str = ""; try{  str = br.readLine();} catch (IOException e){  e.printStackTrace();} return str;}}   }
5	public class LittleElephantAndProblem {  boolean DEBUG = true;  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringBuilder out = new StringBuilder();  StringTokenizer st = null;  String s() throws IOException {   if (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int i() throws IOException {   return Integer.parseInt(s());  }  int i(String s) throws IOException {   return Integer.parseInt(s);  }  long l() throws IOException {   return Long.parseLong(s());  }  long l(String s) throws IOException {   return Long.parseLong(s);  }  double d() throws IOException {   return Double.parseDouble(s());  }  double d(String s) throws IOException {   return Double.parseDouble(s);  }  void D(Object a) {   if (DEBUG) {    int len = getLength(a);    for (int i = 0; i < len; ++i) {     System.out.print(get(a, i) + " ");    }    System.out.println();   }  }  void D(Object[] a) {   if (DEBUG) {    int R = getLength(a), C = getLength(get(a, 0));    for (int i = 0; i < R; ++i) {     for (int j = 0; j < C; ++j) {      System.out.print(get(get(a, i), j) + " ");     }     System.out.println();    }   }  }  void D(String args) {   if (DEBUG) {    System.out.print(args);   }  }  void D(String format, Object... args) {   if (DEBUG) {    System.out.printf(format, args);   }  }  void fl() {   System.out.print(out);  }  int n = i();  public LittleElephantAndProblem() throws IOException {   List<Integer> a = new ArrayList<Integer>();   List<Integer> b = new ArrayList<Integer>();   for (int i = 0; i < n; ++i) {    int x = i();    a.add(x);    b.add(x);   }   sort(b);   int d = 0;   for (int i = 0; i < n; ++i) {    if ((int)a.get(i) != (int)b.get(i)) {     ++d;    }   }   if (d > 2) {    out.append("NO\n");   } else {    out.append("YES\n");   }   fl();  }  public static void main(String[] args) throws IOException {   new LittleElephantAndProblem();  } }
1	public class Noldbach { public Scanner in = new Scanner(System.in); public PrintStream out = System.out;  public boolean[] yes; public int n, k;  public void main() {  n = in.nextInt();  k = in.nextInt();   genPrime();  int i;   yes = new boolean[n+1];   int x;  for(i=0;i+1<prime.length;++i)  {  x = prime[i]+prime[i+1]+1;  if(x <= n && fac[x] == x) yes[x] = true;  }   int count = 0;  for(i=0;i<yes.length;++i) if(yes[i]) ++count;   out.println((count>=k?"YES":"NO")); }   public int N = 100000+100; public int[] fac, rest; public int[] prime;  public void genPrime() {  ArrayList<Integer> ap = new ArrayList<Integer>();  fac = new int[N];  rest = new int[N];   int x,y;  for(x=0;x<N;++x)  {  fac[x] = x;  rest[x] = 1;  }   for(x=2;x<N;++x)  if(fac[x]==x)  {  ap.add(x);  for(y=x+x;y<N;y+=x)  if(fac[y]==y)  {   fac[y] = x;   rest[y] = y/x;  }  }   prime = new int[ap.size()];  for(int i=0;i<prime.length;++i) prime[i] = ap.get(i); }    public static void main(String[] args) {  (new Noldbach()).main(); } }
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));  }  } }
3	public class ROUGH {  public static class FastReader {  BufferedReader br;  StringTokenizer st;     public FastReader() {  br = new BufferedReader(new InputStreamReader(System.in));  }  String next() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (Exception r) {   r.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  long nextLong() {  return Long.parseLong(next());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (Exception r) {   r.printStackTrace();  }  return str;  } }  public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out)); static long mod = (long) (1e9+7); static int N = (int) 1e5;  public static void main(String[] args) {  FastReader sc = new FastReader();  int n = sc.nextInt();  int[] a = new int[n];  TreeSet<Integer> set = new TreeSet<Integer>();  for(int i=0;i<n;++i) {   a[i] = sc.nextInt();   set.add(a[i]);  }  long ans = 0;  while(set.size() > 0) {   ++ans;   int min = set.first();   TreeSet<Integer> temp = new TreeSet<>();   for(int x : set) {   if(x%min != 0) temp.add(x);   }   set = temp;     }  out.print(ans);    out.close(); }  }
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());  }  public double getDouble() {  return Double.parseDouble(nextToken());  }  public long getLong() { return Long.parseLong(nextToken());  }  public String getWord() { return 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;  } }
1	public class 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[] list = new int[n];  for(int i = 0; i < list.length; i++)  list[i] = Integer.parseInt(st.nextToken());  int odd = 0;  int even = 0;  for(int x: list)  if(x%2==1) {   odd++;  }  else {   even++;  }  for(int i = 1; i <= list.length; i++) {  if(list[i-1]%2==1 && odd == 1) {   System.out.println(i);   return;  }  else if(list[i-1]%2 == 0 && even == 1){   System.out.println(i);   return;  }  } } }
4	public class Main{ public static void main(String[] args)throws FileNotFoundException,IOException{  File file = new File("input.txt");  Scanner sc = new Scanner(file);  File outFile = new File("output.txt");  PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(outFile)));  int w = sc.nextInt();  int h = sc.nextInt();  boolean[][] map = new boolean[h+1][w+1];   int x = -1, y = -1;  Queue<Point> open = new LinkedList<Point>();  int k = sc.nextInt();  for(int i=0;i<k;i++){  int tx = sc.nextInt();  int ty = sc.nextInt();  map[ty][tx] = true;  x = tx;  y = ty;  open.add(new Point(x,y));  }  int dx[] = {1,-1,0,0};  int dy[] = {0,0,1,-1};  while(!open.isEmpty()){  Point p = open.poll();   for(int i=0;i<4;i++){   int nx = p.x + dx[i];   int ny = p.y + dy[i];   if(nx>0 && nx<=w && ny>0 && ny<=h && !map[ny][nx]){   map[ny][nx] = true;   x = nx;   y = ny;   open.add(new Point(nx,ny));   }  }  }  pw.println(x + " " + y);  pw.close(); } }
3	public class Solution {   static MyScanner sc;  private static PrintWriter out;  static long M2 = 1_000_000_000L + 7;  private static HashMap<Long, Long>[] mods;  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();  }   private static void solve() throws IOException {   int n = sc.nextInt();   boolean[] k = new boolean[n];   for (int r = 0; r < n; r++) {    k[r] = sc.next().charAt(0) == 'f';   }   if (k[n - 1]) {    out.println(0);    return;   }   long[][] res = new long[n + 1][n + 1];   res[0][0] = 1;   for (int t = 0; t < n; t++) {    boolean pl = t != 0 && k[t - 1];    if (pl) {     System.arraycopy(res[t], 0, res[t + 1], 1, n);    } else {     long last = 0;     for (int f = n; f >= 0; f--) {      last += res[t][f];      last %= M2;      res[t + 1][f] = last;     }    }   }   long pp = 0;   for (long kk : res[n]) {    pp += kk;    pp %= M2;   }   out.println(pp);  }  private static void initData() {   }  static char[][] data;  static String cmd;  private static final class STree {   private final Comparator<Integer> comparator;   int[] val1;   int[] from1;   int[] to1;   int[] max1;   public STree(int c, Comparator<Integer> comparator) {    this.comparator = comparator;    int size = Integer.highestOneBit(c);    if (size != c) {     size <<= 1;    }    int rs = size << 1;    val1 = new int[rs];    from1 = new int[rs];    max1 = new int[rs];    to1 = new int[rs];    Arrays.fill(from1, Integer.MAX_VALUE);    for (int r = rs - 1; r > 1; r--) {     if (r >= size) {      from1[r] = r - size;      to1[r] = r - size;     }     from1[r / 2] = Math.min(from1[r / 2], from1[r]);     to1[r / 2] = Math.max(to1[r / 2], to1[r]);    }   }   public int max(int from, int to) {    return max(1, from, to);   }   private int max(int cur, int from, int to) {    if (cur >= val1.length) return -1;    if (from <= from1[cur] && to1[cur] <= to) {     return max1[cur];    }    if (from1[cur] > to || from > to1[cur]) {     return -1;    }    cur <<= 1;    return max0(max(cur, from, to), max(cur + 1, from, to));   }    public void put(int x, int val) {    x += val1.length >> 1;    val1[x] = val;    max1[x] = val;    addToParent(x);   }    private void addToParent(int cur) {    while (cur > 1) {     cur >>= 1;     max1[cur] = max0(max1[cur << 1], max1[1 + (cur << 1)]);    }   }   private int max0(int i, int i1) {    if (i == -1) return i1;    if (i1 == -1) return i;    return comparator.compare(i, i1) > 0 ? i1 : i;   }  }   private static boolean isset(long i, int k) {   return (i & (1 << k)) > 0;  }  private static void solveT() throws IOException {   int t = sc.nextInt();   while (t-- > 0) {    solve();   }  }   private static long gcd(long l, long l1) {   if (l > l1) return gcd(l1, l);   if (l == 0) return l1;   return gcd(l1 % l, l);  }  private static 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();   }   Integer[] nab(int n) {    Integer[] k = new Integer[n];    for (int i = 0; i < n; i++) {     k[i] = sc.fi();    }    return k;   }   int[] na(int n) {    int[] k = new int[n];    for (int i = 0; i < n; i++) {     k[i] = sc.fi();    }    return k;   }   long[] nl(int n) {    long[] k = new long[n];    for (int i = 0; i < n; i++) {     k[i] = sc.nextLong();    }    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());   }   double nextDouble() {    return Double.parseDouble(next());   }  }  }
1	public class Abra { void solve() throws IOException {  int n = nextInt();  br.readLine();  int h = 0, t = 0;  String s = br.readLine();  for (int i = 0; i < n; i++) {  if ((char)s.charAt(i) == 'H') h++; else t++;  }  int m = 10001;  for (int j = 0; j < n; j++) {  int z = 0;  for (int i = 0; i < n; i++) {   if (i + 1 <= h) {   if (s.charAt((i + j) % n) != 'H') z++;   } else {   if (s.charAt((i + j) % n) != 'T') z++;   }  }  if (z < m) m = z;  }  out.println(m / 2); }  public static void main(String[] args) throws IOException {  new Abra().run(); }   static class myLib {  long fact(long x) {  long a = 1;  for (long i = 2; i <= x; i++) {   a *= i;  }  return a;  }  long digitSum(String x) {  long a = 0;  for (int i = 0; i < x.length(); i++) {   a += x.charAt(i) - '0';  }  return a;  }  long digitSum(long x) {  long a = 0;  while (x > 0) {   a += x % 10;   x /= 10;  }  return a;  }  long digitMul(long x) {  long a = 1;  while (x > 0) {   a *= x % 10;   x /= 10;  }  return a;  }  int digitCubesSum(int x) {  int a = 0;  while (x > 0) {   a += (x % 10) * (x % 10) * (x % 10);   x /= 10;  }  return a;  }  double pif(double ax, double ay, double bx, double by) {  return Math.sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));  }  double pif3D(double ax, double ay, double az, double bx, double by, double bz) {  return Math.sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by) + (az - bz) * (az - bz));  }  double pif3D(double[] a, double[] b) {  return Math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]) + (a[2] - b[2]) * (a[2] - b[2]));  }  long gcd(long a, long b) {  if (a == 0 || b == 0) return 1;  if (a < b) {   long c = b;   b = a;   a = c;  }  while (a % b != 0) {   a = a % b;   if (a < b) {   long c = b;   b = a;   a = c;   }  }  return b;  }  int gcd(int a, int b) {  if (a == 0 || b == 0) return 1;  if (a < b) {   int c = b;   b = a;   a = c;  }  while (a % b != 0) {   a = a % b;   if (a < b) {   int c = b;   b = a;   a = c;   }  }  return b;  }  long lcm(long a, long b) throws IOException {  return a * b / gcd(a, b);  }  int lcm(int a, int b) throws IOException {  return a * b / gcd(a, b);  }  int countOccurences(String x, String y) {  int a = 0, i = 0;  while (true) {   i = y.indexOf(x);   if (i == -1) break;   a++;   y = y.substring(i + 1);  }  return a;  }  int[] findPrimes(int x) {  boolean[] forErato = new boolean[x - 1];  List<Integer> t = new Vector<Integer>();  int l = 0, j = 0;  for (int i = 2; i < x; i++) {   if (forErato[i - 2]) continue;   t.add(i);   l++;   j = i * 2;   while (j < x) {   forErato[j - 2] = true;   j += i;   }  }  int[] primes = new int[l];  Iterator<Integer> iterator = t.iterator();  for (int i = 0; iterator.hasNext(); i++) {   primes[i] = iterator.next().intValue();  }  return primes;  }  int rev(int x) {  int a = 0;  while (x > 0) {   a = a * 10 + x % 10;   x /= 10;  }  return a;  }  class myDate {  int d, m, y;   int[] ml = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };   public myDate(int da, int ma, int ya) {   d = da;   m = ma;   y = ya;   if ((ma > 12 || ma < 1 || da > ml[ma - 1] || da < 1) && !(d == 29 && m == 2 && y % 4 == 0)) {   d = 1;   m = 1;   y = 9999999;   }  }   void incYear(int x) {   for (int i = 0; i < x; i++) {   y++;   if (m == 2 && d == 29) {    m = 3;    d = 1;    return;   }   if (m == 3 && d == 1) {    if (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)) {    m = 2;    d = 29;    }    return;   }   }  }   boolean less(myDate x) {   if (y < x.y) return true;   if (y > x.y) return false;   if (m < x.m) return true;   if (m > x.m) return false;   if (d < x.d) return true;   if (d > x.d) return false;   return true;  }   void inc() {   if ((d == 31) && (m == 12)) {   y++;   d = 1;   m = 1;   } else {   if (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)) {    ml[1] = 29;   }   if (d == ml[m - 1]) {    m++;    d = 1;   } else    d++;   }  }  }  int partition(int n, int l, int m) {          if (n < l) return 0;  if (n < l + 2) return 1;  if (l == 1) return 1;  int c = 0;  for (int i = Math.min(n - l + 1, m); i >= (n + l - 1) / l; i--) {   c += partition(n - i, l - 1, i);  }  return c;  }  int rifmQuality(String a, String b) {  if (a.length() > b.length()) {   String c = a;   a = b;   b = c;  }  int c = 0, d = b.length() - a.length();  for (int i = a.length() - 1; i >= 0; i--) {   if (a.charAt(i) == b.charAt(i + d)) c++;   else   break;  }  return c;  }  String numSym = "0123456789ABCDEF";  String ZFromXToYNotation(int x, int y, String z) {  if (z.equals("0")) return "0";  String a = "";    BigInteger q = BigInteger.ZERO, t = BigInteger.ONE;  for (int i = z.length() - 1; i >= 0; i--) {   q = q.add(t.multiply(BigInteger.valueOf(z.charAt(i) - 48)));   t = t.multiply(BigInteger.valueOf(x));  }  while (q.compareTo(BigInteger.ZERO) == 1) {   a = numSym.charAt((int) (q.mod(BigInteger.valueOf(y)).intValue())) + a;   q = q.divide(BigInteger.valueOf(y));  }  return a;  }  double angleFromXY(int x, int y) {  if ((x == 0) && (y > 0)) return Math.PI / 2;  if ((x == 0) && (y < 0)) return -Math.PI / 2;  if ((y == 0) && (x > 0)) return 0;  if ((y == 0) && (x < 0)) return Math.PI;  if (x > 0) return Math.atan((double) y / x);  else {   if (y > 0) return Math.atan((double) y / x) + Math.PI;   else   return Math.atan((double) y / x) - Math.PI;  }  }  static boolean isNumber(String x) {  try {   Integer.parseInt(x);  } catch (NumberFormatException ex) {   return false;  }  return true;  }  static boolean stringContainsOf(String x, String c) {  for (int i = 0; i < x.length(); i++) {   if (c.indexOf(x.charAt(i)) == -1) return false;  }  return true;  }  long pow(long a, long n) {   if (n == 0) return 1;  long k = n, b = 1, c = a;  while (k != 0) {   if (k % 2 == 0) {   k /= 2;   c *= c;   } else {   k--;   b *= c;   }  }  return b;  }  int pow(int a, int n) {   if (n == 0) return 1;  int k = n, b = 1, c = a;  while (k != 0) {   if (k % 2 == 0) {   k /= 2;   c *= c;   } else {   k--;   b *= c;   }  }  return b;  }  double pow(double a, int n) {   if (n == 0) return 1;  double k = n, b = 1, c = a;  while (k != 0) {   if (k % 2 == 0) {   k /= 2;   c *= c;   } else {   k--;   b *= c;   }  }  return b;  }  double log2(double x) {  return Math.log(x) / Math.log(2);  }  int lpd(int[] primes, int x) {  int i;  for (i = 0; primes[i] <= x / 2; i++) {   if (x % primes[i] == 0) {   return primes[i];   }  }  ;  return x;  }  int np(int[] primes, int x) {  for (int i = 0; true; i++) {   if (primes[i] == x) return i;  }  }  int[] dijkstra(int[][] map, int n, int s) {  int[] p = new int[n];  boolean[] b = new boolean[n];  Arrays.fill(p, Integer.MAX_VALUE);  p[s] = 0;  b[s] = true;  for (int i = 0; i < n; i++) {   if (i != s) p[i] = map[s][i];  }  while (true) {   int m = Integer.MAX_VALUE, mi = -1;   for (int i = 0; i < n; i++) {   if (!b[i] && (p[i] < m)) {    mi = i;    m = p[i];   }   }   if (mi == -1) break;   b[mi] = true;   for (int i = 0; i < n; i++)   if (p[mi] + map[mi][i] < p[i]) p[i] = p[mi] + map[mi][i];  }  return p;  }  boolean isLatinChar(char x) {  if (((x >= 'a') && (x <= 'z')) || ((x >= 'A') && (x <= 'Z'))) return true;  else   return false;  }  boolean isBigLatinChar(char x) {  if (x >= 'A' && x <= 'Z') return true;  else   return false;  }  boolean isSmallLatinChar(char x) {  if (x >= 'a' && x <= 'z') return true;  else   return false;  }  boolean isDigitChar(char x) {  if (x >= '0' && x <= '9') return true;  else   return false;  }  class NotANumberException extends Exception {  private static final long serialVersionUID = 1L;  String mistake;   NotANumberException() {   mistake = "Unknown.";  }   NotANumberException(String message) {   mistake = message;  }  }  class Real {  String num = "0";  long exp = 0;  boolean pos = true;   long length() {   return num.length();  }   void check(String x) throws NotANumberException {   if (!stringContainsOf(x, "0123456789+-.eE")) throw new NotANumberException("Illegal character.");   long j = 0;   for (long i = 0; i < x.length(); i++) {   if ((x.charAt((int) i) == '-') || (x.charAt((int) i) == '+')) {    if (j == 0) j = 1;    else    if (j == 5) j = 6;    else     throw new NotANumberException("Unexpected sign.");   } else    if ("0123456789".indexOf(x.charAt((int) i)) != -1) {    if (j == 0) j = 2;    else     if (j == 1) j = 2;     else     if (j == 2)     ;     else      if (j == 3) j = 4;      else      if (j == 4)      ;      else       if (j == 5) j = 6;       else       if (j == 6)       ;       else        throw new NotANumberException("Unexpected digit.");    } else    if (x.charAt((int) i) == '.') {     if (j == 0) j = 3;     else     if (j == 1) j = 3;     else      if (j == 2) j = 3;      else      throw new NotANumberException("Unexpected dot.");    } else     if ((x.charAt((int) i) == 'e') || (x.charAt((int) i) == 'E')) {     if (j == 2) j = 5;     else      if (j == 4) j = 5;      else      throw new NotANumberException("Unexpected exponent.");     } else     throw new NotANumberException("O_o.");   }   if ((j == 0) || (j == 1) || (j == 3) || (j == 5)) throw new NotANumberException("Unexpected end.");  }   public Real(String x) throws NotANumberException {   check(x);   if (x.charAt(0) == '-') pos = false;   long j = 0;   String e = "";   boolean epos = true;   for (long i = 0; i < x.length(); i++) {   if ("0123456789".indexOf(x.charAt((int) i)) != -1) {    if (j == 0) num += x.charAt((int) i);    if (j == 1) {    num += x.charAt((int) i);    exp--;    }    if (j == 2) e += x.charAt((int) i);   }   if (x.charAt((int) i) == '.') {    if (j == 0) j = 1;   }   if ((x.charAt((int) i) == 'e') || (x.charAt((int) i) == 'E')) {    j = 2;    if (x.charAt((int) (i + 1)) == '-') epos = false;   }   }   while ((num.length() > 1) && (num.charAt(0) == '0'))   num = num.substring(1);   while ((num.length() > 1) && (num.charAt(num.length() - 1) == '0')) {   num = num.substring(0, num.length() - 1);   exp++;   }   if (num.equals("0")) {   exp = 0;   pos = true;   return;   }   while ((e.length() > 1) && (e.charAt(0) == '0'))   e = e.substring(1);   try {   if (e != "") if (epos) exp += Long.parseLong(e);   else    exp -= Long.parseLong(e);   } catch (NumberFormatException exc) {   if (!epos) {    num = "0";    exp = 0;    pos = true;   } else {    throw new NotANumberException("Too long exponent");   }   }  }   public Real() {  }   String toString(long mantissa) {   String a = "", b = "";   if (exp >= 0) {   a = num;   if (!pos) a = '-' + a;   for (long i = 0; i < exp; i++)    a += '0';   for (long i = 0; i < mantissa; i++)    b += '0';   if (mantissa == 0) return a;   else    return a + "." + b;   } else {   if (exp + length() <= 0) {    a = "0";    if (mantissa == 0) {    return a;    }    if (mantissa < -(exp + length() - 1)) {    for (long i = 0; i < mantissa; i++)     b += '0';    return a + "." + b;    } else {    if (!pos) a = '-' + a;    for (long i = 0; i < mantissa; i++)     if (i < -(exp + length())) b += '0';     else     if (i + exp >= 0) b += '0';     else      b += num.charAt((int) (i + exp + length()));    return a + "." + b;    }   } else {    if (!pos) a = "-";    for (long i = 0; i < exp + length(); i++)    a += num.charAt((int) i);    if (mantissa == 0) return a;    for (long i = exp + length(); i < exp + length() + mantissa; i++)    if (i < length()) b += num.charAt((int) i);    else     b += '0';    return a + "." + b;   }   }  }  }  boolean containsRepeats(int... num) {  Set<Integer> s = new TreeSet<Integer>();  for (int d : num)   if (!s.contains(d)) s.add(d);   else   return true;  return false;  }  int[] rotateDice(int[] a, int n) {  int[] c = new int[6];  if (n == 0) {   c[0] = a[1];   c[1] = a[5];   c[2] = a[2];   c[3] = a[0];   c[4] = a[4];   c[5] = a[3];  }  if (n == 1) {   c[0] = a[2];   c[1] = a[1];   c[2] = a[5];   c[3] = a[3];   c[4] = a[0];   c[5] = a[4];  }  if (n == 2) {   c[0] = a[3];   c[1] = a[0];   c[2] = a[2];   c[3] = a[5];   c[4] = a[4];   c[5] = a[1];  }  if (n == 3) {   c[0] = a[4];   c[1] = a[1];   c[2] = a[0];   c[3] = a[3];   c[4] = a[5];   c[5] = a[2];  }  if (n == 4) {   c[0] = a[0];   c[1] = a[2];   c[2] = a[3];   c[3] = a[4];   c[4] = a[1];   c[5] = a[5];  }  if (n == 5) {   c[0] = a[0];   c[1] = a[4];   c[2] = a[1];   c[3] = a[2];   c[4] = a[3];   c[5] = a[5];  }  return c;  }  int min(int... a) {  int c = Integer.MAX_VALUE;  for (int d : a)   if (d < c) c = d;  return c;  }  int max(int... a) {  int c = Integer.MIN_VALUE;  for (int d : a)   if (d > c) c = d;  return c;  }  double maxD(double... a) {  double c = Double.MIN_VALUE;  for (double d : a)   if (d > c) c = d;  return c;  }  double minD(double... a) {  double c = Double.MAX_VALUE;  for (double d : a)   if (d < c) c = d;  return c;  }  int[] normalizeDice(int[] a) {  int[] c = a.clone();  if (c[0] != 0) if (c[1] == 0) c = rotateDice(c, 0);  else   if (c[2] == 0) c = rotateDice(c, 1);   else   if (c[3] == 0) c = rotateDice(c, 2);   else    if (c[4] == 0) c = rotateDice(c, 3);    else    if (c[5] == 0) c = rotateDice(rotateDice(c, 0), 0);  while (c[1] != min(c[1], c[2], c[3], c[4]))   c = rotateDice(c, 4);  return c;  }  boolean sameDice(int[] a, int[] b) {  for (int i = 0; i < 6; i++)   if (a[i] != b[i]) return false;  return true;  }  final double goldenRatio = (1 + Math.sqrt(5)) / 2;  final double aGoldenRatio = (1 - Math.sqrt(5)) / 2;  long Fib(int n) {  if (n < 0) if (n % 2 == 0) return -Math.round((pow(goldenRatio, -n) - pow(aGoldenRatio, -n)) / Math.sqrt(5));  else   return -Math.round((pow(goldenRatio, -n) - pow(aGoldenRatio, -n)) / Math.sqrt(5));  return Math.round((pow(goldenRatio, n) - pow(aGoldenRatio, n)) / Math.sqrt(5));  }  class japaneeseComparator implements Comparator<String> {  @Override  public int compare(String a, String b) {   int ai = 0, bi = 0;   boolean m = false, ns = false;   if (a.charAt(ai) <= '9' && a.charAt(ai) >= '0') {   if (b.charAt(bi) <= '9' && b.charAt(bi) >= '0') m = true;   else    return -1;   }   if (b.charAt(bi) <= '9' && b.charAt(bi) >= '0') {   if (a.charAt(ai) <= '9' && a.charAt(ai) >= '0') m = true;   else    return 1;   }   a += "!";   b += "!";   int na = 0, nb = 0;   while (true) {   if (a.charAt(ai) == '!') {    if (b.charAt(bi) == '!') break;    return -1;   }   if (b.charAt(bi) == '!') {    return 1;   }   if (m) {    int ab = -1, bb = -1;    while (a.charAt(ai) <= '9' && a.charAt(ai) >= '0') {    if (ab == -1) ab = ai;    ai++;    }    while (b.charAt(bi) <= '9' && b.charAt(bi) >= '0') {    if (bb == -1) bb = bi;    bi++;    }    m = !m;    if (ab == -1) {    if (bb == -1) continue;    else     return 1;    }    if (bb == -1) return -1;    while (a.charAt(ab) == '0' && ab + 1 != ai) {    ab++;    if (!ns) na++;    }    while (b.charAt(bb) == '0' && bb + 1 != bi) {    bb++;    if (!ns) nb++;    }    if (na != nb) ns = true;    if (ai - ab < bi - bb) return -1;    if (ai - ab > bi - bb) return 1;    for (int i = 0; i < ai - ab; i++) {    if (a.charAt(ab + i) < b.charAt(bb + i)) return -1;    if (a.charAt(ab + i) > b.charAt(bb + i)) return 1;    }   } else {    m = !m;    while (true) {    if (a.charAt(ai) <= 'z' && a.charAt(ai) >= 'a' && b.charAt(bi) <= 'z' && b.charAt(bi) >= 'a') {     if (a.charAt(ai) < b.charAt(bi)) return -1;     if (a.charAt(ai) > b.charAt(bi)) return 1;     ai++;     bi++;    } else     if (a.charAt(ai) <= 'z' && a.charAt(ai) >= 'a') return 1;     else     if (b.charAt(bi) <= 'z' && b.charAt(bi) >= 'a') return -1;     else      break;    }   }   }   if (na < nb) return 1;   if (na > nb) return -1;   return 0;  }  }  Random random = new Random(); }  void readIntArray(int[] a) throws IOException {  for (int i = 0; i < a.length; i++)  a[i] = nextInt(); }  String readChars(int l) throws IOException {  String r = "";  for (int i = 0; i < l; i++)  r += (char) br.read();  return r; }  StreamTokenizer in; PrintWriter out; boolean oj; BufferedReader br;  void init() throws IOException {  oj = System.getProperty("ONLINE_JUDGE") != null;  Reader reader = oj ? new InputStreamReader(System.in) : new FileReader("input.txt");  Writer writer = oj ? new OutputStreamWriter(System.out) : new FileWriter("output.txt");  br = new BufferedReader(reader);  in = new StreamTokenizer(br);  out = new PrintWriter(writer); }  long selectionTime = 0;  void startSelection() {  selectionTime -= System.currentTimeMillis(); }  void stopSelection() {  selectionTime += System.currentTimeMillis(); }  void run() throws IOException {  long beginTime = System.currentTimeMillis();  long beginMem = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();  init();  solve();  long endMem = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();  long endTime = System.currentTimeMillis();  if (!oj) {  System.out.println("Memory used = " + (endMem - beginMem));  System.out.println("Total memory = " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));  System.out.println("Running time = " + (endTime - beginTime));  }  out.flush(); }  int nextInt() throws IOException {  in.nextToken();  return (int) in.nval; }  long nextLong() throws IOException {  in.nextToken();  return (long) in.nval; }  String nextString() throws IOException {  in.nextToken();  return in.sval; }  double nextDouble() throws IOException {  in.nextToken();  return in.nval; }  myLib lib = new myLib();   }
1	public class Main {    void run() throws IOException {   int n = nint();   char[] s = token().toCharArray();   int h = 0;   for (int i = 0; i < n; i++) {    if (s[i] == 'H') h++;   }   int r = Integer.MAX_VALUE;   for (int i = 0; i < n; i++) {    int t = 0;    for (int j = i; j < i + h; j++) {     if (s[j % n] == 'T') t++;    }    r = min(r, t);   }   out.println(r);  }  class pair implements Comparable <pair> {   int x, y;   pair(int x, int y) {    this.x = x;    this.y = y;      }   public int compareTo (pair p) {    if (x != p.x) {     return x - p.x;    } else {     return y - p.y;    }   }  }    public static void main(String[] args) throws IOException {   Locale.setDefault(Locale.US);       in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   st = new StringTokenizer(" ");   new Main().run();     out.close();  }  static BufferedReader in;  static PrintWriter out;  static StringTokenizer st;  String token() throws IOException {   while (!st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int nint() throws IOException {   return Integer.parseInt(token());  }  long nlong() throws IOException {   return Long.parseLong(token());  }  double ndouble() throws IOException {   return Double.parseDouble(token());  } }
5	public class Round159ProblemA {  public static void main(String[] args) {  Reader r = new Reader();  int filters = r.nextInt();  int devices = r.nextInt();  int sockets = r.nextInt();   List<Integer> filtery = new ArrayList<>();  for (int i = 0; i < filters; i++) {  filtery.add(r.nextInt()-1);  }      if(devices <= sockets){  System.out.println(0);  return;  }else{  Collections.shuffle(filtery);  Collections.sort(filtery);  devices -= sockets;  int act = filtery.size()-1;  int result = 0;  while(devices > 0){     if(act < 0){   System.out.println(-1);   return;   }   devices -= filtery.get(act);   act--;   result++;  }  System.out.println(result);  } }  static class Reader {  StreamTokenizer in;  public Reader() {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(   System.in)));  }  public int nextInt() {  try {   in.nextToken();  } catch (IOException e) {   e.printStackTrace();  }  return (int) in.nval;  }  public long nextLong() {  try {   in.nextToken();  } catch (IOException e) {   e.printStackTrace();  }  return (long) in.nval;  }  public String next() {  try {   in.nextToken();  } catch (IOException e) {   e.printStackTrace();  }  return in.sval;  } } }
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();  } }
5	public class A {  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = null;  private void solve() throws IOException  {   int n = nextInt();   int k = nextInt();   int p[] = new int[n];   int t[] = new int[n];   for(int i = 0; i < n; i++)   {    p[i] = nextInt();    t[i] = nextInt();   }     for(int i = 0; i < n; i++)   {    for(int j = i + 1; j < n; j++)    {     if(p[i] < p[j] || (p[i] == p[j] && t[i] > t[j]))     {      int tmp = p[i];      p[i] = p[j];      p[j] = tmp;      tmp = t[i];      t[i] = t[j];      t[j] = tmp;     }    }      }     int pN = p[k - 1];   int tN = t[k - 1];   int counter = 0;   for(int i = 0; i < n; i++)   {    if(p[i] == pN && t[i] == tN)    {     counter++;    }      }     System.out.println(counter);  }  String nextToken() throws IOException  {   if (st == null || !st.hasMoreTokens())   {    st = new StringTokenizer(bf.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());  }  public static void main(String args[]) throws IOException  {   new A().solve();  }  }
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()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  String nextLine() throws IOException {  st = new StringTokenizer("");  return in.readLine(); }  boolean EOF() throws IOException {  while (!st.hasMoreTokens()) {  String s = in.readLine();  if (s == null)   return true;  st = new StringTokenizer(s);  }  return false; } }
2	public class B {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);   long n = sc.nextInt(), k = sc.nextInt();     long start = 1, end = n;   while(start <= end) {  long mid = (start + end) >> 1;  if(calc(mid) - (n - mid) == k) {   System.out.println(n - mid);   return;  } else if (calc(mid) - (n - mid) > k) {   end = mid - 1;  } else {   start = mid + 1;  }    }   }  public static long calc(long n) {  return (n * n + n) / 2; } }
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());       } }
5	public class Main { public static void main(String args[]) throws IOException  {  Scanner c=new Scanner(System.in);  int N=c.nextInt();  int A[]=new int[N];  for(int i=0;i<N;i++)   {  A[i]=c.nextInt();  }  Arrays.sort(A);  int sum=0;  for(int i=0;i<N;i++)   {  sum+=A[i];  }  int my=0;  int coins=0;  for(int i=N-1;i>=0;i--)   {  coins++;    my+=A[i];  if(my>sum-my)   {   System.out.println(coins);   break;   }  }  } }
5	public class prob1 { public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int n = input.nextInt();  if(n == 1)  {   int m = input.nextInt();  System.out.println("NO");   return;  }  int[] num = new int[n];  boolean flag = false;  for(int i = 0; i < n; i++)  {  num[i] = input.nextInt();  if(num[i] != num[0])   flag = true;  }  if(!flag)  {  System.out.println("NO");  return;  }  int min = Integer.MAX_VALUE;  for(int i = 0; i < n; i++)  if(num[i] < min)   min = num[i];  int min2 = Integer.MAX_VALUE;  for(int i = 0; i < n; i++)  if(num[i] <= min2 && num[i] > min)   min2 = num[i];  System.out.println(min2);   } }
5	public class Main { private static StreamTokenizer in; private static PrintWriter out;  private static int nextInt() throws Exception {  in.nextToken();  return (int)in.nval; }  private static String nextString() throws Exception {  in.nextToken();  return in.sval; }  public static void main(String[] args) throws Exception {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(System.out);   int n = nextInt(), t = nextInt() * 2;  int[][] a = new int[n][2];  for (int i=0; i<n; i++) {  a[i][0] = nextInt() * 2;  a[i][1] = nextInt() * 2;  }   Arrays.sort(a, new Comparator<int[]>() {  public int compare(int[] a, int[] b) {   return a[0]>b[0]?1:a[1]<b[1]?-1:0;  }  });   int s = 2;   for (int i=0; i<n-1; i++) {  int g = (a[i+1][0]-a[i][0])-(a[i+1][1]+a[i][1])/2;  if (g > t) s += 2;  if (g == t) s+= 1;  }  out.println(s);     out.flush(); } }
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 Pair {   public String x;   public int y;   public Pair(String x, int y){    this.x = x;    this.y=y;   }                                 }   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());   }   public double nextDouble(){    return Double.parseDouble(nextToken());   }   public long nextLong(){    return Long.parseLong(nextToken());   }  } }
1	public class Solution { static PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) throws Exception{  StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  in.nextToken();  int n = (int)in.nval;  in.nextToken();  String st = in.sval;  char[] a = new char[n];  for (int i = 0; i<n; i++)  a[i] = st.charAt(i);  int kH = 0;  int kT = 0;  for (int i =0; i<n; i++)  if (a[i] == 'T') kT++;  else kH++;  int kol = 0;  int min = Integer.MAX_VALUE;  int poz;   for (int i=0; i<n; i++)  {  kol = 0;  if (a[i] == 'T') {   for (int j = 0; j<kT; j++){   poz = (i+j)%n;   if (a[poz] == 'H') kol++;   }   if (kol < min) min = kol;  }  else {   for (int j = 0; j<kH; j++){   poz = (i+j)%n;   if (a[poz] == 'T') kol++;   }   if (kol < min) min = kol;  }  }  out.print(min);  out.flush(); } }
0	public class MainClass {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int arr[] = {4,7,47,74,447,474,477,744,747,774};   int i=0, x = in.nextInt();   while (i<arr.length)   if (x%arr[i++] == 0)   {    System.out.print("YES");    return;   }   System.out.print("NO");  } }
1	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);   BPhoenixAndPuzzle solver = new BPhoenixAndPuzzle();   int testCount = Integer.parseInt(in.next());   for (int i = 1; i <= testCount; i++)    solver.solve(i, in, out);   out.close();  }  static class BPhoenixAndPuzzle {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt();    if (n % 2 == 1) {     out.println("NO");     return;    }    n /= 2;    int h = (int) Math.sqrt(n + 0.5);    if (h * h == n) {     out.println("YES");     return;    }    if (n % 2 == 1) {     out.println("NO");     return;    }    n /= 2;    h = (int) Math.sqrt(n + 0.5);    if (h * h == n) {     out.println("YES");    } 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 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 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 String next() {    int c;    while (isSpaceChar(c = this.read())) {     ;    }    StringBuilder result = new StringBuilder();    result.appendCodePoint(c);    while (!isSpaceChar(c = this.read())) {     result.appendCodePoint(c);    }    return result.toString();   }   public 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 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;   }  }  private static 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;  }  private static 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 void run() {   try {    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));    output.flush();    output.close();   } catch (Throwable e) {    System.err.println(e.getMessage());    System.err.println(Arrays.deepToString(e.getStackTrace()));   }  }   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 double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  private long nextLong() throws IOException {   return Long.parseLong(nextToken());  }   private BufferedReader input;  private PrintWriter output;  private StringTokenizer tokens = null; }
1	public class B { BufferedReader in; PrintStream out; StringTokenizer tok; public B() throws NumberFormatException, IOException {  in = new BufferedReader(new InputStreamReader(System.in));   out = System.out;  run(); } void run() throws NumberFormatException, IOException {  int n = nextInt();  int k = nextInt();  int[] num = new int[n];  for(int i = 0; i < n; i++)  num[i] = nextInt();  int[] cant = new int[100001];  int cnt = 0;  int r = 0;  for(; r < n; r++)  {  if(cant[num[r]]==0)cnt++;  cant[num[r]]++;  if(cnt==k) break;  }  if(cnt<k)  {  out.println("-1 -1");  return;  }  int l = 0;  for(; l < r; l++)  {  cant[num[l]]--;  if(cant[num[l]]==0)cnt--;  if(cnt<k) break;  }  out.println((l+1)+" "+(r+1)); } public static void main(String[] args) throws NumberFormatException, IOException  {  new B(); } String nextToken() throws IOException {  if(tok ==null || !tok.hasMoreTokens()) tok = new StringTokenizer(in.readLine());  return tok.nextToken(); } int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(nextToken()); } long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(nextToken()); } double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(nextToken()); } }
1	public class B {   public static void main(String[] args) throws Exception {  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));   String[] parts = bf.readLine().trim().split("[ ]+");  int N = Integer.parseInt(parts[0]);  int K = Integer.parseInt(parts[1]);   int[] nums = new int[N];  int idx = 0;   String line = bf.readLine();  for(int i = 0; i < line.length(); i++) {  char c = line.charAt(i);  if(c == ' ') idx++;  else {   int d = c - '0';   nums[idx] = 10 * nums[idx] + d;  }  }   int from = -1, to = -1;  HashMap<Integer, Integer> count = new HashMap<Integer, Integer>();  for(int i = 0; i < N; i++) {  Integer q = count.get(nums[i]);    if(q == null) count.put(nums[i], 1);  else count.put(nums[i], q + 1);    if(count.size() == K) {   to = i;   break;  }  }   if(count.size() < K) {  System.out.println("-1 -1");  return;  }   for(from = 0; from <= to; from++) {  Integer q = count.get(nums[from]);    if(q == 1) count.remove(nums[from]);  else count.put(nums[from], q - 1);    if(count.size() < K) break;  }   System.out.println((from + 1) + " " + (to + 1));  } }
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 Line perpendicular(Point p) {    return new Line(p, new Point(p.x + a, p.y + b));   }   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 void check(Point a, Point b, ArrayList<Point> p, Point[] rec, int index) {   for (int i = 0; i < 4; i++) {    int m = (i + index) % 4;    int j = (i + 1 + index) % 4;    Point k = intersect(minus(b, a), minus(rec[m], rec[j]), minus(rec[m], a));    if (k.x >= 0 && k.x <= 1 && k.y >= 0 && k.y <= 1) {     Point val = new Point(k.x * minus(b, a).x, k.x * minus(b, a).y);     p.add(add(val, a));             }   }  }  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 convert(Point a, double angle) {   double x = a.x * cos(angle) - a.y * sin(angle);   double y = a.x * sin(angle) + a.y * cos(angle);   return new Point(x, y);  }  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;   }   @Override   public String toString() {    return "Point: " + x + " " + 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 long nextLong() {    return Long.parseLong(next());   }   public int nextInt() {    return Integer.parseInt(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    st = null;    try {     return br.readLine();    } catch (Exception e) {     throw new RuntimeException();    }   }   public boolean endLine() {    try {     String next = br.readLine();     while (next != null && next.trim().isEmpty()) {      next = br.readLine();     }     if (next == null) {      return true;     }     st = new StringTokenizer(next);     return st.hasMoreTokens();    } catch (Exception e) {     throw new RuntimeException();    }   }  } }
1	public class utkarsh {  InputStream is;  PrintWriter out;   long mod = (long) (1e9 + 7);  boolean SHOW_TIME;   void solve() {        int n = ni();   int d = ni();   int a[] = na(n);   Arrays.sort(a);   int ans = 2;   for(int i = 0; i < n-1; i++) {    if(a[i+1] - a[i] == (2 * d)) ans++;    else if(a[i+1] - a[i] > (2 * d)) ans += 2;   }   out.println(ans);  }     public static void main(String[] args) { new utkarsh().run(); }  void run() {   is = System.in;   out = new PrintWriter(System.out);   long start = System.currentTimeMillis();   solve();   long end = System.currentTimeMillis();   if(SHOW_TIME) out.println("\n" + (end - start) + " ms");   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;  }   char nc() { return (char)skip(); }  String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!isSpaceChar(b)) { sb.appendCodePoint(b); b = readByte(); }   return sb.toString();  }  String nLine() {   int b = skip();   StringBuilder sb = new StringBuilder();   while( !(isSpaceChar(b) && 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;  }  double nd() { return Double.parseDouble(ns()); }  float nf() { return Float.parseFloat(ns()); }  int[] na(int n) {   int a[] = new int[n];   for(int i = 0; i < n; i++) { a[i] = ni(); }   return a;  }  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);  } }
5	public class D implements Runnable{ public static void main (String[] args) {new Thread(null, new D(), "_cf", 1 << 28).start();}  public void run() {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  System.err.println("Go!");   int n = fs.nextInt();  Pair[] a = new Pair[n], b = new Pair[n];  for(int i = 0; i < n; i++) {  a[i] = new Pair(fs.nextInt(), i+1);  b[i] = new Pair(a[i].val, a[i].id);  }  Arrays.sort(a);   Fenwick_Tree ft = new Fenwick_Tree(n), ftFreq = new Fenwick_Tree(n);  BigInteger res = BigInteger.ZERO;  int[] update = new int[n];  int sum = 0;  for(int i = 0; i < n; i++) {   if(i + 1 == n || (i + 1 < n && a[i+1].val != a[i].val)) {   update[i] = sum+1;   sum = 0;  }  else {   sum++;  }  }  for(int i = 0; i < n; i++) {  int pos = a[i].id;  long val = a[i].val;  long right = ft.sum(n) - ft.sum(pos);  long freq = ftFreq.sum(n) - ftFreq.sum(pos);       res = add(res, right - (val * freq));     long left = ft.sum(pos);  freq = ftFreq.sum(pos);  res = add(res, (val * freq) - left);        if(update[i] > 0) {   ft.update(pos, val);   ftFreq.update(pos, 1);   int ptr = i-1;   while(ptr >= 0 && update[ptr] == 0) {   ft.update(a[ptr].id, val);   ftFreq.update(a[ptr].id, 1);   ptr--;   }  }  }   HashMap<Integer, Integer> freq = new HashMap<>();  for(int i = n-1; i >= 0; i--) {  if(!freq.containsKey(b[i].val+1)) {   if(!freq.containsKey(b[i].val)) freq.put(b[i].val, 0);   freq.put(b[i].val, freq.get(b[i].val)+1);   continue;  }  long fr = freq.get(b[i].val+1);   res = sub(res, fr * (b[i].val+1) - (fr * (b[i].val)));   if(!freq.containsKey(b[i].val)) freq.put(b[i].val, 0);  freq.put(b[i].val, freq.get(b[i].val)+1);  }    freq.clear();   for(int i = 0; i < n; i++) {  if(!freq.containsKey(b[i].val+1)) {   if(!freq.containsKey(b[i].val)) freq.put(b[i].val, 0);   freq.put(b[i].val, freq.get(b[i].val)+1);   continue;  }  long fr = freq.get(b[i].val+1);   res = add(res, (fr*(b[i].val+1)) - (fr*b[i].val));   if(!freq.containsKey(b[i].val)) freq.put(b[i].val, 0);  freq.put(b[i].val, freq.get(b[i].val)+1);  }   out.println(res);   out.close(); }  BigInteger add (BigInteger a, long b) {  BigInteger res = a.add(BigInteger.valueOf(b));  return res; }  BigInteger sub (BigInteger a, long b) {  BigInteger res = a.subtract(BigInteger.valueOf(b));  return res; }  class Pair implements Comparable<Pair> {  int val, id;  Pair (int a, int b) {  val = a;  id = b;  }   public int compareTo (Pair o) {  if(val == o.val) return Integer.compare(id, o.id);  return Integer.compare(o.val, val);  } }  class Fenwick_Tree {   long[] bit;  int n;   public Fenwick_Tree(int a) {  n = a + 1;  bit = new long[n];  }      void update (int index, long val) {  while(index < n) {   bit[index] += val;   index += (index & (-index));  }  }   long sum (int index) {  long sum = 0;  while(index > 0) {   sum += bit[index];   index -= (index & (-index));  }  return sum;  } }   void sort (int[] a) {  int n = a.length;  for(int i = 0; i < 1000; i++) {  Random r = new Random();  int x = r.nextInt(n), y = r.nextInt(n);  int temp = a[x];  a[x] = a[y];  a[y] = temp;  }  Arrays.sort(a); }  class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner() {  try {   br = new BufferedReader(new InputStreamReader(System.in));     st = new StringTokenizer("");  } 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 String nextLine() {  String line = "";  try {line = br.readLine();}  catch (Exception e) {e.printStackTrace();}  return line;  }  public Integer[] nextIntegerArray(int n) {  Integer[] a = new Integer[n];  for(int i = 0; i < n; i++) a[i] = nextInt();  return a;  }  public int[] nextIntArray(int n) {  int[] a = new int[n];  for(int i = 0; i < n; i++) a[i] = nextInt();  return a;  }  public char[] nextCharArray() {return nextLine().toCharArray();} } }
6	public class Test { static PrintWriter writer =  new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  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; }  static long readLong() {  long 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; }  static String readLine() {  StringBuilder b = new StringBuilder();  try {  boolean start = false;  for (int c = 0; (c = System.in.read()) != -1; ) {   if (Character.isLetterOrDigit(c)) {   start = true;   b.append((char) c);   } else if (start) break;  }  } catch (IOException e) {  }  return b.toString(); }  public static void main(String[] args) {  Test te = new Test();  te.start();  writer.flush(); }  int[] buf = new int[10];  int best(int[][] a, int c) {  int ans = 0;  if (c == a[0].length) {  for (int i = 0; i < a.length; i++)   ans += Arrays.stream(a[i]).max().getAsInt();  return ans;  }  for (int r = 0; r <= a.length; r++) {  for (int i = 0; i < a.length; i++)   buf[(i+1) % a.length] = a[i][c];  for (int i = 0; i < a.length; i++)   a[i][c] = buf[i];  ans = Math.max(ans, best(a, c+1));  }  return ans; }  void start() {  int t = readInt();  while (t-- > 0) {  int n = readInt(), m = readInt();  int[][] a = new int[n][m];  int[][] e = new int[n*m][];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++) {   a[i][j] = readInt();   e[i*m+j] = new int[]{a[i][j], j};   }  Arrays.sort(e, (x, y) -> x[0] == y[0] ? Integer.compare(x[1], y[1])   : Integer.compare(y[0], x[0]));  Set<Integer> cols = new HashSet<>();  for (int[] x : e) {   cols.add(x[1]);   if (cols.size() >= n) break;  }  int[] cs = cols.stream().mapToInt(Integer::intValue).toArray();  int[][] na = new int[n][cs.length];  for (int i = 0; i < n; i++)   for (int j = 0; j < cs.length; j++)   na[i][j] = a[i][cs[j]];  writer.println(best(na, 0));  } } }
6	public class CF8C { FastScanner in; PrintWriter out;  int[] x, y; int[] av; int[][] d = new int[25][25];  int dist(int v, int u) {  if (u == v)  return 0;  return (d[v][u] == 0 ? d[v][u] = d[u][v] = (x[v] - x[u])   * (x[v] - x[u]) + (y[v] - y[u]) * (y[v] - y[u]) : d[v][u]); }  void add(int x) {  av[++av[0]] = x; }  int size() {  return av[0]; }  int get(int i) {  return av[i + 1]; }  int N = 24; int[] dp = new int[(1 << N)]; int[] dpFrom = new int[1 << N];  void solve() {  int x1 = in.nextInt();  int y1 = in.nextInt();  int n = in.nextInt();  x = new int[n + 1];  y = new int[n + 1];  for (int i = 1; i <= n; i++) {  x[i] = in.nextInt();  y[i] = in.nextInt();  }  x[0] = x1;  y[0] = y1;  Arrays.fill(dp, Integer.MAX_VALUE);  dp[0] = 0;  av = new int[n + 1];  for (int i = 0; i <= n; i++)  for (int j = 0; j <= n; j++)   dist(i, j);  for (int st = 0; st < (1 << n); st++) {  if (dp[st] == Integer.MAX_VALUE)   continue;  av[0] = 0;  for (int i = 0; i < n; i++)   if ((st & (1 << i)) == 0)   add(i);  if (av[0] == 0)   continue;  for (int i = 0; i < 1; i++)   for (int j = i + 1; j < av[0]; j++) {   int val = dp[st] + d[get(i) + 1][0]    + d[get(j) + 1][0]    + d[get(i) + 1][get(j) + 1];   if (dp[st | (1 << get(i)) | (1 << get(j))] > val) {    dp[st | (1 << get(i)) | (1 << get(j))] = val;    dpFrom[st | (1 << get(i)) | (1 << get(j))] = st;   }   }  for (int i = 0; i < 1; i++) {   int val = dp[st] + d[get(i) + 1][0] * 2;   if (dp[st | (1 << get(i))] > val) {   dp[st | (1 << get(i))] = val;   dpFrom[st | (1 << get(i))] = st;   }  }  }  out.println(dp[(1 << n) - 1]);  int nowSt = (1 << n) - 1;  ArrayList<Integer> ans = new ArrayList<Integer>();  ans.add(0);  while (nowSt != 0) {  int newSt = dpFrom[nowSt];  for (int i = 0; i < n; i++)   if (((1 << i) & nowSt) == (1 << i))   if (((1 << i) & newSt) == 0)    ans.add(i + 1);  ans.add(0);  nowSt = newSt;  }  for (int i = ans.size() - 1; i >= 0; i--)  out.print(ans.get(i) + " "); }  void run() {  try {  in = new FastScanner(new File("object.in"));  out = new PrintWriter(new File("object.out"));   solve();   out.close();  } catch (FileNotFoundException e) {  e.printStackTrace();  } }  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;  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  } }  public static void main(String[] args) {  new CF8C().runIO(); } }
1	public class C implements Runnable {  private static final boolean USE_FILE_IO = false;  private static final String FILE_IN = "c.in";  private static final String FILE_OUT = "c.out";  BufferedReader in;  PrintWriter out;  StringTokenizer tokenizer = new StringTokenizer("");  public static void main(String[] args) {   new Thread(new C()).start();  }  int n, h, t;  char[] c;  private void solve() throws IOException {   n = nextInt();   c = nextToken().toCharArray();   if (c.length != n) {    throw new IllegalStateException();   }   for (char l : c)    if (l == 'H') {     h++;    }   t = n - h;   if (h == 0) {    out.print(0);    return;   }   int answer = Integer.MAX_VALUE;   for (int hLo = 0; hLo < n; hLo++)    if (c[hLo] == 'H') {     int hHi = (hLo + h) % n;     int current = 0;     int j = hLo;     while (j != hHi) {      if (c[j] == 'T') {       current++;      }      j = (j + 1) % n;     }     answer = Math.min(answer, current);    }   out.print(answer);  }  public void run() {   long timeStart = System.currentTimeMillis();   try {    if (USE_FILE_IO) {     in = new BufferedReader(new FileReader(FILE_IN));     out = new PrintWriter(new FileWriter(FILE_OUT));    } else {     in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(new OutputStreamWriter(System.out));    }    solve();    in.close();    out.close();   } catch (IOException e) {    throw new IllegalStateException(e);   }   long timeEnd = System.currentTimeMillis();   System.out.println("Time spent: " + (timeEnd - timeStart) + " ms");  }  private String nextToken() throws IOException {   while (!tokenizer.hasMoreTokens()) {    String line = in.readLine();    if (line == null) {     return null;    }    tokenizer = new StringTokenizer(line);   }   return tokenizer.nextToken();  }  private int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  private BigInteger nextBigInt() throws IOException {   return new BigInteger(nextToken());  }  private long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  private double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
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));  }  }
3	public class Main{     void pre() throws Exception{}  void solve(int TC)throws Exception{   int n = ni();   int[] a = new int[n];   for(int i = 0; i< n; i++)a[i] = ni();   Arrays.sort(a);   int ans = 0;   for(int i = 0; i< n; i++){    if(a[i] == -1)continue;    ans++;    for(int j = i+1; j< n; j++)if(a[j]%a[i] == 0)a[j] = -1;   }   pn(ans);  }   void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}  void exit(boolean b){if(!b)System.exit(0);}  long IINF = (long)1e18, mod = (long)1e9+7;  final int INF = (int)1e9, MX = (int)2e6+5;  DecimalFormat df = new DecimalFormat("0.00000000");  double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-6;  static boolean multipleTC = false, memory = false, fileIO = false;  FastReader in;PrintWriter out;  void run() throws Exception{   if(fileIO){    in = new FastReader("input.txt");    out = new PrintWriter("output.txt");   }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();  }  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 digit(long s){int ans = 0;while(s>0){s/=10;ans++;}return ans;}  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 p(Object o){out.print(o);}  void pn(Object o){out.println(o);}  void pni(Object o){out.println(o);out.flush();}  String n()throws Exception{return in.next();}  String nln()throws Exception{return in.nextLine();}  int ni()throws Exception{return Integer.parseInt(in.next());}  long nl()throws Exception{return Long.parseLong(in.next());}  double nd()throws Exception{return Double.parseDouble(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;   }  } }
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;  @Override public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  sc = new FastScanner(in);  solve();  } catch (Throwable t) {  Solution.uncaught = t;  } finally {  out.close();  } }  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()); }  public long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  public double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
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); }
1	public class BB { public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  int n=sc.nextInt();  int k=sc.nextInt();  int a[]=new int[n+1];  boolean used[]=new boolean[100009];  for (int i = 1; i <=n; i++) {   a[i]=sc.nextInt();  }  int cnt=0;  int id=0;  for (int i = 1; i <=n; i++) {   if(!used[a[i]]){    cnt++;   used[a[i]]=true;   }   if(cnt==k){    id=i;    break;   }  }  boolean x[]=new boolean[100005];  int y=0;  int id1=0;  if(id==0){   System.out.println(-1+" "+-1);    return;  }  for (int i =id; i >=1; i--) {   if(!x[a[i]]){    y++;    x[a[i]]=true;   }   if(y==k){    id1=i;    break;   }  }  System.out.println(id1+" "+id); } }
0	public class Rules implements Runnable { private Scanner in = new Scanner(System.in); private PrintWriter out = new PrintWriter(System.out); private double a, v, l, d, w; private double ans;  public static void main(String[] args) {  new Thread(new Rules()).start(); }  public void run() {  read();  solve();  write();  out.close(); }  private void read() {  a = in.nextInt();  v = in.nextInt();  l = in.nextInt();  d = in.nextInt();  w = in.nextInt(); }  private double remaining(double v0, double dst) {  double t = (v - v0) / a;  double d = a * t * t / 2 + t * v0;  if (d > dst)  return (Math.sqrt(v0 * v0 + 2 * a * dst) - v0) / a;  return t + (dst - d) / v; }  private void solve() {  if (w * w >= 2 * a * d || w >= v) {  ans = remaining(0, l);  return;  }  {  double t1 = v / a;  double t2 = (v - w) / a;  double dd = a * t1 * t1 / 2 + a * t2 * t2 / 2 + w * t2;  if (dd < d) {   ans = t1 + t2 + (d - dd) / v + remaining(w, l - d);   return;  }  }  double t1 = w / a;  double rd = d - t1 * t1 * a / 2;  double t2 = (Math.sqrt(w * w + a * rd) - w) / a;  ans = t1 + 2 * t2 + remaining(w, l - d); }  private void write() {  out.printf("%.7f\n", ans); } }
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 PrimesAndDivisors {   public static int[] generateDivisors(int n) {    int[] divisors = IntStream.range(0, n + 1).toArray();    for (int i = 2; i * i <= n; i++)     if (divisors[i] == i)      for (int j = i * i; j <= n; j += i) divisors[j] = i;    return divisors;   }  }  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();   }  } }
5	public class A {  final String filename = new String("C").toLowerCase();  void solve() throws Exception {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  if (isSorted(a)) {  out.println("YES");  return;  }  int pos1 = -1;  for (int i = 0; i < n - 1; i++) {  if (a[i] > a[i + 1]) {   int j = i;   while (j >= 0 && a[j] == a[i]) {   j--;   }   pos1 = j + 1;   break;  }  }  int pos2 = -1;  for (int i = n - 2; i >= 0; i--) {  if (a[i] > a[i + 1]) {   int j = i + 1;   while (j < n && a[j] == a[i + 1]) {   j++;   }   pos2 = j - 1;   break;  }  }  int tmp = a[pos1];  a[pos1] = a[pos2];  a[pos2] = tmp;  if (isSorted(a)) {  out.println("YES");  } else {  out.println("NO");  } }  boolean isSorted(int[] a) {  for (int i = 0; i < a.length - 1; i++) {  if (a[i] > a[i + 1]) {   return false;  }  }  return true; }  void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);       solve();   out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  BufferedReader in; StringTokenizer st; PrintWriter out;  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()); }  long nextLong() throws Exception {  return Long.parseLong(nextToken()); }  double nextDouble() throws Exception {  return Double.parseDouble(nextToken()); }  public static void main(String[] args) {  new A().run(); } }
0	public class x {  public static void main(String args[])  {   Scanner obj=new Scanner(System.in);   int n;   String d="0";   n=obj.nextInt();   if(n%4==0 || n%7==0 || n%47==0 || n%74==0 || n%447==0 || n%474==0 || n%747==0)   d="YES";   else if(n%444==0 || n%477==0 || n%744==0 || n%774==0 || n%777==0)   d="YES";   else   d="NO";   System.out.print(d);  } }
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);   CNastyaAndAWardrobe solver = new CNastyaAndAWardrobe();   solver.solve(1, in, out);   out.close();  }  static class CNastyaAndAWardrobe {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    long x = in.nextLong();    long k = in.nextLong();    if (x == 0) {     out.println(0);    } else {     long mod = (long) (1e9 + 7);     long ans = (((((2 * x - 1) % mod)) * power(2, k, mod)) % mod) + 1;     ans %= mod;     out.println(ans);    }   }   long power(long x, long y, long p) {    long res = 1;    x = x % p;    while (y > 0) {     if ((y & 1) > 0)      res = (res * x) % p;     y = y >> 1;     x = (x * x) % p;    }    return res;   }  }  static class FastScanner {   private final InputStream stream;   private final 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 long nextLong() {    return Long.parseLong(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();   }  } }
4	public class C{  private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  private static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));  public static void main (String[] args) throws IOException {   int t = Integer.parseInt(br.readLine());   while(t-- > 0) {    int n = Integer.parseInt(br.readLine());    int prev = 1;    ArrayList<Integer> nums = new ArrayList<>();    nums.add(1);    String till = "1";    for(int i=0;i<n;i++) {     int ln = Integer.parseInt(br.readLine());     if(i == 0) {      bw.write("1\n");      continue;     }     if(ln == 1) {      nums.add(1);     }else if(ln == prev + 1) {      nums.set(nums.size()-1, ln);     }else {      int idx = -1;      for(int j=nums.size()-1;j>=0;j--) {       if(nums.get(j) == ln-1) {        idx = j;        break;       }      }      ArrayList<Integer> temp = new ArrayList<>();      for(int j=0;j<idx;j++) {       temp.add(nums.get(j));      }      temp.add(ln);      nums.clear();      nums = temp;     }     for(int j=0;j<nums.size()-1;j++) {      bw.write(nums.get(j) + ".");     }     bw.write(nums.get(nums.size()-1) + "\n");     prev = ln;    }      }   bw.flush();  } }
2	public class Main { static BigInteger tow=new BigInteger("2"),mod=new BigInteger("1000000007"); static BigInteger pow(BigInteger a,BigInteger b) {  if(b.equals(BigInteger.ZERO))return BigInteger.ONE;  BigInteger x=pow(a,b.divide(tow));  if(b.mod(tow).equals(BigInteger.ZERO))   return x.mod(mod).multiply(x.mod(mod)).mod(mod);  else   return x.mod(mod).multiply(x.mod(mod)).mod(mod).multiply(a).mod(mod); } public static void main(String[] args) throws IOException {  BigInteger x=in.RB(),k=in.RB();  if(k.equals(BigInteger.ZERO))System.out.println(x.multiply(tow).mod(mod));  else if(x.equals(BigInteger.ZERO))System.out.println(0);  else {  BigInteger x1=tow.multiply(x).subtract(BigInteger.ONE);  x1=x1.mod(mod);  BigInteger x2=pow(tow,k);  x2=x2.mod(mod);  System.out.println(x1.multiply(x2).add(BigInteger.ONE).mod(mod));    } } }  class in{ static StringTokenizer st=new StringTokenizer(""); static BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); static String next() throws IOException {  while(!st.hasMoreTokens())st=new StringTokenizer(bf.readLine());  return st.nextToken(); } static int RI() throws IOException {  return Integer.parseInt(next()); } static BigInteger RB() throws IOException {  return new BigInteger(next()); } }
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 int ni() {   return (int) input.ForLong();  }  static String ns() {   return input.ForString();  }  static long nl() {   return input.ForLong();  }  static double nd() throws IOException {   return Double.parseDouble(new BufferedReader(new InputStreamReader(System.in)).readLine());  }    static void pl() {   pw.println();  }  static void p(Object o) {   pw.print(o + " ");  }  static void pws(Object o) {   pw.print(o + "");  }  static void pl(Object o) {   pw.println(o);  }    public static int[] fastSort(int[] f) {   int n = f.length;   int[] to = new int[n];   {    int[] b = new int[65537];    for (int i = 0; i < n; i++) b[1 + (f[i] & 0xffff)]++;    for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];    for (int i = 0; i < n; 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 < n; i++) b[1 + (f[i] >>> 16)]++;    for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];    for (int i = 0; i < n; i++) to[b[f[i] >>> 16]++] = f[i];    int[] d = f;    f = to;    to = d;   }   return f;  }  public static void main(String[] args) {     new Thread(null, null, "Vengeance", 1 << 25)   {    public void run() {     try {      double s = System.currentTimeMillis();      MainSolution();           pw.flush();      pw.close();     } catch (Exception e) {      e.printStackTrace();      System.exit(1);     }    }   }.start();  } }
1	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();   int testCount = Integer.parseInt(in.next());   for (int i = 1; i <= testCount; i++)    solver.solve(i, in, out);   out.close();  }  static class TaskB {   public void solve(int testNumber, InputReader in, PrintWriter out) {    long x = in.readLong();    if (x % 2 == 1) {     out.println("NO");     return;    }    if (x % 2 == 0) {     long p = x / 2;     long square = (long) Math.sqrt(p);     if (square * 1L * square == p) {      out.println("YES");      return;     }    }    if (x % 4 == 0) {     long p = x / 4;     long square = (long) Math.sqrt(p);     if (square * 1L * square == p) {      out.println("YES");      return;     }    }    out.println("NO");   }  }  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 String readString() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     if (Character.isValidCodePoint(c)) {      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 String next() {    return readString();   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
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());   }   long nextLong() throws IOException {    return Long.parseLong(next());   }   double nextDouble() throws IOException {    return Double.parseDouble(next());   }   String nextLine() throws IOException {    return br.readLine();   }  }  }
5	public class Three{  public static void main(String[] args) { Scanner in = new Scanner (System.in); PrintWriter out = new PrintWriter(System.out);  pair[] points = new pair [3]; for (int i = 0; i < 3; ++i) {  int x = in.nextInt();  int y = in.nextInt();  points[i] = new pair (x, y); }  Arrays.sort(points);  int MaxY = Math.max(Math.max(points[0].y, points[1].y), points[2].y); int MinY = Math.min(Math.min(points[0].y, points[1].y), points[2].y);  out.println(MaxY - MinY + points[2].x - points[0].x + 1); for (int i = MinY; i <= MaxY; ++i)  out.println(points[1].x + " " + i); for (int i = points[0].x; i < points[1].x; ++i)  out.println(i + " " + points[0].y); for (int i = points[1].x + 1; i <= points[2].x; ++i)  out.println(i + " " + points[2].y);  out.close();  }  public static class pair implements Comparable<pair> { int x, y; public pair (int x_, int y_) {  x = x_; y = y_; }  @Override public int compareTo(pair o) {  return x - o.x; }  } }
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);   DExplorerSpace solver = new DExplorerSpace();   solver.solve(1, in, out);   out.close();  }  static class DExplorerSpace {   static final int oo = 1000000000;   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.nextInt(), m = in.nextInt(), k = in.nextInt();    int[][] right = new int[n][m - 1];    int[][] down = new int[n - 1][m];    for (int i = 0; i < n; i++) right[i] = in.readIntArray(m - 1);    for (int i = 0; i + 1 < n; i++) down[i] = in.readIntArray(m);    if (k % 2 == 1) {     for (int i = 0; i < n; i++) {      for (int j = 0; j < m; j++) out.print(-1 + " ");      out.println();     }     return;    }    int[][][] dp = new int[k / 2 + 1][n][m];    for (int r = 1; 2 * r <= k; r++) {     for (int i = 0; i < n; i++) Arrays.fill(dp[r][i], oo);     for (int i = 0; i < n; i++)      for (int j = 0; j < m - 1; j++) {       int cost = right[i][j];       dp[r][i][j] = Integer.min(dp[r][i][j], dp[r - 1][i][j + 1] + cost);       dp[r][i][j + 1] = Integer.min(dp[r][i][j + 1], dp[r - 1][i][j] + cost);      }     for (int i = 0; i + 1 < n; i++)      for (int j = 0; j < m; j++) {       int cost = down[i][j];       dp[r][i][j] = Integer.min(dp[r][i][j], dp[r - 1][i + 1][j] + cost);       dp[r][i + 1][j] = Integer.min(dp[r][i + 1][j], dp[r - 1][i][j] + cost);      }    }    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      out.print(2 * dp[k / 2][i][j] + " ");     }     out.println();    }   }  }  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) {    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 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);   }  } }
6	public class Main {  public static void main(String[] args) {   new Thread(null, new Runnable() {    public void run() {     new Main().solve();    }   }, "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, new Comparator<int[]>() {     public int compare(int[] o1, int[] o2) {      return -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[(k + l) % n][max[i][1]]);        }       }       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 CodeHash {   public static void shuffle(int[][] ar) {    Random rd = new Random(new Random().nextInt());    for (int i = 0; i < ar.length; i++) {     int index = rd.nextInt(ar.length);     int[] temp = ar[i];     ar[i] = ar[index];     ar[index] = temp;    }   }  }  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	@SuppressWarnings("unused") public class A { public static void main(String[] args) throws Exception {  Scanner in = new Scanner(System.in);  long n = in.nextLong();  System.out.println("0 0 " + n); } }
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());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }  }   static long MOD=(long)1e9+7;   static void debug(Object... o) {   System.out.println(Arrays.deepToString(o));  }  static FastReader sc=new FastReader();  static PrintWriter out=new PrintWriter(System.out);    static int code(int x,int y) {  return 505*x+y;  }  static class pair{  int x,y;  pair(int a,int b){   this.x=a;   this.y=b;  }  public boolean equals(Object obj) {   if(obj == null || obj.getClass()!= this.getClass()) return false;    pair p = (pair) obj;    return (this.x==p.x && this.y==p.y);   }  public int hashCode() {    return Objects.hash(x,y);   }  }  static int hor[][],ver[][];  static int moves[][]= {{-1,0},{1,0},{0,-1},{0,1}};  static int n,m;  static int dp[][][];  static int solve(int x,int y,int k) {  if(k==0) {   return 0;  }  if(dp[x][y][k]!=0) return dp[x][y][k];  int min=(int)MOD;  for(int mo[]: moves) {  int X=x+mo[0],Y=y+mo[1];  if(X<0 || X>=n || Y<0 || Y>=m) continue;  int val=0;  if(mo[0]==1) val=ver[x][y];  else if(mo[0]==-1) val=ver[x-1][y];  else if(mo[1]==1) val=hor[x][y];  else val=hor[x][y-1];  min=Math.min(min, 2*val+solve(X,Y,k-2));  }  return dp[x][y][k]=min;  }   public static void main (String[] args) throws java.lang.Exception {  int test=1;    while(test-->0) {   n=sc.nextInt();m=sc.nextInt();   int k=sc.nextInt();   if(k%2!=0) {   for(int i=0;i<n;i++) {    for(int j=0;j<m;j++) out.print(-1+" ");    out.println();   }   continue;   }   hor=new int[n][m-1];   ver=new int[n-1][m];   for(int i=0;i<n;i++) {   for(int j=0;j<m-1;j++) {    hor[i][j]=sc.nextInt();   }   }   for(int i=0;i<n-1;i++) {   for(int j=0;j<m;j++) {    ver[i][j]=sc.nextInt();   }   }   dp=new int[n][m][k+1];   for(int i=0;i<n;i++) {   for(int j=0;j<m;j++) {    out.print(solve(i,j,k)+" ");   }   out.println();   }     }   out.flush();   out.close();  } }
3	public class TaskA { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  Set<Integer> set = new HashSet<>();  for (int i = 0; i < n; i++) {   int a = sc.nextInt();   boolean flag = false;   List<Integer> toRemove = new ArrayList<>();   for (int b : set) {    if (a % b == 0) {     flag = true;     break;    } else if (b % a == 0 && a < b) {     toRemove.add(b);    }   }   for (int r: toRemove) {    set.remove(r);   }   if (!flag) {    set.add(a);   }  }  System.out.println(set.size()); } }
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);   TaskG solver = new TaskG();   solver.solve(1, in, out);   out.close();  }  static class TaskG {   static int[][] g;   static int n;   static int[] a;   static int[][] edges;   static long[] dp;   static long[] dpPathToRootWithDetours;   static int time = 0;   static int[] appearance;   static int[] firstAppearance;   static int[] depth;   public static void dfs(int i, int parE) {    firstAppearance[i] = time;    appearance[time++] = i;    dp[i] = a[i];    for (int eIndex : g[i]) {     if (eIndex == parE) continue;     int child = i ^ edges[eIndex][0] ^ edges[eIndex][1];     dfs(child, eIndex);     appearance[time++] = i;     dp[i] += Math.max(dp[child] - edges[eIndex][2] * 2, 0);    }   }   public static void dfs2(int i, int parE) {    if (i == 0) {     dpPathToRootWithDetours[i] = dp[i];    } else {     int par = i ^ edges[parE][0] ^ edges[parE][1];     depth[i] = depth[par] + 1;     dpPathToRootWithDetours[i] = dpPathToRootWithDetours[par] - Math.max(0, dp[i] - edges[parE][2] * 2);     dpPathToRootWithDetours[i] -= edges[parE][2];     dpPathToRootWithDetours[i] += dp[i];     long myPathWeight = Math.max(dp[i] - edges[parE][2] * 2, 0);     long change = dp[par] - myPathWeight - edges[parE][2] * 2;     change = Math.max(change, 0);     dp[i] += change;    }    for (int eIndex : g[i]) {     if (eIndex == parE) continue;     dfs2(i ^ edges[eIndex][0] ^ edges[eIndex][1], eIndex);    }   }   public void solve(int testNumber, InputReader in, PrintWriter out) {    n = in.NextInt();    int q = in.NextInt();    a = in.NextIntArray(n);    edges = new int[n - 1][3];    {     long[] count = new long[n];     for (int i = 0; i < n - 1; i++) {      int u = in.NextInt() - 1;      int v = in.NextInt() - 1;      int w = in.NextInt();      edges[i][0] = u;      edges[i][1] = v;      edges[i][2] = w;      count[u]++;      count[v]++;     }     g = new int[n][];     for (int i = 0; i < n; i++) {      g[i] = new int[(int) count[i]];     }     for (int i = 0; i < n - 1; i++) {      for (int j = 0; j < 2; j++) {       g[edges[i][j]][(int) --count[edges[i][j]]] = i;      }     }    }    dp = new long[n];    dpPathToRootWithDetours = new long[n];    depth = new int[n];    firstAppearance = new int[n];    appearance = new int[(n - 1) * 2 + 1];    dfs(0, -1);    dfs2(0, -1);    GraphLowestCommonAncestor.LCA lca = GraphLowestCommonAncestor.createLCA(appearance, firstAppearance, depth);    firstAppearance = null;    depth = null;    appearance = null;    edges = null;    g = null;    for (int i = 0; i < q; i++) {     int u = in.NextInt() - 1;     int v = in.NextInt() - 1;     int lcaI = lca.getLCA(u, v);     long res = dpPathToRootWithDetours[u] + dpPathToRootWithDetours[v] - 2 * dpPathToRootWithDetours[lcaI] + dp[lcaI];     out.println(res);    }   }  }  static class MinRangeSparseTable implements ISearchInRange {   private final int[][] sparseTables;   private final long[] array;   private final boolean reverseOrdered;   public MinRangeSparseTable(long[] array, boolean reverseOrdered) {    this.reverseOrdered = reverseOrdered;    this.array = array;    int LCALength = IntegerExtension.getNumberOfBits(array.length);    sparseTables = new int[LCALength][];    sparseTables[0] = new int[array.length];    for (int i = 0; i < array.length; i++) {     sparseTables[0][i] = i;    }    for (int i = 1; i < LCALength; i++) {     int size = 1 << i;     int jumpSize = 1 << (i - 1);     sparseTables[i] = new int[sparseTables[0].length - size + 1];     for (int j = 0; j < sparseTables[i].length; j++) {      sparseTables[i][j] = min(sparseTables[i - 1][j], sparseTables[i - 1][j + jumpSize]);     }    }   }   private int min(int a, int b) {    return ((array[a] < array[b]) ^ reverseOrdered) ? a : b;   }    public Pair<Long, Long> queryIndexValueInRange(long l, long r) {    int size = (int) (r - l + 1);    int LCAIndex = IntegerExtension.getNumberOfBits(size) - 1;    int sizeNeeded = 1 << LCAIndex;    int res = min(sparseTables[LCAIndex][(int) l], sparseTables[LCAIndex][(int) (r - sizeNeeded + 1)]);    return new Pair<>((long) res, array[res]);   }   public MinRangeSparseTable(long[] array) {    this(array, false);   }  }  static class GraphLowestCommonAncestor {   public static GraphLowestCommonAncestor.LCA createLCA(int[] appearances, final int[] firstAppearance, final int[] depth) {    return new GraphLowestCommonAncestor.LCA_MinRangeSparseTable(appearances, firstAppearance, depth);   }   public interface LCA {    int getLCA(int a, int b);   }   private static class LCA_MinRangeSparseTable implements GraphLowestCommonAncestor.LCA {    private final MinRangeSparseTable minRangeSparseTable;    private final int[] firstAppearance;    private final int[] indexToNode;    public LCA_MinRangeSparseTable(int[] appearances, final int[] firstAppearance, final int[] depth) {     this.firstAppearance = firstAppearance;     this.indexToNode = appearances;     long[] depthOrder = new long[appearances.length];     for (int i = 0; i < depthOrder.length; i++) {      depthOrder[i] = depth[appearances[i]];     }     minRangeSparseTable = new MinRangeSparseTable(depthOrder);    }     public int getLCA(int a, int b) {     a = firstAppearance[a];     b = firstAppearance[b];     int l = Math.min(a, b), r = Math.max(a, b);     return indexToNode[(int) (long) minRangeSparseTable.queryIndexValueInRange(l, r).first];    }   }  }  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 int[] NextIntArray(int n) {    return NextIntArray(n, 0);   }   public int[] NextIntArray(int n, int offset) {    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = NextInt() + offset;    }    return a;   }  }  static interface ISearchInRange {  }  static class Pair<T1, T2> {   public T1 first;   public T2 second;   public Pair(T1 f, T2 s) {    first = f;    second = s;   }  }  static class IntegerExtension {   public static int getNumberOfBits(long i) {    return 64 - Long.numberOfLeadingZeros(i);   }  } }
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 int[] toIntArray()throws Exception{   String str[]=br.readLine().split(" ");   int k[]=new int[str.length];   for(int i=0;i<str.length;i++){    k[i]=Integer.parseInt(str[i]);   }   return k;  }  public static int toInt()throws Exception{   return Integer.parseInt(br.readLine());  }  public static long[] toLongArray()throws Exception{   String str[]=br.readLine().split(" ");   long k[]=new long[str.length];   for(int i=0;i<str.length;i++){    k[i]=Long.parseLong(str[i]);   }   return k;  }  public static long toLong()throws Exception{   return Long.parseLong(br.readLine());  }  public static double[] toDoubleArray()throws Exception{   String str[]=br.readLine().split(" ");   double k[]=new double[str.length];   for(int i=0;i<str.length;i++){    k[i]=Double.parseDouble(str[i]);   }   return k;  }  public static double toDouble()throws Exception{   return Double.parseDouble(br.readLine());  }  public static String toStr()throws Exception{   return br.readLine();  }  public static String[] toStrArray()throws Exception{   String str[]=br.readLine().split(" ");   return str;  }   }
0	public class TwoSquares {   int INF = 1000;   void solve() {   int[][] s1 = new int[4][2];   for (int i = 0; i < 4; i++) {    s1[i][0] = in.nextInt();    s1[i][1] = in.nextInt();   }     int[][] s2 = new int[4][2];   for (int i = 0; i < 4; i++) {    s2[i][0] = in.nextInt();    s2[i][1] = in.nextInt();   }     if (ok(s1, s2)) {    out.println("Yes");    return;   }     rotate(s1);   rotate(s2);     if (ok(s2, s1)) {    out.println("Yes");    return;   }     out.println("No");  }   void rotate(int[][] s) {   for (int i = 0; i < 4; i++) {    int x = s[i][0], y = s[i][1];    s[i][0] = x - y;    s[i][1] = x + y;   }  }   boolean ok(int[][] s1, int[][] s2) {   int xmin = INF, xmax = -INF, ymin = INF, ymax = -INF;   for (int i = 0; i < 4; i++) {    xmin = Math.min(xmin, s1[i][0]);    xmax = Math.max(xmax, s1[i][0]);    ymin = Math.min(ymin, s1[i][1]);    ymax = Math.max(ymax, s1[i][1]);   }     for (int i = 0; i < 4; i++) {    if (s2[i][0] >= xmin && s2[i][0] <= xmax && s2[i][1] >= ymin && s2[i][1] <= ymax) return true;   }     int[] mid2 = new int[]{s2[0][0] + s2[2][0], s2[0][1] + s2[2][1]};   return mid2[0] >= xmin * 2 && mid2[0] <= xmax * 2 && mid2[1] >= ymin * 2 && mid2[1] <= ymax * 2;  }   public static void main(String[] args) {   in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));   out = new PrintWriter(System.out);   new TwoSquares().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());   }     public double nextDouble() {    return Double.parseDouble(nextToken());   }  } }
6	public class Order8C implements Runnable {  private Scanner in = new Scanner(System.in);  private PrintWriter out = new PrintWriter(System.out);  int mintime;  String path;  int xs;  int ys;  int n;  int[] obx;  int[] oby;   public static void main(String[] args) { new Thread(new Order8C()).start();  }  private void read() { xs = in.nextInt(); ys = in.nextInt(); n = in.nextInt(); obx = new int[n]; oby = new int[n]; for(int i = 0; i<n; i++){  obx[i] = in.nextInt();  oby[i] = in.nextInt(); }   }  private void solve() {   int[] ds = new int[n]; int[][] d = new int[n][n];  int[] best = new int[1 << n]; int[] last = new int[1 << n];  for(int i = 0; i<n; i++){  ds[i] = (obx[i]-xs)*(obx[i]-xs) + (oby[i]-ys)*(oby[i]-ys);  for(int j = i+1; j<n; j++){  d[i][j] = (obx[i]-obx[j])*(obx[i]-obx[j]) + (oby[i]-oby[j])*(oby[i]-oby[j]);  d[j][i] = (obx[i]-obx[j])*(obx[i]-obx[j]) + (oby[i]-oby[j])*(oby[i]-oby[j]);  } }  for(int i=0; i< (1<<n); i++){   best[i] = 100000000; } best[0] = 0;  for(int i=0; i< (1<<n); i++){     for(int j = 0; j<n; j++){  if( ((1 << j) & i) != 0){   if(best[i - (1<<j)] + 2*ds[j] < best[i]){  best[i] = best[i - (1<<j)] + 2*ds[j];  last[i] = i - (1<< j);   }   for(int k = j+1; k<n; k++){    if( ((1 << k) & i) != 0){    if( (best[i-(1<<j) -(1<<k)] +ds[j]+ds[k]+d[j][k]) < best[i]){    best[i] = (best[i-(1<<j) -(1<<k)] +ds[j]+ds[k]+d[j][k]);    last[i] = i -(1<<j) - (1<< k);    }    }   }   break;  }  } } int i = (1<<n) -1; mintime = best[i]; path = "";  while(i >0){    path = path + "0 ";  int dif = i-last[i];   for(int j=0; j<n; j++){  if( ((1<<j) & dif) != 0){   path = path + (j+1) + " ";  }  }    i = last[i]; } path = path + "0";  }  private void write() { out.println(mintime); out.println(path);  }  public void run() { read(); solve(); write(); out.close();  } }
1	public class A implements Runnable { public static void main(String[] args) {  new A().run(); }  class FastScanner {  BufferedReader br;  StringTokenizer st;  boolean eof;  String buf;  public FastScanner(String fileName) throws FileNotFoundException {  br = new BufferedReader(new FileReader(fileName));  nextToken();  }  public FastScanner(InputStream stream) {  br = new BufferedReader(new InputStreamReader(stream));  nextToken();  }  String nextToken() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (Exception e) {   eof = true;   break;   }  }  String ret = buf;  buf = eof ? "-1" : st.nextToken();  return ret;  }  int nextInt() {  return Integer.parseInt(nextToken());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  }  void close() {  try {   br.close();  } catch (Exception e) {   }  }  boolean isEOF() {  return eof;  } }  FastScanner sc; PrintWriter out;  public void run() {  Locale.setDefault(Locale.US);  try {  sc = new FastScanner(System.in);  out = new PrintWriter(System.out);  solve();  sc.close();  out.close();  } catch (Throwable e) {  e.printStackTrace();  System.exit(1);  } }  int nextInt() {  return sc.nextInt(); }  String nextToken() {  return sc.nextToken(); }  long nextLong() {  return sc.nextLong(); }  double nextDouble() {  return sc.nextDouble(); }  boolean isPrime(int x) {  for (int i = 2; i * i <= x; i++) {  if (x % i == 0) {   return false;  }  }  return true; }  void solve() {  int n = nextInt();  int k = nextInt();  ArrayList<Integer> primes = new ArrayList<Integer>();  for (int i = 2; i <= n; i++) {  if (isPrime(i)) {   primes.add(i);  }  }  int ans = 0;  for (int i = 0; i < primes.size(); i++) {  for (int j = 0; j < i - 1; j++) {   if (primes.get(j) + primes.get(j + 1) + 1 == primes.get(i)    .intValue()) {   ans++;   break;   }  }  }  if (ans >= k) {  out.println("YES");  } else {  out.println("NO");  } } }
0	public class A {  public static void main(String[] args) {  try (final 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 int nextInt() {  return Integer.parseInt(next());  }   public long nextLong() {  return Long.parseLong(next());  }  public void close() {  try {   br.close();  } catch (IOException e) {   }  } } }
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; } }
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());  }  long nextLong() {  return Long.parseLong(next());  } }  public static void main(String[] arg) {  new A().run(); } }
3	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = sc.nextInt();   }   Arrays.sort(a);   Set<Integer> div = new HashSet<>();   boolean[] d = new boolean[n];   for (int i = 0; i < n; i++) {    for (int j = 0 ; j < n; j++) {     if (d[j]) {      continue;     }     if (a[j]%a[i] == 0) {      d[j] = true;      div.add(a[i]);     }    }   }   System.out.println(div.size());  } }
1	public class Main{ public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  while(sc.hasNext()) {  int n=sc.nextInt();  String s=sc.next();  int sum=0;  for(int i=0;i<s.length();i++) {   if(s.charAt(i)=='+') {   sum++;   }   if(s.charAt(i)=='-'&&sum!=0) {   sum--;   }  }  System.out.println(sum);  } } }
5	public class A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int N = sc.nextInt();   int first = Integer.MAX_VALUE, second = Integer.MAX_VALUE;   for (int i = 0, x; i < N; ++i) {    x = sc.nextInt();    if (x < first) {     second = first;     first = x;    } else if (x > first && x < second) {     second = x;    }   }   if (second == Integer.MAX_VALUE)    System.out.println("NO");   else    System.out.println(second);  } }
1	public class A {  public static void main(String args[])  {   Scanner scan = new Scanner(System.in);   int n = scan.nextInt();      int odd = -1;   int even = -1;   int oc = 0;   int ec = 0;     for(int i=0;i < n;i++)   {    if(scan.nextInt() % 2 == 0)    {     ec++;     even = i+1;    }    else    {     oc++;     odd = i+1;    }   }     if(ec == 1)    System.out.println(even);   else    System.out.println(odd);  } }
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 String nextLine()  {  String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;  }  public int nextInt()  {  int c = read();    while(isSpaceChar(c))   c = read();    int sgn = 1;    if (c == '-')   {   sgn = -1;   c = read();  }    int res = 0;  do   {   if(c<'0'||c>'9')    throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  while (!isSpaceChar(c));     return res * sgn;  }   public long nextLong()  {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-')   {   sgn = -1;   c = read();  }  long res = 0;    do   {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  while (!isSpaceChar(c));   return res * sgn;  }   public double nextDouble()  {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-')   {   sgn = -1;   c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.')   {   if (c == 'e' || c == 'E')   return res * Math.pow(10, nextInt());   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  if (c == '.')   {   c = read();   double m = 1;   while (!isSpaceChar(c))   {   if (c == 'e' || c == 'E')    return res * Math.pow(10, nextInt());   if (c < '0' || c > '9')    throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();   }  }  return res * sgn;  }   public String readString()  {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do   {   res.appendCodePoint(c);   c = read();  }   while (!isSpaceChar(c));    return res.toString();  }   public boolean isSpaceChar(int c)  {  if (filter != null)   return filter.isSpaceChar(c);  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }   public String next()  {  return readString();  }   public interface SpaceCharFilter  {  public boolean isSpaceChar(int ch);  } }   public static void main(String args[]) throws Exception {  new Thread(null, new 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 lcm(int a, int b)  {   return (a*b)/gcd(a, b);  } static int max= -1; public void run() {  InputReader sc= new InputReader(System.in);  PrintWriter w= new PrintWriter(System.out);  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 sqr = 2*r*2*r;  double[] ans= new double[n];  for(int i = 0;i < arr.length;i++){  ans[i] = r*1.0;  for(int j = 0;j < i;j++){   if(Math.abs(arr[i] - arr[j]) < 2*r){   ans[i] = Math.max(ans[i],Math.sqrt(sqr - Math.abs(arr[i] - arr[j])*Math.abs(arr[i]-arr[j])) + ans[j]);   }else if(Math.abs(arr[i]-arr[j]) == 2*r){   ans[i] = Math.max(ans[i],ans[j]);   }  }  }  for(int i = 0;i < ans.length;i++){  System.out.printf("%.7f ",ans[i]);  }  w.close(); } }
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()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(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); }  public void run() {  Locale.setDefault(Locale.UK);  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   solve();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } finally {  out.flush();  } } }
0	public class Main {  public static void main(String[] args) {   Scanner read = new Scanner(System.in);   double a = (double)read.nextInt();   double v = (double)read.nextInt();   double l = (double)read.nextInt();   double d = (double)read.nextInt();   double w = (double)read.nextInt();   double t=0;   if(w>=v){    double d1=v*v/(2*a);    if(d1>l){     t+= Math.sqrt(2*l/a);    }    else{     t+= v/a + (l-d1)/v;    }   }   else{    double temp = (v-w)/a;    double d1 = v*v/(2*a);    double d2 = d - v*temp + a*temp*temp/2;    if(d1>d2){     double temp2 = Math.sqrt(2*a*d);     if(temp2<w){      w=temp2;      temp=(v-w)/a;      t+= temp2/a;     }     else{      double vx=Math.sqrt(v*v/2+a*d2);      t+= (vx/a) + ((vx-w)/a);     }    }    else{     t+= (v/a) + ((d2-d1)/v) + (temp);    }    double d3 = d + w*temp + a*temp*temp/2;    if(d3>l){     t+= (-w+Math.sqrt(w*w+2*a*(l-d)))/a;    }    else{     t+= (temp) + ((l-d3)/v);    }   }   System.out.printf("%.6f", t);   read.close();  } }
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()); }  public long nextLong() {  return Long.parseLong(next()); } }
1	public class as { static class Reader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;    public Reader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public Reader(String file_name) throws IOException   {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public String readLine() throws IOException   {    byte[] buf = new byte[100000000];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }    public int nextInt() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do    {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');     if (neg)     return -ret;    return ret;   }    public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }    public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();     do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');     if (c == '.')    {     while ((c = read()) >= '0' && c <= '9')     {      ret += (c - '0') / (div *= 10);     }    }     if (neg)     return -ret;    return ret;   }    private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }    private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }    public void close() throws IOException   {    if (din == null)     return;    din.close();   }  }   public static void main(String[] args) throws Exception {  Reader sc=new Reader();  StringBuilder finalAnswer=new StringBuilder();   int t=sc.nextInt();  while(t-->0) {  int count=0;  int n=sc.nextInt();  if(n==2 || n==4) {   finalAnswer.append("YES").append('\n');   count++;  }  if(n%2==0 && count==0){   n/=2;   if((int)Math.sqrt(n)*(int)Math.sqrt(n)==n) {   finalAnswer.append("YES").append('\n');   count++;   }   else {   n*=2;   }  }  if(n%4==0 && count==0) {   n/=4;   if((int)Math.sqrt(n)*(int)Math.sqrt(n)==n) {   finalAnswer.append("YES").append('\n');   count++;   }  }  if(count==0){   finalAnswer.append("NO").append('\n');  }  }  System.out.println(finalAnswer); }   public static long gcd(long a, long b) {  while (b > 0)  {   long temp = b;   b = a % b;    a = temp;  }  return a; } public static long lcm(long a, long b) {  return a * (b / gcd(a, b)); } static boolean containsDigit(int number, int digit) {  while (number > 0)  {   int curr_digit = number % 10;   if (curr_digit == digit) return true;   number /= 10;  }   return false; } static boolean isPalindrome(String s) {  int n = s.length();  for (int i = 0; i < (n/2); ++i) {   if (s.charAt(i) != s.charAt(n - i - 1)) {    return false;   }  }   return true; } void sieveOfEratosthenes(int n)  {                    boolean prime[] = new boolean[n + 1];   for (int i = 0; i <= n; i++)    prime[i] = true;    for (int p = 2; p * p <= n; p++)   {           if (prime[p] == true)    {         for (int i = p * p; i <= n; i += p)      prime[i] = false;    }   }      for (int i = 2; i <= n; i++)   {    if (prime[i] == true)     System.out.print(i + " ");   }  } }
5	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);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, FastReader in, PrintWriter out) {    int n = in.nextInt();    TaskD.Pair[] p = new TaskD.Pair[n];    for (int i = 0; i < n; ++i) {     p[i] = new TaskD.Pair(in.nextLong(), in.nextLong());    }    Arrays.sort(p);    int last = 0;    int ans = 1;    for (int i = 1; i < n; ++i) {     if (p[i].x - p[i].w >= p[last].x + p[last].w) {      last = i;      ++ans;     }    }    out.println(ans);   }   static class Pair implements Comparable<TaskD.Pair> {    long x;    long w;    public Pair(long x, long w) {     this.x = x;     this.w = w;    }    public int compareTo(TaskD.Pair o) {     return Long.compare(x + w, o.x + o.w);    }    public String toString() {     return x + " " + w;    }   }  }  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;   }   public long nextLong() {    int c = pread();    while (isSpaceChar(c))     c = pread();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = pread();    }    long res = 0;    do {     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 CF {   BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st=null;   private void solution() throws IOException{  int n=nextInt();  if((n % 4==0 && n>=4)||(n % 7==0 && n>=7) || (n % 44==0 && n>=44) || (n % 47==0 && n>=47) || (n % 77==0 && n>=77) || (n % 74==0 && n>=74)  || (n % 444==0 && n>=444) || (n % 447==0 && n>=447) || (n % 474==0 && n>=74) || (n % 477==0 && n>=477) || (n % 744==0 && n>=744)  || (n % 747==0 && n>=747) || (n % 777==0 && n>=777)){    System.out.println("YES");  }else{     System.out.println("NO");}   }   String nextToken()throws IOException {     if(st==null || !st.hasMoreTokens()){       st = new StringTokenizer(bf.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());   }   public static void main(String args[]) throws IOException {     new CF().solution();   } }
3	public class D911{  void solve() {  int n = ni();  int[] a = ia(n);  int Q = ni();  String[] ans = {"even", "odd"};  int cur = merge(a, 0, n - 1) % 2;  while(Q-->0)  {  int l = ni(), r = ni();  cur ^= (r - l + 1) / 2 % 2;  out.println(ans[cur]);  }   }  int merge(int[] a, int l, int r) {  if(l >= r)  return 0;  int mid = l + r >> 1;  int v1 = merge(a, l, mid);  int v2 = merge(a, mid + 1, r);   int[] rep = new int[r-l+1];  int ptr0 = 0, ptr1 = l, ptr2 = mid + 1;   long len = mid-l+1;  int ret = 0;  while(ptr1<=mid && ptr2<=r)  {  if(a[ptr1] <= a[ptr2])  {   len--;   rep[ptr0++] = a[ptr1++];  }  else  {   ret += len;   rep[ptr0++] = a[ptr2++];   }  }   while(ptr1 <= mid)  rep[ptr0++] = a[ptr1++];  while(ptr2 <= r)  rep[ptr0++] = a[ptr2++];   for(int i=0;i<ptr0;i++)  a[l+i] = rep[i];   return v1 + v2 + ret; }  public static void main(String[] args){new D911().run();}  private byte[] bufferArray = new byte[1024]; private int bufLength = 0; private int bufCurrent = 0; InputStream inputStream; PrintWriter out;  public void run() {  inputStream = System.in;  out = new PrintWriter(System.out);  solve();  out.flush(); }  int nextByte() {  if(bufLength == -1)  throw new InputMismatchException();  if(bufCurrent >= bufLength)  {  bufCurrent = 0;  try  {bufLength = inputStream.read(bufferArray);}  catch(IOException e)  { throw new InputMismatchException();}  if(bufLength <= 0)   return -1;  }  return bufferArray[bufCurrent++]; }  boolean isSpaceChar(int x) {return (x < 33 || x > 126);}  boolean isDigit(int x) {return (x >= '0' && x <= '9');}  int nextNonSpace() {  int x;  while((x=nextByte()) != -1 && isSpaceChar(x));  return x; }  int ni() {  long ans = nl();  if (ans >= Integer.MIN_VALUE && ans <= Integer.MAX_VALUE)  return (int)ans;  throw new InputMismatchException(); }  long nl() {  long ans = 0;  boolean neg = false;  int x = nextNonSpace();  if(x == '-')  {  neg = true;  x = nextByte();  }  while(!isSpaceChar(x))  {  if(isDigit(x))  {   ans = ans * 10 + x -'0';   x = nextByte();  }  else   throw new InputMismatchException();  }  return neg ? -ans : ans; }  String ns() {  StringBuilder sb = new StringBuilder();  int x = nextNonSpace();  while(!isSpaceChar(x))  {  sb.append((char)x);  x = nextByte();  }  return sb.toString(); }  char nc() { return (char)nextNonSpace();}  double nd() { return (double)Double.parseDouble(ns()); }  char[] ca() { return ns().toCharArray();}  char[][] ca(int n) {  char[][] ans = new char[n][];  for(int i=0;i<n;i++)  ans[i] = ca();  return ans; }  int[] ia(int n) {  int[] ans = new int[n];  for(int i=0;i<n;i++)  ans[i] = ni();  return ans; }  void db(Object... o) {System.out.println(Arrays.deepToString(o));}  }
2	public class B { public static final boolean DEBUG = false; Scanner sc;  public void debug(Object o) {  if (DEBUG) {  int ln = Thread.currentThread().getStackTrace()[2].getLineNumber();  String fn = Thread.currentThread().getStackTrace()[2].getFileName();  System.out.println("(" + fn + ":" + ln+ "): " + o);  } }  public void pln(Object o) {  System.out.println(o); }  long getNumber(int x, int y, int n, int m) {  int n1 = Math.max(0, x + m - n);  int n2 = Math.max(0, y + m - n);  int n3 = Math.max(0, 1 - (x - m));  int n4 = Math.max(0, 1 - (y - m));   int n12 = Math.max(0, n1 + n2 - m - 1);  int n23 = Math.max(0, n2 + n3 - m - 1);  int n34 = Math.max(0, n3 + n4 - m - 1);  int n41 = Math.max(0, n4 + n1 - m - 1);      int m1 = m+1;  long nr = 1 + ((long)m1)*m1*2 - m1*2;  nr -= ((long)n1)*n1 + ((long)n2)*n2 + ((long)n3)*n3 + ((long)n4)*n4;  nr += ((long)n12)*(n12+1)/2 + ((long)n23)*(n23+1)/2 + ((long)n34)*(n34+1)/2 + ((long)n41)*(n41+1)/2;   return nr; } public void run() {    sc = new Scanner(System.in);   int n = sc.nextInt();  int x = sc.nextInt();  int y = sc.nextInt();  int c = sc.nextInt();   if (c <= 1) {  pln(0);  return;  }   int ll = 0;  int rr = 2*n+20;   while(true) {  int m = (ll+rr) / 2;  if (getNumber(x, y, n, m) >= c) {   rr = m;  }  else {   ll = m;  }     if (rr - ll < 3) {   for (int m2=ll; m2<=rr; m2++) {   if (getNumber(x, y, n, m2) >= c) {    pln(m2);    return;   }   }  }  }   } public static void main(String[] args) {  B t = new B();  t.run(); } }
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 B {  public static void main(String[] args) throws IOException {   BufferedReader br= new BufferedReader(new InputStreamReader(System.in));   int t= Integer.parseInt(br.readLine());   while (t-->0)   {    String[] s1= br.readLine().split(" ");    int n= Integer.parseInt(s1[0]);        int x= 1;    boolean ans=true;    while (n%2==0){     x*=2;     n/=2;    }    if (x==1) ans= false;    int z= (int)Math.sqrt(n);    if (z*z!=n) ans= false;    if (ans) System.out.println("YES");    else System.out.println("NO");   }  } }
5	public class A {  private static StreamTokenizer in = null;  private static PrintWriter out = null;   static int nextInt() throws IOException {   in.nextToken();   return (int) in.nval;  }   static long nextLong() throws IOException {   in.nextToken();   return (long) in.nval;  }  static double nextDouble() throws IOException {   in.nextToken();   return (double) in.nval;  }   static String nextString() throws IOException {   in.nextToken();   return in.sval;  }   public static void main(String[] args) throws IOException {   in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));   out = new PrintWriter(System.out);     new A().solve();   out.flush();  }   public void solve() throws IOException {   int n = nextInt();   int min = Integer.MAX_VALUE;   int res = Integer.MAX_VALUE;   for (int i=0; i<n; ++i) {    int d = nextInt();    if (d<min) {     res = min;     min = d;    } else if (d>min && d<res)     res = d;   }   if (res == Integer.MAX_VALUE)    out.println("NO");   else    out.println(res);  } }
4	public class D {  private static ArrayDeque<Integer>[][] edge;  private static long[][] dp[],w1,w2;  private static int N,M,K;  private static void answer()  {   StringBuilder sb=new StringBuilder();   for(int i=0;i<N;i++)   {    for (int j = 0; j < M; j++) sb.append(dp[i][j][K]).append(" ");    sb.append("\n");   }   System.out.println(sb);  }  private static long solve(int i, int j, int pos)  {   if(pos==0) return 0;   if(dp[i][j][pos]!=-1) return dp[i][j][pos];   long a=Long.MAX_VALUE/100;   if(i-1>=0) a=Math.min(a,solve(i-1,j,pos-1)+w2[i-1][j]);   if(i<N-1) a=Math.min(a,solve(i+1,j,pos-1)+w2[i][j]);   if(j-1>=0) a=Math.min(a,solve(i,j-1,pos-1)+w1[i][j-1]);   if(j<M-1) a=Math.min(a,solve(i,j+1,pos-1)+w1[i][j]);   return dp[i][j][pos]=a;  }  public static void main(String[] args) throws Exception  {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   int i;   String[] s=br.readLine().trim().split(" ");   N=Integer.parseInt(s[0]);   M=Integer.parseInt(s[1]);   K=Integer.parseInt(s[2]);   edge=new ArrayDeque[N][M];   for(i=0;i<N;i++)   {    for(int j=0;j<M;j++)     edge[i][j]=new ArrayDeque<>();   }   w1=new long[N][M-1];   w2=new long[N-1][M];   dp=new long[N][M][K/2+1];   for(i=0;i<N;i++)   {    s=br.readLine().trim().split(" ");    for(int j=0;j<M-1;j++) w1[i][j]=Integer.parseInt(s[j])*2L;   }   for(i=0;i<N-1;i++)   {    s=br.readLine().trim().split(" ");    for(int j=0;j<M;j++) w2[i][j]=Integer.parseInt(s[j])*2L;   }   for(i=0;i<N;i++)   {    for(int j=0;j<M;j++)     Arrays.fill(dp[i][j],-1);   }   if(K%2==1)   {    K/=2;    answer();    System.exit(0);   }   K/=2;   for(i=0;i<N;i++)   {    for(int j=0;j<M;j++)     solve(i,j,K);   }   answer();  } }
2	public class Main {  static int n, k;  public static void main(String[] args) throws IOException {   FastScanner sc = new FastScanner();   PrintWriter pw = new PrintWriter(System.out);   n = sc.nextInt();   k = sc.nextInt();   long l = 0;   long r = n + 1;   while (l + 1 != r) {    long m = (r + l) / 2;    if (check(m))     l = m;    else     r = m;   }   pw.print(l * (l + 1L) / 2L - k);   pw.close();  }  public static boolean check(long m) {   return m * (m + 1) / 2 - (n - m) <= k;  } } class FastScanner {  static BufferedReader br;  static StringTokenizer st = new StringTokenizer("");  public FastScanner() {   br = new BufferedReader(new InputStreamReader(System.in));  }  public String next() throws IOException {   while (!st.hasMoreTokens())    st = new StringTokenizer(br.readLine());   return st.nextToken();  }  public int nextInt() throws IOException {   return Integer.parseInt(next());  } }
4	public class c {  static boolean used[][]; static int n; static int m; static int a[][];   public static void main(String args[])throws Exception{  Scanner in =new Scanner(new File("input.txt"));  PrintWriter out=new PrintWriter(new File("output.txt"));  n = in.nextInt();  m = in.nextInt();  int k = in.nextInt();     int x[]=new int[k];  int y[]=new int[k];  for (int i = 0; i<k; i++){  x[i] = in.nextInt();  y[i] = in.nextInt();  }   int max = 0;  int xx = 1; int yy= 1;  for (int i = 1; i<=n; i++)  for (int j = 1; j<=m; j++){   int count = Integer.MAX_VALUE;   for (int l =0; l<k; l++)   count = Math.min(Math.abs(i - x[l]) + Math.abs(j - y[l]), count);    if (max < count){   max = count;   xx = i; yy = j;   }  }  out.println(xx + " " + yy);  out.close(); } }
4	public class Problem implements Runnable {  private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  private BufferedReader in;  private PrintWriter out;  private StringTokenizer tok = new StringTokenizer("");  private void init() throws FileNotFoundException {   Locale.setDefault(Locale.US);   String fileName = "";       in = new BufferedReader(new FileReader("input.txt"));     out = new PrintWriter("output.txt");     }   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());  }  long readLong() {   return Long.parseLong(readString());  }  double readDouble() {   return Double.parseDouble(readString());  }  int[] readIntArray(int size) {   int[] a = new int[size];   for (int i = 0; i < size; i++) {    a[i] = readInt();   }   return a;  }  public static void main(String[] args) {     new Problem().run();  }  long timeBegin, timeEnd;  void time() {   timeEnd = System.currentTimeMillis();   System.err.println("Time = " + (timeEnd - timeBegin));  }  @Override  public void run() {   try {    timeBegin = System.currentTimeMillis();    init();    solve();    out.close();    time();   } catch (Exception e) {    e.printStackTrace();    System.exit(-1);   }  }   int[][] dist;  int n, m;  P v;  ArrayDeque<P> q = new ArrayDeque<>();  private void solve() throws IOException {   n = readInt();   m = readInt();   int k = readInt();   dist = new int[n][m];   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     dist[i][j] = -1;   for (int i = 0; i < k; i++) {    int x = readInt() - 1, y = readInt() - 1;    dist[x][y] = 0;    q.add(new P(x, y));   }   bfs();   out.println(v.x + 1 + " " + (v.y + 1));  }  public void bfs() {   int[] dx = {0, 1, 0, -1};   int[] dy = {1, 0, -1, 0};   while (!q.isEmpty()) {    v = q.poll();    for (int i = 0; i < 4; i++) {     int nx = v.x + dx[i];     int ny = v.y + dy[i];     if (inside(nx, ny) && dist[nx][ny] == -1) {      q.add(new P(nx, ny));      dist[nx][ny] = dist[v.x][v.y] + 1;     }    }   }  }  public boolean inside(int x, int y) {   if (x < n && y < m && x >= 0 && y >= 0) {    return true;   }   return false;  } } class P {  int x, y;  public P(int x, int y) {   this.x = x;   this.y = y;  } }
4	public class Main { public static void main(String[] args) {  InputStream inputStream;  try {  inputStream = new FileInputStream("input.txt");  } catch (IOException e) {  throw new RuntimeException(e);  }  OutputStream outputStream;  try {  outputStream = new FileOutputStream("output.txt");  } catch (IOException e) {  throw new RuntimeException(e);  }  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) {   int N = in.nextInt();   int M = in.nextInt();   int K = in.nextInt();   int[][] dist = new int[N+1][M+1];   for(int[] ini : dist) Arrays.fill(ini,1 << 30);   int best = 0;   ArrayList<Integer> result = new ArrayList<Integer>();   Queue<Integer> q = new LinkedList<Integer>();   for(int k = 0; k < K; ++k) {    int x = in.nextInt();    int y = in.nextInt();    dist[x][y] = 0;    q.offer(x);    q.offer(y);   }   int[] dx = new int[] { 1,-1,0,0 };   int[] dy = new int[] {0,0,1,-1};   while(!q.isEmpty()) {    int a = q.poll();    int b = q.poll();    for(int r = 0; r < 4; ++r) {     int x = a + dx[r];     int y = b + dy[r];     if(x >= 1 && x <= N && y >=1 && y <= M && dist[x][y] > dist[a][b] + 1) {      dist[x][y] = dist[a][b] + 1;      q.offer(x);      q.offer(y);     }    }   }   for(int i = 1; i <= N; ++i)    for(int j = 1; j <= M; ++j) best = Math.max(best,dist[i][j]);   for(int a = 1; a <= N; ++a)    for(int b = 1; b <= M; ++b) if(dist[a][b] == best) {     result.add(a);     result.add(b);    }   if(result.size() > 0) {    out.print(result.get(0) + " " + result.get(1));   }   out.println();  } } 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());  } }
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 long nl() {   return Long.parseLong(n());  }  public void write(String s) {   try {    out.write(s);   } catch (IOException e) {}  } }
1	public class TaskA implements Runnable { private InputReader in; private PrintWriter out;  public static void main(String[] args) {  new Thread(new TaskA()).start();  }  public TaskA() {     in = new InputReader(System.in);  out = new PrintWriter(System.out); }  public void run() {   int n = in.readInt();  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = in.readInt();  boolean odd = a[0] % 2 + a[1] % 2 + a[2] % 2 >= 2;  for (int i = 0; i < n; i++) {  if (a[i] % 2 == 1 && !odd)   out.println(i + 1);  if (a[i] % 2 == 0 && odd)   out.println(i + 1);  }  out.close(); }  private 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;  }  public long readLong() {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  long res = 0;  do {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  } while (!isSpaceChar(c));  return res * sgn;  }  public String readString() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuffer res = new StringBuffer();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  private boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  private String readLine0() {  StringBuffer buf = new StringBuffer();  int c = read();  while (c != '\n' && c != -1) {   buf.appendCodePoint(c);   c = read();  }  return buf.toString();  }  public String readLine() {  String s = readLine0();  while (s.trim().length() == 0)   s = readLine0();  return s;  }  public String readLine(boolean ignoreEmptyLines) {  if (ignoreEmptyLines)   return readLine();  else   return readLine0();  }  public BigInteger readBigInteger() {  try {   return new BigInteger(readString());  } catch (NumberFormatException e) {   throw new InputMismatchException();  }  }  public char readCharacter() {  int c = read();  while (isSpaceChar(c))   c = read();  return (char) c;  }  public double readDouble() {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.') {   if (c < '0' || c > '9') {   if (c == 'e' || c == 'E') {    int e = readInt();    return res * Math.pow(10, e);   }   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') {    int e = readInt();    return res * Math.pow(10, e);   }   if (c < '0' || c > '9')    throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();   }  }  return res * sgn;  } } }
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());  }  long readLong() throws IOException {   return Long.parseLong(readToken());  }  double readDouble() throws IOException {   return Double.parseDouble(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();  }  boolean eof() throws IOException {   return !in.ready();  }  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();  } }
3	public class P911D { public static void main(String[] args) {  FastScanner scan = new FastScanner();  PrintWriter pw = new PrintWriter(System.out);  int n = scan.nextInt();  int[] arr = new int[n];  for (int i = 0; i < n; i++)  arr[i] = scan.nextInt();  int inv = 0;  for (int i = 0; i < n; i++)  {  for (int j = i+1; j < n; j++)  {   if (arr[i] > arr[j])   inv++;  }  }  inv &= 1;   int[] cumul = new int[n+1];  for (int i = 2; i < cumul.length; i++)  {  cumul[i] = cumul[i-1] + i-1;  }  int q = scan.nextInt();  for (int i = 0; i < q; i++)  {  int a = scan.nextInt()-1;  int b = scan.nextInt()-1;  inv += cumul[b-a+1];  inv &= 1;  if (inv == 0)   pw.println("even");  else   pw.println("odd");  }  pw.flush(); }  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 String nextLine()  {  String line = "";  try  {   line = br.readLine();  } catch (Exception e)  {   e.printStackTrace();  }  return line;  } } }
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<>();      }     }         boolean BellmanFord(boolean check){      d[0] = 0;      for(int i = 0; i < N - 1; i++){       for(int j = 0; j < N; j++){        for(Edge e : ja[j]){         if(e.flow == 0)continue;         d[e.u] = Math.min(d[e.u] , d[j] + e.cost);        }       }      }      if(check){       for(int j = 0; j < N; j++){        for(Edge e : ja[j]){         if(e.flow == 0)continue;         if(d[j] + e.cost < d[e.u]) return false;        }       }       }return true;     }     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 o;        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];       }      }     }     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());   }   public long nextLong() {    return Long.parseLong(next());   }   public 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);  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;  }  } }
2	public class bender {  static long[] dx = new long[]{0, 1, 0, -1};  static long[] dy = new long[]{-1, 0, 1, 0};  static long n, x, y, c;   public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));        StringTokenizer dxdync = new StringTokenizer(in.readLine());   n = Long.parseLong(dxdync.nextToken());   x = Long.parseLong(dxdync.nextToken());   y = Long.parseLong(dxdync.nextToken());   c = Long.parseLong(dxdync.nextToken());     long a = 0;   long b = c;     while(a < b){    long m = (a + b)/2;       long[] dxn = new long[4];    long[] dyn = new long[4];       for(int d = 0; d < 4; d++){     dxn[d] = x + dx[d] * m;     dyn[d] = y + dy[d] * m;    }       long ret = (m+1)*(m+1) + m*m;       ret -= h(1 - dyn[0]);    ret -= h(dyn[2] - n);    ret -= h(dxn[1] - n);    ret -= h(1 - dxn[3]);       ret += q(1 - dyn[0] - (n-x+1));    ret += q(1 - dyn[0] - x);    ret += q(dyn[2] - n - (n - x + 1));    ret += q(dyn[2] - n - (x));       if (ret < c) a = m + 1;    else b = m;   }     System.out.println(a);  }   public static long h(long x) {   if (x <= 0) return 0;   return 2*q(x) - x;  }  private static long q(long x){   if (x <= 0) return 0;   return x*(x+1)/2;  } }
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{   double eps= 0.00000001;   static final int MAXN = 10000001;      static int spf[] = new int[MAXN];   Map<Integer,Set<Integer>> dp= new HashMap<>();           public void sieve()   {    spf[1] = 1;    for (int i=2; i<MAXN; i++)              spf[i] = i;           for (int i=4; i<MAXN; i+=2)     spf[i] = 2;    for (int i=3; i*i<MAXN; i++)    {         if (spf[i] == i)     {           for (int j=i*i; j<MAXN; j+=i)                    if (spf[j]==j)        spf[j] = i;     }    }   }        public Set<Integer> getFactorization(int x)   {    if(dp.containsKey(x)) return dp.get(x);    Set<Integer> ret = new HashSet<>();    while (x != 1)    {     if(spf[x]!=2) ret.add(spf[x]);     x = x / spf[x];    }    dp.put(x,ret);    return ret;   }     public int lowerIndex(List<Integer> arr, int n, int x)   {    int l = 0, h = n - 1;    while (l <= h)    {     int mid = (l + h) / 2;     if (arr.get(mid) >= x)      h = mid - 1;     else      l = mid + 1;    }    return l;   }      public int upperIndex(List<Integer> arr, int n, int y)   {    int l = 0, h = n - 1;    while (l <= h)    {     int mid = (l + h) / 2;     if (arr.get(mid) <= y)      l = mid + 1;     else      h = mid - 1;    }    return h;   }      public int countInRange(List<Integer> arr, int n, int x, int y)   {       int count = 0;    count = upperIndex(arr, n, y) -      lowerIndex(arr, n, x) + 1;    return count;   }   InputReader in;   PrintWriter out;   public void solve(InputReader in, PrintWriter out) {    this.in=in;    this.out=out;    int t=in.nextInt();    while(t-->0){     int n= in.nextInt();     int[] arr= new int[n];     for(int i=0;i<n;i++) arr[i]= in.nextInt();     int[] cur= new int[n];     int idx=0;     for(int num: arr){      if(idx<n && num==cur[idx]+1){       cur[idx]=num;       printRes(cur, idx);       idx++;      }      else{       for(int i=idx;i>=0;i--){        if(i<n && num!=cur[i]+1) cur[i]=0;        else{         cur[i]=num;         printRes(cur,i);         i++;         idx=i;         break;        }       }      }     }    }   }   public void printRes(int[] cur, int idx){    for(int i=0;i<idx;i++) out.print(cur[i]+".");    out.println(cur[idx]);   }   public boolean ok(char[] s){    boolean allEqual = true;    boolean Alternate = true;    for (int i = 0; i < s.length - 1; i++){     if (s[i]!=s[i+1]){      allEqual = false;     }     else{      Alternate = false;     }    }    if (s[0] == '0' || s[s.length-1] == '0'){     return false;    }    return allEqual || Alternate;   }      public static boolean nextPermutation(char[] array){    boolean hasNext = false;    int i;    for(i = array.length-2; i >= 0; i--){     if(array[i] < array[i+1]){      hasNext = true;      break;     }    }        if(!hasNext){     return false;    }           int j;    for(j = i+1; j < array.length; j++){     if(array[j] <= array[i]){      break;     }    }    j--;           swap(array, i, j);    reverse(array, i+1, array.length);      return true;   }   public static void swap(char[] array, int i, int j) {    char temp =array[i];    array[i] = array[j];    array[j] =temp;   }   public static void reverse(char[] array, int start, int end){    for(int i = start, j = end-1; i < j; i++, j--) {     swap(array, i, j);    }   }   public static class compareL implements Comparator<Tuple>{    @Override    public int compare(Tuple t1, Tuple t2) {     return t2.l - t1.l;    }   }   public static class compareR implements Comparator<Tuple>{    @Override    public int compare(Tuple t1, Tuple t2) {     return t1.r - t2.r;    }   }   public static class Tuple{    public int l, r, w;    public Tuple(int l, int r,int w){     this.l = l; this.r= r;     this.w =w;    }   }   public static class Range implements Comparable<Range>{    public int l, r;    List<Integer> data;    int weight;    public Range(int l, int r, List<Integer> data){     this.data = data;     this.l = l; this.r =r;     this.weight = (int)1e9;    }    @Override    public int compareTo(Range o) {     return this.l - o.l;    }   }   public int _gcd(int a, int b)   {    if(b == 0) {     return a;    }    else {     return _gcd(b, a % b);    }   }  }  static class Tuple implements Comparable<Tuple>{   int x, y, z;   public Tuple(int x, int y, int z){    this.x= x;    this.y= y;    this.z=z;   }   @Override   public int compareTo(Tuple o){    return this.x-o.x;   }  }  static class Pair implements Comparable<Pair>{   public int x;   public int y;   public Pair(int x, int y){    this.x= x;    this.y= y;   }   @Override   public int compareTo(Pair o) {    return this.x-o.x;   }  }   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());   }   public double nextDouble(){    return Double.parseDouble(nextToken());   }   public long nextLong(){    return Long.parseLong(nextToken());   }  } }
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());  }  }
3	public class a{  public static void main(String[] args)throws IOException{ br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int n = nextInt(); int v[] = new int[n]; int fv[] = new int[101]; for(int i = 0; i<n;i++){  v[i] = nextInt(); } Arrays.sort(v); for(int i = 0; i<n;i++){  for(int j = i; j<n;j++){  if(v[j]%v[i]==0){   v[j] = v[i];   fv[v[j]]++;  }  } } int ans = 0; for(int i = 0; i<101;i++){  if(fv[i]!=0){  ans++;  } } out.println(ans); out.close();  }  static BufferedReader br;  static StringTokenizer st = new StringTokenizer("");  static String next()throws IOException{ while(!st.hasMoreTokens()){  st = new StringTokenizer(br.readLine()); } return st.nextToken();  }  static int nextInt()throws IOException{ return Integer.parseInt(next());  }  }
4	public class Main {  int n,m; int d[][]; Queue<int[]> q = new LinkedList<int[]>(); int cur[];  public void run() throws Exception{  Scanner in = new Scanner(new File("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  n = in.nextInt();  m = in.nextInt();  int k = in.nextInt();  d = new int[n][m];  for(int i=0;i<n;i++) Arrays.fill(d[i], Integer.MAX_VALUE/2);  for(int i=0;i<k;i++){  int x = in.nextInt()-1;  int y = in.nextInt()-1;  d[x][y] = 0;  q.add(new int[]{x,y});  }     while(q.size() > 0){  cur = q.poll();  int x = cur[0];  int y = cur[1];  add(x, y+1);  add(x+1, y);  add(x-1, y);  add(x, y-1);  }  int max = 0;  int x = 0;  int y = 0;  for(int i=0;i<n;i++)  for(int j=0;j<m;j++)   if (max < d[i][j]){   max = d[i][j];   x = i;   y = j;   }  out.println((x+1) + " " + (y+1));  out.close(); }  private void add(int x, int y){  if (x < 0 || y < 0) return;  if (x >=n || y >=m) return;  if (d[x][y] > d[cur[0]][cur[1]] + 1){  d[x][y] = d[cur[0]][cur[1]] + 1;  q.add(new int[]{x,y});  } }  public static void main(String[] args) throws Exception{  new Main().run(); } }
3	public class Codeforces {   static long MOD = 1_000_000_007L;  static void main2() throws Exception {   int n = ni();   int[] arr = nia(n);   Map<Integer, List<Pair<Integer, Integer>>> map = new HashMap<>();   for(int r = 0; r < n; r++) {    int sum = 0;    for(int l = r; l >= 0; l--) {     sum += arr[l];     if(!map.containsKey(sum)) map.put(sum, new ArrayList<Pair<Integer, Integer>>());     map.get(sum).add(new Pair<Integer, Integer>(l + 1, r + 1));    }   }   int bestSum = Integer.MIN_VALUE;   int bestSumCount = -1;   for(Map.Entry<Integer, List<Pair<Integer, Integer>>> entry : map.entrySet()) {    int count = 0;    int r = -1;    for(Pair<Integer, Integer> pair : entry.getValue()) {     if(r < pair.first) {      count++;      r = pair.second;     }    }    if(count > bestSumCount) {     bestSumCount = count;     bestSum = entry.getKey();    }   }     println(bestSumCount);   int r = -1;   for(Pair<Integer, Integer> pair : map.get(bestSum)) {    if(r < pair.first) {     println(pair.first + " " + pair.second);     r = pair.second;    }   }  }                    private static byte[] scannerByteBuffer = new byte[1024];  private static int scannerIndex;  private static InputStream scannerIn;  private static int scannerTotal;  private static BufferedWriter printerBW;  private static boolean DEBUG = false;  private static int next() throws IOException {   if (scannerTotal < 0)    throw new InputMismatchException();   if (scannerIndex >= scannerTotal) {    scannerIndex = 0;    scannerTotal = scannerIn.read(scannerByteBuffer);    if (scannerTotal <= 0)     return -1;   }   return scannerByteBuffer[scannerIndex++];  }  static int ni() throws IOException {   int integer = 0;   int n = next();   while (isWhiteSpace(n))    n = next();   int neg = 1;   if (n == '-') {    neg = -1;    n = next();   }   while (!isWhiteSpace(n)) {    if (n >= '0' && n <= '9') {     integer *= 10;     integer += n - '0';     n = next();    } else     throw new InputMismatchException();   }   return neg * integer;  }  static long nl() throws IOException {   long integer = 0;   int n = next();   while (isWhiteSpace(n))    n = next();   int neg = 1;   if (n == '-') {    neg = -1;    n = next();   }   while (!isWhiteSpace(n)) {    if (n >= '0' && n <= '9') {     integer *= 10;     integer += n - '0';     n = next();    } else     throw new InputMismatchException();   }   return neg * integer;  }  static String line() throws IOException {   StringBuilder sb = new StringBuilder();   int n = next();   while (isWhiteSpace(n))    n = next();   while (!isNewLine(n)) {    sb.append((char) n);    n = next();   }   return sb.toString();  }  private static boolean isNewLine(int n) {   return n == '\n' || n == '\r' || n == -1;  }  private static boolean isWhiteSpace(int n) {   return n == ' ' || isNewLine(n) || n == '\t';  }  static int[] nia(int n) throws Exception {   if (n < 0)    throw new Exception("Array size should be non negative");   int[] array = new int[n];   for (int i = 0; i < n; i++)    array[i] = ni();   return array;  }  static int[][] n2dia(int r, int c) throws Exception {   if (r < 0 || c < 0)    throw new Exception("Array size should be non negative");   int[][] array = new int[r][c];   for (int i = 0; i < r; i++)    array[i] = nia(c);   return array;  }  static long[] nla(int n) throws Exception {   if (n < 0)    throw new Exception("Array size should be non negative");   long[] array = new long[n];   for (int i = 0; i < n; i++)    array[i] = nl();   return array;  }  static float[] nfa(int n) throws Exception {   if (n < 0)    throw new Exception("Array size should be non negative");   float[] array = new float[n];   for (int i = 0; i < n; i++)    array[i] = nl();   return array;  }  static double[] nda(int n) throws Exception {   if (n < 0)    throw new Exception("Array size should be non negative");   double[] array = new double[n];   for (int i = 0; i < n; i++)    array[i] = nl();   return array;  }  static <T> void print(T ... str) {   try {    for(T ele : str)     printerBW.append(ele.toString());    if (DEBUG)     flush();   } catch (IOException e) {    System.out.println(e.toString());   }  }  static <T> void println(T ... str) {   if(str.length == 0) {    print('\n');    return;   }   for(T ele : str)    print(ele, '\n');  }  static void flush() throws IOException {   printerBW.flush();  }  static void close() {   try {    printerBW.close();   } catch (IOException e) {    System.out.println(e.toString());   }  }  public static void main(String[] args) throws Exception {   long startPointTime = System.currentTimeMillis();   scannerIn = System.in;   printerBW = new BufferedWriter(new OutputStreamWriter(System.out));   if (args.length > 0 && args[0].equalsIgnoreCase("debug")     || args.length > 1 && args[1].equalsIgnoreCase("debug"))    DEBUG = true;   main2();   long endTime = System.currentTimeMillis();   float totalProgramTime = endTime - startPointTime;   if (args.length > 0 && args[0].equalsIgnoreCase("time") || args.length > 1 && args[1].equalsIgnoreCase("time"))    print("Execution time is " + totalProgramTime + " (" + (totalProgramTime / 1000) + "s)");   close();  }  static class Pair <L, R> {   L first;   R second;   Pair(L first, R second) {    this.first = first;    this.second = second;   }   public boolean equals(Object p2) {    if (p2 instanceof Pair) {     return ((Pair) p2).first.equals(first) && ((Pair) p2).second.equals(second);    }    return false;   }   public String toString() {    return "(first=" + first.toString() + ",second=" + second.toString() + ")";   }  }  static class DisjointSet {   int[] arr;   int[] size;   DisjointSet(int n) {    arr = new int[n + 1];    size = new int[n + 1];    makeSet();   }   void makeSet() {    for (int i = 1; i < arr.length; i++) {     arr[i] = i;     size[i] = 1;    }   }   void union(int i, int j) {    if (i == j)     return;    if (i > j) {     i ^= j;     j ^= i;     i ^= j;    }    i = find(i);    j = find(j);    if (i == j)     return;    arr[j] = arr[i];    size[i] += size[j];    size[j] = size[i];   }   int find(int i) {    if (arr[i] != i) {     arr[i] = find(arr[i]);     size[i] = size[arr[i]];    }    return arr[i];   }   int getSize(int i) {    i = find(i);    return size[i];   }   public String toString() {    return Arrays.toString(arr);   }  }  static boolean isSqrt(double a) {   double sr = Math.sqrt(a);   return ((sr - Math.floor(sr)) == 0);  }  static long abs(long a) {   return Math.abs(a);  }  static int min(int ... arr) {   int min = Integer.MAX_VALUE;   for (int var : arr)    min = Math.min(min, var);   return min;  }  static long min(long ... arr) {   long min = Long.MAX_VALUE;   for (long var : arr)    min = Math.min(min, var);   return min;  }  static int max(int... arr) {   int max = Integer.MIN_VALUE;   for (int var : arr)    max = Math.max(max, var);   return max;  }  static long gcd(long a, long b) {   if (b == 0)    return a;   return gcd(b, a % b);  } }
2	public class A {  public static void main(String[] args) throws IOException  {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   long N,K,tmp,ans=0;   String s[]=br.readLine().trim().split(" ");   N=Long.parseLong(s[0]);   K=Long.parseLong(s[1]);   long l=1,r=N,mid;   while(l<=r)   {    mid=(l+r)/2;    tmp=mid*(mid+1)/2;    tmp-=N;    tmp+=mid;    if(tmp==K)    {     ans=N-mid;     break;    }    else if(tmp>K)     r=mid-1;    else     l=mid+1;   }   System.out.println(ans);  } }
2	public class Main{ static long s; static boolean check(long n){  int sum = 0;  long storen=n;  while(n>0){  int k = (int)(n%10);  n /=10;  sum+=k;  }  return storen-(long)sum >= s; } public static void main(String args[]){  PrintWriter pw=new PrintWriter(System.out);  InputReader ip=new InputReader(System.in);   long n;  n=ip.nextLong();  s=ip.nextLong();  if(s>n){  pw.println("0");  }  else{  long l=0,r=n;  boolean possible=false;  long mid=0;  int it=100;  while(it-->0){   mid = (l+r)/2;   if(check(mid)){   r=mid;   possible = true;   }   else{   l=mid+1;   }     }  if(possible){   pw.println(n-l+1);  }   else{   pw.println("0");  }  }   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);   }  } }
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 long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-') {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.') {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public boolean ready() throws IOException {  return br.ready();  }  } }
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 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);  }  private static 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;  } }
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 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) {    long n = in.nextLong();    long s = in.nextLong();    if (n - digitSum(n) < s) {     out.println(0);     return;    }    long left = 0;    long right = n;    while (left < right) {     long mid = left + (right - left) / 2;     if (mid - digitSum(mid) >= s) {      right = mid;     } else {      left = mid + 1;     }    }    out.println(n - left + 1);   }   long digitSum(long a) {    long result = 0;    while (a > 0) {     result += a % 10;     a /= 10;    }    return result;   }  }  static class InputReader {   private static BufferedReader in;   private static StringTokenizer tok;   public InputReader(InputStream in) {    this.in = new BufferedReader(new InputStreamReader(in));   }   public long nextLong() {    return Long.parseLong(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();   }  } }
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);   BSportMafia solver = new BSportMafia();   solver.solve(1, in, out);   out.close();  }  static class BSportMafia {   private InputReader in;   private OutputWriter out;   public void solve(int testNumber, InputReader in, OutputWriter out) {    this.in = in;    this.out = out;    long n = in.nextInt();    long k = in.nextInt();    for (long i = 1; i * (i + 1) / 2 + i <= n + k; i++) {     if (i * (i + 1) / 2 + i == n + k) {      out.println(n - i);      return;     }    }   }  }  static class InputReader extends InputStream {   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 - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   private static boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  }  static class OutputWriter {   private final PrintWriter out;   public OutputWriter(OutputStream outputStream) {    out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));   }   public OutputWriter(Writer writer) {    this.out = new PrintWriter(writer);   }   public void close() {    out.close();   }   public void println(long i) {    out.println(i);   }  } }
1	public class Main {  private static 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);   }  }  private static void shuffleArray(int[] array) {   int index;   Random random = new Random();   for (int i = array.length - 1; i > 0; i--) {    index = random.nextInt(i + 1);    if (index != i) {     array[index] ^= array[i];     array[i] ^= array[index];     array[index] ^= array[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();  }  private static 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();   }   byte nextByte() {    return Byte.parseByte(next());   }   short nextShort() {    return Short.parseShort(next());   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   void close() {    try {     br.close();    } catch (IOException e) {     e.printStackTrace();    }   }  }  private static 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();    }   }  } }
5	public class A {  int IOMode = 0;  String taskName = "";  void solve() throws IOException {   int n = nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = nextInt();   Arrays.sort(a);   int z = 0;   for (int i = 0; i < n; i++) {    if (a[i] != 1) z++;   }   if (z == 0 && n > 1) a[n - 2] = 2;   if (n == 1 && a[0] == 1) {    out.println(2);    return;   }   out.print("1 ");   for (int i = 0; i < n - 1; i++)    out.print(a[i] + " ");  }  public static void main(String[] args) throws IOException {   if (args.length > 0 && args[0].equals("Abra")) debugMode = true;   new A().run();  }  long startTime = System.nanoTime(), tempTime = startTime, finishTime = startTime;  long startMem = Runtime.getRuntime().totalMemory(), finishMem = startMem;  void run() throws IOException {   init();   if (debugMode) {    con.println("Start");    con.println("Console output:");   }   solve();   finishTime = System.nanoTime();   finishMem = Runtime.getRuntime().totalMemory();   out.flush();   if (debugMode) {    int maxSymbols = 1000, c = 0;    BufferedReader tbr = new BufferedReader(new FileReader("input.txt"));    char[] a = new char[maxSymbols];    tbr.read(a);    if (a[0] != 0) {     con.println();     con.println("File input:");     con.print(a);    }    boolean left = true;    for (int i = 0; i < maxSymbols; i++) left = left && a[i] != 0;    if (left) con.println("...");    else con.println();    tbr = new BufferedReader(new FileReader("output.txt"));    a = new char[maxSymbols];    tbr.read(a);    if (a[0] != 0) {     con.println();     con.println("File output:");     con.print(a);    }    left = true;    for (int i = 0; i < maxSymbols; i++) left = left && a[i] != 0;    if (left) con.println("...");    else con.println();    con.println("Time passed: " + (finishTime - startTime) / 1000000000.0 + " sec");    con.println("Memory used: " + (finishMem - startMem) + " bytes");    con.println("Total memory: " + Runtime.getRuntime().totalMemory() + " bytes");   }  }  boolean tick(double x) {   if (System.nanoTime() - tempTime > x) {    tempTime = System.nanoTime();    con.println("Tick at " + (tempTime - startTime) / 1000000000 + " sec");    con.print(" ");    return true;   }   return false;  }  void printTime() {   con.println((System.nanoTime() - tempTime) + " nanos passed");   tempTime = System.nanoTime();  }  static boolean debugMode = false;  PrintStream con = System.out;  void init() throws IOException {   if (debugMode && IOMode != 3) {    br = new BufferedReader(new FileReader("input.txt"));    out = new PrintWriter(new FileWriter("output.txt"));   } else    switch (IOMode) {     case 0:      br = new BufferedReader(new InputStreamReader(System.in));      out = new PrintWriter(System.out);      break;     case 1:      br = new BufferedReader(new FileReader(taskName + ".in"));      out = new PrintWriter(new FileWriter(taskName + ".out"));      break;     case 2:      br = new BufferedReader(new FileReader("input.txt"));      out = new PrintWriter(new FileWriter("output.txt"));      break;     case 3:      out = new PrintWriter(new FileWriter("input.txt"));      break;    }  }  BufferedReader br;  PrintWriter out;  StringTokenizer in;  boolean hasMoreTokens() throws IOException {   while (in == null || !in.hasMoreTokens()) {    String line = br.readLine();    if (line == null) return false;    in = new StringTokenizer(line);   }   return true;  }  String nextString() throws IOException {   return hasMoreTokens() ? in.nextToken() : null;  }  int nextInt() throws IOException {   return Integer.parseInt(nextString());  }  long nextLong() throws IOException {   return Long.parseLong(nextString());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextString());  } }
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 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 boolean subset(long x, long y) {    return intersect(x, y) == x;   }      public long merge(long x, long y) {    return x | y;   }   public long intersect(long x, long y) {    return x & y;   }   public long differ(long x, long y) {    return x - intersect(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 long readLong() {    int sign = 1;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+' ? 1 : -1;     next = read();    }    long 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 double readDouble() {    boolean sign = true;    skipBlank();    if (next == '+' || next == '-') {     sign = next == '+';     next = read();    }    long val = 0;    while (next >= '0' && next <= '9') {     val = val * 10 + next - '0';     next = read();    }    if (next != '.') {     return sign ? val : -val;    }    next = read();    long radix = 1;    long point = 0;    while (next >= '0' && next <= '9') {     point = point * 10 + next - '0';     radix = radix * 10;     next = read();    }    double result = val + (double) point / radix;    return sign ? result : -result;   }   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 readLine(char[] data, int offset) {    int originalOffset = offset;    while (next != -1 && next != '\n') {     data[offset++] = (char) next;     next = read();    }    return offset - originalOffset;   }   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 char readChar() {    skipBlank();    char c = (char) next;    next = read();    return c;   }   public void flush() throws IOException {    os.write(cache.toString().getBytes(charset));    os.flush();    cache.setLength(0);   }   public boolean hasMore() {    skipBlank();    return next != -1;   }  }  public static class Debug {   private boolean allowDebug;   public Debug(boolean allowDebug) {    this.allowDebug = allowDebug;   }   public void assertTrue(boolean flag) {    if (!allowDebug) {     return;    }    if (!flag) {     fail();    }   }   public void fail() {    throw new RuntimeException();   }   public void assertFalse(boolean flag) {    if (!allowDebug) {     return;    }    if (flag) {     fail();    }   }   private void outputName(String name) {    System.out.print(name + " = ");   }   public void debug(String name, int x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, long x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, double x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, int[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, long[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, double[] x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.toString(x));   }   public void debug(String name, Object x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println("" + x);   }   public void debug(String name, Object... x) {    if (!allowDebug) {     return;    }    outputName(name);    System.out.println(Arrays.deepToString(x));   }  } }
2	public class CFC {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  private static final long MOD = 1000L * 1000L * 1000L + 7;  private static final int[] dx = {0, -1, 0, 1};  private static final int[] dy = {1, 0, -1, 0};  private static final String yes = "Yes";  private static final String no = "No";  void solve() throws IOException {   long x = nextLong();   long k = nextLong();   if (x == 0) {    outln(0);    return;   }   x %= MOD;   long two = powMod(2, k, MOD);   long res = two;   res *= 2;   res %= MOD;   res *= x;   res %= MOD;   res -= two - 1;   while (res < 0) {    res += MOD;   }   while (res >= MOD) {    res -= MOD;   }   outln(res);  }  public long powMod(long N, long M, long MOD){   if(M == 0L)    return 1L;   long[] hp = new long[64];   boolean[] bp = new boolean[64];   hp[0] = N;   for(int i = 1; i < hp.length; i++) {    hp[i] = (hp[i - 1] * hp[i - 1]) % MOD;   }   for(int j = 0; j < hp.length; j++) {    if((M & (1L << j)) != 0)     bp[j] = true;   }   long res = 1;   for(int i = 0;i < bp.length; i++){    if(bp[i]) {     res = (res * hp[i]) % MOD;    }   }   return res;  }  void shuffle(int[] a) {   int n = a.length;   for(int i = 0; i < n; i++) {    int r = i + (int) (Math.random() * (n - i));    int tmp = a[i];    a[i] = a[r];    a[r] = tmp;   }  }  long gcd(long a, long b) {   while(a != 0 && b != 0) {    long c = b;    b = a % b;    a = c;   }   return a + b;  }  private void outln(Object o) {   out.println(o);  }  private void out(Object o) {   out.print(o);  }  public CFC() 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 CFC();  }  public long[] nextLongArr(int n) throws IOException{   long[] res = new long[n];   for(int i = 0; i < n; i++)    res[i] = nextLong();   return res;  }  public int[] nextIntArr(int n) throws IOException {   int[] res = new int[n];   for(int i = 0; i < n; i++)    res[i] = nextInt();   return res;  }  public String nextToken() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return null;    }   }   return st.nextToken();  }  public String nextString() {   try {    return br.readLine();   } catch (IOException e) {    eof = true;    return null;   }  }  public int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  public long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  public double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
5	public class Houses implements Runnable {  private void solve() throws IOException {   int n = nextInt();   int t = nextInt();   int[] x = new int[n];   int[] a = new int[n];   for (int i = 0; i < n; ++i) {    x[i] = nextInt() * 2;    a[i] = nextInt();   }   Set<Integer> res = new HashSet<Integer>();   for (int i = 0; i < n; ++i) {    if (valid(n, t, x, a, x[i] + a[i] + t))     res.add(x[i] + a[i] + t);    if (valid(n, t, x, a, x[i] - a[i] - t))     res.add(x[i] - a[i] - t);   }   writer.println(res.size());  }  private boolean valid(int n, int t, int[] x, int[] a, int pos) {   for (int i = 0; i < n; ++i) {    if (Math.abs(pos - x[i]) < a[i] + t)     return false;   }   return true;  }  public static void main(String[] args) {   new Houses().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();  } }
4	public class C {  static FastIO f;  public static void main(String args[]) throws IOException {  f = new FastIO();  int t, n, a, i;  Node r, p, c;   t = f.ni();   while(t-->0)  {  n = f.ni();  r = p = new Node(-1, null);     for(i = 0; i < n; i++)  {   a = f.ni();   if(a != 1)   {   while(a != p.i + 1)    p = p.p;   p = p.p;   }             c = new Node(a, p);   p.c.add(c);   p = c;  }   dfs(r, "");  }  f.flush(); }  public static void dfs(Node n, String s) throws IOException {  String t;  if(n.i == -1)  t = s;  else  {  t = s + n.i + ".";  f.out(s + n.i + "\n");  }  for(Node c : n.c)  dfs(c, t); }  static class Node {  int i;  Node p;  ArrayList<Node> c;   Node(int x, Node y)  {  i = x;  p = y;  c = new ArrayList<>();  }   @Override  public int hashCode()  {  return super.hashCode();  }   @Override  public boolean equals(Object obj)  {  Node that = (Node)obj;   return super.equals(obj);  }   @Override  public String toString()  {  return "[" + "PARAMETERS" + "]";  } }  public static class FastIO {  BufferedReader br;  BufferedWriter bw, be;  StringTokenizer st;  public FastIO()  {  br = new BufferedReader(new InputStreamReader(System.in));  bw = new BufferedWriter(new OutputStreamWriter(System.out));  be = new BufferedWriter(new OutputStreamWriter(System.err));  st = new StringTokenizer("");  }  private void read() throws IOException  {  st = new StringTokenizer(br.readLine());  }  public String ns() throws IOException  {  while(!st.hasMoreTokens())   read();  return st.nextToken();  }  public int ni() throws IOException  {  return Integer.parseInt(ns());  }  public long nl() throws IOException  {  return Long.parseLong(ns());  }  public float nf() throws IOException  {  return Float.parseFloat(ns());  }  public double nd() throws IOException  {  return Double.parseDouble(ns());  }  public char nc() throws IOException  {  return ns().charAt(0);  }  public int[] nia(int n) throws IOException  {  int[] a = new int[n];  for(int i = 0; i < n; i++)   a[i] = ni();   return a;  }  public long[] nla(int n) throws IOException  {  long[] a = new long[n];  for(int i = 0; i < n; i++)   a[i] = nl();   return a;  }  public char[] nca() throws IOException  {  return ns().toCharArray();  }  public void out(String s) throws IOException  {  bw.write(s);  }  public void flush() throws IOException  {  bw.flush();  be.flush();  }  public void err(String s) throws IOException  {  be.write(s);  } } }
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);   TaskG1 solver = new TaskG1();   solver.solve(1, in, out);   out.close();  }  static class TaskG1 {   final int mod = (int) 1e9 + 7;   int[][][] dp;   int rec(int mask, int time, int T, int genre, int[] ts, int[] gs) {    if (time > T)     return 0;    if (time == T)     return 1;    if (mask == (1 << ts.length) - 1)     return 0;    int res = dp[genre][time][mask];    if (res != -1)     return res;    res = 0;    for (int i = 0; i < ts.length; i++) {     if ((mask & (1 << i)) == 0 && (mask == 0 || gs[i] != genre)) {      res += rec(mask | (1 << i), time + ts[i], T, gs[i], ts, gs);      if (res >= mod)       res -= mod;     }    }    return dp[genre][time][mask] = res;   }   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int[] ts = new int[n];    int[] gs = new int[n];    int T = in.nextInt();    for (int i = 0; i < n; i++) {     ts[i] = in.nextInt();     gs[i] = in.nextInt() - 1;    }    dp = new int[3][T][1 << n];    for (int[][] aux : dp) {     for (int[] aux2 : aux)      Arrays.fill(aux2, -1);    }    int ans = rec(0, 0, T, 0, ts, gs);    out.println(ans);   }  }  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;   }  } }
6	public class ElongatedMatrix {  private static int n;   private static int[][] minCost;   private static int[][] minCostEndpoints;    private static HashMap<Integer, Integer> costs = new HashMap<>();  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int[] params = Arrays.stream(br.readLine().split(" "))     .mapToInt(x -> Integer.parseInt(x)).toArray();   n = params[0];   int m = params[1];   int[][] matrix = new int[n][m];   for (int i = 0; i < n; i++) {    matrix[i] = Arrays.stream(br.readLine().split(" "))      .mapToInt(x -> Integer.parseInt(x)).toArray();   }   minCost = new int[n][n];   minCostEndpoints = new int[n][n];   for (int i = 0; i < n; i++) {    for (int j = 0; j < n; j++) {     if (i > j) {      minCost[i][j] = Integer.MAX_VALUE;      for (int k = 0; k < m; k++) {       int diff = Math.abs(matrix[i][k] - matrix[j][k]);       if (diff < minCost[i][j]) {        minCost[i][j] = diff;       }      }      minCost[j][i] = minCost[i][j];     }     minCostEndpoints[i][j] = Integer.MAX_VALUE;     for (int k = 0; k < m - 1; k++) {      int diff = Math.abs(matrix[i][k + 1] - matrix[j][k]);      if (diff < minCostEndpoints[i][j]) {       minCostEndpoints[i][j] = diff;      }     }    }   }   int maxCost = n == 1 ? minCostEndpoints[0][0] : 0;   for (int i = 0; i < n; i++) {    costs.clear();    for (int j = 0; j < n; j++) {     if (i != j) {      int bitmask = (1 << i) | (1 << j);      int state = bitmask + (j << 16);      costs.put(state, minCost[i][j]);     }    }    for (int j = 0; j < n; j++) {     if (i != j) {      if (minCostEndpoints[i][j] <= maxCost) {       continue;      } else {       int pathCost = Math.min(minCostEndpoints[i][j], findMaxCost(i, j, (1 << n) - 1));       maxCost = Math.max(maxCost, pathCost);      }     }    }   }   System.out.println(maxCost);   br.close();  }    private static int findMaxCost(int st, int end, int set) {   int state = set + (end << 16);   if (costs.containsKey(state)) {    return costs.get(state);   }   int maxCost = 0;   for (int i = 0; i < n; i++) {    if (i != st && i != end && (set & (1 << i)) != 0) {     int setWithoutEnd = set - (1 << end);     int pathCost = Math.min(findMaxCost(st, i, setWithoutEnd), minCost[i][end]);     maxCost = Math.max(pathCost, maxCost);    }   }   costs.put(state, maxCost);   return maxCost;  } }
1	public class A {  public static void main(String[] args) throws Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   br.readLine();   String[] ss = br.readLine().split(" ");   int n = ss.length;   int[] a = new int[n];   for (int i = 0; i < n; ++i)    a[i] = Integer.parseInt(ss[i]);   for (int i = 0; i < n; ++i) {    boolean ok = true;    for (int j = 0; j < n; ++j)     if (j != i && a[j] % 2 == a[i] % 2)      ok = false;    if (ok)     System.out.println(i + 1);   }  } }
0	public class A {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   long A = in.nextLong();   long B = in.nextLong();   System.out.println(f(A,B));  }  static long f(long A, long B) {   if(A==0) return 0;   if(A < B) return f(B,A);   else {    long k = A/B;    return k+f(A-B*k, B);   }  } }
4	public class ProblemA_23 {   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_23().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{   String s = readString();   for (int length = s.length() - 1; length > 0; length--){    for (int i = 0; i < s.length() - length; i++){     if (s.lastIndexOf(s.substring(i, i + length)) > i){      out.print(length);      return;     }    }   }   out.print(0);  } }
0	public class A {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  String ns = sc.next();  sc.close();   int n1 = Integer.parseInt(ns);  int n2 = Integer.parseInt(ns.substring(0, ns.length() - 1));  int n3 = Integer.parseInt(ns.substring(0, ns.length() - 2) + ns.substring(ns.length() - 1));   int max = n1;  max = (n2 > max) ? (n2) : (max);  max = (n3 > max) ? (n3) : (max);   System.out.println(max);  } }
4	public class C {  static class Struct {   int x, y, count;   public Struct(int xx, int yy, int c) {    x = xx;    y = yy;    count = c;   }  }  public static void main(String[] args) throws IOException {   Scanner sc = new Scanner(new FileReader("input.txt"));   int n = sc.nextInt();   int m = sc.nextInt();   FileWriter fw=new FileWriter("output.txt");   boolean[][] grid = new boolean[n][m];   int[] dx = new int[] { 1, 0, -1, 0 };   int[] dy = new int[] { 0, -1, 0, 1 };   int k = sc.nextInt();   LinkedList<Struct> a = new LinkedList<Struct>();   for (int i = 0; i < k; i++) {    a.add(new Struct(sc.nextInt() - 1, sc.nextInt() - 1, 0));   }   int max = Integer.MIN_VALUE, maxX = -1, maxY = -1;   while (!a.isEmpty()) {    Struct tmp = a.remove();    if (grid[tmp.x][tmp.y] == true)     continue;    grid[tmp.x][tmp.y] = true;    if (tmp.count > max) {     max = tmp.count;     maxX = tmp.x;     maxY = tmp.y;    }    for (int i = 0; i < 4; i++) {     int nx = tmp.x + dx[i];     int ny = tmp.y + dy[i];     if (nx < n && nx >= 0 && ny < m && ny >= 0) {      if (grid[nx][ny] == false) {       a.add(new Struct(nx, ny, tmp.count + 1));      }     }    }   }   fw.write((maxX + 1) + " " + (maxY + 1)+"\n");   System.out.println((maxX + 1) + " " + (maxY + 1));   fw.flush();  } }
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] + " ");  } } }
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++){    out: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;   out: 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();  }  String nextLine() throws Exception {   String str = "";   try {    str = br.readLine();   } catch (IOException e) {    throw new Exception(e.toString());   }   return str;  }  int ni() {   return Integer.parseInt(ns());  }  long nl() {   return Long.parseLong(ns());  }  double nd() {   return Double.parseDouble(ns());  } }
4	public class C35 {  public static int mod = 1000000007; public static long INF = (1L << 60);  static int n,m; static class Pair {  int x,y;  Pair(int x,int y)  {  this.x=x;  this.y=y;  }  @Override  public int hashCode()  {  final int prime = 31;  int result = 1;  result = prime * result + x;  result = prime * result + y;  return result;  }  @Override  public boolean equals(Object obj)  {  if (this == obj)   return true;  if (obj == null)   return false;  if (getClass() != obj.getClass())   return false;  Pair other = (Pair) obj;  if (x != other.x)   return false;  if (y != other.y)   return false;  return true;  } } static boolean[][] burned; static int[] dx={-1,0,1,0}; static int[] dy={0,-1,0,1}; static boolean isvalid(int x,int y) {  return x>=0&&x<n&&y>=0&&y<m; } public static void main(String[] args) throws IOException {  Scanner in = new Scanner("input.txt");  PrintWriter out = new PrintWriter(new FileWriter("output.txt"));  n=in.nextInt();  m=in.nextInt();  burned=new boolean[n][m];  int k=in.nextInt();  Set<Pair> set=new HashSet<Pair>();  Pair prev=null;  for(int i=0;i<k;i++)  {  int x=in.nextInt();  int y=in.nextInt();  burned[x-1][y-1]=true;  set.add(prev=new Pair(x-1, y-1));  }  while(!set.isEmpty())  {  Set<Pair> tempset=new HashSet<>();  for(Pair p : set)  {  int x=p.x;  int y=p.y;  prev=p;  for(int i=0;i<4;i++)  {   if(isvalid(x+dx[i], y+dy[i])&&!burned[x+dx[i]][y+dy[i]])   {   tempset.add(new Pair(x+dx[i], y+dy[i]));   burned[x+dx[i]][y+dy[i]]=true;   }  }  }  set=tempset;  }  out.printf("%d %d\n",(prev.x+1),(prev.y+1));  out.close();  }  public static long pow(long x, long n)  {  long res = 1;  for (long p = x; n > 0; n >>= 1, p = (p * p))  {  if ((n & 1) != 0)   {   res = (res * p);  }  }  return res; }  public static long pow(long x, long n, long mod)  {  long res = 1;  for (long p = x; n > 0; n >>= 1, p = (p * p) % mod)  {  if ((n & 1) != 0)   {   res = (res * p % mod);  }  }  return res; }  public static long gcd(long n1, long n2) {  long r;  while (n2 != 0)  {  r = n1 % n2;  n1 = n2;  n2 = r;  }  return n1; }  public static long lcm(long n1, long n2)  {  long answer = (n1 * n2) / (gcd(n1, n2));  return answer; }  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(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 String nextLine() throws IOException {return br.readLine();}  public double nextDouble() throws IOException { return Double.parseDouble(next()); }  public boolean ready() throws IOException {return br.ready();}  } }
0	public class C994{ static double area(double x1,double y1,double x2,double y2,double x3,double y3){  return Math.abs((x1 * (y2 - y3) +   x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0);  } public static void main(String args[])throws IOException{  Scanner sc=new Scanner(new BufferedReader(new InputStreamReader(System.in)));  PrintWriter pw=new PrintWriter(System.out);  int x11=sc.nextInt();  int y11=sc.nextInt();  int x12=sc.nextInt();  int y12=sc.nextInt();  int x13=sc.nextInt();  int y13=sc.nextInt();  int x14=sc.nextInt();  int y14=sc.nextInt();  double x1c=(x11+x12+x13+x14)/4.0;  double y1c=(y11+y12+y13+y14)/4.0;  int x21=sc.nextInt();  int y21=sc.nextInt();  int x22=sc.nextInt();  int y22=sc.nextInt();  int x23=sc.nextInt();  int y23=sc.nextInt();  int x24=sc.nextInt();  int y24=sc.nextInt();  double x2c=(x21+x22+x23+x24)/4.0;  double y2c=(y21+y22+y23+y24)/4.0;  double a1=area(x11,y11,x12,y12,x13,y13)+area(x11,y11,x13,y13,x14,y14);  double a2=area(x21,y21,x22,y22,x23,y23)+area(x21,y21,x23,y23,x24,y24);  if(a1==area(x11,y11,x12,y12,x21,y21)+area(x11,y11,x21,y21,x14,y14)+area(x21,y21,x12,y12,x13,y13)+area(x21,y21,x14,y14,x13,y13)){  pw.println("YES");  pw.close();  return;  }  if(a1==area(x11,y11,x12,y12,x22,y22)+area(x11,y11,x22,y22,x14,y14)+area(x22,y22,x12,y12,x13,y13)+area(x22,y22,x14,y14,x13,y13)){  pw.println("YES");  pw.close();  return;  }  if(a1==area(x11,y11,x12,y12,x23,y23)+area(x11,y11,x23,y23,x14,y14)+area(x23,y23,x12,y12,x13,y13)+area(x23,y23,x14,y14,x13,y13)){  pw.println("YES");  pw.close();  return;  }  if(a1==area(x11,y11,x12,y12,x24,y24)+area(x11,y11,x24,y24,x14,y14)+area(x24,y24,x12,y12,x13,y13)+area(x24,y24,x14,y14,x13,y13)){  pw.println("YES");  pw.close();  return;  }  if(a1==area(x11,y11,x12,y12,x2c,y2c)+area(x11,y11,x2c,y2c,x14,y14)+area(x2c,y2c,x12,y12,x13,y13)+area(x2c,y2c,x14,y14,x13,y13)){  pw.println("YES");  pw.close();  return;  }  if(a2==area(x21,y21,x22,y22,x11,y11)+area(x21,y21,x11,y11,x24,y24)+area(x11,y11,x22,y22,x23,y23)+area(x11,y11,x24,y24,x23,y23)){  pw.println("YES");  pw.close();  return;  }  if(a2==area(x21,y21,x22,y22,x12,y12)+area(x21,y21,x12,y12,x24,y24)+area(x12,y12,x22,y22,x23,y23)+area(x12,y12,x24,y24,x23,y23)){  pw.println("YES");  pw.close();  return;  }  if(a2==area(x21,y21,x22,y22,x13,y13)+area(x21,y21,x13,y13,x24,y24)+area(x13,y13,x22,y22,x23,y23)+area(x13,y13,x24,y24,x23,y23)){  pw.println("YES");  pw.close();  return;  }  if(a2==area(x21,y21,x22,y22,x14,y14)+area(x21,y21,x14,y14,x24,y24)+area(x14,y14,x22,y22,x23,y23)+area(x14,y14,x24,y24,x23,y23)){  pw.println("YES");  pw.close();  return;  }  if(a2==area(x21,y21,x22,y22,x1c,y1c)+area(x21,y21,x14,y14,x2c,y2c)+area(x1c,y1c,x22,y22,x23,y23)+area(x1c,y1c,x24,y24,x23,y23)){  pw.println("YES");  pw.close();  return;  }   pw.println("NO");  pw.close(); } }
2	public class Main{  public static long howMany(long n, long x, long y, long s){   long res = 0;   int cnt = 0;   long[] px = new long[9];   long[] py = new long[9];   if(x - s < 1){    px[cnt] = 1;    py[cnt++] = y-x+s+1 <= n ? y-x+s+1 : n;    px[cnt] = 1;    py[cnt++] = x+y-s-1 > 0? x+y-s-1: 1;    res += 6;   }else{    px[cnt] = x-s;    py[cnt++] = y;    res += 2;   }     if(y - s < 1){    py[cnt] = 1;    px[cnt++] = x+y-s-1 > 0 ? x+y-s-1 : 1;    py[cnt] = 1;    px[cnt++] = x-(y-s)+1 <= n ? x-y+s+1: n;    res += 6;   }else{    px[cnt] = x;    py[cnt++] = y-s;    res += 2;   }     if(x + s > n){    px[cnt] = n;    py[cnt++] = y-(x+s)+n > 0 ? y-(x+s)+n : 1;    px[cnt] = n;    py[cnt++] = x+s+y - n <= n ? x+s+y-n : n;    res += 6;   }else{    px[cnt] = x+s;    py[cnt++] = y;    res += 2;   }     if(y + s > n){    py[cnt] = n;    px[cnt++] = x+y+s-n <= n? x+y+s-n : n;    py[cnt] = n;    px[cnt++] = n-(y+s-x) > 0 ? n-(y+s-x) :1;    res += 6;   }else{    px[cnt] = x;    py[cnt++] = y+s;    res += 2;   }     px[cnt] = px[0];   py[cnt] = py[0];     long ret = 0;   long sum = 0;   for(int i = 0; i < cnt; i++){    ret += px[i]*py[i+1]-py[i]*px[i+1];    sum += Math.max(Math.abs(px[i]-px[i+1]), Math.abs(py[i]-py[i+1]))+1;   }   return (4*ret + 4*sum - res)/8;  }   public static void main(String[] args) throws Exception{   BufferedReader r = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer str = new StringTokenizer(r.readLine());   int n = Integer.parseInt(str.nextToken());   int x = Integer.parseInt(str.nextToken());   int y = Integer.parseInt(str.nextToken());   long c = Long.parseLong(str.nextToken());   if(c == 1){    System.out.println(0);    return;   }   long high = 1;   while(howMany(n, x, y, high) < c){    high <<= 1;   }   long low = high>>1;   while(high - low > 1){    long med = (high+low)/2;    if(howMany(n, x, y, med) < c){     low = med;    }else{     high = med;    }   }   System.out.println(high);  } }
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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, Scanner in, PrintWriter out) {    int n = in.nextInt();    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = in.nextInt();    }    Arrays.sort(a);    int nc = 0;    for (int i = 0; i < n; i++) {     boolean divs = false;     for (int j = 0; j < i; j++) {      if (a[i] % a[j] == 0) {       divs = true;       break;      }     }     if (!divs) {      nc++;     }    }    out.println(nc);   }  } }
1	public class codef8 {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);  int num = sc.nextInt();  int beacon[] = new int[1000001];  int pos[] = new int[num];  for (int i = 0; i < num; i++) {  int position = sc.nextInt();  beacon[position] = sc.nextInt();  pos[i] = position;  }  int dp[] = new int[1000001];  int max = 1;  if (beacon[0] != 0)  dp[0] = 1;   for (int i = 1; i <= 1000000; i++) {  if (beacon[i] == 0) {   dp[i] = dp[i-1];  }   else {   int j = i - beacon[i] - 1;   if (j < 0) {   dp[i] = 1;   }   else {   dp[i] = dp[j] + 1;   }  }  max = Math.max(max, dp[i]);  }   System.out.println(num-max); } }
1	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) {    int n = in.nextInt();    int d = in.nextInt();    int[] a = new int[n];    Set<Integer> set = new HashSet<>();    for (int i = 0; i < n; i++) {     a[i] = in.nextInt();    }     int ans = 2;    for (int i = 1; i < n; i++) {     if (a[i] - a[i - 1] == 2 * d) {      ans++;     } else if (a[i] - a[i - 1] > 2 * d) {      ans += 2;     }    }    out.println(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 println(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 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 boolean isSpaceChar(int c) {    if (filter != null) {     return filter.isSpaceChar(c);    }    return isWhitespace(c);   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
5	public class AAA {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = in.nextInt();   int max = a[0];   int ind = 0;   for (int k = 1; k < n; k++) {    if (a[k] > max) {     max = a[k];     ind = k;    }   }   if (max != 1) {    a[ind] = 1;    Arrays.sort(a);    for (int i = 0; i < a.length - 1; i++)     System.out.print(a[i] + " ");    System.out.println(a[a.length - 1]);   } else {    a[0] = 2;    Arrays.sort(a);    for (int i = 0; i < a.length - 1; i++)     System.out.print(a[i] + " ");    System.out.println(a[a.length - 1]);   }  } }
5	public class main {   public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int houses = sc.nextInt();   int size = sc.nextInt();   hizzy[] array = new hizzy[houses];   long total =2;   for(int a=0;a<houses;a++)array[a]=new hizzy(sc.nextInt(),sc.nextInt());   Arrays.sort(array);   for(int a=0;a<houses-1;a++){    double L = array[a].loc+array[a].size/2;    double R = array[a+1].loc-array[a+1].size/2;    if(R-L>size)total+=2;    else if((R-L)==size)total++;   }   System.out.println(total);  }  } class hizzy implements Comparable{  double loc;  double size;  hizzy(double l, double s){   this.loc=l;   this.size=s;  }   public int compareTo(Object o) {   hizzy other = (hizzy) o;   return (int) (this.loc-other.loc);  }  }
3	public class maestro{  public static long inversions(long[] arr) {   long x = 0;   int n = arr.length;   for (int i = n - 2; i >= 0; i--) {    for (int j = i + 1; j < n; j++) {     if (arr[i] > arr[j]) {      x++;          }             }   }   return x;  }  public static void main(String[] args){   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   long[] arr = new long[n];   for (int i=0;i<n;i++) arr[i] = sc.nextLong();   long m = sc.nextLong();   long x = inversions(arr)%2;   for (int i=0;i<m;i++){    int l = sc.nextInt()-1;    int r = sc.nextInt()-1;    if ((r-l+1)%4>1) x=(x+1)%2;    if (x==1) System.out.println("odd");    else System.out.println("even");   }    } }
6	public class ElongatedMatrix2 {  public static void main(String[] args) {   FastScanner scanner = new FastScanner();   int N = scanner.nextInt();   int M = scanner.nextInt();   int[][] arr = new int[N][M];   for(int i = 0; i < N; i++) {    for(int j = 0; j < M; j++) {     arr[i][j] = scanner.nextInt();    }   }   int[][] distRow = new int[N][N];   int[][] distTop = new int[N][N];       for(int i = 0; i < N; i++) {    for(int j = i+1; j < N; j++) {     int curMin = Integer.MAX_VALUE;     for(int k = 0; k < M; k++) {      curMin = Math.min(curMin, Math.abs(arr[i][k] - arr[j][k]));     }     distRow[i][j] = distRow[j][i] = curMin;    }   }     for(int i = 0; i < N; i++) {    for(int j = 0; j < N; j++) {     int curMin = Integer.MAX_VALUE;     for(int k = 0; k+1 < M; k++) {      curMin = Math.min(curMin, Math.abs(arr[i][k] - arr[j][k+1]));     }     distTop[i][j] = curMin;    }   }   int maxMask = 1 << N;   int[][][] dp = new int[maxMask][N][N];   for(int i = 0; i < maxMask; i++) {    for(int j = 0; j < N; j++) {     Arrays.fill(dp[i][j], Integer.MAX_VALUE);    }   }   for(int mask = 1; mask < maxMask; mask++) {    for (int j = 0; j < N; j++) {     if ((mask & ( 1 << j)) == 0) continue;     for(int k = 0; k < N; k++) {      if ((mask &(1 << k)) == 0) continue;      if (j == k && mask - (1 << k) != 0) continue;      for (int i = 0; i < N; i++) {       if ((mask & (1 << i)) > 0) continue;       int curMask = mask | (1 << i);       if (dp[curMask][i][k] != Integer.MAX_VALUE)        dp[curMask][i][k] = Math.max(dp[curMask][i][k], Math.min(dp[mask][j][k], distRow[i][j]));       else        dp[curMask][i][k] = Math.min(dp[mask][j][k], distRow[i][j]);      }     }    }   }   maxMask--;   int max = 0;   for(int i= 0; i < N; i++) {    for(int j = 0; j < N; j++) {     if (i==j && N != 1) continue;     max = Math.max(max, Math.min(dp[maxMask][i][j], distTop[i][j]));    }   }   System.out.println(max);  }  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());   }   String readNextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   int[] readIntArray(int n) {    int[] a = new int[n];    for (int idx = 0; idx < n; idx++) {     a[idx] = nextInt();    }    return a;   }  } }
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); } }
4	public class sdffsdf {  public static void main(String[] args) {  try{  File file = new File("input.txt");  Scanner sc = new Scanner(file);  String s = sc.nextLine();  String[] seperatedd = s.split(" ");  int x = Integer.parseInt(seperatedd[0]);  int y = Integer.parseInt(seperatedd[1]);  int[][] grid = new int[x][y];  for(int i = 0; i < x; i++)  {   for(int j = 0; j < y; j++)   {   grid[i][j] = 0;   }  }  s = sc.nextLine();  int z = Integer.parseInt(s);  LinkedList<Point> BFS = new LinkedList<Point>();  s = sc.nextLine();  String[] seperated = s.split(" ");  for(int i = 0; i < seperated.length; i = i + 2)  {   Point temp = new Point();   temp.x = Integer.parseInt(seperated[i])-1;   temp.y = Integer.parseInt(seperated[i+1])-1;   grid[temp.x][temp.y] = 1;   BFS.addLast(temp);  }  while(!BFS.isEmpty())  {   Point temp = new Point();   temp = BFS.removeFirst();   int k = temp.x;   int l = temp.y;     if(!(l+1 >= y || grid[k][l+1] == 1))   {   Point temp1 = new Point();   temp1.x = k;   temp1.y = l+1;   grid[temp1.x][temp1.y] = 1;   BFS.addLast(temp1);   }   if(!(k+1 >= x || grid[k+1][l] == 1))   {   Point temp1 = new Point();   temp1.x = k+1;   temp1.y = l;   grid[temp1.x][temp1.y] = 1;   BFS.addLast(temp1);   }          if(!(l-1 < 0 || grid[k][l-1] == 1))   {   Point temp1 = new Point();   temp1.x = k;   temp1.y = l-1;   grid[temp1.x][temp1.y] = 1;   BFS.addLast(temp1);   }   if(!(k-1 < 0 || grid[k-1][l] == 1))   {   Point temp1 = new Point();   temp1.x = k-1;   temp1.y = l;   grid[temp1.x][temp1.y] = 1;   BFS.addLast(temp1);   }   if(BFS.isEmpty())   {  try {    File fil = new File("output.txt");    PrintWriter out = new PrintWriter(fil);    int v1 = (int)temp.getX() + 1;    int v2 = (int)temp.getY() + 1;    out.println(v1 + " " + v2);     out.close();    }   catch (Exception e) {}   }  }  }  catch (Exception e) {  System.out.println("nbvnb");  }  } }
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);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.nextInt();    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = in.nextInt();    }    Arrays.sort(a);    boolean[] dead = new boolean[n];    int ans = 0;    for (int i = 0; i < n; i++) {     if (dead[i]) {      continue;     }     ++ans;     for (int j = i; j < n; j++) {      if (a[j] % a[i] == 0) {       dead[j] = true;      }     }    }    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 JavaApplication1 {    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{  public void solve(int testNumber, InputReader in, PrintWriter out){   String base = in.next();  for (int len=base.length()-1;len>=1;len--)    for (int i=0;i<base.length()-len+1;i++)     for (int j=i+1;j<base.length()-len+1;j++)      if (base.substring(i,i+len).equals(base.substring(j,j+len))){       out.println(len);    return;      }  out.println(0);   }  } 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());  }  public long nextLong(){   return Long.parseLong(next());  }  public double nextDouble(){   return Double.parseDouble(next());  } }
3	public class C {  public static void main(String[] args){  FastScanner scan = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  n = scan.nextInt(); mod = (int)1e9+7;  in = new char[n];  for(int i = 0; i < n; i++) in[i] = scan.next().charAt(0);  dp = new Long[n][n];  out.println(go(0, 0));  out.close(); }  static long go(int at, int i) {  if(at == n-1) return 1;  if(dp[at][i] != null) return dp[at][i];  long res = 0;  if(in[at] == 's') {  res += go(at+1, i);  res %= mod;  if(i > 0) {   res += go(at, i-1);   res %= mod;  }  } else {  res += go(at+1, i+1);  res %= mod;  }  return dp[at][i] = res; }  static Long[][] dp; static int n, mod; static char[] in;  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 String nextLine() {  String line = "";  if(st.hasMoreTokens()) line = st.nextToken();  else try {return br.readLine();}catch(IOException e){e.printStackTrace();}  while(st.hasMoreTokens()) line += " "+st.nextToken();  return line;  }  public int[] nextIntArray(int n) {  int[] a = new int[n];  for(int i = 0; i < n; i++) a[i] = nextInt();  return a;  }  public long[] nextLongArray(int n){  long[] a = new long[n];  for(int i = 0; i < n; i++) a[i] = nextLong();  return a;  }  public double[] nextDoubleArray(int n){  double[] a = new double[n];  for(int i = 0; i < n; i++) a[i] = nextDouble();  return a;  }  public char[][] nextGrid(int n, int m){  char[][] grid = new char[n][m];  for(int i = 0; i < n; i++) grid[i] = next().toCharArray();  return grid;  } }  }
1	public class Solution {  public static void main(String[] args) {   new Thread(new Runnable() {       @Override    public void run() {     new Solution();    }   }).start();  }  Solution() {   String data = "2\nR1C18\nR1";   PrintWriter pw = new PrintWriter(System.out);   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));     try {    int n = Integer.parseInt(in.readLine());    int[] res = new int[2];    for (int i = 0; i < n; i++) {     String s = in.readLine();     if (isSecondType(s, res)) {      pw.println(toFirstType(res));     } else {      pw.println(toSecondType(s));     }    }   } catch (IOException e) {   } finally {    pw.flush();    pw.close();   }  }  private String toSecondType(String s) {   int i = 0;   for (; i < s.length(); i++) {    if (s.charAt(i) < 'A' || s.charAt(i) > 'Z') break;   }   String first = s.substring(0, i);   String second = s.substring(i, s.length());   StringBuilder sb = new StringBuilder();   sb.append("R");   sb.append(second);   sb.append("C");   sb.append(stringToNum(first));   return sb.toString();  }  private int stringToNum(String first) {   int k = 0;   int res = 0;   int p = 1;   for (int i = first.length() - 1; i >= 0; i--) {    int v = first.charAt(i) - 'A' + k;    k = 1;    res += p * v;    p *= 26;   }   return res + 1;  }  private String toFirstType(int[] res) {   StringBuilder sb = new StringBuilder();   sb.append(numToString(res[1]));   sb.append(res[0]);   return sb.toString();  }  private String numToString(int num) {   StringBuilder sb = new StringBuilder();   while (num > 0) {    num--;    char c = (char) (num % 26 + 'A');    sb.append(c);    num /= 26;   }   return sb.reverse().toString();  }  private boolean isSecondType(String s, int[] res) {   try {    return doIsSecondType(s, res);   } catch (Exception e) {    return false;   }  }  private boolean doIsSecondType(String s, int[] res) {   StringTokenizer st = new StringTokenizer(s, "RC", true);   String token = st.nextToken();   if (!token.equals("R")) return false;   token = st.nextToken();   if (!isDigit(token)) return false;   res[0] = Integer.parseInt(token);   token = st.nextToken();   if (!token.equals("C")) return false;   token = st.nextToken();   if (!isDigit(token)) return false;   res[1] = Integer.parseInt(token);   return true;  }  private boolean isDigit(String token) {   for (int i = 0; i < token.length(); i++) {    if (token.charAt(i) < '0' || token.charAt(i) > '9') return false;   }   return true;  } }
3	public class A {  FastScanner in;  PrintWriter out;  void solve() {   int n = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }   Arrays.sort(a);   int res = 0;   for (int i = 0; i < n; i++) {    boolean ok = false;    for (int j = 0; j < i; j++) {     if (a[i] % a[j] == 0) {      ok = true;     }    }    if (!ok) {     res++;    }   }   out.println(res);  }  void run() {   try {    in = new FastScanner(new File("A.in"));    out = new PrintWriter(new File("A.out"));    solve();    out.close();   } catch (FileNotFoundException e) {    e.printStackTrace();   }  }  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;   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }  }  public static void main(String[] args) {   new A().runIO();  } }
4	public class A {  public static void main(String[] args) throws IOException{   Scanner sc = new Scanner(System.in);   String s = sc.next();   int n = s.length();   for (int i = n; i >= 1; i--) {    Set<String> set = new HashSet<String>();    for (int j = 0; j < n-i+1; j++) {     String t = s.substring(j, j+i);     if (set.contains(t)) {      System.out.println(i);      return;     }     set.add(t);    }   }   System.out.println(0);  }  }
4	public class Abc {  public static void main(String[] args) throws IOException {   Scanner sc=new Scanner(new FileReader("input.txt"));   PrintWriter out=new PrintWriter(new File("output.txt"));   int n=sc.nextInt(),m=sc.nextInt(),k=sc.nextInt();   boolean vis[][]=new boolean[n][m];   LinkedList<Integer> q=new LinkedList<>();   for (int i=0;i<k;i++){    int x=sc.nextInt()-1,y=sc.nextInt()-1;    vis[x][y]=true;    q.add(x);q.add(y);   }   int lastx=-1,lasty=-1;   int dirX[]={1,-1,0,0},dirY[]={0,0,1,-1};   while (!q.isEmpty()){    int x=q.removeFirst();    int y=q.removeFirst();    lastx=x;lasty=y;    for (int i=0;i<4;i++){     int newx=x+dirX[i],newy=y+dirY[i];     if (newx>=0 && newx<n && newy>=0 && newy<m && !vis[newx][newy]){      vis[newx][newy]=true;      q.add(newx);q.add(newy);     }    }   }   out.println((lastx+1)+" "+(lasty+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();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
2	public class utkarsh {  InputStream is;  PrintWriter out;   long mod = (long) (1e9 + 7);  boolean SHOW_TIME;   void solve() {        long X = nl();   BigInteger x = BigInteger.valueOf(X);   long K = nl();   BigInteger k = BigInteger.valueOf(K);   BigInteger MOD = BigInteger.valueOf(mod);     if(X == 0) {    out.println(0); return;   }   if(k.compareTo(BigInteger.ZERO) == 0) {    out.println((x.add(x)).mod(MOD)); return;   }     BigInteger p = BigInteger.valueOf(modpow(2, K, mod));   BigInteger ans = x.multiply(p);   ans = ans.add(ans);   ans = ans.subtract(p).add(BigInteger.ONE);   ans = ans.add(MOD);   out.println(ans.mod(MOD));  }   long modpow(long b, long e, long mod) {   b %= mod;   long r = 1;   while(e > 0) {    if((e & 1) == 1) {     r *= b; r %= mod;    }    b *= b; b %= mod;    e >>= 1;   }   return r;  }     public static void main(String[] args) { new utkarsh().run(); }  void run() {   is = System.in;   out = new PrintWriter(System.out);   long start = System.currentTimeMillis();   solve();   long end = System.currentTimeMillis();   if(SHOW_TIME) out.println("\n" + (end - start) + " ms");   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;  }   char nc() { return (char)skip(); }  String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!isSpaceChar(b)) { sb.appendCodePoint(b); b = readByte(); }   return sb.toString();  }  String nLine() {   int b = skip();   StringBuilder sb = new StringBuilder();   while( !(isSpaceChar(b) && 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;  }  double nd() { return Double.parseDouble(ns()); }  float nf() { return Float.parseFloat(ns()); }  int[] na(int n) {   int a[] = new int[n];   for(int i = 0; i < n; i++) { a[i] = ni(); }   return a;  }  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);  } }
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(); } }
3	public final class paint_and_numers {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[] a = new int[n];   for(int i=0;i<n;i++) a[i] = in.nextInt();   Arrays.sort(a);   int count = 0;   boolean[] c = new boolean[n];   for(int i=0;i<n;i++) {    if(c[i]==false) {     c[i]=true;     count++;     for(int j=i+1;j<n;j++) {      if(a[j]%a[i]==0) {       c[j] = true;      }     }    }   }   System.out.println(count);  } }
5	public class CDF22_A {  public static void main(String[] args) throws Exception {   Scanner sc = new Scanner(System.in);   int N = sc.nextInt();   int[] A = new int[N];   for (int i=0; i<N; i++)    A[i] = sc.nextInt();   Arrays.sort(A);   int i = 0;   while (i < A.length && A[i] == A[0]) i++;   System.out.println(i == A.length ? "NO" : A[i]);   sc.close();  } }
4	public class practice {  public static void main(String[] args) throws FileNotFoundException {    Scanner scn = new Scanner(new FileReader("input.txt"));  PrintWriter out = new PrintWriter(new File("output.txt"));  int n=scn.nextInt(),m=scn.nextInt(),k=scn.nextInt();  int[][] inf=new int[k][2];  for(int i=0;i<k;i++){   inf[i][0]=scn.nextInt();inf[i][1]=scn.nextInt();  }  int ans=0,x=1,y=1;  for(int i=1;i<=n;i++){   for(int j=1;j<=m;j++){   int temp=Integer.MAX_VALUE;   for(int l=0;l<k;l++){   temp=Math.min(temp, Math.abs(i-inf[l][0])+Math.abs(j-inf[l][1]));    }   if(temp>ans){    ans=temp;x=i;y=j;   }   }  }  out.print(x+ " " + y);   out.close();  } }
1	public class b { public static void main(String[] args) throws Exception {   BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  StringTokenizer st = new StringTokenizer(f.readLine());  int T = Integer.parseInt(st.nextToken());   for (int t = 0; t < T; t++) {  st = new StringTokenizer(f.readLine());  int n = Integer.parseInt(st.nextToken());  int sqrt = (int)Math.sqrt(n);  int sqrt2 = (int)Math.sqrt(n/2);  if (sqrt*sqrt == n && sqrt%2 == 0) {   out.println("YES");  } else if (2*sqrt2*sqrt2 == n) {   out.println("YES");  } else {   out.println("NO");  }  }   out.close(); } }
3	public class CFC {  static int n;  static int[][] dp;  static boolean[] s;  public static void main(String[] args) throws IOException {   FastScanner in = new FastScanner(System.in);      n = in.nextInt();   if(n == 1){    System.out.println(1);    return;   }   dp = new int[n][n+1];   s = new boolean[n];   for(int i = 0;i <n; i++)s[i] = in.next().equals("s");   for(int j = 0;j < n; j++){    if(s[n-2])dp[n-1][j] = j+1;    else dp[n-1][j] = 1;   }   int suma , sumb;   for(int i = n-2; i >= 0; i--){    if(i == 0 ? true : s[i-1]){     if(s[i]) {      for (int j = 0; j < n; j++) {       dp[i][j] = ((j == 0 ? 0 : dp[i][j - 1]) + dp[i + 1][j]) % 1000000007;      }     }     else{      for(int j = 0;j < n; j++){       dp[i][j] = ((j == 0 ? 0 : dp[i][j-1]) + dp[i+1][j+1]) % 1000000007;      }     }    }    else{     if(s[i]){      for(int j = 0;j < n; j++){       dp[i][j] = dp[i+1][j];      }     }     else{      for(int j = 0;j < n; j++){       dp[i][j] = dp[i+1][j+1];      }     }    }   }   System.out.println(dp[0][0]);  }  private 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 long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String next() {    int c = read();    while (isSpaceChar(c)) c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   public String nextLine() {    int c = read();    while (isEndline(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isEndline(c));    return res.toString();   }  } }
1	public class TaskA implements Runnable { private InputReader in; private PrintWriter out;  public static void main(String[] args) {  new Thread(new TaskA()).start();  }  public TaskA() {      in = new InputReader(System.in);  out = new PrintWriter(System.out); }  public void run() {   int n = in.readInt();  int k = in.readInt();  int last = 2;  for (int i = 3; i + last < n; i++) {  boolean good = true;  for (int j = 2; j * j <= i; j++) {   if (i % j == 0) {   good = false;   break;   }  }  if (good) {   int p = i + last + 1;   for (int j = 2; j * j <= p; j++) {   if (p % j == 0) {    good = false;    break;   }   }   if (good)   k--;   last = i;  }  }  if (k <= 0)  out.println("YES");  else  out.println("NO");  out.close(); }  private 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;  }  public long readLong() {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  long res = 0;  do {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  } while (!isSpaceChar(c));  return res * sgn;  }  public String readString() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuffer res = new StringBuffer();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  private boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  private String readLine0() {  StringBuffer buf = new StringBuffer();  int c = read();  while (c != '\n' && c != -1) {   buf.appendCodePoint(c);   c = read();  }  return buf.toString();  }  public String readLine() {  String s = readLine0();  while (s.trim().length() == 0)   s = readLine0();  return s;  }  public String readLine(boolean ignoreEmptyLines) {  if (ignoreEmptyLines)   return readLine();  else   return readLine0();  }  public BigInteger readBigInteger() {  try {   return new BigInteger(readString());  } catch (NumberFormatException e) {   throw new InputMismatchException();  }  }  public char readCharacter() {  int c = read();  while (isSpaceChar(c))   c = read();  return (char) c;  }  public double readDouble() {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.') {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  if (c == '.') {   c = read();   double m = 1;   while (!isSpaceChar(c)) {   if (c < '0' || c > '9')    throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();   }  }  return res * sgn;  } } }
1	public class Main {       static final double eps = 1e-8;       public static void main(String[] args) throws IOException {     try {            int n = nextInt();       int k = nextInt();       int[] a = new int[n];       int[] d = new int[n];       int[] dr = new int[n];       boolean used[] = new boolean[100001];       a[0] = nextInt();       used[ a[0] ] = true;       d[0] = 1;       for(int i = 1; i < n; i++)       {        a[i] = nextInt();        if(!used[ a[i] ])        {         used[ a[i] ] = true;         d[i] = d[i - 1] + 1;        }        else        {         d[i] = d[i - 1];        }       }       Arrays.fill(used, false);              int r = Arrays.binarySearch(d, k);             if(r < 0)       {        pw.println("-1 -1");        return;       }         while( r > 0 && d[r] == d[r - 1] )        r--;             used[ a[r] ] = true;       dr[r] = 1;       for(int i = r - 1; i >= 0; i--)       {        if(!used[ a[i] ])        {         used[ a[i] ] = true;         dr[i] = dr[i + 1] + 1;        }        else        {         dr[i] = dr[i + 1];        }       }                      int l = 0;         while(l < n - 1 && dr[l] == dr[l + 1] && r - l >= k)        l++;                    pw.println(l + 1 + " " + (r + 1));     }     finally {      pw.close();     }    }         static Scanner sc = new Scanner(System.in);    static PrintWriter pw = new PrintWriter(System.out);    static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));    static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));    static StringTokenizer st ;    static int nextInt() throws IOException {     in.nextToken();     return (int) in.nval;    }    static long nextLong() throws IOException {     in.nextToken();     return (long) in.nval;    }    static double nextDouble() throws IOException {     in.nextToken();     return in.nval;    }    static String next() throws IOException {     in.nextToken();     return in.sval;    }    static void outArray(int[] O) {     for(int i = 0; i < O.length - 1; i++)      pw.print(O[i] + " ");     pw.println(O[O.length - 1]);    }   }
5	public class A { private Scanner in; private PrintWriter out;  private String INPUT = "";  public void solve() {  int n = ni();  int[] a = new int[n];  for(int i = 0;i < n;i++){  a[i] = ni();  }  Arrays.sort(a);  for(int i = 1;i < n;i++){  if(a[i] > a[i - 1]){   out.println(a[i]);   return;  }  }  out.println("NO"); }  public void run() throws Exception {  in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(new StringReader(INPUT));  out = new PrintWriter(System.out);   solve();  out.flush(); }   public static void main(String[] args) throws Exception {  new A().run(); }  private int ni() { return Integer.parseInt(in.next()); } private static void tr(Object... o) { System.out.println(o.length == 1 ? o[0] : Arrays.toString(o)); } }
3	public class ProblemD {  static int mod = (int) (1e9+7);  static InputReader in;  static PrintWriter out;   static void update(int i, int val, int[] bit){   for(; i < bit.length; i += (i&-i))    bit[i] += val;  }   static int query(int i, int[] bit){   int ans=0;     for(; i>0; i -= (i&-i))    ans += bit[i];     return ans;  }   static int get(int l, int r, int[] bit){   if(l > r) return 0;   return query(r, bit) - query(l - 1, bit);  }   static void solve()  {   in = new InputReader(System.in);   out = new PrintWriter(System.out);        int n = in.nextInt();   int[] arr = new int[n + 1];   int[] bit = new int[n + 2];     for(int i = 1; i <= n; i++){    arr[i] = in.nextInt();   }   int cnt = 0;     for(int i = n; i > 0; i--){    cnt += query(arr[i], bit);    update(arr[i], 1, bit);   }   cnt %= 2;     int q = in.nextInt();   while(q-- > 0){       int l = in.nextInt();    int r = in.nextInt();    int length = r - l + 1;    int x = (length * (length - 1)) / 2;    x %= 2;    cnt ^= x;    out.println(cnt == 0 ? "even" : "odd");   }     out.close();  }   public static void main(String[] args)  {   new Thread(null ,new Runnable(){    public void run(){     try{      solve();     } catch(Exception e){      e.printStackTrace();     }    }   },"1",1<<26).start();    }  static class Pair implements Comparable<Pair>  {   long x,y;   Pair (long x,long y)   {     this.x = x;     this.y = y;   }   public int compareTo(Pair o)   {    return Long.compare(this.x,o.x);       }   public boolean equals(Object o)   {    if (o instanceof Pair)    {     Pair p = (Pair)o;     return p.x == x && p.y==y;    }    return false;   }   @Override   public String toString()   {    return x + " "+ y ;   }     }   static long add(long a,long b){   long x=(a+b);   while(x>=mod) x-=mod;   return x;  }  static long sub(long a,long b){   long x=(a-b);   while(x<0) x+=mod;   return x;  }   static long mul(long a,long b){   long x=(a*b);   while(x>=mod) x-=mod;   return x;  }   static String rev(String s){   StringBuilder sb=new StringBuilder(s);   sb.reverse();   return sb.toString();  }   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 long pow(long n,long p,long m)  {   long result = 1;   if(p==0){    return 1;   }      while(p!=0)   {    if(p%2==1)     result *= n;    if(result >= m)     result %= m;    p >>=1;    n*=n;    if(n >= m)     n%=m;   }     return result;  }  static long pow(long n,long p)  {   long result = 1;   if(p==0)    return 1;   while(p!=0)   {    if(p%2==1)     result *= n;     p >>=1;    n*=n;    }   return result;  }  static void debug(Object... o)  {    System.out.println(Arrays.deepToString(o));  }  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 int[] nextIntArray(int n)   {     int a[] = new int[n];     for (int i = 0; i < n; i++)     {       a[i] = nextInt();     }     return a;   }   public long[] nextLongArray(int n)   {     long a[] = new long[n];     for (int i = 0; i < n; i++)     {       a[i] = nextLong();     }     return a;   }   public String readString()   {     int c = snext();     while (isSpaceChar(c))     {       c = snext();     }     StringBuilder res = new StringBuilder();     do     {       res.appendCodePoint(c);       c = snext();     } while (!isSpaceChar(c));     return res.toString();   }   public String nextLine()   {     int c = snext();     while (isSpaceChar(c))       c = snext();     StringBuilder res = new StringBuilder();     do     {       res.appendCodePoint(c);       c = snext();     } while (!isEndOfLine(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;   }   private boolean isEndOfLine(int c)   {     return c == '\n' || c == '\r' || c == -1;   }   public interface SpaceCharFilter   {     public boolean isSpaceChar(int ch);   }  } }
5	public class Contest169ProblemA implements Runnable {  void solve() throws NumberFormatException, IOException {   int n = nextInt(), a = nextInt(), b = nextInt();   ArrayList<Integer> tasks= new ArrayList<Integer>();     for (int i = 0; i < n; ++i){    tasks.add(nextInt());   }   Collections.sort(tasks);   int l1 = tasks.get(b-1);   int l2 = tasks.get(b);   if (l2 - l1 >= 0){    out.print(l2-l1);   } else {    out.print(l2-l1);   }  }   StringTokenizer st;  BufferedReader in;  PrintWriter out;   public static void main(String[] args) {   new Thread(new Contest169ProblemA()).start();  }   public void run() {   try {    if (System.getProperty("ONLINE_JUDGE") != null) {     in = new BufferedReader(new InputStreamReader(System.in));    } else {     in = new BufferedReader(new FileReader("input.txt"));    }    out = new PrintWriter(System.out);     solve();    } catch (Exception e) {    e.printStackTrace();    System.out.print(e);    System.exit(9000);    } finally {     out.flush();    out.close();   }  }    String nextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }   int nextInt() throws NumberFormatException, IOException {   return Integer.parseInt(nextToken());  }   long nextLong() throws NumberFormatException, IOException {   return Long.parseLong(nextToken());  }   double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextToken());  }  }
3	public class PythInd { public static final int MOD = 1000000007;  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = Integer.parseInt(sc.nextLine());  String[] sTypes = new String[n];  for (int i = 0; i < n; i++) {  sTypes[i] = sc.nextLine();  }  sc.close();     int[][] dp = new int[n][n];  dp[0][0] = 1;  for (int i = 0; i < dp.length - 1; i++) {  if (sTypes[i].equals("s")) {   int curSum = 0;   for (int j = i + 1; j >= 0; j--) {   curSum = (dp[i][j] + curSum) % MOD;   dp[i + 1][j] += curSum;   dp[i + 1][j] %= MOD;   }  } else {   for (int j = 1; j <= i + 1; j++) {   dp[i + 1][j] += dp[i][j - 1];   dp[i + 1][j] %= MOD;   }  }  }  int ans = 0;  for (int i = 0; i < dp[0].length; i++) {  ans = (ans + dp[n - 1][i]) % MOD;  }  System.out.println(ans); } }
5	public class Main {  public static void main(String[] args) {  Scanner cin=new Scanner(new BufferedInputStream(System.in));   int n=cin.nextInt(),   m=cin.nextInt(),   k=cin.nextInt();  int[] a=new int[51];   for (int i=0;i<n;i++) {  a[i]=-cin.nextInt();  }  Arrays.sort(a);   if (m<=k) {   System.out.println(0);   return;  }  for (int i=0;i<Math.min(k,n);i++) {  m+=a[i];  if (m-(k-1-i)<=0) {   System.out.println(i+1);   return;  }  }  for (int i=k;i<n;i++) {  m+=a[i]+1;  if (m<=0) {   System.out.println(i+1);   return;  }  }  System.out.println(-1);   cin.close(); } }
6	public class Handbag {      public static class Item{  int x;  int y;   Item(int x, int y){  this.x = x;   this.y = y;  }     public int dist(Item i){  int dx = x - i.x;  int dy = y - i.y;  return dx*dx + dy*dy;  } }     public static int solve(int bitNum){   if(bitNum == (1 << N) - 1)   return 0;   if(bits[bitNum] != -1)   return bits[bitNum];   int ans = Integer.MAX_VALUE;  int j = 0;  for(int i = 1; i < N; i++){    if((bitNum & (1 << i)) == 0){      if(j == 0){       ans = 2 * items[0].dist(items[i]) + solve(bitNum | (1 << i));    j = i;   }   else{      int dist1 = items[0].dist(items[i]);      int dist2 = items[i].dist(items[j]);      int dist3 = items[j].dist(items[0]);               ans = Math.min(ans, dist1 + dist2 + dist3 + solve(bitNum | (1 << i) | (1 << j)));   }  }  }  return bits[bitNum] = ans;  }  static void printOptPath(int bitNum) {  if (bitNum == (1 << N) - 1)  return;     int j = 0;  for (int i = 1; i < N; i++)    if ((bitNum & (1 << i)) == 0) {     if (j == 0) {      j = i;    if (bits[bitNum] == 2 * items[0].dist(items[i]) + solve(bitNum | (1 << i))) {    pw.print(" " + i + " 0");    printOptPath(bitNum | (1 << i));    return;   }   }   else if (bits[bitNum] ==     items[0].dist(items[i]) + items[i].dist(items[j]) + items[j].dist(items[0]) + solve(bitNum | (1 << i) | (1 << j))) {      pw.print(" " + j + " " + i + " 0");    printOptPath(bitNum | (1 << i) | (1 << j));    return;   }  } }  private static int N = 0; private static Item[] items; private static int[] bits;   private static PrintWriter pw = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));    String[] input = br.readLine().split(" ");  Item handbag = new Item(Integer.parseInt(input[0]), Integer.parseInt(input[1]));   N = Integer.parseInt(br.readLine()) + 1;  items = new Item[N];  for(int n = 1; n < N; n++){  input = br.readLine().split(" ");  items[n] = new Item(Integer.parseInt(input[0]), Integer.parseInt(input[1]));  }   items[0] = handbag;        bits = new int[1 << N];  Arrays.fill(bits, -1);    int ans = solve(1 << 0);  pw.println(ans);    pw.print("0");  printOptPath(1 << 0);    pw.close(); } }
4	public class Main{  public static void pri(ArrayList<Integer> list)  {   int len=list.size();   for(int i=0;i<len-1;++i)    System.out.print(list.get(i)+".");   System.out.println(list.get(len-1));  }  public static void main(String[] args) throws java.io.IOException {   Scanner sc=new Scanner(System.in);   int t=sc.nextInt();   while(t-->0)   {    int n=sc.nextInt();    int[] arr=new int[n];    for(int i=0;i<n;++i)    {     arr[i]=sc.nextInt();    }    ArrayList<Integer> cur=new ArrayList<>();    cur.add(1);    System.out.println(1);    for(int i=1;i<n;++i)    {     if(arr[i]==1)     {      cur.add(1);      pri(cur);      continue;     }     int len=cur.size();     while(cur.get(len-1)!=arr[i]-1)     {      cur.remove(len-1);      len--;     }     cur.set(len-1,arr[i]);     pri(cur);     continue;    }   }  } }
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 String readString() throws IOException {  int c = read();  while (isSpaceChar(c)) {   c = read();  }  StringBuilder res=new StringBuilder();  do {   res.append((char)c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  public final int readInt() throws IOException {  int c = read();  boolean neg=false;  while (isSpaceChar(c)) {   c = read();  }  char d=(char)c;    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;  } } }
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 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()); } }
1	public class MSpreadSheet {   public int toNum(String x)  {   int result = 0;   int pow = 0;   for (int i = x.length()-1; i >=0; i--)   {    result+=(x.charAt(i)-'A'+1)*Math.pow(26, pow);    pow++;   }   return result;  }   public String toString(int x)  {   if(x<=26) return String.valueOf((char)(x+'A'-1));   String result = "";   while(x!=0)   {    if(x%26==0)    {     result = 'Z' + result;     x = x/26 - 1;    }    else    {     result = (char)((x%26)+'A'-1) + result;     x = x/26;    }      }   return result;  }   public boolean check(String x)  {   if(x.charAt(0)!='R') return false;   int in = x.indexOf('C');   if(in==-1) return false;   if(Character.isDigit(x.charAt(in-1))&&Character.isDigit(x.charAt(in+1))) return true;   return false;  }   public void solve(String x)  {   String r="";   String c="";   if(check(x))   {    int in = x.indexOf('C');    r = x.substring(1,in);    c = x.substring(in+1);    System.out.println(toString(Integer.parseInt(c))+r);   }   else   {    int i =0;    while(!Character.isDigit(x.charAt(i)))      c+=x.charAt(i++);    while(i<x.length())     r+=x.charAt(i++);    System.out.println("R"+r+"C"+toNum(c));   }  }   public static void main(String[] args) {   MSpreadSheet sh = new MSpreadSheet();   Scanner s = new Scanner(System.in);   int n = s.nextInt();   int i = 0;   while(i<n)   {    sh.solve(s.next());    i++;   }  } }
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());   }  } }
3	public class CE35D { public static void main(String[] args) throws NumberFormatException, IOException {   BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(sc.readLine());  String[] t = sc.readLine().split(" ");  int[] list = new int[n];  for(int x=0; x<n; x++){  list[x] = Integer.parseInt(t[x]);  }   boolean even = true;   int[] indList = new int[n+1];     for(int x=0; x<n; x++){  indList[list[x]] = x;  }   for(int x=1; x<=n; x++){  int theIndex = indList[x];  int other = list[x-1];  if(theIndex != x-1){   even = !even;   list[x-1] = x;   list[theIndex] = other;     indList[x] = x-1;   indList[other] = theIndex;  }  }      int numQ = Integer.parseInt(sc.readLine());  for(int x=0; x<numQ; x++){  String[] dir = sc.readLine().split(" ");  int l = Integer.parseInt(dir[0]);  int r = Integer.parseInt(dir[1]);  int diff = r - l + 1;  if(diff%4 > 1){   even = !even;  }  if(even){   System.out.println("even");  }  else{   System.out.println("odd");  }  } } }
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);   }  } }
4	public final class C {  static class Node {   int val;   String path;   Node node;   Node(String p, int t) {    path = p;    val = t;   }  }  public static void main(String[] args) {   final FastScanner fs = new FastScanner();   final int t = fs.nextInt();   final StringBuilder sb = new StringBuilder();   for (int test = 0; test < t; test++) {    final int n = fs.nextInt();    final Deque<Node> dq = new ArrayDeque<>();    dq.offerLast(new Node("", 0));    for (int i = 0; i < n; i++) {     final int next = fs.nextInt();     if (dq.getFirst().val + 1 != next) {      if (next == 1) {       final Node peek = dq.getFirst();       final String p = peek.path.isEmpty() ? String.valueOf(peek.val)                : (peek.path + '.' + peek.val);       dq.addFirst(new Node(p, 1));      } else {       while (dq.getFirst().val + 1 != next) {        dq.removeFirst();       }       dq.getFirst().val++;      }     } else {      dq.getFirst().val++;     }     add(sb, dq.getFirst(), dq.getFirst().val);    }   }   System.out.println(sb);  }  private static void add(StringBuilder sb, Node node, int val) {   final String p = node.path.isEmpty() ? String.valueOf(val)            : (node.path + '.' + val);   sb.append(p);   sb.append('\n');  }  static final class Utils {   private static class Shuffler {    private static void shuffle(int[] x) {     final Random r = new Random();     for (int i = 0; i <= x.length - 2; i++) {      final int j = i + r.nextInt(x.length - i);      swap(x, i, j);     }    }    private static void shuffle(long[] x) {     final Random r = new Random();     for (int i = 0; i <= x.length - 2; i++) {      final int j = i + r.nextInt(x.length - i);      swap(x, i, j);     }    }    private static void swap(int[] x, int i, int j) {     final int t = x[i];     x[i] = x[j];     x[j] = t;    }    private static void swap(long[] x, int i, int j) {     final long t = x[i];     x[i] = x[j];     x[j] = t;    }   }   public static void shuffleSort(int[] arr) {    Shuffler.shuffle(arr);    Arrays.sort(arr);   }   public static void shuffleSort(long[] arr) {    Shuffler.shuffle(arr);    Arrays.sort(arr);   }   private Utils() {}  }  static class FastScanner {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer("");   private 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());   }   int[] nextIntArray(int n) {    final int[] a = new int[n];    for (int i = 0; i < n; i++) { a[i] = nextInt(); }    return a;   }   long[] nextLongArray(int n) {    final long[] a = new long[n];    for (int i = 0; i < n; i++) { a[i] = nextLong(); }    return a;   }  } }
2	public class ReallyBigNumbers1 {   public static void main(String[] args) throws IOException  {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(br.readLine());   PrintWriter out = new PrintWriter(System.out);   long n = Long.parseLong(st.nextToken());   long s = Long.parseLong(st.nextToken());     int r = 0 ;     long l = 0L ;   long u = n ;     if( (l-sumDigits(l)< s ) && (u-sumDigits(u)< s ) )   {    out.println(0);    out.flush();    out.close();    return ;   }     long specified = 0L ;   while( true )   {    long m = (l + u) / 2L ;       if( ( m - sumDigits(m) ) >= s && ( (m-1) - sumDigits(m-1) ) < s )    {     specified = m ;     break ;    }       if( l > u )     break ;       else    {     if( ( m - sumDigits(m) ) >= s )      u = m-1 ;     else      l = m+1 ;    }   }     out.println( n-specified+1 );   out.flush();   out.close();    }   public static int sumDigits(long n)  {   char [] a = (n+"").toCharArray();   int sum = 0 ;   for(int k = 0 ; k < a.length ; k++)   {    sum += Integer.parseInt(a[k]+"") ;   }   return sum ;  }  }
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; } }
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;  }  public int compareTo(Item o){  return o.b-this.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;  }   public double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }   public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }   public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }   public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  } } }
5	public class ProblemA {  public static void main(String[] args) throws IOException {   BufferedReader s = new BufferedReader(new InputStreamReader(System.in));   String[] data = s.readLine().split(" ");   int n = Integer.valueOf(data[0]);   int a = Integer.valueOf(data[1]);   int b = Integer.valueOf(data[2]);   long[] h = new long[n];   String[] line = s.readLine().split(" ");   for (int i = 0 ; i < n ; i++) {    h[i] = Integer.valueOf(line[i]);   }   Arrays.sort(h);     System.out.println(h[b] - h[b-1]);  } }
0	public class CF267A {  public static void main(String[] args) {  int n=0, a, b;  BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));  try {  n = Integer.parseInt(stdin.readLine());  } catch (IOException e) {  }  while(n-->0){  String[] row = null;  try {   row = stdin.readLine().split(" ");  } catch (IOException e) {     e.printStackTrace();  }  a = Integer.parseInt(row[0]);  b = Integer.parseInt(row[1]);  if(a<b) System.out.println(calc(a,b));  else System.out.println(calc(b,a));  } }  static int calc(int a, int b){  if(a==0) return 0;  if(a==b) return 1;  if(a==1) return b;  else return b/a+calc(b%a, a); } }
0	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   if ((n % 4 == 0) || (n % 7 == 0) || (n % 44 == 0) || (n % 47 == 0) || (n % 74 == 0) || (n % 77 == 0)     || (n % 444 == 0) || (n % 447 == 0) || (n % 474 == 0) || (n % 477 == 0) || (n % 744 == 0)     || (n % 747 == 0) || (n % 774 == 0) || (n % 777 == 0)) {    System.out.println("YES");    return;   }   System.out.println("NO");  } }
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();    int[][] cols = new int[m][n];    for(int i = 0; i < n; i++) {     for(int j =0; j < m; j++) {      cols[j][i] = scanner.nextInt();     }    }    int maxMask = 1 << n;    int[] dp = new int[maxMask];    Arrays.fill(dp, -1);    dp[0] = 0;    for(int i = 0; i < m; i++) {     for(int mask = maxMask-1; mask>=0; mask--) {      int[] arr = cols[i].clone();      for(int j = 0; j < n; j++) {       for(int smask = mask; smask >= 0; smask = (smask-1)&mask) {        if (dp[smask] == -1) continue;        int add = 0;        for(int k = 0; k < n; k++) {         if (((mask^smask)&(1 << k)) > 0) add += arr[k];        }        dp[mask] = Math.max(dp[mask], dp[smask] + add);        if (smask == 0) break;       }       arr = shift(arr);      }     }    }    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;  }  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());   }     String readNextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
0	public class P1 {  public static void main(String[] args) {  System.out.println("25"); } }
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};  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); }  void debug(Object... os){  System.err.println(Arrays.deepToString(os)); }  public static void main(String[] args){  Locale.setDefault(Locale.US);  new P111C().run(); } }
2	public class b2 { public static void main(String[] args) throws IOException {  input.init(System.in);  int n = input.nextInt(), x = input.nextInt(), y = input.nextInt(), c = input.nextInt();  long lo = 0, hi = 2*n;  while(hi > lo+1)  {   long mid = (hi+lo)/2;   long covered = go(n, x, y, mid);   if(covered < c)    lo = mid;   else hi = mid;  }  if(go(n, x, y, lo) < c) lo++;  System.out.println(lo);  } public static long go(int n, int x, int y, long d) {  long res = d*d + (d+1)*(d+1);  long maxLeft = d - x;  if(maxLeft >= 0) res -= (maxLeft+1)*(maxLeft+1);  long maxTop = d - y;  if(maxTop >= 0) res -= (maxTop+1)*(maxTop+1);  long maxRight = d - (n+1-x);  if(maxRight >= 0) res -= (maxRight+1)*(maxRight+1);  long maxBot = d - (n+1-y);  if(maxBot >= 0) res -= (maxBot+1)*(maxBot+1);  long maxTopLeft = d - (x+y);  if(maxTopLeft >= 0) res += (maxTopLeft+1)*(maxTopLeft+2)/2;  long maxTopRight = d - ((n+1-x)+y);  if(maxTopRight >= 0) res += (maxTopRight+1)*(maxTopRight+2)/2;  long maxBotLeft = d - (x+(n+1-y));  if(maxBotLeft >= 0) res += (maxBotLeft+1)*(maxBotLeft+2)/2;  long maxBotRight = d - ((n+1-x)+(n+1-y));  if(maxBotRight >= 0) res += (maxBotRight+1)*(maxBotRight+2)/2;  return res; } public static class input {  static BufferedReader reader;  static StringTokenizer tokenizer;    static void init(InputStream input) {   reader = new BufferedReader(      new InputStreamReader(input) );   tokenizer = new StringTokenizer("");  }    static String next() throws IOException {   while ( ! tokenizer.hasMoreTokens() ) {       tokenizer = new StringTokenizer(      reader.readLine() );   }   return tokenizer.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt( next() );  }   static double nextDouble() throws IOException {   return Double.parseDouble( next() );  } } }
2	public class candies { public void run() throws Exception {  Scanner file = new Scanner(System.in);  int actions = file.nextInt();  int left = file.nextInt();  int start = 0;  int c = 1;  while (true) {  start += c;  if (c + (start - left) == actions) break;  c++;  }  System.out.println(start - left); }  public static void main(String[] args) throws Exception {  new candies().run(); } }
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]) + " ");  } } }
1	public class Main { private static StreamTokenizer in; private static PrintWriter out; private static int nextInt() throws Exception { in.nextToken(); return (int)in.nval; } private static String nextString() throws Exception { in.nextToken(); return in.sval; } public static void main(String[] args) throws Exception { in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(System.out); int n = nextInt(); byte f = (byte)nextInt(); byte s = (byte)nextInt(); byte t = (byte)nextInt(); boolean bf = false; boolean bs = false; boolean bt = false; if((f&1) == 0){bf = true;} if((s&1) == 0){bs = true;} if((t&1) == 0){bt = true;} if((!bf)&&bs&&bt){System.out.println(1);return;} if(bf&&(!bs)&&bt){System.out.println(2);return;} if(bf&&bs&&(!bt)){System.out.println(3);return;} if(bf&&!bs&&!bt){System.out.println(1);return;} if(!bf&&bs&&!bt){System.out.println(2);return;} if(!bf&&!bs&&bt){System.out.println(3);return;} for(int i = 4; i<=n; i++){ byte g = (byte) nextInt(); if(((g+f)&1) == 1){System.out.println(i); return;} }  out.flush(); } }
4	public class C {  public static void main(String[] args) throws IOException {   FastScanner scn = new FastScanner();   PrintWriter out = new PrintWriter(System.out);   for (int tc = scn.nextInt(); tc > 0; tc--) {    int N = scn.nextInt();    int[] arr = new int[N];    for (int i = 0; i < N; i++) {     arr[i] = scn.nextInt();    }    StringBuilder[] ans = new StringBuilder[N];    ans[0] = new StringBuilder("1");    ArrayDeque<Integer> st = new ArrayDeque<>();    st.addLast(0);    for (int i = 1; i < N; i++) {         ans[i] = new StringBuilder();     if (arr[i] == 1) {      st.addLast(i);      ans[i].append(ans[i - 1].toString() + ".1");     } else {      while (arr[st.getLast()] != arr[i] - 1) {       st.removeLast();      }      int pos = st.removeLast();      String[] prev = ans[pos].toString().split("[.]");      for (int j = 0, sz = prev.length - 1; j < sz; j++) {       ans[i].append(prev[j] + ".");      }      ans[i].append(arr[i] + "");      st.addLast(i);     }    }    for (StringBuilder str : ans) {     out.println(str);    }   }   out.close();  }  private static int gcd(int num1, int num2) {   int temp = 0;   while (num2 != 0) {    temp = num1;    num1 = num2;    num2 = temp % num2;   }   return num1;  }  private static int lcm(int num1, int num2) {   return (int)((1L * num1 * num2) / gcd(num1, num2));  }  private static void ruffleSort(int[] arr) {                      }  private static class FastScanner {   BufferedReader br;   StringTokenizer st;   FastScanner() {    this.br = new BufferedReader(new InputStreamReader(System.in));    this.st = new StringTokenizer("");   }   String next() {    while (!st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException err) {      err.printStackTrace();     }    }    return st.nextToken();   }   String nextLine() {    if (st.hasMoreTokens()) {     return st.nextToken("").trim();    }    try {     return br.readLine().trim();    } catch (IOException err) {     err.printStackTrace();    }    return "";   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }  } }
3	public class PythonIndentation { public static void main(String args[]) {  Scanner sc=new Scanner(System.in);  int t=sc.nextInt();  int a[]=new int[t];  int c=0;  a[0]=1;  long mod=(long) (1e9+7);  sc.nextLine();  for(int i=0;i<t;i++)  {  String s=sc.nextLine();  if(s.equals("f"))   c++;  else  {   for(int j=1;j<=c;j++)   {   a[j]=(int) (((a[j]%mod)+(a[j-1]%mod))%mod);   }  }  }   System.out.println(a[c]);  sc.close();   } }
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;   }  }  private static 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;  }  private static 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 void run() {   try {    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));    output.flush();    output.close();   } catch (Throwable e) {    System.err.println(e.getMessage());    System.err.println(Arrays.deepToString(e.getStackTrace()));   }  }   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 double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  private long nextLong() throws IOException {   return Long.parseLong(nextToken());  }   private BufferedReader input;  private PrintWriter output;  private StringTokenizer tokens = null; }
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 Query {    int x1;    int y1;    int x2;    int y2;    public Query(int x1, int y1, int x2, int y2) {     this.x1 = x1;     this.y1 = y1;     this.x2 = x2;     this.y2 = y2;    }     public boolean equals(Object o) {     if (this == o) return true;     if (o == null || getClass() != o.getClass()) return false;     TaskB.Query query = (TaskB.Query) o;     if (x1 != query.x1) return false;     if (y1 != query.y1) return false;     if (x2 != query.x2) return false;     return y2 == query.y2;    }     public int hashCode() {     int result = x1;     result = 31 * result + y1;     result = 31 * result + x2;     result = 31 * result + y2;     return result;    }   }   static class IOInteractor implements TaskB.Interactor {    Scanner in;    PrintWriter out;    HashMap<TaskB.Query, Integer> cache;    public IOInteractor(Scanner in, PrintWriter out) {     this.in = in;     this.out = out;     cache = new HashMap<>();    }     public int query(int x1, int y1, int x2, int y2) {     TaskB.Query q = new TaskB.Query(x1, y1, x2, y2);     if (cache.containsKey(q))      return cache.get(q);     if (x1 > x2 || y1 > y2)      return 0;     Assert.assertTrue(x1 >= 1 && y1 >= 1);     out.println("? " + x1 + " " + y1 + " " + x2 + " " + y2);     out.flush();     int res = in.nextInt();     cache.put(q, res);     return res;    }     public void answer(int x11, int y11, int x12, int y12, int x21, int y21, int x22, int y22) {     out.println("! " + x11 + " " + y11 + " " + x12 + " " + y12 + " " + x21 + " " + y21 + " " + x22 + " " + y22);     out.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;   }   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();   }  }  static class Assert {   public static void assertTrue(boolean flag) {     if (!flag)     throw new AssertionError();   }  } }
6	public class cf11d { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  int m = in.nextInt();  boolean[][] g = new boolean[n][n];  boolean[] ok = new boolean[1<<n];  int[] f = new int[1<<n];  for(int i=1; i<(1<<n); i++) {  ok[i] = Integer.bitCount(i)>=3;  f[i] = first(i);  }  for(int i=0; i<m; i++) {  int a = in.nextInt()-1;  int b = in.nextInt()-1;  g[a][b] = g[b][a] = true;  }  long[][] dp = new long[n][1<<n];  for(int i=0; i<n; i++)  dp[i][1<<i] = 1;  for(int i=1; i<(1<<n); i++)  for(int j=0; j<n; j++)   for(int k=f[i]+1; k<n; k++)   if((i&(1<<k)) == 0 && g[j][k])    dp[k][i^(1<<k)] += dp[j][i];  long ret = 0;  for(int i=1; i<(1<<n); i++)  for(int j=0; j<n; j++)   if(ok[i] && j != f[i])   ret += g[j][f[i]]?dp[j][i]:0;  System.out.println(ret/2); } static int first(int x) {  int ret = 0;  while(x%2==0) {  x/=2;  ret++;  }  return ret; } }
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; }  private static 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();  }  String nextLine() throws IOException {  return br.readLine();  }  int nextInt() throws IOException {  return Integer.parseInt(next());  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(next());  }  boolean ready() throws IOException {  return br.ready();  }  } }
6	public class E implements Runnable { FastReader scn; PrintWriter out; String INPUT = "";  void solve() {  int t = scn.nextInt();  while(t-- > 0) {  int n = scn.nextInt(), m = scn.nextInt();  int[][] arr = scn.next2DInt(n, m);    int[][] col = new int[m][2];  for(int j = 0; j < m; j++) {   int max = 0;   for(int i = 0; i < n; i++) {   max = Math.max(max, arr[i][j]);   }   col[j][0] = max;   col[j][1] = j;  }  Arrays.parallelSort(col, (o1, o2) -> o2[0] - o1[0]);    int take = Math.min(n, m);    int[][] lol = new int[n][take];  for(int j = 0; j < take; j++) {   for(int i = 0; i < n; i++) {   lol[i][j] = arr[i][col[j][1]];   }  }    ans = 0;  func(lol, 0);  out.println(ans);  } }  int ans = 0;  void func(int[][] arr, int col) {  int n = arr.length, m = arr[0].length;  if(col == m) {  int rv = 0;  for(int i = 0; i < n; i++) {   int mx = 0;   for(int j = 0; j < m; j++) {   mx = Math.max(mx, arr[i][j]);   }   rv += mx;   }  ans = Math.max(ans, rv);  return;  }   for(int rot = 0; rot < n; rot++) {  int f = arr[0][col];  for(int j = 1; j < n; j++) {   arr[j - 1][col] = arr[j][col];  }  arr[n - 1][col] = f;  func(arr, col + 1);  } }  public void run() {  long time = System.currentTimeMillis();  boolean oj = System.getProperty("ONLINE_JUDGE") != null;  out = new PrintWriter(System.out);  scn = new FastReader(oj);  solve();  out.flush();  if (!oj) {  System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));  } }  public static void main(String[] args) {  new Thread(null, new E(), "Main", 1 << 26).start(); }  class FastReader {  InputStream is;  public FastReader(boolean onlineJudge) {  is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());  }  byte[] inbuf = new byte[1024];  public int lenbuf = 0, ptrbuf = 0;  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++];  }  boolean isSpaceChar(int c) {  return !(c >= 33 && c <= 126);  }  int skip() {  int b;  while ((b = readByte()) != -1 && isSpaceChar(b))   ;  return b;  }  double nextDouble() {  return Double.parseDouble(next());  }  char nextChar() {  return (char) skip();  }  String next() {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(isSpaceChar(b))) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }  String nextLine() {  int b = skip();  StringBuilder sb = new StringBuilder();  while ((!isSpaceChar(b) || b == ' ')) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }  char[] next(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);  }  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 * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }  long nextLong() {  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();  }  }  char[][] nextMatrix(int n, int m) {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)   map[i] = next(m);  return map;  }  int[] nextIntArray(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = nextInt();  return a;  }  long[] nextLongArray(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  int[][] next2DInt(int n, int m) {  int[][] arr = new int[n][];  for (int i = 0; i < n; i++) {   arr[i] = nextIntArray(m);  }  return arr;  }  long[][] next2DLong(int n, int m) {  long[][] arr = new long[n][];  for (int i = 0; i < n; i++) {   arr[i] = nextLongArray(m);  }  return arr;  }  int[] shuffle(int[] arr) {  Random r = new Random();  for (int i = 1, j; i < arr.length; i++) {   j = r.nextInt(i);   int c = arr[i];   arr[i] = arr[j];   arr[j] = c;  }  return arr;  }  long[] shuffle(long[] arr) {  Random r = new Random();  for (int i = 1, j; i < arr.length; i++) {   j = r.nextInt(i);   long c = arr[i];   arr[i] = arr[j];   arr[j] = c;  }  return arr;  }  int[] uniq(int[] arr) {  arr = scn.shuffle(arr);  Arrays.sort(arr);  int[] rv = new int[arr.length];  int pos = 0;  rv[pos++] = arr[0];  for (int i = 1; i < arr.length; i++) {   if (arr[i] != arr[i - 1]) {   rv[pos++] = arr[i];   }  }  return Arrays.copyOf(rv, pos);  }  long[] uniq(long[] arr) {  arr = scn.shuffle(arr);  Arrays.sort(arr);  long[] rv = new long[arr.length];  int pos = 0;  rv[pos++] = arr[0];  for (int i = 1; i < arr.length; i++) {   if (arr[i] != arr[i - 1]) {   rv[pos++] = arr[i];   }  }  return Arrays.copyOf(rv, pos);  }  int[] reverse(int[] arr) {  int l = 0, r = arr.length - 1;  while (l < r) {   arr[l] = arr[l] ^ arr[r];   arr[r] = arr[l] ^ arr[r];   arr[l] = arr[l] ^ arr[r];   l++;   r--;  }  return arr;  }  long[] reverse(long[] arr) {  int l = 0, r = arr.length - 1;  while (l < r) {   arr[l] = arr[l] ^ arr[r];   arr[r] = arr[l] ^ arr[r];   arr[l] = arr[l] ^ arr[r];   l++;   r--;  }  return arr;  }  int[] compress(int[] arr) {  int n = arr.length;  int[] rv = Arrays.copyOf(arr, n);  rv = uniq(rv);  for (int i = 0; i < n; i++) {   arr[i] = Arrays.binarySearch(rv, arr[i]);  }  return arr;  }  long[] compress(long[] arr) {  int n = arr.length;  long[] rv = Arrays.copyOf(arr, n);  rv = uniq(rv);  for (int i = 0; i < n; i++) {   arr[i] = Arrays.binarySearch(rv, arr[i]);  }  return arr;  } } }
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();  } }
6	public class E584 {  public static void main(String[] args) {   MyScanner sc = new MyScanner();   PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));   int t = sc.nextInt();   while (t > 0) {    int n = sc.nextInt(); int m = sc.nextInt();    int [][] a = new int[m][n];    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      a[j][i] = sc.nextInt();     }    }    int [][] dp = new int[m + 1][(1 << n)];    for (int i = 1; i <= m; i++) {     for (int j = 0; j < (1 << n); j++) {      dp[i][j] = Math.max(dp[i][j], dp[i - 1][j]);      int [] b = a[i - 1];      for (int start = 0; start < n; start++) {       int [] c = new int[n];       for (int p = 0; p < n; p++) c[p] = b[(start + p) % n];       for (int k = 0; k < (1 << n); k++) {        if ((k | j) == j) {         int sum = 0;         for (int p = 0; p < n; p++) {          if (((k >> p) & 1) == 0 && ((j >> p) & 1) == 1) sum += c[p];         }         dp[i][j] = Math.max(dp[i][j], dp[i - 1][k] + sum);        }       }      }     }    }    out.println(dp[m][(1 << n) - 1]);    t--;   }   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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   } }
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());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }  } }
4	public class Solution {  public static void main(String [] args){   Scanner in = new Scanner(System.in);   String ins = in.nextLine();   HashMap <String,Integer> sub = new HashMap<String,Integer>();   for (int i=0;i<ins.length();i++){    for (int j=i+1;j<=ins.length();j++){     String key = ins.substring(i,j);     if (sub.containsKey(key)){      sub.put(key,sub.get(key)+1);     } else {      sub.put(key,1);     }    }   }   int max = 0;   for (String key:sub.keySet()){    if (sub.get(key) >= 2 && key.length() > max){     max = key.length();    }   }   System.out.print(max);  } }
5	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;  }  long nextLong() throws IOException  {  in.nextToken();  return (long)in.nval;  }  void run() throws IOException  {      in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(new OutputStreamWriter(System.out));  solve();  out.flush();  }  void solve() throws IOException  {  int N=nextInt();  int m=nextInt();  int k=nextInt();    ArrayList<Integer> ts= new ArrayList<Integer>();   for (int i = 0; i < N; i++) {    ts.add(nextInt());   }   int count=0,pos=0;   Collections.sort(ts);   int jj=ts.size()-1;  while(m>k){     if((jj<0)||(k==0))  {pos=1;break;}  else{     k+=ts.get(jj) -1;  jj--;  count++;  }    }  if(pos==0)    out.println(count);  else    out.println("-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) {    public void run() {     try {      solve();     } catch (Exception e) {      e.printStackTrace();      System.exit(1);     }    }   }.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 long nl() throws IOException  {   return scan.nextLong();  }  static double nd() throws IOException  {   return scan.nextDouble();  }  static String ne() throws IOException  {   return scan.next();  }  static String nel() throws IOException  {   return scan.nextLine();  }  static void pl()  {   pw.println();  }  static void p(Object o)  {   pw.print(o+" ");  }  static void pl(Object o)  {   pw.println(o);  }  static void psb(StringBuilder sb)  {   pw.print(sb);  }  static void pa(String arrayName, Object arr[])  {   pl(arrayName+" : ");   for(Object o : arr)    p(o);   pl();  }  static void pa(String arrayName, int arr[])  {   pl(arrayName+" : ");   for(int o : arr)    p(o);   pl();  }  static void pa(String arrayName, long arr[])  {   pl(arrayName+" : ");   for(long o : arr)    p(o);   pl();  }  static void pa(String arrayName, double arr[])  {   pl(arrayName+" : ");   for(double o : arr)    p(o);   pl();  }  static void pa(String arrayName, char arr[])  {   pl(arrayName+" : ");   for(char o : arr)    p(o);   pl();  }  static void pa(String listName, List list)  {   pl(listName+" : ");   for(Object o : list)    p(o);   pl();  }  static void pa(String arrayName, Object[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(Object o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, int[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(int o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, long[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(long o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, char[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(char o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, double[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(double o : arr[i])     p(o);    pl();   }  }  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 ehsan { public static BigInteger f(BigInteger m,BigInteger n){  BigInteger s,l;  s=n.multiply(m.add(BigInteger.valueOf(1)));  l=m.multiply(m.add(BigInteger.valueOf(1)));  l=l.divide(BigInteger.valueOf(2));  s=s.subtract(l);  s=s.subtract(m);  return s; } public static BigInteger bs(BigInteger a,BigInteger b,BigInteger n,BigInteger d){  BigInteger c,e;  c=a.add(b);  c=c.divide(BigInteger.valueOf(2));  e=f(c,n);  if(e.equals(d))  return c.add(BigInteger.valueOf(1));  if(a.equals(b.add(BigInteger.valueOf(-1))))  return b.add(BigInteger.valueOf(1));  if(e.compareTo(d)>0)  return bs(a,c,n,d);  return bs(c,b,n,d); } public static void main(String[] args)  {  Scanner sc = new Scanner(System.in);  BigInteger bi1 = sc.nextBigInteger();  BigInteger bi2 = sc.nextBigInteger();  BigInteger i,n=bi2;  BigInteger i2=BigInteger.valueOf(1);  BigInteger sum=BigInteger.valueOf(0);  if(bi1.compareTo(bi2)<0){  System.out.println(0);  return;  }  if(bi1.compareTo(bi2)==0){  System.out.println(1);  return;  }  bi2=((n.multiply(n.add(BigInteger.valueOf(1)))).divide(BigInteger.valueOf(2))).subtract(n.subtract(BigInteger.valueOf(1)));  if(bi1.compareTo(bi2)>0)  System.out.println(-1);  else{  System.out.println(bs(BigInteger.valueOf(0),n.add(BigInteger.valueOf(-2)),n,bi1));  } } }
0	public class Coder{   static class FastScanner{   BufferedReader s;   StringTokenizer st;     public FastScanner(){    st = new StringTokenizer("");    s = new BufferedReader(new InputStreamReader(System.in));   }     public int nextInt() throws IOException{    if(st.hasMoreTokens())     return Integer.parseInt(st.nextToken());    else{     st = new StringTokenizer(s.readLine());     return nextInt();    }   }  }     public static void main(String[] args) throws IOException{   FastScanner s = new FastScanner();   PrintWriter ww = new PrintWriter(new OutputStreamWriter(System.out));   int test = s.nextInt(); int cnt=0;   while(test-->0){    int a = s.nextInt();    int b = s.nextInt();    cnt=0;    while(a!=0 && b!=0){     int max = Math.max(a, b);     if(max == b){      int divi = b/a;      b -= divi*a;      cnt+=divi;     }else{      int divi = a/b;      a -= divi*b;      cnt+=divi;     }      }    ww.println(cnt);   }   ww.close();  } }
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); } }
0	public class Sol122A {  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()); }  long nextLong() throws Exception {  return Long.parseLong(next()); }  double nextDouble() throws Exception {  return Double.parseDouble(next()); }  void solve() throws Exception {  long x = nextLong();  out.println((x % 4) * (x % 7) * (x % 74) * (x % 47) * (x % 44) * (x % 77) * (x % 444) * (x % 447) * (x % 474) * (x % 477) * (x % 744) * (x % 747) * (x % 774) * (x % 777) == 0 ? "YES" : "NO"); }  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 Sol122A().run(); } }
3	public class Main {  final static int mod = 1_000_000_007;  public static void main(String[] args) throws Exception {  STDIN scan = new STDIN();  PrintWriter pw = new PrintWriter(System.out);   int n = scan.nextInt();  boolean even = true;  int[] a = new int[n];  for(int i = 0; i < n; i++) {  a[i] = scan.nextInt();  for(int j = 0; j < i; j++)   if(a[i] < a[j]) even = !even;  }  int q = scan.nextInt();  while(q-- > 0) {  int l = scan.nextInt(), r = scan.nextInt();  int len = r - l + 1;  int permutations = len * (len - 1) / 2;  if(permutations % 2 != 0) even = !even;  pw.println(even ? "even" : "odd");  }   pw.flush(); }   static class STDIN {  BufferedReader br;  StringTokenizer st;  public STDIN() {  br = new BufferedReader(new InputStreamReader(System.in));  st = null;  }  boolean hasNext() throws Exception {  if (!st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.hasMoreTokens();  }  int nextInt() throws Exception {  return Integer.parseInt(next());  }  long nextLong() throws Exception {  return Long.parseLong(next());  }  double nextDouble() throws Exception {  return Double.parseDouble(next());  }  String next() throws Exception {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  String nextLine() throws Exception {  return br.readLine();  } } }
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); } }
2	@SuppressWarnings("Duplicates") public class C817 {  private FastScanner in;  private PrintWriter out;  private long calcSum(long x) {   int ans = 0;   while (x > 0) {    ans += x % 10;    x /= 10;   }   return ans;  }  private long calcDiff(long x) {   return x - calcSum(x);  }  private long binSearch(long n, long s) {   long l = 0;   long r = n + 1;   while (r - l > 1) {    long m = (r + l) >> 1;    if (calcDiff(m) >= s) {     r = m;    } else {     l = m;    }   }   return l;  }  private void solve() throws IOException {   long n = in.nextLong();   long s = in.nextLong();   long ans = binSearch(n, s);   out.println(n - ans);  }  private 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 f) {    br = new BufferedReader(new InputStreamReader(f));   }   FastScanner(File f) {    try {     br = new BufferedReader(new FileReader(f));    } catch (FileNotFoundException e) {     e.printStackTrace();    }   }   String next() {    while (st == null || !st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }  }  public static void main(String[] arg) {   new C817().run();  } }
3	public class Solution {  static final int INF = (int) 1e9;  static final int mod = (int) (1e9 + 7);  static final short UNCALC = -1;   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[] a = sc.nextIntArray(n);   long[] cum = new long[n];   cum[0] = a[0];   for (int i = 1; i < n; i++)    cum[i] = a[i] + cum[i - 1];   HashMap<Long, ArrayList<Pair>> hm = new HashMap<>();   for (int i = 0; i < n; i++) {    for (int j = i; j < n; j++) {     long cur = get(cum, i, j);     if (!hm.containsKey(cur)) hm.put(cur, new ArrayList<>());     hm.get(cur).add(new Pair(i, j));    }   }   int max = 0;   StringBuilder ans = new StringBuilder();   for (long sum : hm.keySet()) {    ArrayList<Pair> cur = hm.get(sum);    Collections.sort(cur);    int poss = 0;    int r = -1;    StringBuilder sb = new StringBuilder();    for (int i = 0; i < cur.size(); i++) {     if (cur.get(i).left > r) {      poss++;      r = cur.get(i).right;      sb.append(cur.get(i));     }    }    if (poss> max){     max = poss;     ans = sb;    }   }   out.println(max);   out.println(ans);   out.flush();   out.close();  }  static long get(long[] a, int i, int j) {   return a[j] - (i > 0 ? a[i - 1] : 0);  }  static class Pair implements Comparable<Pair> {   int left, right;   public Pair(int left, int right) {    this.left = left;    this.right = right;   }   @Override   public int compareTo(Pair o) {    return right - o.right;   }   @Override   public String toString() {    return (left + 1) + " " + (right + 1) + "\n";   }  }  static class Scanner {   StringTokenizer st;   BufferedReader br;   public Scanner(InputStream system) {    br = new BufferedReader(new InputStreamReader(system));   }   public Scanner(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 String nextLine() throws IOException {    return br.readLine();   }   public int nextInt() throws IOException {    return Integer.parseInt(next());   }   public double nextDouble() throws IOException {    return Double.parseDouble(next());   }   public char nextChar() throws IOException {    return next().charAt(0);   }   public Long nextLong() throws IOException {    return Long.parseLong(next());   }   public boolean ready() throws IOException {    return br.ready();   }   public void waitForInput() throws InterruptedException {    Thread.sleep(3000);   }   public int[] nextIntArray(int n) throws IOException {    int[] a = new int[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }   public Integer[] nextIntegerArray(int n) throws IOException {    Integer[] a = new Integer[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }   public double[] nextDoubleArray(int n) throws IOException {    double[] ans = new double[n];    for (int i = 0; i < n; i++)     ans[i] = nextDouble();    return ans;   }   public short nextShort() throws IOException {    return Short.parseShort(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.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 {   private static BufferedReader in;   private static 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 A23 {  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  String s = in.nextLine();  int i=0,j=0,n=0,t=0,count=0;  n=s.length();  String s1="y",s2="yu6j";  for(t=1;t<n;t++)   {   for(i=0;i<t;i++)    {    s1=s.substring(i,i+n-t);    for(j=i+1;j<=t;j++)     {     s2=s.substring(j,j+n-t);     if(s1.equalsIgnoreCase(s2))      {      count++;break;      }     if(count==1) break;     }    if(count==1) break;    }   if(count==1) break;   } if(n==0)  {  System.out.println("0");  } else {  if(count==1)  {  System.out.println(s1.length());  }  else System.out.println("0");  } } }
0	public class Task1 {  public static void main(String[] args) {   int n = new Scanner(System.in).nextInt();   System.out.println(n*3/2);  } }
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 Ideone { static long ans=0; public static void Stepgcd(long a,long b) {  if (b!=0) {ans+=(a/b);Stepgcd(b,a%b);}  } public static void main (String[] args) throws java.lang.Exception {  Scanner in=new Scanner(System.in);  long a=in.nextLong(),b=in.nextLong();  Stepgcd(a,b);  System.out.println(ans); } }
1	public class A {  public static void main(String[] args) throws Exception {  boolean submit = true;   Scanner sc = submit ? new Scanner(System.in) : new Scanner(new File("A.in"));  while(sc.hasNext()) {  int n = sc.nextInt(), k = sc.nextInt();  boolean p[] = sieveOfEratosthenes(1001);  ArrayList<Integer> nolds = new ArrayList<Integer>();     for(int i = 0, prev = 0; i < p.length; i++) {   if(p[i]) {   nolds.add(prev+i + 1);   prev = i;   }     }        int c = 0;  for(int i : nolds)   if(i >= 2 && i <= n && p[i])   c++;    System.out.println(c >= k ? "YES" : "NO");    }          }    static boolean[] sieveOfEratosthenes(int n) {   boolean prime[] = new boolean[n+1];   fill(prime, 2, n, true);   for(int i = 2; i <= n; i++)    if(prime[i])     for(int j = i*i; j <= n; j+=i)      prime[j] = false;   return prime;  } }
1	public class Solution {  private BufferedReader in; private PrintWriter out; private StringTokenizer st;  void solve() throws IOException {  int n = nextInt();  int k = nextInt();  ArrayList<Integer> ps = new ArrayList<Integer>();  boolean[] prime = new boolean[n + 1];  Arrays.fill(prime, true);  prime[0] = prime[1] = false;  for (int i = 2; i <= n; ++i) {  if (prime[i]) {   ps.add(i);   for (int j = 2 * i; j <= n; j += i) {   prime[j] = false;   }  }  }  for (int i = 0; i < ps.size() - 1; ++i) {  int t = ps.get(i) + ps.get(i + 1) + 1;  if (t <= n && prime[t]) {   --k;  }  }  out.println(k <= 0 ? "YES" : "NO"); }  Solution() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   eat("");   solve();   in.close();  out.close(); }  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()); }  long nextLong() throws IOException {  return Long.parseLong(next()); }  double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static void main(String[] args) throws IOException {  new Solution(); } }
3	public class A extends PrintWriter {  void run() {   int n = nextInt();   int m = 101;   boolean[] c = new boolean[m];   for (int i = 0; i < n; i++) {    int v = nextInt();    c[v] = true;   }   int ans = 0;   for (int v = 1; v < m; v++) {    if (c[v]) {     ++ans;     for (int u = v; u < m; u += v) {      c[u] = false;     }    }   }   println(ans);  }  boolean skip() {   while (hasNext()) {    next();   }   return true;  }  int[][] nextMatrix(int n, int m) {   int[][] matrix = new int[n][m];   for (int i = 0; i < n; i++)    for (int j = 0; j < m; j++)     matrix[i][j] = nextInt();   return matrix;  }  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());  }  long nextLong() {   return Long.parseLong(next());  }  double nextDouble() {   return Double.parseDouble(next());  }  String nextLine() {   try {    return reader.readLine();   } catch (IOException err) {    return null;   }  }  public A(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;   A solution = new A(System.out);   if (OJ) {    reader = new BufferedReader(new InputStreamReader(System.in));    solution.run();   } else {    reader = new BufferedReader(new FileReader(new File(A.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();  } }
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 double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
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 int[] KMP(String val) {   int i = 0;   int j = -1;   int[] result = new int[val.length() + 1];   result[0] = -1;   while (i < val.length()) {    while (j >= 0 && val.charAt(j) != val.charAt(i)) {     j = result[j];    }    j++;    i++;    result[i] = j;   }   return result;  }  public static boolean nextPer(int[] data) {   int i = data.length - 1;   while (i > 0 && data[i] < data[i - 1]) {    i--;   }   if (i == 0) {    return false;   }   int j = data.length - 1;   while (data[j] < data[i - 1]) {    j--;   }   int temp = data[i - 1];   data[i - 1] = data[j];   data[j] = temp;   Arrays.sort(data, i, data.length);   return true;  }  public static int digit(long n) {   int result = 0;   while (n > 0) {    n /= 10;    result++;   }   return result;  }  public static double dist(long a, long b, long x, long y) {   double val = (b - a) * (b - a) + (x - y) * (x - y);   val = Math.sqrt(val);   double other = x * x + a * a;   other = Math.sqrt(other);   return val + other;  }  public static class Point implements Comparable<Point> {   int x, y;   public Point(int start, int end) {    this.x = start;    this.y = end;   }   @Override   public int hashCode() {    int hash = 5;    hash = 47 * hash + this.x;    hash = 47 * hash + this.y;    return hash;   }   @Override   public boolean equals(Object obj) {    if (obj == null) {     return false;    }    if (getClass() != obj.getClass()) {     return false;    }    final Point other = (Point) obj;    if (this.x != other.x) {     return false;    }    if (this.y != other.y) {     return false;    }    return true;   }   @Override   public int compareTo(Point o) {    return Integer.compare(x, o.x);   }  }  public static class FT {   long[] data;   FT(int n) {    data = new long[n];   }   public void update(int index, long value) {    while (index < data.length) {     data[index] += value;     index += (index & (-index));    }   }   public long get(int index) {    long result = 0;    while (index > 0) {     result += data[index];     index -= (index & (-index));    }    return result;   }  }  public static long gcd(long a, long b) {   if (b == 0) {    return a;   }   return gcd(b, a % b);  }  public static long pow(long a, long b, 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 long nextLong() {    return Long.parseLong(next());   }   public int nextInt() {    return Integer.parseInt(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    st = null;    try {     return br.readLine();    } catch (Exception e) {     throw new RuntimeException();    }   }   public boolean endLine() {    try {     String next = br.readLine();     while (next != null && next.trim().isEmpty()) {      next = br.readLine();     }     if (next == null) {      return true;     }     st = new StringTokenizer(next);     return st.hasMoreTokens();    } catch (Exception e) {     throw new RuntimeException();    }   }  } }
4	public class Main {  static MyScanner scan;  static PrintWriter pw;  static long MOD = 1_000_000_007;  static long INF = 2_000_000_000_000_000_000L;  static long inf = 2_000_000_000;  public static void main(String[] args) {   new Thread(null, null, "_", 1 << 27) {    public void run() {     try {      solve();     } catch (Exception e) {      e.printStackTrace();      System.exit(1);     }    }   }.start();  }  static void solve() throws java.lang.Exception {     initIo(false, "");   StringBuilder sb = new StringBuilder();   int t = ni();   while (t-->0) {    int n = ni();    ArrayList<ArrayList<Integer>> ans = new ArrayList<>();    ArrayList<Integer> prev = new ArrayList<>();    prev.add(1);    ni();    for(int i=1;i<n;i++) {     int x = ni();     ans.add(prev);     ArrayList<Integer> next = new ArrayList<>();     int idx = -1;     for(int j=prev.size()-1;j>=0;--j) {      if(prev.get(j)==x-1) {       for(int k=0;k<j;++k) {        next.add(prev.get(k));       }       next.add(x);       idx = j;       break;      }     }     if(idx==-1) {      assert_in_range("x", x, 1, 1);      for(int e : prev) {       next.add(e);      }      next.add(1);     }     prev = next;    }    ans.add(prev);    for(ArrayList<Integer> list: ans) {     print(list);    }   }   pw.flush();   pw.close();  }  static void print(ArrayList<Integer> list) {   for(int i=0;i<list.size();i++) {    pw.print(list.get(i));    if(i==list.size()-1) {     continue;    }    pw.print(".");   }   pl();  }  static void assert_in_range(String varName, int n, int l, int r) {   if (n >=l && n<=r) return;   System.out.println(varName + " is not in range. Actual: "+n+" l : "+l+" r: "+r);   System.exit(1);  }  static void assert_in_range(String varName, long n, long l, long r) {   if (n>=l && n<=r) return;   System.out.println(varName + " is not in range. Actual: "+n+" l : "+l+" r: "+r);   System.exit(1);  }  static void initIo(boolean isFileIO, String suffix) throws IOException {   scan = new MyScanner(isFileIO, suffix);   if(isFileIO) {    pw = new PrintWriter("/Users/dsds/Desktop/output"+suffix+".txt");   }   else {    pw = new PrintWriter(System.out, true);   }  }  static int ni() throws IOException  {   return scan.nextInt();  }  static long nl() throws IOException  {   return scan.nextLong();  }  static double nd() throws IOException  {   return scan.nextDouble();  }  static String ne() throws IOException  {   return scan.next();  }  static String nel() throws IOException  {   return scan.nextLine();  }  static void pl()  {   pw.println();  }  static void p(Object o)  {   pw.print(o+" ");  }  static void pl(Object o)  {   pw.println(o);  }  static void psb(StringBuilder sb)  {   pw.print(sb);  }  static void pa(String arrayName, Object arr[])  {   pl(arrayName+" : ");   for(Object o : arr)    p(o);   pl();  }  static void pa(String arrayName, int arr[])  {   pl(arrayName+" : ");   for(int o : arr)    p(o);   pl();  }  static void pa(String arrayName, long arr[])  {   pl(arrayName+" : ");   for(long o : arr)    p(o);   pl();  }  static void pa(String arrayName, double arr[])  {   pl(arrayName+" : ");   for(double o : arr)    p(o);   pl();  }  static void pa(String arrayName, char arr[])  {   pl(arrayName+" : ");   for(char o : arr)    p(o);   pl();  }  static void pa(String arrayName, TreeSet<Integer> set)  {   pl(arrayName+" : ");   for(Object o : set)    p(o);   pl();  }  static void pa(String arrayName, boolean arr[])  {   pl(arrayName+" : ");   for(boolean o : arr)    p(o);   pl();  }  static void pa(String listName, List list)  {   pl(listName+" : ");   for(Object o : list)    p(o);   pl();  }  static void pa(String arrayName, Object[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(Object o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, int[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(int o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, long[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(long o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, char[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(char o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, double[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(double o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, boolean[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(boolean o : arr[i])     p(o);    pl();   }  }  static class MyScanner  {   BufferedReader br;   StringTokenizer st;   MyScanner(boolean readingFromFile, String suffix) throws IOException   {    if(readingFromFile) {     br = new BufferedReader(new FileReader("/Users/ddfds/Desktop/input"+suffix+".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());   }  } }
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(); } }
1	public class B {  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 boolean sq(long x) {  long l = 1;  long r = (int)Math.sqrt(1e16)+1;  while (l+1<r) {  long m = (l+r)>>1;  if (m * m > x) r = m;  else l = m;  }  return l*l == x; }  static boolean solve(long x) {  if ((x&1)==1) return false;  if ((x & (x-1)) == 0) return true;  long num = 2;  while (num < x && x % num == 0) {  if (sq(x/num)) return true;  num*=2;  }  return false; }  public static void readInput() throws IOException {     int t = Integer.parseInt(br.readLine());  while (t-->0) {  int x = Integer.parseInt(br.readLine());  out.println(solve(x) ? "YES":"NO");  } } }
1	public class CF1082D { 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[n];  int[] i1 = new int[n];  int[] i2 = new int[n];  int n1 = 0, n2 = 0, m2 = 0;  for (int i = 0; i < n; i++) {  int a = Integer.parseInt(st.nextToken());  aa[i] = a;  if (a == 1)   i1[n1++] = i;  else {   i2[n2++] = i;   m2 += a;  }  }  if (m2 < (n2 - 1) * 2 + n1) {  System.out.println("NO");  return;  }  int m = n2 - 1 + n1;  int d = n2 - 1 + Math.min(n1, 2);  PrintWriter pw = new PrintWriter(System.out);  pw.println("YES " + d);  pw.println(m);  for (int i = 0; i + 1 < n2; i++) {  pw.println((i2[i] + 1) + " " + (i2[i + 1] + 1));  aa[i2[i]]--; aa[i2[i + 1]]--;  }  if (n1 > 0) {  while (n2 > 0 && aa[i2[n2 - 1]] == 0)   n2--;  pw.println((i2[n2 - 1] + 1) + " " + (i1[n1 - 1] + 1));  aa[i2[n2 - 1]]--;  n1--;  }  for (int i = 0, j = 0; j < n1; j++) {  while (aa[i2[i]] == 0)   i++;  pw.println((i2[i] + 1) + " " + (i1[j] + 1));  aa[i2[i]]--;  }  pw.close(); } }
5	public class Cottage {   public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int t = sc.nextInt();   List<Point> houses = new ArrayList<Point>();   for (int i = 0; i < n; i++) {    int x = sc.nextInt();    int a = sc.nextInt();    houses.add(new Point(x, a));   }   Collections.sort(houses, new Comparator<Point>() {       @Override    public int compare(Point o1, Point o2) {     return ((Integer) o1.x).compareTo(o2.x);    }   });   int pos = 2;   for (int i = 0; i < n - 1; i++) {    double end = houses.get(i).x + (houses.get(i).y+0.0)/2;    double start = houses.get(i+1).x - (houses.get(i+1).y+0.0)/2;       double diff = start-end;       if (Math.abs(diff-t) < 0.0000001) {     pos++;    }    if (diff > t) {     pos += 2;    }   }   System.out.println(pos);  } }
5	public class Main {  static Map<BigInteger, BigInteger> mp = new HashMap<BigInteger, BigInteger>();  public static void main(String[] args) {   mp.clear();   Scanner cin = new Scanner(new BufferedInputStream(System.in));   BigInteger n = cin.nextBigInteger();   BigInteger x = cin.nextBigInteger();   mp.put(x, BigInteger.ONE);   BigInteger sum = x;   BigInteger ans = BigInteger.ZERO;   for (int i = 2;i <= n.intValue(); i++) {    x=cin.nextBigInteger();    BigInteger tmp = x.multiply(BigInteger.valueOf(i-1)).subtract(sum);    if (mp.containsKey(x.subtract(BigInteger.ONE))) tmp = tmp.subtract(mp.get(x.subtract(BigInteger.ONE)));    if (mp.containsKey(x.add(BigInteger.ONE))) tmp = tmp.add(mp.get(x.add(BigInteger.ONE)));    ans = ans.add(tmp);    sum = sum.add(x);    BigInteger xx;    if (mp.containsKey(x)) xx = mp.get(x);    else xx = BigInteger.ZERO;    mp.put(x, xx.add(BigInteger.ONE));   }   System.out.println(ans);  } }
1	class Parser {  final private int BUFFER_SIZE = 1 << 16;  private java.io.DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;  public Parser(java.io.InputStream in)  {   din = new java.io.DataInputStream(in);   buffer = new byte[BUFFER_SIZE];   bufferPointer = bytesRead = 0;  }  public int nextInt() throws Exception  {   byte c = read();   while (c <= ' ')    c = read();   boolean neg = c == '-';   if (neg)    c = read();   int ret = 0;   do   {    ret = ret * 10 + c - '0';    c = read();   } while (c > ' ');   bufferPointer--;   if (neg)    return -ret;   return ret;  }  public long nextLong() throws Exception  {   byte c = read();   while (c <= ' ')    c = read();   boolean neg = c == '-';   if (neg)    c = read();   long ret = 0;   do   {    ret = ret * 10 + c - '0';    c = read();   } while (c > ' ');   bufferPointer--;   if (neg)    return -ret;   return ret;  }  public double nextDouble() throws Exception  {   byte c = read();   while (c <= ' ')    c = read();   boolean neg = c == '-';   if (neg)    c = read();   boolean seenDot = false;   double div = 1;   double ret = 0;   do   {    if (c == '.')     seenDot = true;    else    {     if (seenDot)      div *= 10;     ret = ret * 10 + c - '0';    }    c = read();   } while (c > ' ');   bufferPointer--;   ret /= div;   if (neg)    return -ret;   return ret;  }  public char nextChar() throws Exception  {   byte c = read();   while (c <= ' ')    c = read();   return (char) c;  }  public String next() throws Exception  {   StringBuilder ret = new StringBuilder();   byte c = read();   while (c <= ' ')    c = read();   do   {    ret.append((char) c);    c = read();   } while (c > ' ');   bufferPointer--;   return ret.toString();  }    public int next(char[] ret) throws Exception  {   byte c = read();   while (c <= ' ')    c = read();   int bRead = 0;   do   {    ret[bRead++] = (char) c;    c = read();   } while (c > ' ');   bufferPointer--;   return bRead;  }  public String nextLine() throws Exception  {   StringBuilder ret = new StringBuilder();   byte c = read();   while (c != '\r' && c != '\n' && c != -1)   {    ret.append((char) c);    c = read();   }   if (c == '\r')    read();   return ret.toString();  }  public boolean hasNext() throws Exception  {   byte c;   do   {    c = read();    if (c == -1)    {     bufferPointer--;     return false;    }   } while (c <= ' ');   bufferPointer--;   return true;  }  private void fillBuffer() throws Exception  {   bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);  }  private byte read() throws Exception  {   if (bufferPointer == bytesRead) fillBuffer();   if (bytesRead == -1) return -1;   return buffer[bufferPointer++];  } } class Printer {  final private int BUFFER_SIZE = 1 << 16;  private java.io.DataOutputStream dout;  private byte[] buffer;  private int bufferPointer;  Printer(java.io.OutputStream out) throws Exception  {   dout = new java.io.DataOutputStream(out);   buffer = new byte[BUFFER_SIZE];   bufferPointer = 0;  }  public void println() throws Exception  {   write((byte) '\n');  }    public void println(int n) throws Exception  {   print(n);   println();  }  public void print(int n) throws Exception  {   if (n >= 0)    print(n, true);   else   {    write((byte) '-');    print(-n, true);   }  }  private void print(int n, boolean first) throws Exception  {   if (n == 0)   {    if (first)     write((byte) (n + '0'));   }   else   {    print(n / 10, false);    write((byte) ((n % 10) + '0'));   }  }    public void println(long n) throws Exception  {   print(n);   println();  }  public void print(long n) throws Exception  {   if (n >= 0)    print(n, true);   else   {    write((byte) '-');    print(-n, true);   }  }  private void print(long n, boolean first) throws Exception  {   if (n == 0)   {    if (first)     write((byte) (n + '0'));   }   else   {    print(n / 10, false);    write((byte) ((n % 10) + '0'));   }  }    public void println(double d) throws Exception  {   print(d);   println();  }  public void print(double d) throws Exception  {   print("double printing is not yet implemented!");  }    public void println(char c) throws Exception  {   print(c);   println();  }  public void print(char c) throws Exception  {   write((byte) c);  }    public void println(String s) throws Exception  {   print(s);   println();  }  public void print(String s) throws Exception  {   int len = s.length();   for (int i = 0; i < len; i++)    print(s.charAt(i));  }  public void close() throws Exception  {   flushBuffer();  }  private void flushBuffer() throws Exception  {   dout.write(buffer, 0, bufferPointer);   bufferPointer = 0;  }  private void write(byte b) throws Exception  {   buffer[bufferPointer++] = b;   if (bufferPointer == BUFFER_SIZE)    flushBuffer();  } } public class Main {  public static void main(String[] args) throws Exception  {   new Main();  }  final int oo = (int)1e9;    InputStream stream = System.in;  Parser in = new Parser(stream);  Printer out = new Printer(System.out);  Printer err = new Printer(System.err);  long start_time = System.nanoTime();      int Sn;  char[] S = new char[1000];  char[] B = new char[1000];   Main() throws Exception  {   for (int T=in.nextInt(); T-->0; )   {    Sn = in.next(S);    if (matchRxCy())     toLet();    else     toNum();   }     long end_time = System.nanoTime();   err.println("Time: " + ((end_time-start_time)/1e9) + "(s).");   if (stream instanceof FileInputStream)   {    err.println("~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~~~~~~~~~~~~~~~~");    err.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~CHANGE INPUT STREAM~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");    err.println("~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~~~~~~~~~~~~~~~~");   }   out.close();   err.close();  }   boolean matchRxCy()  {   boolean ok=S[0]=='R'&&(S[1]>='0'&&S[1]<='9');   if (!ok) return false;   int i;   for (i=2; i<Sn && S[i]!='C'; ++i);   return i<Sn;  }   void toLet() throws Exception  {   int r = 0;   int i=1;   while (S[i]!='C')    r=r*10+S[i++]-'0';   int c = 0;   ++i;   while (i<Sn)    c=c*10+S[i++]-'0';       int bi=0;   while (c>0)   {    B[bi++]=(char)((c-1)%26+'A');    c=(c-1)/26;   }     for (int j=bi-1; j>=0; --j)    out.print(B[j]);   i=1;   while (S[i]!='C')    out.print(S[i++]);   out.println();  }   void toNum() throws Exception  {   int c=0;   int i=0;   int v=1;   while (Character.isLetter(S[i++]))    v*=26;   v/=26;   i=0;   while (Character.isLetter(S[i]))   {    c+=v*(S[i++]-'A'+1);    v/=26;   }     int r=0;   while (i<Sn)    r=r*10+S[i++]-'0';     out.print('R');   out.print(r);   out.print('C');   out.print(c);   out.println();  } }
3	public class Solve6 {  public static void main(String[] args) throws IOException {   PrintWriter pw = new PrintWriter(System.out);   new Solve6().solve(pw);   pw.flush();   pw.close();  }  public void solve(PrintWriter pw) throws IOException {   FastReader sc = new FastReader();   int n = sc.nextInt();   int[] a = new int[n + 1];   for (int i = 1; i <= n; i++) {    a[i] = sc.nextInt();   }   HashMap<Integer, LinkedList<Pair<Integer, Integer>>> h = new HashMap();   for (int i = 1; i <= n; i++) {    int s = 0;    for (int j = i; j >= 1; j--) {     s += a[j];     LinkedList<Pair<Integer, Integer>> l;     if (!h.containsKey(s)) {      l = new LinkedList();     } else {      l = h.get(s);     }     l.add(new Pair(j, i));     h.put(s, l);    }   }   int max = 0, index = 0;   for (Map.Entry<Integer, LinkedList<Pair<Integer, Integer>>> entrySet : h.entrySet()) {    int i = 0, size = 0;    for (Pair<Integer, Integer> pair : entrySet.getValue()) {     if (pair.getKey() > i) {      i = pair.getValue();      size++;     }    }    if (size > max) {     max = size;     index = entrySet.getKey();    }   }   pw.println(max);   int i = 0;   for (Pair<Integer, Integer> pair : h.get(index)) {    if (pair.getKey() > i) {     pw.println(pair.getKey() + " " + pair.getValue());     i = pair.getValue();    }   }  }  static class FastReader {   StringTokenizer st;   BufferedReader br;   public FastReader() {    br = new BufferedReader(new InputStreamReader(System.in));   }   public boolean hasNext() throws IOException {    String s = br.readLine();    if (s == null || s.isEmpty()) {     return false;    }    st = new StringTokenizer(s);    return true;   }   public String next() throws IOException {    if (st == null || !st.hasMoreTokens()) {     String s = br.readLine();     if (s.isEmpty()) {      return null;     }     st = new StringTokenizer(s);    }    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 String nextLine() throws IOException {    return br.readLine();   }  } }
3	public class PaintNumbers {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int[] nums = new int[n];   for (int i = 0; i < n; i++) {    nums[i] = in.nextInt();   }   boolean[] visited = new boolean[n];   int min = Integer.MAX_VALUE;   int a = 0;   boolean cont = true;   while (cont) {    for (int i = 0; i < n; i++) {     if (!visited[i]) {      min = Math.min(min, nums[i]);     }    }    cont = false;    for (int i = 0; i < n; i++) {     if (!visited[i] && nums[i] % min == 0) {      cont = true;      visited[i] = true;     }    }    a++;    min = Integer.MAX_VALUE;   }   System.out.println(a - 1);  }  }
6	public class Main{ static int[][]memo; static int n,m,in[][]; static int dp(int col,int maxRowMask) {  if(col>=m)return 0;  if(memo[col][maxRowMask]!=-1)return memo[col][maxRowMask];   int ans=0;   for(int colMask=0;colMask<(1<<n);colMask++) {    int sum=0;  for(int i=0;i<n;i++) {   if(((colMask>>i)&1)!=0) {   sum+=in[i][col];   }  }  int curMask=colMask;  for(int cyclicShift=0;cyclicShift<n;cyclicShift++) {   if((curMask&maxRowMask)!=0) {   int lastBit=curMask&1;   curMask>>=1;   curMask|=(lastBit<<(n-1));   continue;   }     ans=Math.max(ans, sum+dp(col+1, maxRowMask|curMask));     int lastBit=curMask&1;   curMask>>=1;   curMask|=(lastBit<<(n-1));     }    }  return memo[col][maxRowMask]=ans; } 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();  in=new int[n][m];  for(int i=0;i<n;i++)in[i]=sc.intArr(m);  memo=new int[m][1<<n];  for(int i=0;i<m;i++)Arrays.fill(memo[i], -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[] intArr(int n) throws IOException {   int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();   return in;  }  public long[] longArr(int n) throws IOException {   long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();   return in;  }  public int[] intSortedArr(int n) throws IOException {   int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();   shuffle(in);   Arrays.sort(in);   return in;  }  public long[] longSortedArr(int n) throws IOException {   long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();   shuffle(in);   Arrays.sort(in);   return in;  }  public Integer[] IntegerArr(int n) throws IOException {   Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();   return in;  }  public Long[] LongArr(int n) throws IOException {   Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();   return in;  }  public String nextLine() throws IOException {  return br.readLine();  }   public int nextInt() throws IOException {  return Integer.parseInt(next());  }   public double nextDouble() throws IOException {  return Double.parseDouble(next());  }   public char nextChar() throws IOException {  return next().charAt(0);  }   public long nextLong() throws IOException {  return Long.parseLong(next());  }   public boolean ready() throws IOException {  return br.ready();  }   public void waitForInput() throws InterruptedException {  Thread.sleep(3000);  } } 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;  } } }
6	public class Main {  private FastScanner in; private PrintWriter out;  public void solve() throws IOException {  int N = in.nextInt();  int M = in.nextInt();  int[][] edges = new int[N][N];  for (int i = 0; i < M; i++) {  int a = in.nextInt() - 1;  int b = in.nextInt() - 1;  edges[a][b] = 1;  edges[b][a] = 1;  }  int globalCountMasks = 1 << N;  int[][] masks = new int[N + 1][];  int[] countMasks = new int[N + 1];  for (int i = 0; i <= N; i++) {  masks[i] = new int[combinations(N, i)];  }  for (int i = 0; i < globalCountMasks; i++) {  int c = countBit1(i);  masks[c][countMasks[c]] = i;  countMasks[c]++;  }  long globalCountCycles = 0;  long[][] count = new long[globalCountMasks][N];  for (int a = 0; a < N - 2; a++) {  int aBit = 1 << a;  count[aBit][a] = 1;  long countCycles = 0;  for (int i = 2; i <= N; i++) {   for (int m = 0; m < countMasks[i]; m++) {   int mask = masks[i][m];   if ((mask & aBit) == 0)    continue;   if ((mask & (aBit - 1)) > 0)    continue;   count[mask][a] = 0;   for (int v = a + 1; v < N; v++) {    int vBit = 1 << v;    if ((mask & vBit) == 0)    continue;    count[mask][v] = 0;    for (int t = a; t < N; t++) {    if ((mask & (1 << t)) == 0 || t == v     || edges[v][t] == 0)     continue;    count[mask][v] += count[mask ^ vBit][t];    }    if (edges[a][v] == 1 && mask != (aBit | vBit)) {    countCycles += count[mask][v];    }   }   }  }  globalCountCycles += countCycles / 2;  }  out.println(globalCountCycles); }  private int countBit1(int k) {  int c = 0;  while (k > 0) {  c += k & 1;  k >>= 1;  }  return c; }  private int combinations(int n, int k) {  if (k > n || k < 0) {  throw new IllegalArgumentException();  }  int r = 1;  for (int i = 1; i <= k; i++) {  r = r * (n + 1 - i) / i;  }  return r; }  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());  } }  public static void main(String[] arg) {  new Main().run(); } }
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 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 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 BigInteger readBigInteger() {     try {       return new BigInteger(ns());     } catch (NumberFormatException e) {       throw new InputMismatchException();     }   }   public char readCharacter() {     int c = read();     while (isSpaceChar(c))       c = read();     return (char) c;   }   public double readDouble() {     int c = read();     while (isSpaceChar(c))       c = read();     int sgn = 1;     if (c == '-') {       sgn = -1;       c = read();     }     double res = 0;     while (!isSpaceChar(c) && c != '.') {       if (c == 'e' || c == 'E')         return res * Math.pow(10, 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 boolean eof() {     int value;     while (isSpaceChar(value = peek()) && value != -1)       read();     return value == -1;   }   public String next() {     return ns();   }   public SpaceCharFilter getFilter() {     return filter;   }   public void setFilter(SpaceCharFilter filter) {     this.filter = filter;   }    }  public interface SpaceCharFilter {   public boolean isSpaceChar(int ch);  } }
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);   }  } }
5	public class D {  public static class BIT {  long[] dat;   public BIT(int n){  dat = new long[n + 1];  }   public void add(int k, long a){   for(int i = k + 1; i < dat.length; i += i & -i){   dat[i] += a;   }  }   public long sum(int s, int t){   if(s > 0) return sum(0, t) - sum(0, s);    long ret = 0;  for(int i = t; i > 0; i -= i & -i) {   ret += dat[i];  }  return ret;  } }  public static void main(String[] args) {  try (final Scanner sc = new Scanner(System.in)) {  final int n = sc.nextInt();    long[] array = new long[n];  for(int i = 0; i < n; i++){ array[i] = sc.nextLong(); }    TreeSet<Long> value_set = new TreeSet<Long>();  for(int i = 0; i < n; i++){ value_set.add(array[i]); }  ArrayList<Long> value_list = new ArrayList<Long>(value_set);    BigInteger answer = BigInteger.ZERO;  final int bit_n = value_list.size();  BIT cnt_bit = new BIT(bit_n);  BIT val_bit = new BIT(bit_n);    for(int i = n - 1; i >= 0; i--){   final long value = array[i];   final int value_index = Collections.binarySearch(value_list, value);     int upper_pos = Collections.binarySearch(value_list, value + 2);   if(upper_pos < 0){ upper_pos = (-upper_pos) - 1; }   if(0 <= upper_pos && upper_pos < bit_n){   final long upper_sum = val_bit.sum(upper_pos, bit_n) - cnt_bit.sum(upper_pos, bit_n) * value;   answer = answer.add(BigInteger.valueOf(upper_sum));   }     int lower_pos = Collections.binarySearch(value_list, value - 2);   if(lower_pos < 0){ lower_pos = (-lower_pos) - 2; }   if(0 <= lower_pos && lower_pos < bit_n){   final long lower_sum = val_bit.sum(0, lower_pos + 1) - cnt_bit.sum(0, lower_pos + 1) * value;   answer = answer.add(BigInteger.valueOf(lower_sum));   }     cnt_bit.add(value_index, 1);   val_bit.add(value_index, value);     }    System.out.println(answer);  } }  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 int nextInt() {  return Integer.parseInt(next());  }   public long nextLong() {  return Long.parseLong(next());  }  public void close() {  try {   br.close();  } catch (IOException e) {   }  } } }
1	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);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, FastScanner in, FastPrinter out) {    int n = in.nextInt();    int k = in.nextInt();    char[] c = in.next().toCharArray();    NavigableSet<Integer> ones = new TreeSet<>();    NavigableSet<Integer> zeros = new TreeSet<>();    for (int i = 0; i < n; i++) {     if (c[i] == '0') zeros.add(i);     else ones.add(i);    }    if (ones.isEmpty() || zeros.isEmpty() || ones.last() - ones.first() + 1 <= k || zeros.last() - zeros.first() + 1 <= k) {     out.println("tokitsukaze");     return;    }    if (check(ones, n, k) && check(zeros, n, k)) {     out.println("quailty");     return;    }    out.println("once again");   }   private boolean check(NavigableSet<Integer> ones, int n, int k) {    for (int i = 0; i + k <= n; i++) {     int left = ones.first();     int right = ones.last();     if (left >= i) {      left = ones.higher(i + k - 1);     }     if (right < i + k) {      right = ones.lower(i);     }     if (right - left + 1 > k) {      return false;     }    }    return true;   }  }  static class FastPrinter extends PrintWriter {   public FastPrinter(OutputStream out) {    super(out);   }   public FastPrinter(Writer out) {    super(out);   }  }  static 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();    }   }   public String next() {    StringBuilder sb = new StringBuilder();    int c = read();    while (isWhiteSpace(c)) {     c = read();    }    if (c < 0) {     return null;    }    while (c >= 0 && !isWhiteSpace(c)) {     sb.appendCodePoint(c);     c = read();    }    return sb.toString();   }   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;   }   public String readLine() {    try {     return super.readLine();    } catch (IOException e) {     return null;    }   }  } }
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(); } }
0	public class Question267A {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);   int t=sc.nextInt();   while (t--!=0){    int x=sc.nextInt();    int y=sc.nextInt();    int max=Math.max(x,y);    int min=Math.min(x,y);    int ans=0;    while (min>0 && max>0){     int temp=max;     ans+=temp/min;     max=min;     min=temp%min;    }    System.out.println(ans);   }  } }
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;   }  } }
5	public class A22 {  static StreamTokenizer in; static PrintWriter out;  static int nextInt() throws IOException {  in.nextToken();  return (int)in.nval; }  static String nextString() throws IOException {  in.nextToken();  return in.sval; }  public static void main(String[] args) throws IOException {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(System.out);  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = nextInt();   Arrays.sort(a);  int f = a[0], q = 1;  while (q < n && a[q] == f) q++;   out.println(q < n ? a[q] : "NO");   out.flush(); } }
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());  }  long nextLong() throws IOException {   return Long.valueOf(nextToken());  }  double nextDouble() throws IOException {   return Double.valueOf(nextToken());  }  public static void main(String[] args) throws IOException {   new Main().run();  } }
0	public class JavaApplication2 {    public static void main(String[] args) {   Scanner s=new Scanner(System.in);       int n;      n=s.nextInt();      System.out.print(n+" "+"0 0");    } }
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();   }  } }
3	public class A { FastScanner in; PrintWriter out; boolean systemIO = true;  public class Fenvik {  int[] sum;  public Fenvik(int n) {  sum = new int[n];  }  public void add(int x) {  for (; x < sum.length; x = (x | (x + 1))) {   sum[x]++;  }  }  public int sum(int r) {  int ans = 0;  for (; r >= 0; r = (r & (r + 1)) - 1) {   ans += sum[r];  }  return ans;  } }  public int gcd(int x, int y) {  if (y == 0) {  return x;  }  if (x == 0) {  return y;  }  return gcd(y, x % y); }   public class Edge {  int to;  long s;  public Edge(int to, long s) {  this.to = to;  this.s = s;  } }  public long dfs(int v, int prev, long sumth, long minsum, long s) {  tin[v] = timer;  timer++;  up[v][0] = new Edge(prev, s);  for (int i = 1; i <= l; i++) {  Edge e = up[v][i - 1];  up[v][i] = new Edge(up[e.to][i - 1].to, up[e.to][i - 1].s + e.s);  }  minsum = Math.min(minsum, sumth);  maxup[v] = sumth - minsum;  long mxdown = sumth;  for (Edge e : list[v]) {  if (e.to != prev) {   mxdown = Math.max(mxdown, dfs(e.to, v, sumth + e.s, minsum, e.s));  }  }  tout[v] = timer;  timer++;  maxdown[v] = mxdown - sumth;  return mxdown; }  public boolean upper(int a1, int b1) {  return tin[a1] <= tin[b1] && tout[a1] >= tout[b1]; }  public Edge lca(int a, int b) {  if (a == b) {  return new Edge(a, 0);  }  int v = -1;  int a1 = a;  int b1 = b;  if (tin[a] <= tin[b] && tout[a] >= tout[b]) {  v = b;  long lenb = 0;  for (int i = l; i >= 0; i--) {   a1 = up[v][i].to;   b1 = a;   if (!(tin[a1] <= tin[b1] && tout[a1] >= tout[b1])) {   lenb += up[v][i].s;   v = up[v][i].to;   }  }  lenb += up[v][0].s;  v = up[v][0].to;  return new Edge(v, lenb);  }  if (upper(b, a)) {  v = a;  long lena = 0;  for (int i = l; i >= 0; i--) {   a1 = up[v][i].to;   b1 = b;   if (!(tin[a1] <= tin[b1] && tout[a1] >= tout[b1])) {   lena += up[v][i].s;   v = up[v][i].to;   }  }  lena += up[v][0].s;  v = up[v][0].to;  return new Edge(v, lena);  }  v = a;  long lena = 0;  for (int i = l; i >= 0; i--) {  a1 = up[v][i].to;  b1 = b;  if (!(tin[a1] <= tin[b1] && tout[a1] >= tout[b1])) {   lena += up[v][i].s;   v = up[v][i].to;  }  }  lena += up[v][0].s;  v = up[v][0].to;  v = b;  long lenb = 0;  for (int i = l; i >= 0; i--) {  a1 = up[v][i].to;  b1 = a;  if (!(tin[a1] <= tin[b1] && tout[a1] >= tout[b1])) {   lenb += up[v][i].s;   v = up[v][i].to;  }  }  lenb += up[v][0].s;  v = up[v][0].to;  return new Edge(v, lena + lenb); }  int n; int l; int[] tin; int[] tout; int timer = 0; long[] maxup; long[] maxdown; Edge[][] up; ArrayList<Edge>[] list;  public void solve() {  int n = in.nextInt();  int[] a = new int[n];  for (int i = 0; i < a.length; i++) {  a[i] = in.nextInt();  }  Arrays.sort(a);  int ans = 0;  boolean[] used = new boolean[n];  for (int i = 0; i < used.length; i++) {  if (!used[i]) {   ans++;   for (int j = i; j < used.length; j++) {   if (a[j] % a[i] == 0) {    used[j] = true;   }   }  }  }  out.print(ans); }  public void run() {  try {  if (systemIO) {   in = new FastScanner(System.in);   out = new PrintWriter(System.out);  } else {   in = new FastScanner(new File("input.txt"));   out = new PrintWriter(new File("output.txt"));  }  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 nextLine() {  try {   return br.readLine();  } catch (IOException e) {   return null;  }  }  String next() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  }   public static void main(String[] arg) {  new A().run(); } }
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 {   static final int modular = (int) (1e9 + 7);   public void solve(int testNum, InputReader in, PrintWriter out) {    int n = in.nextInt();    int ans = 0;    String[] g = new String[n];    int[][] dp = new int[2][n];    for(int i = 0; i < n; i++) {     g[i] = in.next();    }    if(n == 1) {     out.println(1);     return;    }    dp[0][0] = 1;    for(int i = 1; i < n; i++) {     if(g[i - 1].equals("f")) {      dp[1][0] = 0;      for(int j = 1; j < n; j++) {       dp[1][j] = dp[0][j - 1];      }     }     else {      dp[1][n - 1] = dp[0][n - 1];      for(int j = n - 2; j >= 0; j--) {       dp[1][j] = dp[1][j + 1] + dp[0][j];       dp[1][j] = dp[1][j] % modular;      }     }     for(int j = 0; j < n; j++) {      dp[0][j] = dp[1][j];     }     if(i == n - 1) {      for(int j = 0; j < n; j++) {       ans = ans + dp[1][j];       ans = ans % modular;      }     }    }    out.println(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 Main {    public static void main(String[] args)throws java.lang.Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String s = br.readLine();  int max = 0;   for (int i = 0; i < s.length(); i++) {    for (int j = i+1; j < s.length(); j++) {     if(s.substring(i+1).contains(s.substring(i,j)))      max = Math.max(max, j-i);    }}    System.out.println(max);     } }
2	public class Main {  private static void solve() {  long x = nl();  long k = nl();  long mod = 1000000000 + 7;   if (x == 0) {  System.out.println(0);  } else if (k == 0) {  System.out.println(x * 2 % mod);    } else {    x %= mod;   long a;  a = (x - 1 + mod) * pow(2, k, mod) + 1;  a %= mod;   long b = x * pow(2, k, mod);  b %= mod;    System.out.println((a + b) % mod);  } }  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<<~x<0)ret = ret * a % mod;  }  return ret; }  public static void main(String[] args) {  new Thread(null, new Runnable() {  @Override  public void run() {   long start = System.currentTimeMillis();   String debug = args.length > 0 ? args[0] : null;   if (debug != null) {   try {    is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));   } catch (Exception e) {    throw new RuntimeException(e);   }   }   reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);   solve();   out.flush();   tr((System.currentTimeMillis() - start) + "ms");  }  }, "", 64000000).start(); }  private static java.io.InputStream is = System.in; private static java.io.PrintWriter out = new java.io.PrintWriter(System.out); private static java.util.StringTokenizer tokenizer = null; private static 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(); }  private static double nd() {  return Double.parseDouble(next()); }  private static long nl() {  return Long.parseLong(next()); }  private static int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = ni();  return a; }  private static char[] ns() {  return next().toCharArray(); }  private static long[] nal(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)  a[i] = nl();  return a; }  private static int[][] ntable(int n, int m) {  int[][] table = new int[n][m];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   table[i][j] = ni();  }  }  return table; }  private static int[][] nlist(int n, int m) {  int[][] table = new int[m][n];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++) {   table[j][i] = ni();  }  }  return table; }  private static int ni() {  return Integer.parseInt(next()); }  private static void tr(Object... o) {  if (is != System.in)  System.out.println(java.util.Arrays.deepToString(o)); } }
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<>();  public void run() {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  System.err.println("");  valToNode = new HashMap<>();  nodeToVal = new HashMap<>();  whichBox = new HashMap<>();   int K = fs.nextInt();  int[][] vals = new int[K][], valToNode2 = new int[K][];  long[] sums = new long[K];  long total = 0;   for(int i = 0; i < K; i++) {  int size = fs.nextInt();  vals[i] = new int[size];  valToNode2[i] = new int[size];  for(int j = 0; j < size; j++) {   vals[i][j] = fs.nextInt();   sums[i] += vals[i][j];   valToNode2[i][j] = valToNode.size();   valToNode.put(vals[i][j], valToNode.size());   nodeToVal.put(valToNode.size()-1, vals[i][j]);   whichBox.put(vals[i][j], i);  }  total += sums[i];  }  if(total % K != 0) {  System.out.println("No");  return;  }  long perGroup = total/K;   N = valToNode.size();  ptsTo = new int[N];  for(int i = 0; i < K; i++) {  for(int j = 0; j < vals[i].length; j++) {   long newSum = perGroup - (sums[i]-vals[i][j]);   if(newSum > (int)1e9 || newSum < (int)-1e9) continue;   if(valToNode.containsKey((int)newSum)) {   ptsTo[valToNode.get(vals[i][j])] = valToNode.get((int)newSum);   }   else ptsTo[valToNode.get(vals[i][j])] = -1;  }  }   tempList = new int[N];  dfsStack = new int[N];  cycleMask = new int[N];   for(int i = 0; i < K; i++) {  for(int j = 0; j < vals[i].length; j++) {   int node = valToNode.get(vals[i][j]);   if(dfsStack[node] == 0) dfs(node);  }  }   int[] goodMask = new int[1<<K];  Arrays.fill(goodMask, -1); goodMask[0] = 0;  for(int mask = 1; mask < goodMask.length; mask++) {  int idx = Integer.numberOfTrailingZeros(Integer.lowestOneBit(mask));  for(int i = 0; i < vals[idx].length; i++) {   int node = valToNode2[idx][i];   if(cycleMask[node] == mask) {   goodMask[mask] = node;   break;   }  }  }   int[] dp = new int[1<<K];  Arrays.fill(dp, -1); dp[0] = 0;  for(int mask = 1; mask < dp.length; mask++) {  if(goodMask[mask] != -1) {   dp[mask] = mask;   continue;  }  for(int sub = mask; sub != 0; sub = (sub-1)&mask) {   if(goodMask[sub] == -1) continue;   int newMask = mask-sub;   if(dp[newMask] == -1) continue;     dp[mask] = sub;   break;  }  }   if(dp[dp.length-1] == -1) out.println("No");  else {  int[][] res = new int[K][2];  for(int[] x : res) Arrays.fill(x, -1);  int curMask = dp.length-1;  while(curMask > 0) {   int temp = dp[curMask];   int curNode = goodMask[temp];     while(temp > 0) {   int curVal = nodeToVal.get(curNode), curBox = whichBox.get(curVal);   res[curBox][0] = curVal;   int goingTo = ptsTo[curNode], goingVal = nodeToVal.get(goingTo), goingBox = whichBox.get(goingVal);   res[goingBox][1] = curBox;   curNode = ptsTo[curNode];   temp -= 1<<curBox;   }     curMask -= dp[curMask];  }    out.println("Yes");  for(int i = 0; i < K; i++) {   if(res[i][1] == -1) throw null;   out.printf("%d %d\n", res[i][0], res[i][1]+1);  }  }   out.close(); }  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;  }  public double nextDouble() {  double cur = nextLong();  return c!='.' ? cur:cur+nextLong()/num;  }  public String next() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c>32) {   res.append(c);   c=nextChar();  }  return res.toString();  }  public String nextLine() {  StringBuilder res = new StringBuilder();  while(c<=32)c=nextChar();  while(c!='\n') {   res.append(c);   c=nextChar();  }  return res.toString();  }  public boolean hasNext() {  if(c>32)return true;  while(true) {   c=nextChar();   if(c==NC)return false;   else if(c>32)return true;  }  }   public int[] nextIntArray(int n) {  int[] res = new int[n];  for(int i = 0; i < n; i++) res[i] = nextInt();  return res;  }   } }
6	public class Main {  static class Task {   int NN = 1000006;  int MOD = 998244353;  int INF = 2000000000;  long INFINITY = 1000000000000000000L;   long [][] a;  long [][] w, w1;  long [][] dp;   int countBit(int num) {  int ret = 0;  while(num > 0) {   if((num&1)!=0)   ++ret;   num >>= 1;  }  return ret;  }   long rec(int at, int mask, int n, int start) {  long ans = -INFINITY;  if(dp[at][mask] != -1)   return dp[at][mask];  if(countBit(mask) == n) {   return dp[at][mask] = w1[start][at];  }  for(int i=0;i < n;++i) {   if(((mask>>i)&1)==0) {   ans = Math.max(ans,     Math.min(w[at][i], rec(i, mask | (1<<i), n, start)));   }  }  return dp[at][mask] = ans;  }   public void solve(InputReader in, PrintWriter out) {  int n = in.nextInt(), m = in.nextInt();  dp = new long[n][1<<n];  a = new long[n][m];  w = new long[n][n];  w1 = new long[n][n];  for(int i=0;i<n;++i) {   for(int j=0;j<m;++j) {   a[i][j] = in.nextLong();   }  }  for(int i=0;i<n;++i) {   for(int j=0;j<n;++j) {   w[i][j] = INFINITY;   if(i == j)    continue;   for(int k=0;k<m;++k) {    w[i][j] = Math.min(w[i][j], Math.abs(a[j][k] - a[i][k]));   }   }  }  for(int i=0;i<n;++i) {   for(int j=0;j<n;++j) {   w1[i][j] = INFINITY;   for(int k=1;k<m;++k) {    w1[i][j] = Math.min(w1[i][j], Math.abs(a[i][k] - a[j][k - 1]));   }   }  }  long ans = 0;  for(int start = 0;start < n;++start) {   for(int i=0;i<n;++i) {   for(int j=0;j<(1<<n);++j)    dp[i][j] = -1;   }   ans = Math.max(ans, rec(start, 1<<start, n, start));  }  out.println(ans);  }   class Pair {  Integer first, second;  public Pair() {  }  public Pair(int first, int second) {   this.first = first;   this.second = second;  }  @Override  public int hashCode() {   final int prime = 31;   int result = 1;   result = prime * result + getOuterType().hashCode();   result = prime * result + first;   result = prime * result + second;   return result;  }  @Override  public boolean equals(Object obj) {   if (this == obj)   return true;   if (obj == null)   return false;   if (getClass() != obj.getClass())   return false;   Pair other = (Pair) obj;   if (!getOuterType().equals(other.getOuterType()))   return false;   if (first != other.first)   return false;   if (second != other.second)   return false;   return true;  }  private Task getOuterType() {   return Task.this;  }    }   }  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 nextLine() {   String str = "";   try {   str = reader.readLine();  } catch (IOException e) {     e.printStackTrace();  }   return str;   }     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 double nextDouble() {   return Double.parseDouble(next());   }    } }
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));  }  } }
6	public class ProblemC { public static void main(String[] args) throws IOException {  BufferedReader s = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);     int[] pt = readPoint(s);  int n = Integer.valueOf(s.readLine());  int[][] xp = new int[n+1][];  for (int i = 1 ; i <= n ; i++) {  xp[i] = readPoint(s);  }  xp[0] = pt;   int[][] dist = new int[n+1][n+1];  for (int i = 0 ; i <= n ; i++) {  for (int j = 0 ; j <= n ; j++) {   int dx = Math.abs(xp[i][0] - xp[j][0]);   int dy = Math.abs(xp[i][1] - xp[j][1]);   dist[i][j] = dx*dx + dy*dy;  }  }   int[][] dist2 = new int[n+1][n+1];  for (int i = 0 ; i <= n ; i++) {  for (int j = 0 ; j <= n ; j++) {   dist2[i][j] = dist[0][i] + dist[i][j] + dist[j][0];  }  }   int[] dp = new int[1<<n];  int[][] dp_prev = new int[2][1<<n];  Arrays.fill(dp, Integer.MAX_VALUE);  dp[0] = 0;   for (int i = 0 ; i < (1<<n) ; i++) {  if (dp[i] == Integer.MAX_VALUE) {   continue;  }  int base = dp[i];    for (int y = 0 ; y < n ; y++) {   if ((i & (1<<y)) >= 1) {   break;   }   for (int z = y+1 ; z < n ; z++) {   if ((i & (1<<z)) >= 1) {    continue;   }   int ti = i | (1<<y) | (1<<z);   int d = dist2[y+1][z+1];   if (dp[ti] > base + d) {    dp[ti] = base + d;    dp_prev[0][ti] = z+1;    dp_prev[1][ti] = y+1;   }   }  }  }      int bestOnes = 0;  for (int i = 0 ; i < (1<<n) ; i++) {  if (dp[i] == Integer.MAX_VALUE) {   continue;  }  int sub = (1<<n) - 1 - i;  int add = 0;  for (int j = 0 ; j < n ; j++) {   if ((sub & (1<<j)) >= 1) {   add += dist[0][j+1] * 2;   }  }  if (dp[i] + add < dp[(1<<n)-1]) {   dp[(1<<n)-1] = dp[i] + add;   bestOnes = sub;  }  }   StringBuffer b = new StringBuffer();  b.append(" 0");  for (int i = 0 ; i < n ; i++) {  if ((bestOnes & (1<<i)) >= 1) {   b.append(" ").append(i+1).append(" ").append(0);  }  }   out.println(dp[(1<<n)-1]);  int nptn = (1<<n)-1-bestOnes;  while (nptn >= 1) {  int i1 = dp_prev[0][nptn];  int i2 = dp_prev[1][nptn];  if (i1 >= 1) {   nptn -= 1<<(i1-1);   b.append(" ").append(i1);  }  if (i2 >= 1) {   nptn -= 1<<(i2-1);   b.append(" ").append(i2);  }  b.append(" ").append(0);  }  out.println(b.substring(1));  out.flush(); }  private static void generateRandom() {  System.out.println("0 0");  System.out.println("24");  for (int i = 0 ; i < 24 ; i++) {  int a = (int)(Math.random() * 200 - 100);  int b = (int)(Math.random() * 200 - 100);  System.out.println(a + " " + b);  } }   private static int[] readPoint(BufferedReader s) throws IOException {  int[] ret = new int[2];  String[] data = s.readLine().split(" ");  ret[0] = Integer.valueOf(data[0]);  ret[1] = Integer.valueOf(data[1]);  return ret; }  public static void debug(Object... os){  System.err.println(Arrays.deepToString(os)); } }
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 {   final int P = (int) 1e9 + 7;   int n;   char[] commands;   int[][] memo;   public void solve(int testNumber, InputReader in, PrintWriter out) {    n = in.nextInt();    commands = new char[n];    memo = new int[n][12345];    for (int i = 0; i < n; i++) {     commands[i] = in.next().charAt(0);     for (int j = 0; j < 12345; j++) {      memo[i][j] = -1;     }    }    out.print(solve(1, 0));   }   int add(int a, int b) {    return ((a % P) + (b % P)) % P;   }   int solve(int i, int indents) {    if (i == n) return 1;    if (memo[i][indents] != -1) return memo[i][indents];    int answer;    if (commands[i - 1] == 'f') {     answer = solve(i + 1, indents + 1);    } else {     if (indents == 0) {      answer = solve(i + 1, indents);     } else {      answer = add(solve(i, indents - 1), solve(i + 1, indents));     }    }    return memo[i][indents] = answer;   }  }  static class InputReader {   private StringTokenizer tokenizer;   private BufferedReader reader;   public InputReader(InputStream inputStream) {    reader = new BufferedReader(new InputStreamReader(inputStream));   }   private void fillTokenizer() {    if (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (Exception e) {      throw new RuntimeException(e);     }    }   }   public String next() {    fillTokenizer();    return tokenizer.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }  } }
0	public class Test{  static int pos = 0 ;  static int arr[] ;  static LinkedList l1 = new LinkedList() ; static void find(int p ,char[]x,int put[],String s){  int c= 0 ;  for (int i = 0; i < s.length(); i++) {   if(x[p]==s.charAt(i)){   c++ ; }  }  put[p] = c ; } static int mode(int m ,int[]x ){  int temp = 0 ;  for (int i = x.length-1; i >=0; i--) {   if(x[i]<=m){    temp= x[i] ;        return m-temp ;       }  }  return m-temp ; } static int mode2(int m ,int[]x ){  int temp = 0 ;    for (int i = x.length-1; i >=0; i--) {   if(x[i]<=m){    temp= x[i] ;        return x[i] ;       }  }  return 0 ; } static int find(int x[],int temp){  int j = 0 ;  for (int i = x.length-1; i >=0; i--) {   if(x[i]==temp) return j+1 ;   j++ ;  }  return -1 ; } static String ch(long[]x,long b){  for (int i = 0; i < x.length; i++) {   if(x[i]==b)return "YES" ;  }  return "NO" ; }  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 );      }     }
0	public class A912 {  public static void main(String[] args) {    Scanner scan = new Scanner(System.in);   int A = scan.nextInt();  int B = scan.nextInt();  long x = scan.nextInt();  long y = scan.nextInt();  long z = scan.nextInt();   long requiredA = x * 2 + y;  long requiredB = y + z * 3;   long neededA = Math.max(0, requiredA - A);  long neededB = Math.max(0, requiredB - B);  System.out.print(neededA + neededB); } }
1	public class A implements Runnable { public static void main(String [] args) throws IOException {  new Thread(null, new A(), "", 1 << 20).start(); }  String file = "input"; BufferedReader input; PrintWriter out;  public void run()  {  try  {    input = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new BufferedOutputStream(System.out));  solve();  input.close();  out.close();  }  catch(Exception e)  {  e.printStackTrace();  System.exit(1);  } }  void solve() throws IOException {  ArrayList<Integer> p = new ArrayList<Integer>();  StringTokenizer st = tokens();  int n = nextInt(st), k = nextInt(st);  for(int i = 2; i <= n; i++)  if(prime(i)) p.add(i);   int count = 0;  for(int x = 2; x <= n; x++)  {  if(!prime(x)) continue;  for(int i = 0; i + 1 < p.size(); i++)  {   int p1 = p.get(i);   int p2 = p.get(i + 1);   int P = p1 + p2 + 1;   if(P == x)   {   count++;   break;   }   if(P > x) break;  }  }  System.out.println(count >= k ? "YES" : "NO");    }  boolean prime(int n) {  for(int i = 2; i * i <= n; i++)  if(n % i == 0) return false;  return true; }  StringTokenizer tokens() throws IOException {  return new StringTokenizer(input.readLine()); }  String next(StringTokenizer st) {  return st.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(input.readLine()); }  int nextInt(StringTokenizer st) {  return Integer.parseInt(st.nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(input.readLine()); }  double nextDouble(StringTokenizer st) {  return Double.parseDouble(st.nextToken()); }  void print(Object... o) {  out.println(deepToString(o)); } }
5	public class D {  public static void main(String[] args){  FastScanner scan = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int n = scan.nextInt();  long[] a = scan.nextLongArray(n);  BigInteger res = BigInteger.ZERO;  for (int i = n-1; i >= 0; i--) res = res.add(BigInteger.valueOf(i*a[i] - (n-1-i)*a[i]));  HashMap<Long, Long> map = new HashMap<>();  for(int i = 0; i < n; i++) {  res = res.subtract(BigInteger.valueOf(map.getOrDefault(a[i]-1, 0L)));  res = res.add(BigInteger.valueOf(map.getOrDefault(a[i]+1, 0L)));  map.put(a[i], map.getOrDefault(a[i], 0L)+1);  }  out.println(res);  out.close(); }  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 String nextLine() {  String line = "";  if(st.hasMoreTokens()) line = st.nextToken();  else try {return br.readLine();}catch(IOException e){e.printStackTrace();}  while(st.hasMoreTokens()) line += " "+st.nextToken();  return line;  }  public int[] nextIntArray(int n) {  int[] a = new int[n];  for(int i = 0; i < n; i++) a[i] = nextInt();  return a;  }  public long[] nextLongArray(int n){  long[] a = new long[n];  for(int i = 0; i < n; i++) a[i] = nextLong();  return a;  }  public double[] nextDoubleArray(int n){  double[] a = new double[n];  for(int i = 0; i < n; i++) a[i] = nextDouble();  return a;  }  public char[][] nextGrid(int n, int m){  char[][] grid = new char[n][m];  for(int i = 0; i < n; i++) grid[i] = next().toCharArray();  return grid;  } }  }
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); } }
2	public class q5 {         public static void main(String[] args) throws IOException {  Reader.init(System.in); PrintWriter out=new PrintWriter(System.out); long n=Reader.nextInt(); long k=Reader.nextLong(); long v=8*n+8*k+4; long v2=(long) Math.sqrt(v); long v3=2*n+2;  long v5=(v3-v2)/2; out.println(v5);      out.flush(); } }      class Reader {  static BufferedReader reader;  static StringTokenizer tokenizer;   static void init() throws IOException {   reader = new BufferedReader(     new FileReader("detect.in"));  tokenizer = new StringTokenizer("");  }  static void init(InputStream input) {   reader = new BufferedReader(      new InputStreamReader(input) );   tokenizer = new StringTokenizer("");  }   static String nextLine() throws IOException{  return reader.readLine();  }  static String next() throws IOException {   while ( ! tokenizer.hasMoreTokens() ) {       tokenizer = new StringTokenizer(      reader.readLine() );   }   return tokenizer.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt( next() );  }  static long nextLong() throws IOException {   return Long.parseLong( next() );  }  static double nextDouble() throws IOException {   return Double.parseDouble( next() );  } }
3	public class Main {  public static void main(String[] args) {   new Thread(null, new Runnable() {    public void run() {     new Main().solve();    }   }, "1", 1 << 26).start();  }  void solve() {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   ScanReader in = new ScanReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   APaintTheNumbers solver = new APaintTheNumbers();   solver.solve(1, in, out);   out.close();  }  static class APaintTheNumbers {   public void solve(int testNumber, ScanReader in, PrintWriter out) {    int n = in.scanInt();    int[] hash = new int[101];    boolean[] hash1 = new boolean[101];    for (int i = 0; i < n; i++) hash[in.scanInt()]++;    int ans = 0;    for (int i = 1; i <= 100; i++) {     if (hash1[i]) continue;     if (hash[i] == 0) continue;     for (int j = i; j <= 100; j += i) hash1[j] = true;     ans++;    }    out.println(ans);   }  }  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;   }  } }
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 double nextDouble() throws Exception {   return Double.parseDouble(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);   }  } }
4	public class C23A {  public static void main(String args[]){   Scanner sc=new Scanner(System.in);   String str=sc.next();   for(int k=str.length()-1;k>=1;k--){    for(int i=0;i<=str.length()-k;i++){     for(int j=i+1;j<=str.length()-k;j++){      if(str.substring(i,i+k).equals(str.substring(j,j+k))){        System.out.println(k);        return;      }     }    }   }   System.out.println(0);  } }
0	public class Main { public static void main(String[] args) {  Scanner in=new Scanner(new BufferedInputStream(System.in));  PrintStream out=System.out;  int n=in.nextInt();  if (n>=0) out.println(n);  else out.println(Math.max(-((-n)/10), -((-n)/100*10+(-n)%10)));  out.close();  in.close(); } }
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 int mod = (int) Math.pow(10, 9) + 7;   public void solve(int testNumber, InputReader in, PrintWriter out) {       int n = in.readInt();    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = in.readString().charAt(0) == 'f' ? 1 : 0;    }    long[][] ans = new long[n][n + 2];    ans[0][0] = 1;    int indent = 0;    if (a[0] == 1) indent++;    for (int i = 1; i < n; i++) {     if (a[i - 1] == 1) {      for (int j = indent - 1; j >= 1; j--) {       ans[i][j] = ans[i - 1][j - 1];      }      ans[i][indent] = 1;     } else {      for (int j = indent; j >= 0; j--) {       ans[i][j] = (ans[i][j + 1] + ans[i - 1][j]) % mod;      }     }     indent += a[i];    }    long aa = 0;    for (int i = 0; i < n + 2; i++) {     aa = (aa + ans[n - 1][i]) % mod;    }    out.println(aa);   }  }  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 String readString() {    int c = read();    while (isSpaceChar(c)) c = read();    StringBuilder res = new StringBuilder();    do {     res.append((char) c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
4	public class C {  static class Node{   StringBuilder sb = new StringBuilder();   Stack<Integer> stk = new Stack<>();  }  public static void main(String[] args) throws IOException {   Soumit sc = new Soumit();   int t = sc.nextInt();   StringBuilder sb = new StringBuilder();   while (t-->0){    int n = sc.nextInt();    int[] arr = sc.nextIntArray(n);    Stack<Node> mainstk = new Stack<>();    Node pnode = new Node();    pnode.stk.push(1);    pnode.sb.append("1");    mainstk.push(pnode);    sb.append(pnode.sb).append("\n");    for(int i=1;i<n;i++){     int val = arr[i];     if(val==1){      Node node = new Node();      node.stk.push(1);      node.sb.append(mainstk.peek().sb).append(".1");      mainstk.push(node);      sb.append(node.sb).append("\n");     }     else {      while (true) {       Node node = mainstk.pop();       if (node.stk.peek()==val-1) {        node.stk.push(val);        if(mainstk.isEmpty()){         node.sb = new StringBuilder();         node.sb.append(val);         sb.append(val).append("\n");        }        else{         Node peeknode = mainstk.peek();         node.sb = new StringBuilder();         node.sb.append(peeknode.sb).append(".").append(val);         sb.append(peeknode.sb).append(".").append(val).append("\n");        }        mainstk.push(node);        break;       }      }     }    }   }   System.out.println(sb);   sc.close();  }  static class Soumit {   final private int BUFFER_SIZE = 1 << 18;   final private DataInputStream din;   final private byte[] buffer;   private PrintWriter pw;   private int bufferPointer, bytesRead;   StringTokenizer st;   public Soumit() {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public Soumit(String file_name) throws IOException {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public void streamOutput(String file) throws IOException {    FileWriter fw = new FileWriter(file);    BufferedWriter bw = new BufferedWriter(fw);    pw = new PrintWriter(bw);   }   public void println(String a) {    pw.println(a);   }   public void print(String a) {    pw.print(a);   }   public String readLine() throws IOException {    byte[] buf = new byte[3000064];    int cnt = 0, c;    while ((c = read()) != -1) {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }   String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   public void sort(int[] arr) {    ArrayList<Integer> arlist = new ArrayList<>();    for (int i : arr)     arlist.add(i);    Collections.sort(arlist);    for (int i = 0; i < arr.length; i++)     arr[i] = arlist.get(i);   }   public void sort(long[] arr) {    ArrayList<Long> arlist = new ArrayList<>();    for (long i : arr)     arlist.add(i);    Collections.sort(arlist);    for (int i = 0; i < arr.length; i++)     arr[i] = arlist.get(i);   }   public int[] nextIntArray(int n) throws IOException {    int[] arr = new int[n];    for (int i = 0; i < n; i++) {     arr[i] = nextInt();    }    return arr;   }   public long[] nextLongArray(int n) throws IOException {    long[] arr = new long[n];    for (int i = 0; i < n; i++) {     arr[i] = nextLong();    }    return arr;   }   public double[] nextDoubleArray(int n) throws IOException {    double[] arr = new double[n];    for (int i = 0; i < n; i++) {     arr[i] = nextDouble();    }    return arr;   }   public int nextInt() throws IOException {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public long nextLong() throws IOException {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public double nextDouble() throws IOException {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (c == '.') {     while ((c = read()) >= '0' && c <= '9') {      ret += (c - '0') / (div *= 10);     }    }    if (neg)     return -ret;    return ret;   }   private void fillBuffer() throws IOException {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }   private byte read() throws IOException {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }   public void close() throws IOException {       if (din != null) din.close();    if (pw != null) pw.close();   }  } }
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();  }  public static class Util {    public static <T extends Comparable<T> > void merge_sort(T[] a) {   Object[] aux = new Object[a.length];   merge_sort0(a, aux, 0, a.length);  }    public static <T extends Comparable<T> > void merge_sort(T[] a, int l, int r) {   Object[] aux = new Object[a.length];   merge_sort0(a, aux, l, r);  }    @SuppressWarnings("unchecked")  private static <T extends Comparable<T> > void merge_sort0(T[] a, Object[] temp, int l, int r) {   if (l + 1 == r) return;   int mid = (l + r) >> 1;   merge_sort0(a, temp, l, mid);   merge_sort0(a, temp, mid, r);   int x = l, y = mid, c = l;   while (x < mid || y < r) {   if (y == r || (x < mid && a[x].compareTo(a[y]) <= 0)) temp[c++] = a[x++];   else temp[c++] = a[y++];   }   for (int i = l; i < r; i++) a[i] = (T)temp[i];  }    static final Random RAN = new Random();    public static <T extends Comparable<T> > void quick_sort(T[] a) {   quick_sort0(a, 0, a.length);  }    public static <T extends Comparable<T> > void quick_sort(T[] a, int l, int r) {   quick_sort0(a, l, r);  }    private static <T extends Comparable<T> > void quick_sort0(T[] a, int l, int r) {   if (l + 1 >= r) return;   int p = l + RAN.nextInt(r - l);   T t = a[p]; a[p] = a[l]; a[l] = t;   int x = l, y = r - 1;   while (x < y) {   while (x < y && a[y].compareTo(t) > 0) --y;   while (x < y && a[x].compareTo(t) < 0) ++x;   if (x < y) {    T b = a[x]; a[x] = a[y]; a[y] = b;    ++x; --y;   }   }   quick_sort0(a, l, y + 1);   quick_sort0(a, x, r);  }    static final int BOUND = 8;    public static void bucket_sort(int[] a) {   bucket_sort(a, 0, a.length);  }    public static void bucket_sort(int[] a, int l, int r) {   int[] cnt = new int[1 << BOUND], b = new int[r - l + 1];   int y = 0;   for (int i = l; i < r; i++) ++cnt[a[i] & (1 << BOUND) - 1];   while (y < Integer.SIZE) {   for (int i = 1; i < 1 << BOUND; i++) cnt[i] += cnt[i - 1];   for (int i = r - 1; i >= l; i--) b[--cnt[a[i] >> y & (1 << BOUND) - 1]] = a[i];   y += BOUND;   Arrays.fill(cnt, 0);   for (int i = l; i < r; i++) {    a[i] = b[i - l];    ++cnt[a[i] >> y & (1 << BOUND) - 1];   }   }  }    public static void bucket_sort(long[] a) {   bucket_sort(a, 0, a.length);  }    public static void bucket_sort(long[] a, int l, int r) {   int[] cnt = new int[1 << BOUND];   long[] b = new long[r - l + 1];   int y = 0;   while (y < Long.SIZE) {   Arrays.fill(cnt, 0);   for (int i = l; i < r; i++) ++cnt[(int) (a[i] >> y & (1 << BOUND) - 1)];   for (int i = 1; i < 1 << BOUND; i++) cnt[i] += cnt[i - 1];   for (int i = r - 1; i >= l; i--) b[--cnt[(int) (a[i] >> y & (1 << BOUND) - 1)]] = a[i];   for (int i = l; i < r; i++) a[i] = b[i - l];   y += BOUND;   }  }    public static void sort(int[] a) {   if (a.length <= 1 << BOUND) {   Integer[] b = new Integer[a.length];   for (int i = 0; i < a.length; i++) b[i] = a[i];   quick_sort(b);   for (int i = 0; i < a.length; i++) a[i] = b[i];   } else bucket_sort(a);  }   public static void sort(long[] a) {   if (a.length <= 1 << BOUND) {   Long[] b = new Long[a.length];   for (int i = 0; i < a.length; i++) b[i] = a[i];   quick_sort(b);   for (int i = 0; i < a.length; i++) a[i] = b[i];   } else bucket_sort(a);  }    public static <T extends Comparable<T> > void sort(T[] a) {   quick_sort(a);  }    public static void shuffle(int[] a) {   Random ran = new Random();   for (int i = 0; i < a.length; i++) {   int p = ran.nextInt(i + 1);   int q = a[p]; a[p] = a[i]; a[i] = q;   }  }    public static void shuffle(long[] a) {   Random ran = new Random();   for (int i = 0; i < a.length; i++) {   int p = ran.nextInt(i + 1);   long q = a[p]; a[p] = a[i]; a[i] = q;   }  }    public static <T> void shuffle(T[] a) {   Random ran = new Random();   for (int i = 0; i < a.length; i++) {   int p = ran.nextInt(i + 1);   T q = a[p]; a[p] = a[i]; a[i] = q;   }  }    } }
0	public class first { int max(int a1,int a2,int a3) {  int max=a1;  if(a2>=max)  max=a2;  if(a3>=max)  max = a3;  return max;  }  public static void main(String[] args) {  int num=0;   Scanner sc = new Scanner(System.in);  num = sc.nextInt();  int num2 = num/10;  int num3 = num%10;  int num4 = (num2/10)*10+num3;  first fs = new first();  int result = fs.max(num,num2,num4);  System.out.println(result); } }
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);   }  } }
4	public class x35C  {  public static void main(String hi[]) throws Exception  {   BufferedReader infile = new BufferedReader(new FileReader("input.txt"));   StringTokenizer st = new StringTokenizer(infile.readLine());   int N = Integer.parseInt(st.nextToken());   int M = Integer.parseInt(st.nextToken());   int K = Integer.parseInt(infile.readLine());   int[][] grid = new int[N][M];   for(int i=0; i < N; i++)    Arrays.fill(grid[i], -1);   ArrayDeque<Integer> q = new ArrayDeque<Integer>();   st = new StringTokenizer(infile.readLine());   while(K-->0)   {    int a = Integer.parseInt(st.nextToken())-1;    int b = Integer.parseInt(st.nextToken())-1;    grid[a][b] = 0;    q.add(a); q.add(b);   }   while(q.size() > 0)   {    int x = q.poll();    int y = q.poll();    if(x > 0 && grid[x-1][y] == -1)    {     grid[x-1][y] = grid[x][y]+1;     q.add(x-1); q.add(y);    }    if(y > 0 && grid[x][y-1] == -1)    {     grid[x][y-1] = grid[x][y]+1;     q.add(x); q.add(y-1);    }    if(x+1 < N && grid[x+1][y] == -1)    {     grid[x+1][y] = grid[x][y]+1;     q.add(x+1); q.add(y);    }    if(y+1 < M && grid[x][y+1] == -1)    {     grid[x][y+1] = grid[x][y]+1;     q.add(x); q.add(y+1);    }   }   int r = 0;   int c = 0;   for(int i=0; i < N; i++)    for(int j=0; j < M; j++)     if(grid[r][c] < grid[i][j])     {     r = i;     c = j;     }   r++; c++;   System.setOut(new PrintStream(new File("output.txt")));   System.out.println(r+" "+c);  }  }
5	public class A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int N = sc.nextInt();   TreeSet<Integer> set = new TreeSet<Integer>();   for(int i=0;i<N;i++){    int a = sc.nextInt();    set.add(a);   }   if(set.size()==1)System.out.println("NO");   else{    set.remove(set.first());    System.out.println(set.first());   }  } }
6	public class Main { 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 void debug(Object... os) {  out.println(Arrays.deepToString(os)); }  private static void solve() throws IOException {  String[] line = nss();  int n = Integer.parseInt(line[0]);  int m = Integer.parseInt(line[1]);  boolean[][] matrix = new boolean[n][n];  for (int i = 0; i < m; i++) {  line = nss();  int u = Integer.parseInt(line[0]) - 1;  int v = Integer.parseInt(line[1]) - 1;  matrix[u][v] = matrix[v][u] = true;  }  long[][] dp = new long[1<<n][n];  for(int i=0;i<n;i++)  dp[1<<i][i]=1;  long ret=0;  for(int mask =0;mask< 1<<n;mask++){  for(int last =0;last<n;last++)   if((mask & (1<<last))!=0){   int first=-1;   for(first=0;first<n;first++)    if((mask & (1<<first))!=0)    break;   for(int add =first;add<n;add++)    if((mask & (1<<add))==0 && matrix[last][add])    dp[mask+ (1<<add)][add]+=dp[mask][last];       if(Long.bitCount(mask)>2 && matrix[first][last])    ret+=dp[mask][last];   }  }  out.println(ret/2L);  }  private static String[] nss() throws IOException {  return in.readLine().split(" "); }  private static int ni() throws NumberFormatException, IOException {  return Integer.parseInt(in.readLine()); } }
6	public class Main {  public static void main(String[] args) {   new Thread(null, new Runnable() {    public void run() {     new Main().solve();    }   }, "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[(k + l) % n][max[i][1]]);        }       }       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 CodeHash {   public static void shuffle(int[][] ar) {    Random rd = new Random(new Random().nextInt());    for (int i = 0; i < ar.length; i++) {     int index = rd.nextInt(ar.length);     int[] temp = ar[i];     ar[i] = ar[index];     ar[index] = temp;    }   }  }  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;   }  } }
1	public class Main {    public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[] nums = new int[n];   int kisu = 0;   int gusu = 0;   for(int i = 0 ; i < n ; i++){    nums[i] = sc.nextInt();    if(nums[i] % 2 == 0)gusu++;    if(nums[i] % 2 == 1)kisu++;   }   int ans = -1;   if(gusu == 1){    for(int i = 0 ; i < n ; i++){     if(nums[i]%2 == 0){      ans = i+1;      break;     }    }   }   else{    for(int i = 0 ; i < n ; i++){     if(nums[i]%2 == 1){      ans = i+1;      break;     }    }      }   System.out.println(ans);  } }
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();  } }
6	public class LookingForOrder {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   String[] parsedString = parsedString = in.readLine().split(" ");   int xStart = parseInt(parsedString[0]);   int yStart = parseInt(parsedString[1]);   int objectNum = parseInt(in.readLine());   int[] xLocs = new int[objectNum + 1];   int[] yLocs = new int[objectNum + 1];   int[] bitMasks = new int[1 << objectNum];   Arrays.fill(bitMasks, MAX_VALUE);   int[] previous = new int[1 << objectNum];   xLocs[objectNum] = xStart;   yLocs[objectNum] = yStart;   for (int i = 0; i < objectNum; i++) {    parsedString = in.readLine().split(" ");    xLocs[i] = parseInt(parsedString[0]);    yLocs[i] = parseInt(parsedString[1]);   }        int[][] times = new int[objectNum + 1][objectNum + 1];   for (int i = 0; i <= objectNum; i++) {    for (int j = 0; j <= objectNum; j++) {     times[i][j] = times[j][i] = (xLocs[i] - xLocs[j]) * (xLocs[i] - xLocs[j]) + (yLocs[i] - yLocs[j]) * (yLocs[i] - yLocs[j]);    }   }             bitMasks[0] = 0;   for (int i = 0; i < (1 << objectNum); i++) {    if (bitMasks[i] != MAX_VALUE) {     for (int j = 0; j < objectNum; j++) {      if (((1 << j) & i) == 0) {       int curState = (1 << j) | i;       int curTime = bitMasks[i] + 2 * times[objectNum][j];        if (curTime < bitMasks[curState]) {        bitMasks[curState] = curTime;        previous[curState] = i;       }              for (int k = 0; k < objectNum; k++) {        if (((1 << k) & curState) == 0) {         int kState = ((1 << k) | curState);                  int kTime = bitMasks[i] + times[objectNum][j] + times[j][k] + times[k][objectNum];         if (kTime < bitMasks[kState]) {          bitMasks[kState] = kTime;          previous[kState] = i;         }        }       }       break;      }     }    }   }   int finalState = (1 << objectNum) - 1;   StringBuilder sb = new StringBuilder();   sb.append(bitMasks[finalState]).append('\n');   Deque<Integer> outputQ = new ArrayDeque<>();   outputQ.add(0);   int curState = finalState;   while (curState > 0) {       int difference = curState ^ previous[curState];    int firstItem = -1;    int secondItem = -1;    for (int i = 0; i < objectNum; i++) {     if (((1 << i) & difference) > 0) {      secondItem = firstItem;      firstItem = i;     }    }    if (secondItem != -1) {         outputQ.add(firstItem + 1);     outputQ.add(secondItem + 1);     outputQ.add(0);    } else {     outputQ.add(firstItem + 1);     outputQ.add(0);    }    curState = previous[curState];   }   sb.append(outputQ.removeLast());   while (!outputQ.isEmpty()) {    sb.append(' ').append(outputQ.removeLast());   }   System.out.print(sb);  } }
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 void writeInt(int a) {this.out.print(a);this.out.print(' ');}  public void writeWord(String s){   this.out.print(s);  }  public void writeIntArray(int[] a, int k, String separator) {   StringBuilder sb = new StringBuilder();   for (int i = 0; i < k; i++) {    if (i > 0) sb.append(separator);    sb.append(a[i]);   }   this.writeLine(sb.toString());  }  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 long[] readLongArray() {   String[]n=this.readLine().trim().split("\\s+");long[]r=new long[n.length];   for(int i=0;i<n.length;i++)r[i]=Long.parseLong(n[i]);   return r;  }  public int[] readIntArray() {   String[]n=this.readLine().trim().split("\\s+");int[]r=new int[n.length];   for(int i=0;i<n.length;i++)r[i]=Integer.parseInt(n[i]);   return r;  }  public int[] readIntArray(int n) {   int[] res = new int[n];   char[] all = this.readLine().toCharArray();   int cur = 0;boolean have = false;   int k = 0;   boolean neg = false;   for(int i = 0;i<all.length;i++){    if(all[i]>='0' && all[i]<='9'){     cur = cur*10+all[i]-'0';     have = true;    }else if(all[i]=='-') {     neg = true;    }    else if(have){     res[k++] = neg?-cur:cur;     cur = 0;     have = false;     neg = false;    }   }   if(have)res[k++] = neg?-cur:cur;   return res;  }  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;   }  }  public String readWord() {   try {    boolean start = false;    StringBuilder sb = new StringBuilder();    while (true) {     int c = br.read();     if (c!= ' ' && c!= '\r' && c!='\n' && c!='\t') {      sb.append((char)c);      start = true;     } else if (start || c == -1) return sb.toString();    }   } catch (Exception ex) {    return "";   }  }  public char readSymbol() {   try {    while (true) {     int c = br.read();     if (c != ' ' && c != '\r' && c != '\n' && c != '\t') {      return (char) c;     }    }   } catch (Exception ex) {    return 0;   }  }  } class Pair {  public Pair(int a, int b) {this.a = a;this.b = b;}  public int a;  public int b; } class PairLL {  public PairLL(long a, long b) {this.a = a;this.b = b;}  public long a;  public long b; } class Triple {  public Triple(int a, int b, int c) {this.a = a;this.b = b;this.c = c;}  public int a;  public int b;  public int c; }
1	public class Main { PrintWriter out = new PrintWriter(System.out); BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer tok = new StringTokenizer("");  String next() throws IOException {   if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }   return tok.nextToken();  }  int ni() throws IOException { return Integer.parseInt(next()); }  long nl() throws IOException { return Long.parseLong(next()); }   long mod=1000000007;   void solve() throws IOException {   for (int tc=ni();tc>0;tc--) {    long n=ni();    long q=1;    long p=1;    boolean f=false;    while (true) {     if (p*2==n || p*4==n) { f=true; break; }     q++;     p=q*q;     if (p>n) break;    }    if (f) out.println("YES");    else out.println("NO");   }   out.flush();  }   int gcd(int a,int b) { return(b==0?a:gcd(b,a%b)); }  long gcd(long a,long b) { return(b==0?a:gcd(b,a%b)); }  long mp(long a,long p) { long r=1; while(p>0) { if ((p&1)==1) r=(r*a)%mod; p>>=1; a=(a*a)%mod; } return r; }   public static void main(String[] args) throws IOException {   new Main().solve();  } }
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) {   long a = in.nextLong();   long b = in.nextLong();   if (a < b) {    long t = a;    a = b;    b = t;   }   long ans = 0;   while (b > 0) {    ans += a / b;    long t = a % b;    a = b;    b = t;   }   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();   }  }  public String next() {   StringBuilder sb = new StringBuilder();   int c = read();   while (isWhiteSpace(c)) {    c = read();   }   if (c < 0) {    return null;   }   while (c >= 0 && !isWhiteSpace(c)) {    sb.appendCodePoint(c);    c = read();   }   return sb.toString();  }  static boolean isWhiteSpace(int c) {   return c >= 0 && c <= 32;  }  public long nextLong() {   return Long.parseLong(next());  }  public String readLine() {   try {    return super.readLine();   } catch (IOException e) {    return null;   }  }  } class FastPrinter extends PrintWriter {  public FastPrinter(OutputStream out) {   super(out);  }  public FastPrinter(Writer out) {   super(out);  }  }
5	public class Beta22PA {   public static void main(String[] args) {   Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int minimum = 200, second = 200;  for(int i=0; i<n; i++) {  int temp = scan.nextInt();  if(temp<minimum) {   second = minimum;   minimum = temp;  } else if(temp>minimum&&temp<second) {   second = temp;  }  }  if(second>100) {  System.out.println("NO");  } else {  System.out.println(second);  } } }
1	public class Main{  public static void main(String[] args) {   new Main().run();  }  Scanner sc=new Scanner(System.in);  void run() {   int n=sc.nextInt();   char[] cs=sc.next().toCharArray();   int h=0;   for(int i=0;i<n;i++)if(cs[i]=='H')h++;   int res=n;   for(int i=0;i<n;i++) {    int val=0;    for(int j=0;j<h;j++)if(cs[(i+j)%n]=='T')val++;    res=min(res,val);   }   System.out.println(res);  } }
3	public class C { static final long MOD = 1_000_000_007; public static void main(String[] args) throws Exception {  FastScanner sc = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int N = sc.nextInt();  long[][] dp = new long[N][N];  dp[0][0] = 1L;  for(int i = 0; i < N-1; i++) {  char oper = sc.next().charAt(0);  if(oper == 'f') {   dp[i+1][0] = 0L;   for(int j = 1; j < N; j++) {   dp[i+1][j] = dp[i][j-1];   }  }  else {   dp[i+1][N-1] = dp[i][N-1];   for(int j = N-2; j >= 0; j--) {   dp[i+1][j] = (dp[i+1][j+1] + dp[i][j]) % MOD;   }  }  }  long res = 0;  for(int i = 0; i < N; i++) {  res += dp[N-1][i];  res %= MOD;  }  out.println(res);  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 long nextLong() {  return Long.parseLong(next());  }  public double nextDouble() {  return Double.parseDouble(next());  }  public String nextLine() {  try {   return reader.readLine();  } catch (IOException e) {   throw new RuntimeException(e);  }  }  } }
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 logWln(Object X){if (verb) System.err.print(X);} static void info(Object o){ System.out.println(o);} static void output(Object o){outputWln(""+o+"\n"); } static void outputWln(Object o){try {out.write(""+ o);} catch (Exception e) {}}     static 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 String readString() throws IOException {  int c = read();  while (isSpaceChar(c)) {   c = read();  }  StringBuilder res=new StringBuilder();  do {   res.append((char)c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  public final int readInt() throws IOException {  int c = read();  boolean neg=false;  while (isSpaceChar(c)) {   c = read();  }  char d=(char)c;    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;  } }  }
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;  }  } }
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);   E solver = new E();   solver.solve(1, in, out);   out.close();  }  static class E {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.ni(), K = in.ni();    long mod = 998244353;    long[][] dp = new long[n + 1][n + 1];    for (int lim = 1; lim <= n; lim++) {     long sum = 1;     dp[0][lim] = 1;     for (int i = 1; i <= n; i++) {      dp[i][lim] = (dp[i][lim] + sum) % mod;      sum = (sum + dp[i][lim]) % mod;      if (i >= lim)       sum = (sum - dp[i - lim][lim] + mod) % mod;     }    }    long ans = 0;    for (int k = 1; k < Math.min(K, n + 1); k++) {     long h = dp[n][k] - dp[n][k - 1];     int lim = K / k;     if (K % k == 0)      lim--;     if (lim > n)      lim = n;     ans += dp[n][lim] * h % mod;    }    out.println(2 * ans % mod);   }  }  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());   }  } }
4	public class p23a {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   char[] x = in.next().toCharArray();     int min = 0;   int max = x.length;   while(true) {    if(max-min == 1)     break;    int mid = (max+min)/2;    boolean eq = false;    for (int i = 0; i <= x.length-mid; i++) {     for (int j = 0; j <= x.length-mid; j++) {      if(j == i)       continue;      eq = true;      for (int k = 0; k < mid; k++) {       if(x[i+k] != x[j+k]) {        eq = false;        break;       }      }      if(eq)       break;     }     if(eq) break;    }    if(eq) {     min = mid;    } else {     max = mid;    }   }   System.out.println(min);    } }
0	public class Main {         public static void main(String[] args) throws Exception {   Scanner sc = null;   PrintWriter pr = null;    pr=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));          long n = sc.nextInt();   if (n > 0) pr.println(n);   else {    long n1 = n / 10;    long n2 = n / 100 * 10 + n % 10;    if (n1 < n2) pr.println(n2);    else pr.println(n1);   }      pr.close();   sc.close();  } }
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(),a=in.nextInt(),b=in.nextInt(),i,c=0;   int ar[]=new int[n];   for(i=0;i<n;i++)    ar[i]=in.nextInt();   Arrays.sort(ar);   out.println(ar[b]-ar[b-1]); } }
2	public class Edu23 {  public static int sum(String s){  int tot=0;  for(int i =0; i<s.length();i++){  tot+=(s.charAt(i)-'0');  }  return tot; } public static BigInteger comb(int n, int k){  if(k==0)  return new BigInteger("1");  else  return comb(n,k-1).multiply(new BigInteger(n-k+1+"")).divide(new BigInteger(k+"")); } public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  long n = sc.nextLong();  long s = sc.nextLong();  long i;  for(i =s ; i-sum(i+"")<s;i++)  if(i%10==0)i+=9;  System.out.println(Math.max(0, n-i+1));   } static class Scanner {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s));  }  public Scanner(String f) throws FileNotFoundException {  br = new BufferedReader(new FileReader(f));  }  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 String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(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;  }  public int[] nextIntArray1(int n) throws IOException {  int[] a = new int[n + 1];  for (int i = 1; i <= n; i++)   a[i] = nextInt();  return a;  }  public int[] shuffle(int[] a, int n) {  int[] b = new int[n];  for (int i = 0; i < n; i++)   b[i] = a[i];  Random r = new Random();  for (int i = 0; i < n; i++) {   int j = i + r.nextInt(n - i);   int t = b[i];   b[i] = b[j];   b[j] = t;  }  return b;  }  public int[] nextIntArraySorted(int n) throws IOException {  int[] a = nextIntArray(n);  a = shuffle(a, n);  Arrays.sort(a);  return a;  }  public long[] nextLongArray(int n) throws IOException {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  public long[] nextLongArray1(int n) throws IOException {  long[] a = new long[n + 1];  for (int i = 1; i <= n; i++)   a[i] = nextLong();  return a;  }  public long[] nextLongArraySorted(int n) throws IOException {  long[] a = nextLongArray(n);  Random r = new Random();  for (int i = 0; i < n; i++) {   int j = i + r.nextInt(n - i);   long t = a[i];   a[i] = a[j];   a[j] = t;  }  Arrays.sort(a);  return a;  } } }
4	public class Main{  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());   }   int[] nextArray(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++) a[i] = nextInt();    return a;   }   long[] nextArray(long n) {    long[] a = new long[(int) n];    for (int i = 0; i < n; i++) a[i] = nextLong();    return a;   }   long nextLong() {    return Long.parseLong(next());   }  }  static class FastWriter extends PrintWriter {    FastWriter(){     super(System.out);    }    void println(int[] array) {     for(int i=0; i<array.length; i++) {      print(array[i]+" ");     }     println();    }    void println(long [] array) {     for(int i=0; i<array.length; i++) {      print(array[i]+" ");     }     println();    }   }  static int x,y;  public static void main(String[] args){   FastScanner in = new FastScanner();   FastWriter out = new FastWriter();   int n=in.nextInt();   int m=in.nextInt();   int k=in.nextInt();   int[][] right=new int[n][m-1];   int[][] down=new int[n-1][m];   for (int i = 0; i < n; i++) {    right[i]=in.nextArray(m-1);   }   for (int i = 0; i < n - 1; i++) {    down[i]=in.nextArray(m);   }   if(k%2!=0){    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      out.print("-1 ");     }     out.println();    }   }else {    int[][] dp=new int[n][m];    int[][] dp1=new int[n][m];    for (int i = 0; i < k / 2; i++) {     for (int j = 0; j < n; j++) {      for (int l = 0; l < m; l++) {       int ans=Integer.MAX_VALUE;       if(j>0){        ans=Math.min(ans,dp[j-1][l]+down[j-1][l]);       }       if(l>0){        ans=Math.min(ans,dp[j][l-1]+right[j][l-1]);       }       if(j!=n-1){        ans=Math.min(ans,dp[j+1][l]+down[j][l]);       }       if(l!=m-1){        ans=Math.min(ans,dp[j][l+1]+right[j][l]);       }       dp1[j][l]=ans;      }     }     dp=dp1;     dp1=new int[n][m];    }    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      out.println((2*dp[i][j])+" ");     }     out.println();    }   }   out.close();  } }
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)));   long x = nextLong();   long y = nextLong();   long ans = 0;   while (x > 0 && y > 0) {    if (x > y) {     ans += x / y;     x %= y;    }    else {     ans += y / x;     y %= x;    }   }   System.out.println(ans);  }  private static int nextInt() throws IOException {   return Integer.parseInt(next());  }  private static long nextLong() throws IOException {   return Long.parseLong(next());  }  private static double nextDouble() throws IOException {   return Double.parseDouble(next());  }  private static String next() throws IOException {   while (st==null || !st.hasMoreTokens())    st = new StringTokenizer(br.readLine());   return st.nextToken();  } }
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;  }  public long readLong() {   int c = read();   while (isSpaceChar(c))    c = read();   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   long res = 0;   do {    if (c < '0' || c > '9')     throw new InputMismatchException();    res *= 10;    res += c - '0';    c = read();   } while (!isSpaceChar(c));   return res * sgn;  }  public String readString() {   int c = read();   while (isSpaceChar(c))    c = read();   StringBuffer res = new StringBuffer();   do {    res.appendCodePoint(c);    c = read();   } while (!isSpaceChar(c));   return res.toString();  }  private boolean isSpaceChar(int c) {   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  private String readLine0() {   StringBuffer buf = new StringBuffer();   int c = read();   while (c != '\n' && c != -1) {    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 char readCharacter() {   int c = read();   while (isSpaceChar(c))    c = read();   return (char) c;  }  public double readDouble() {   int c = read();   while (isSpaceChar(c))    c = read();   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   double res = 0;   while (!isSpaceChar(c) && c != '.') {    if (c == 'e' || c == 'E')     return res * Math.pow(10, readInt());    if (c < '0' || c > '9')     throw new InputMismatchException();    res *= 10;    res += c - '0';    c = read();   }   if (c == '.') {    c = read();    double m = 1;    while (!isSpaceChar(c)) {     if (c == 'e' || c == 'E')      return res * Math.pow(10, readInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     m /= 10;     res += (c - '0') * m;     c = read();    }   }   return res * sgn;  } }
4	public class GiveString23A {  public static void main(String[] args)  {   Scanner in = new Scanner(System.in);   String stroke = in.next();   char[] s = new char [stroke.length()];   for (int i=0;i<stroke.length();i++)    s[i]=stroke.charAt(i);   int dlina = 0;   for (int i=0;i<s.length-1;i++)    for (int j=i+1;j<s.length;j++)     for (int k=0;k<(s.length-j);k++)      if (s[i]==s[j])      {       int ik=i+k;       int jk = j+k;       if (s[ik]==s[jk])       {        if (dlina<k+1)         dlina=k+1;        }       else       break;      }     System.out.println(dlina);  } }
5	public class Main {  public static void main (String[] args) throws java.lang.Exception  {   Scanner sc = new Scanner(System.in);   int numSupply = sc.nextInt();   int dev = sc.nextInt();   int socket = sc.nextInt();   int[] sockInSu = new int[numSupply];   for (int i = 0; i< sockInSu.length; i++) {    sockInSu[i] = sc.nextInt();   }     Arrays.sort(sockInSu);     if (socket >= dev) {    System.out.println(0);   }else {    int count = 0;    for (int i = sockInSu.length-1; i >= 0; i--) {     socket+= sockInSu[i]-1;     count++;     if (socket >= dev) {      System.out.println(count);      break;     }    }    if (socket < dev)     System.out.println(-1);   }  } }
3	public class InversionCounting { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br.readLine(); int[] a = Arrays.stream(br.readLine().split(" ")).mapToInt(x->Integer.parseInt(x)).toArray(); boolean evenInv = true; for (int i = 0; i < a.length; i++) {  for (int j = 0; j < a.length-1; j++) {  if(a[j]>a[j+1]) {   int temp = a[j];   a[j] = a[j+1];   a[j+1] = temp;   evenInv =!evenInv;  }  } } int q = Integer.parseInt(br.readLine()); for (int i = 0; i < q; i++) {  int[] sw = Arrays.stream(br.readLine().split(" ")).mapToInt(x->Integer.parseInt(x)).toArray();  int len = sw[1]-sw[0];  if((len)*(len+1)%4 != 0) {  evenInv = !evenInv;  }  if(evenInv) {  System.out.println("even");  }else {  System.out.println("odd");  } }  } }
3	public class ques1 {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int b = sc.nextInt();   ArrayList<Integer> ar=new ArrayList<>();   for(int i=0;i<b;i++){    ar.add(sc.nextInt());   }   Collections.sort(ar);   int count=0;   int i=0;   while(ar.size()!=0)   {    int tmep=ar.get(i);    int v=ar.remove(i);    count++;    int j=0;    while(j<ar.size()){     if(ar.get(j)%tmep==0){      int a=ar.remove(j);     }     else      j++;    }   }   System.out.println(count);   } }
3	public class CC { public static void main(String[] args)throws Throwable {  MyScanner sc=new MyScanner();  PrintWriter pw=new PrintWriter(System.out);   n=sc.nextInt();  s=new char [n];  for(int i=0;i<n;i++)  s[i]=sc.next().charAt(0);  mem=new int [2*n+1][n+1];  for(int [] x : mem)  Arrays.fill(x, -1);  pw.println(dp(0, 0));   pw.flush();  pw.close(); } static int n; static char [] s; static int [][] mem;  static int dp(int i,int j){  if(i==n)  return j==0? 1 : 0;  if(mem[i][j]!=-1)  return mem[i][j];  int ans=0;  if(s[i]=='f'){  ans+=dp(i+1, j+1);  ans%=mod;  }else{  ans+=dp(i+1, j);  ans%=mod;  if(j>0){   ans+=dp(i, j-1);   ans%=mod;  }  }   return mem[i][j]=ans; }  static int mod=(int)(1e9+7);  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());}  String nextLine(){String str = "";  try {str = br.readLine();}  catch (IOException e) {e.printStackTrace();}  return str;} } }
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());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  int[] readArr(int n) throws IOException {   int[] res = new int[n];   for (int i = 0; i < n; i++) {    res[i] = readInt();   }   return res;  }  long[] readArrL(int n) throws IOException {   long[] res = new long[n];   for (int i = 0; i < n; i++) {    res[i] = readLong();   }   return res;  }  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 A {  static InputStreamReader in = new InputStreamReader(System.in);  static BufferedReader bf = new BufferedReader(in);  static StreamTokenizer st = new StreamTokenizer(bf);  static Scanner sc = new Scanner(System.in);  static class Sort implements Comparable<Sort> {   int x, a;   public int compareTo(Sort arg0) {    if (this.x > arg0.x)     return 1;    return 0;   }  }  public static void main(String[] args) throws IOException {   int n = nextInt();   double t = nextInt();   Sort[] p = new Sort[n];   for (int i = 0; i < n; i++) {    p[i] = new Sort();    p[i].x = nextInt();    p[i].a = nextInt();   }   int ans = 2;   Arrays.sort(p);   for (int i = 1; i < p.length; i++) {    double k = p[i].x - p[i].a / 2.0 - p[i - 1].x - p[i - 1].a / 2.0;    if (t == k)     ans++;    else if (k > t)     ans += 2;   }   System.out.println(ans);  }  private static String nextString() throws IOException {   st.nextToken();   return st.sval;  }  private static int nextInt() throws IOException {   st.nextToken();   return (int) st.nval;  } }
0	public class A630 {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);     String s = sc.nextLine();   System.out.println("25");  } }
0	public class Main { public static void main(String args[]) throws Exception  {    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  int n=Integer.parseInt(br.readLine());  System.out.println("0 0 "+n);} }
0	public class Main {  private BufferedReader in; private BufferedWriter out;  double time(double a, double l, double v0, double v) {  double t = (v - v0) / a;  double s = a * t * t / 2 + v0 * t;  if (s <= l) {  return t + (l - s) / v;  }  double B = v0, C = -l;  double D = Math.sqrt(B * B - 2 * a * C);  return (-B + D) / a; }   public void solve() throws Exception {  StreamTokenizer st = new StreamTokenizer(in);  st.nextToken();  double a = st.nval;  st.nextToken();  double v = st.nval;  st.nextToken();  double l = st.nval;  st.nextToken();  double d = st.nval;  st.nextToken();  double w = st.nval;  double ttt = Math.sqrt(2 * d / a);  double ans = 0.0;  if (w > v || ttt * a < w) {  ans = time(a, l, 0, v);  } else {  double B = 2 * w / a, C = -w * w / (a * a) - 4 * d / a;  double D = Math.sqrt(B * B - 4 * C);  ans = (-B + D) / 2;  if ((a * ans + w) / 2.0 > v) {   double t1 = v / a;   double t2 = (v - w) / a;   double s = (a * t1 * t1 / 2.0) + (v * t2 - a * t2 * t2 / 2.0);   ans = t1 + t2 + (d - s) / v;  }  ans += time(a, l - d, w, v);  }  DecimalFormat df = new DecimalFormat("0.000000000");  out.write(df.format(ans) + "\n"); }  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new BufferedWriter(new OutputStreamWriter(System.out));  solve();  out.flush();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  public static void main(String[] args) {  try {  Locale.setDefault(Locale.US);  } catch (Exception e) {  }  new Main().run(); } }
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; } }
5	public class Solution implements Runnable {        class Pair implements Comparable<Pair> {   int col;   int time;   int place;     public Pair() {      }     public Pair(int col, int time) {    this.col = col;    this.time = time;   }     @Override   public int compareTo(Pair arg0) {    if (col == arg0.col) {     return time - arg0.time;    }    return arg0.col - col;   }       }   public void solve() throws Exception {   int n = sc.nextInt();   int k = sc.nextInt();     ArrayList<Pair> a = new ArrayList<Pair>();     for (int i = 0;i < n; ++ i) {    a.add(new Pair(sc.nextInt(), sc.nextInt()));   }   Collections.sort(a);     int place = 1;   int placex = 0;   int ans2 = 0;   int ans1 = 0;     for (int i = 0;i < n; ++ i) {    if (i > 0 && a.get(i).compareTo(a.get(i - 1)) != 0) {     ++ place;     ++ placex;    } else {     ++ placex;    }    a.get(i).place = place;    if (placex == k) {     ans1 = place;    }   }     for (int i = 0;i < n; ++ i) {    if (a.get(i).place == ans1) {     ++ ans2;    }   }     out.println(ans2);   }           static String filename = "";  static boolean fromFile = false;   BufferedReader in;  PrintWriter out;  FastScanner sc;   public static void main(String[] args) {   new Thread(null, new Solution(), "", 1 << 25).start();  }   public void run() {   try {    init();    solve();   } catch (Exception e) {    throw new RuntimeException(e);   } finally {    out.close();   }  }   void init() throws Exception {   if (fromFile) {    in = new BufferedReader(new FileReader(filename+".in"));    out = new PrintWriter(new FileWriter(filename+".out"));   } else {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);   }   sc = new FastScanner(in);  } } class FastScanner {   BufferedReader reader;  StringTokenizer strTok;   public FastScanner(BufferedReader reader) {   this.reader = reader;  }   public String nextToken() throws IOException {   while (strTok == null || !strTok.hasMoreTokens()) {    strTok = new StringTokenizer(reader.readLine());   }     return strTok.nextToken();  }   public int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }   public long nextLong() throws IOException {   return Long.parseLong(nextToken());  }   public double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }   public BigInteger nextBigInteger() throws IOException {   return new BigInteger(nextToken());  }   public BigDecimal nextBigDecimal() throws IOException {   return new BigDecimal(nextToken());  } }
5	public class Main {  public static void main(String[] args) {       Scanner kb = new Scanner(System.in);  int n = kb.nextInt();  int a[] = new int[n];  int b[] = new int[n];  for(int i = 0;i<n;i++){  a[i]=kb.nextInt();  b[i]=a[i];  }  Arrays.sort(a);  int count = 0;  for(int i=0;i<n;i++){  if(a[i]!=b[i])count++;  }  if(count<=2)  System.out.println("YES");  else  System.out.println("NO");  } }
3	public class A {  public static void main(String[] args) throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(reader.readLine());   String str[] = reader.readLine().split(" ");   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = Integer.parseInt(str[i]);   }   Arrays.sort(a);   int k = 0;   for (int i = 0; i < n; i++) {    if (a[i] == 0){     continue;    }    for (int j = i + 1; j < n; j++) {     if (a[j] % a[i] == 0){      a[j] = 0;     }    }    k++;   }   System.out.println(k);  } }
2	public class TC {  static long N;  static int k;  static long WHOLESUM;   static long SUM( long k )  {   long res=k*( k+1 )/2;   return res-1;  }   static long returnPipes( int mid )  {   long not=SUM( mid-1 );   long totpipes=WHOLESUM-not;   int number=k-mid+1;   long res=totpipes-number+1;   return res;  }   static long binarySearch( int lo, int hi )  {   int res=Integer.MAX_VALUE;   int val=0;   while( lo <= hi )   {    int mid=( lo+hi )/2;    long cnt=returnPipes( mid );    val=k-mid+1;;       if( cnt < N )    {     hi=mid-1;     continue;    }    else    {     res=Math.min( val, res );     lo=mid+1;    }   }     if( res==Integer.MAX_VALUE )    return -1;   else    return res;    }    public static void main( String[] args ) throws IOException  {   Scanner s=new Scanner( System.in );   N=s.nextLong();   k=s.nextInt();   WHOLESUM=SUM( k );   if( N<=1 )    System.out.println(0 );   else    System.out.println( binarySearch( 2, k ) );  }    }
0	public class Solution {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   s.nextLine();   while(s.hasNext()) {    int first = s.nextInt();    int second = s.nextInt();    System.out.println(calculate(first,second));   }  }   public static int calculate(int first, int second) {   int operations = 0;   while(first != 0 && second != 0) {    int temp;    if(first < second) {     temp = second/first;     operations += temp;     second -= (first*temp);    }    else {     temp = first/second;     operations += temp;     first -= (second*temp);    }   }   return operations;  } }
5	public class Teams {  BufferedReader in;  PrintWriter out;  StringTokenizer st;  Random rnd;   class Pair implements Comparable<Pair> {   int a, b;   public Pair(int a, int b) {    this.a = a;    this.b = b;   }     public int compareTo(Pair p) {    if(a != p.a) {     return -(a - p.a);    }       return (b - p.b);   }  }  void solve() throws IOException {   int n = nextInt(), k = nextInt();     Pair[] ps = new Pair[n];     for(int i = 0; i < n; i++)    ps[i] = new Pair(nextInt(), nextInt());     Arrays.sort(ps);     int curPlace = 1, res = 0;     int[] places = new int[n];     for(int i = 0; i < n; i++) {    if(i - 1 >= 0 && ps[i].compareTo(ps[i - 1]) != 0)     ++curPlace;       places[i] = curPlace;   }     for(int i = 0; i < n; i++) {    if(places[i] == places[k - 1])     ++res;   }     out.println(res);  }  public static void main(String[] args) {   new Teams().run();  }  public void run() {   try {    final String className = this.getClass().getName().toLowerCase();    try {     in = new BufferedReader(new FileReader(className + ".in"));     out = new PrintWriter(new FileWriter(className + ".out"));    } catch (FileNotFoundException e) {     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());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
2	public class Main {  public static void main(String[] args) {  Scanner sc =new Scanner(System.in);  long n = sc.nextLong(), k = sc.nextLong();  long ans = 0, sum = 0;  while(ans < n) {  if(sum - (n-ans) == k) break;  ans++;  sum += ans;  }  sc.close();  System.out.println(n-ans); }    }
1	public class Primes { static Scanner in = new Scanner( new BufferedReader( new InputStreamReader( System.in ) ) );  public static void main( String[] args ) {  int n = in.nextInt(), k = in.nextInt(), count = 0;  boolean[] isP = new boolean[n+1];  for( int i = 2; i <= n; i++ ) isP[i] = true;  ArrayList<Integer> primes = new ArrayList<Integer>();  for( int i = 2; i <= n; i++ ) if( isP[i] )  {  primes.add(i);  if( i <= Math.sqrt(n) ) for( int j = 2*i; j <= n; j += i ) isP[j] = false;  }  for( int i = 0; i < primes.size()-1; i++ )  {  int sum = primes.get(i)+primes.get(i+1)+1;  if( sum<=n && isP[sum] ) count++;  }  if( count>=k ) System.out.println( "YES" );  else System.out.println( "NO" ); } }
4	public class Solution implements Runnable {  Scanner input; PrintWriter output;  private void solve() throws Exception {  int n = nextInt();  int m = nextInt();  int k = nextInt();  int[] r = new int[k];  int[] c = new int[k];  for (int i = 0; i < k; i++)  {  r[i] = nextInt();  c[i] = nextInt();  }  int best = -1;  int bestr = -1;  int bestc = -1;  for (int i = 1; i <= n; i++)  {  for (int j = 1; j <= m; j++)  {   int d = n + m;   for (int q = 0; q < k; q++)   {   d = Math.min(d, Math.abs(i - r[q]) + Math.abs(j - c[q]));   }   if (d < best) continue;   best = d;   bestr = i;   bestc = j;  }  }  out(bestr + " " + bestc); }  private int nextInt() throws Exception {  return input.nextInt(); }  private void out(String s) {  output.println(s); }  public void run() {  try {  solve();  } catch (Exception ex) {  throw new RuntimeException(ex);  } finally {  output.close();  } }  public Solution() throws IOException {  input = new Scanner(new FileReader("input.txt"));  output = new PrintWriter("output.txt"); }  public static void main(String[] args) throws IOException {  Locale.setDefault(Locale.US);  new Thread(new Solution()).start(); } }
6	public class Main {  private static FastScanner sc = new FastScanner();  private static long mod = 1000000007;  public static void main(String[] args) {  int n = sc.nextInt();  int T = sc.nextInt();  int[] t = new int[n];  int[] g = new int[n];  for(int i=0; i<n; i++) {   t[i] = sc.nextInt();   g[i] = sc.nextInt() - 1;  }  long[][][] dp = new long[T+1][3][1 << 15];  for(int i=1; i<=T; i++) {   for(int j=0; j<n; j++) {   if(i - t[j] == 0) {    dp[i][g[j]][1 << j] = (dp[i][g[j]][1 << j] + 1) % mod;   } else if(i - t[j] > 0) {    for(int k=0; k<(1 << 15); k++) {    if((k >> j & 1) == 1) {     continue;    }    dp[i][g[j]][k + (1 << j)] = (dp[i][g[j]][k + (1 << j)] + dp[i - t[j]][(g[j] + 1) % 3][k] + dp[i - t[j]][(g[j] + 2) % 3][k]) % mod;    }   }   }  }  long ans = 0;  for(int j=0; j<3; j++) {   for(int k=0; k<(1 << 15); k++) {   ans = (ans + dp[T][j][k]) % mod;   }  }  System.out.println(ans);  }  static long power(long m , long n){  if(n == 0) {   return 1;  }else if(n == 1){    return m;   }else if(n % 2 == 0){    long s = power(m, n/2);    return ( (s % mod) * (s % mod) ) % mod;   }else{    return ( (m % mod) * (power(m, n-1) % mod) ) % mod;   }  }  static class FastScanner {   private final InputStream in = System.in;   private final byte[] buffer = new byte[1024];   private int ptr = 0;   private int buflen = 0;   private boolean hasNextByte() {    if(ptr < buflen) {     return true;    } else {     ptr = 0;     try {      buflen = in.read(buffer);     } catch(IOException e) {      e.printStackTrace();     }     if(buflen <= 0) {      return false;     }    }    return true;   }   private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}   private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}   private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}   public boolean hasNext() { skipUnprintable(); return hasNextByte();}   public String next() {    if (!hasNext()) throw new NoSuchElementException();    StringBuilder sb = new StringBuilder();    int b = readByte();    while(isPrintableChar(b)) {     sb.appendCodePoint(b);     b = readByte();    }    return sb.toString();   }   public long nextLong() {    return Long.parseLong(next());   }   public int nextInt(){    return Integer.parseInt(next());   }   public double nextDouble(){    return Double.parseDouble(next());   }  } }
6	public class Main implements Runnable {   int n; long[][] f; boolean[][] e;  int bit(int value) {  return (1<<value); }  void solve() throws IOException {  n = nextInt();  int m = nextInt();  f = new long[1<<n][n];  e = new boolean[n][n];  for (int i = 0; i < (1<<n); ++i) {  for (int j = 0; j < n; ++j) {   f[i][j] = -1;  }  }  for (int i = 0; i < n; ++i) {  for (int j = 0; j < n; ++j) {   f[bit(i)|bit(j)][j] = 0;   e[i][j] = false;  }  }  for (int i = 0; i < m; ++i) {  int u = nextInt()-1;  int v = nextInt()-1;  e[u][v] = true;  e[v][u] = true;  if (u < v) {   f[bit(u)|bit(v)][v] = 1;  }  else {   f[bit(v)|bit(u)][u] = 1;  }  }  long answer = 0;  for (int i = 1; i < (1<<n); ++i) {  int start = 0;  while (((1<<start)&i) == 0) {   ++start;  }  int s = bit(start);  for (int nxt = start+1; nxt < n; ++nxt) {   int b = bit(nxt);   if ((b&i) > 0 && (b|s) != i) {   if (e[start][nxt]) {    answer += clc(i, nxt);   }   }  }  }  writer.print(answer>>1); }  long clc(int maska, int last) {  if (f[maska][last] == -1) {  int first = 0;  while (((1<<first)&maska) == 0) {   ++first;  }  f[maska][last] = 0;  for (int b = first+1; b < n; ++b) {   if ((bit(b)&maska)>0) {   if (e[b][last]) {    f[maska][last] += clc(maska^bit(last), b);   }   }  }   }  return f[maska][last]; }  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());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }   String nextString() throws IOException {  return reader.readLine();  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }  }
5	public class Main {   public static void main(String[] args) throws IOException {     BufferedReader in=new BufferedReader(new InputStreamReader(System.in));   PrintWriter out=new PrintWriter(System.out);   int mod=1000000007;   String[] input=in.readLine().split(" ");   int n=Integer.parseInt(input[0]);   int a=Integer.parseInt(input[1]);   int b=Integer.parseInt(input[2]);   String[] h=in.readLine().split(" ");   int[] mas=new int[n];   for(int i=0; i<n; i++){    mas[i]=Integer.parseInt(h[i]);   }   Arrays.sort(mas);   int l=mas[b-1];   int r=mas[b];   int count=0;   if(l==r) count=0;   else count=r-l;   out.println(count);   out.close();  } }
6	public class Main{     void pre() throws Exception{}  void solve(int TC)throws Exception{   int n = ni(), m = ni();   long[][] a = new long[n][m];   long[] col = new long[m];   for(int i = 0; i< n; i++){    for(int j = 0; j< m; j++){     a[i][j] = nl();     col[j] = Math.max(a[i][j], col[j]);    }   }   Integer[] p = new Integer[m];   for(int i = 0; i< m; i++)p[i] = i;   Arrays.sort(p, (Integer i1, Integer i2) -> Long.compare(col[i2], col[i1]));   long[][] mat = new long[n][Math.min(m, 6)];   for(int i = 0; i< Math.min(m, 6); i++){    for(int j = 0; j< n; j++)mat[j][i] = a[j][p[i]];   }   long pow = 1;   for(int i = 0; i< Math.min(m, 6); i++)pow *= n;   int[] sh = new int[Math.min(m, 6)];   long ans = 0;   for(int i = 0; i< pow; i++){    int x = i;    for(int j = 0; j< Math.min(m, 6); j++){     sh[j] = x%n;     x/=n;    }    long cur = 0;    for(int ro = 0; ro < n; ro++){     long cR = 0;     for(int j = 0; j < Math.min(m, 6); j++)cR = Math.max(cR, mat[(ro+sh[j])%n][j]);     cur += cR;    }    ans = Math.max(ans, cur);   }   pn(ans);  }   void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}  void exit(boolean b){if(!b)System.exit(0);}  long IINF = (long)1e18, mod = (long)1e9+7;  final int INF = (int)1e9, MX = (int)2e6+5;  DecimalFormat df = new DecimalFormat("0.00000000");  double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-6;  static boolean multipleTC = true, memory = false, fileIO = false;  FastReader in;PrintWriter out;  void run() throws Exception{   if(fileIO){    in = new FastReader("input.txt");    out = new PrintWriter("output.txt");   }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();  }  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 digit(long s){int ans = 0;while(s>0){s/=10;ans++;}return ans;}  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 p(Object o){out.print(o);}  void pn(Object o){out.println(o);}  void pni(Object o){out.println(o);out.flush();}  String n()throws Exception{return in.next();}  String nln()throws Exception{return in.nextLine();}  int ni()throws Exception{return Integer.parseInt(in.next());}  long nl()throws Exception{return Long.parseLong(in.next());}  double nd()throws Exception{return Double.parseDouble(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;   }  } }
1	public class a implements Runnable {  private void solve() throws IOException {  int n = nextInt();  int oddcnt = 0, evencnt = 0;  int odd = 0, even = 0;  for (int i = 0; i < n; i++) {  int a = nextInt();  if (a % 2 == 0) {   even = i + 1;   evencnt++;  } else {   odd = i + 1;   oddcnt++;  }  }  if (oddcnt == 1) {  System.out.println(odd);  } else {  System.out.println(even);  } }  public static void main(String[] args) {  new Thread(new a()).start(); }  BufferedReader br; StringTokenizer st; PrintWriter out; boolean eof = false;  public void run() {  Locale.setDefault(Locale.US);  try {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  out.close();  } catch (Throwable e) {  e.printStackTrace();  System.exit(239);  } }  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() {  return Integer.parseInt(nextToken()); }  long nextLong() {  return Long.parseLong(nextToken()); }  double nextDouble() {  return Double.parseDouble(nextToken()); } }
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();  } }
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);  } }
3	public class A { public static void main(String args[]) {  Scanner sc = new Scanner (System.in);  int n = sc.nextInt();  int a[] = new int[n+1];  for(int i=1 ; i<=n ; i++) a[i] = sc.nextInt();  int cnt = 0;  for(int i=1 ; i<=n ; i++) {  for(int j=i-1 ; j>=1 ; j--) {   if(a[i]<a[j])   ++cnt;  }  }   int q = sc.nextInt();  cnt = cnt % 2;  while(q-->0) {  int x = sc.nextInt();  int y = sc.nextInt();  int r = y-x+1;  long ok = (r*(r-1))/2;  if(ok%2==0) {     }  else {   cnt ^= 1 ;   }  System.out.println(cnt==0?"even":"odd");  } } }
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();  } static class MS{   HashMap<Long, Integer> map;  public MS() {    map = new HashMap<Long, Integer>();  }  public void add(long x) {   if(map.containsKey(x)){    map.put(x, map.get(x)+1);   }   else{    map.put(x, 1);    }  }  public void remove(long x) {   if(!map.containsKey(x))    return;   if(map.get(x)==1){    map.remove(x);    }   else     map.put(x, map.get(x)-1);  }     public int size() {   return map.keySet().size();  }  public void removeAll(int x) {   map.remove(x);  }  public int getFreq(long x){   if (map.containsKey(x))   return map.get(x);   return 0;  } } 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 String[] readArrayString(int n){  String[] array = new String[n];  for(int j =0 ;j<n;j++)  array[j] = sc.next();  return array; } static int[] readArrayInt(int n){  int[] array = new int[n];  for(int j = 0;j<n;j++)   array[j] = sc.nextInt();  return array;  } static int[] readArrayInt1(int n){  int[] array = new int[n+1];  for(int j = 1;j<=n;j++){  array[j] = sc.nextInt();  }  return array; } static long[] readArrayLong(int n){  long[] array = new long[n];  for(int j =0 ;j<n;j++)  array[j] = sc.nextLong();  return array; } static double[] readArrayDouble(int n){  double[] array = new double[n];  for(int j =0 ;j<n;j++)  array[j] = sc.nextDouble();  return array; } static int minIndex(int[] array){  int minValue = Integer.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } static int minIndex(long[] array){  long minValue = Long.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } static int minIndex(double[] array){  double minValue = Double.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } 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; } static void verdict(boolean a){   out.println(a ? "YES" : "NO");  }  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());   }   String nextLine() {    String str = "";    try{     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }    } }
1	public class A {  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 d = sc.nextInt();   int[] arr = new int[n];   for (int i = 0; i < arr.length; i++) {    arr[i] = sc.nextInt();   }   HashSet<Integer> set = new HashSet<>();   for (int i = 0; i < arr.length; i++) {    set.add(arr[i]+d);    set.add(arr[i]-d);   }   int cnt = 0;   for (int loc: set) {    int minDist = (int)2e9;    for (int i = 0; i < n; i++) {     minDist = Math.min(minDist, Math.abs(arr[i]-loc));    }    if(minDist == d)     cnt++;   }   pw.println(cnt);   pw.flush();   pw.close();  }   static int[][] packD(int n, int[] from, int[] to) {   int[][] g = new int[n][];   int[] p = new int[n];   for (int f : from) if(f != -1) p[f]++;   for (int i = 0; i < n; i++) g[i] = new int[p[i]];   for (int i = 0; i < from.length; i++) if(from[i] != -1) {g[from[i]][--p[from[i]]] = to[i];}   return g;  }  static void shuffle(int[] a)  {   int n = a.length;   for(int i = 0; i < n; i++)   {    int r = i + (int)(Math.random() * (n - i));    int tmp = a[i];    a[i] = a[r];    a[r] = tmp;   }  }  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 String nextLine() throws IOException {return br.readLine();}   public boolean ready() throws IOException {return br.ready();}  } }
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();  } }
6	public class C {  static int[] DP;  static Point[] Next;  static int[][] pair;  static int[] single;  static int n;  public static int get(int mask) {   if (mask + 1 == (1 << n))    return 0;   if (DP[mask] != -1)    return DP[mask];   int x = 0;   for (;; x++)    if ((mask & (1 << x)) == 0)     break;   int min = Integer.MAX_VALUE;   for (int i = 0; i < n; i++) {    if ((mask & (1 << i)) != 0 || i == x)     continue;    int temp = pair[x][i] + get(mask | (1 << i) | (1 << x));    if (temp < min) {     min = temp;     Next[mask] = new Point(x, i);    }   }   int temp = single[x] + get(mask | (1 << x));   if (temp < min) {    min = temp;    Next[mask] = new Point(x, -1);   }   return DP[mask] = min;  }  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   Point start = new Point(in.nextInt(), in.nextInt());   n = in.nextInt();   Point[] A = new Point[n];   for (int i = 0; i < n; i++)    A[i] = new Point(in.nextInt(), in.nextInt());   DP = new int[1 << n];   Next = new Point[1 << n];   Arrays.fill(DP, -1);   pair = new int[n][n];   single = new int[n];   for (int i = 0; i < n; i++)    for (int j = 0; j < n; j++) {     int dx1 = A[i].x - start.x;     int dy1 = A[i].y - start.y;     int dx2 = A[j].x - A[i].x;     int dy2 = A[j].y - A[i].y;     int dx3 = A[j].x - start.x;     int dy3 = A[j].y - start.y;     pair[i][j] = dx1 * dx1 + dy1 * dy1 + dx2 * dx2 + dy2 * dy2       + dx3 * dx3 + dy3 * dy3;     single[i] = 2 * (dx1 * dx1 + dy1 * dy1);    }   int ans = get(0);   System.out.println(ans);   int mask = 0;   while (mask + 1 != (1 << n)) {    Point temp = Next[mask];    if (temp.y == -1)     System.out.print("0 " + (temp.x + 1) + " ");    else {     System.out       .print("0 " + (temp.x + 1) + " " + (temp.y + 1) + " ");     mask |= (1 << temp.y);    }    mask |= (1 << temp.x);   }   System.out.println("0");  } }
5	public class A { 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());  State[] s = new State[n];  for(int i = 0; i < n; i++) {  st = new StringTokenizer(br.readLine());  s[i] = new State(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));  }  Arrays.sort(s);  int num = 2;  for(int i = 1; i < s.length; i++) {  int dist = s[i].x - s[i-1].x;  dist *= 2;  int size = s[i].d + s[i-1].d;  size += 2 * t;  if(dist == size)   num++;  else if(dist > size)   num += 2;  }  System.out.println(num); } static class State implements Comparable<State> {  public int x,d;  public State(int a, int b) {  x=a;  d=b;  }  public int compareTo(State s) {  return x - s.x;  } } }
6	public class E {  public static void main(String[] args) throws Exception {   BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));   int T = Integer.parseInt(bf.readLine());   for(int t=0; t<T; t++) {   StringTokenizer st = new StringTokenizer(bf.readLine());   int n = Integer.parseInt(st.nextToken());   int m = Integer.parseInt(st.nextToken());   int[][] a = new int[n][m];   for(int i=0; i<n; i++) {    st = new StringTokenizer(bf.readLine());    for(int j=0; j<m; j++) a[i][j] = Integer.parseInt(st.nextToken());    }      int[] max = new int[m];   for(int i=0; i<n; i++) {    for(int j=0; j<m; j++) {    if(a[i][j] > max[j]) max[j] = a[i][j];    }   }   int[][] pos = new int[m][2];   for(int i=0; i<m; i++) {    pos[i][0] = max[i];    pos[i][1] = i;   }   Arrays.sort(pos, new Comparator<int[]>() {    @Override    public int compare(int[] o1, int[] o2) {    return Integer.compare(o2[0], o1[0]);    }   });    int[][] new_a = new int[n][Math.min(n,m)];   for(int i=0; i<n; i++) {    for(int j=0; j<Math.min(n,m); j++) {    new_a[i][j] = a[i][pos[j][1]];    }   }   int exp = 1; for(int i=0; i<Math.min(n,m); i++) exp *= n;   int maxval = -1;   for(int i=0; i<exp; i++) {       int sum = 0;    for(int j=0; j<n; j++) {    int toAdd = 0;    int val = i;    for(int k=0; k<Math.min(n,m); k++) {     int tooAdd = new_a[(j+val)%n][k];     val /= n;     if(tooAdd > toAdd) toAdd = tooAdd;    }    sum += toAdd;    }    if(sum > maxval) maxval = sum;   }   out.println(maxval);   }           out.close(); System.exit(0);  } }
4	public class FireAgain {  Point[] coordinate; Queue<Point> q = new LinkedList<>();  boolean[][] vis; PrintStream out; int x, y;  boolean distance(Point word1, Point word2) {  if (Math.abs(word1.x - word2.x) == 1 && Math.abs(word1.y - word2.y) == 1)  return false;  if (Math.abs(word1.x - word2.x) == 1 && word1.y == word2.y)  return true;  if (word1.x == word2.x && Math.abs(word1.y - word2.y) == 1)  return true;  return false; }  void bfs(Point s) {  while (!q.isEmpty()) {  s = q.poll();   Point p = new Point();  p.x = s.x - 1;  p.y = s.y;   if (p.x >= 1 && p.x <= x && p.y >= 1 && p.y <= y) {   if (!vis[p.x][p.y]) {   vis[p.x][p.y] = true;   q.add(p);   }  }   p = new Point();  p.x = s.x + 1;  p.y = s.y;   if (p.x >= 1 && p.x <= x && p.y >= 1 && p.y <= y) {   if (!vis[p.x][p.y]) {   vis[p.x][p.y] = true;   q.add(p);   }  }   p = new Point();  p.x = s.x;  p.y = s.y - 1;   if (p.x >= 1 && p.x <= x && p.y >= 1 && p.y <= y) {   if (!vis[p.x][p.y]) {   vis[p.x][p.y] = true;   q.add(p);   }  }    p = new Point () ;  p.x = s.x ;  p.y = s.y + 1;    if (p.x >= 1 && p.x <= x && p.y >= 1 && p.y <= y) {   if (!vis[p.x][p.y]) {   vis[p.x][p.y] = true ;   q.add(p);      }  }   if (q.size() == 0)   out.print(s.x + " " + s.y);  }  }  public static void main(String[] args) throws FileNotFoundException {    FireAgain F = new FireAgain();  Scanner in = new Scanner (new FileReader("input.txt"));  F.out = new PrintStream(new File("output.txt"));   F.x = in.nextInt();  F.y = in.nextInt();  int l = 0;  F.vis = new boolean[F.x + 1][F.y + 1];  int k = in.nextInt();  for (int i = 0; i < k; i++) {  Point P = new Point(in.nextInt(), in.nextInt());  F.vis[P.x][P.y] = true;   F.q.add(P);  }  F.bfs(F.q.peek());  } }
1	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   FastScanner in = new FastScanner(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public int[] parse(FastScanner in, int n) {    String s = in.next();    int[] temp = new int[n];    for (int i = 0; i < n; ++i) {     temp[i] = s.charAt(i) - 'A';    }    return temp;   }   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.nextInt();    int[] s = parse(in, n);    Map<Integer, TreeSet<Integer>> map = new HashMap<>();    for (int i = 0; i < n; ++i) {     if (map.containsKey(s[i])) {      map.get(s[i]).add(i);     } else {      TreeSet<Integer> temp = new TreeSet<>();      temp.add(i);      map.put(s[i], temp);     }    }    int ans = Integer.MAX_VALUE;    for (int i = 0; i < n; ++i) {     int finalI = i;     final Int integer = new Int();     integer.x = i;     map.forEach((Integer x, TreeSet set) -> {      if (x != s[finalI]) {       Integer temp = (Integer) set.higher(finalI);       if (temp == null) {        integer.x = -2;       } else {        if (integer.x != -2)         integer.x = Integer.max(integer.x, temp);       }      } else {      }     });     if (integer.x != -2) {      ans = Integer.min(ans, integer.x - i + 1);     }    }    out.print(ans);   }   public class Int {    int x;    public Int() {     x = -1;    }   }  }  static class FastScanner {   private BufferedReader br;   private StringTokenizer st;   public FastScanner(File f) {    try {     br = new BufferedReader(new FileReader(f));    } catch (FileNotFoundException e) {     e.printStackTrace();    }   }   public FastScanner(InputStream inputStream) {    br = new BufferedReader(new InputStreamReader(inputStream));   }   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());   }  } }
5	public class ProblemA {  BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));  int[] readInts() throws IOException {   String[] strings = reader.readLine().split(" ");   int[] ints = new int[strings.length];   for(int i = 0; i < ints.length; i++) {    ints[i] = Integer.parseInt(strings[i]);   }   return ints;  }  void solve() throws IOException {   int[] tt = readInts();   int n = tt[0];   int m = tt[1];   int k = tt[2];   int[] a = readInts();   Arrays.sort(a);   for(int i = 0, j = a.length - 1; i < j; i++, j--) {    int t = a[i];    a[i] = a[j];    a[j] = t;   }   int ix = 0;   while(k < m && ix < n) {    k += a[ix++] - 1;   }   if(k < m) {    writer.println(-1);   }   else {    writer.println(ix);   }   writer.flush();  }  public static void main(String[] args) throws IOException {   new ProblemA().solve();  } }
4	public class C implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer st; Random rnd;  short[] qx, qy; boolean[][] used; final int[] dx = {1, -1, 0, 0}; final int[] dy = {0, 0, 1, -1};  void solve() throws IOException {  int n = nextInt(), m = nextInt();   qx = new short[n * m];  qy = new short[n * m];  used = new boolean[n][m];   int k = nextInt(), qs = 0, qt = 0;   for(int i = 0; i < k; i++) {  int x = nextInt() - 1, y = nextInt() - 1;  used[x][y] = true;  qx[qt] = (short) x;  qy[qt] = (short) y;  ++qt;  }   int rx = 0, ry = 0;   while(qs < qt) {  int cx = qx[qs], cy = qy[qs];  ++qs;    rx = cx;  ry = cy;    for(int z = 0; z < 4; z++) {   int nx = cx + dx[z], ny = cy + dy[z];     if(nx >= 0 && ny >= 0 && nx < n && ny < m && !used[nx][ny]) {   used[nx][ny] = true;   qx[qt] = (short) nx;   qy[qt] = (short) ny;   ++qt;   }  }  }   out.println((rx + 1) + " " + (ry + 1)); }  public static void main(String[] args) {  final boolean oldChecker = false;   if(oldChecker) {  new Thread(null, new C(), "yarrr", 1 << 24).start();  } else {  new C().run();  } }  public void run() {  try {  try {   in = new BufferedReader(new FileReader("input.txt"));   out = new PrintWriter(new FileWriter("output.txt"));  } catch (FileNotFoundException e) {   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()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
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 void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new BufferedWriter(new OutputStreamWriter(System.out));      solve();  out.flush();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  public int iread() throws Exception {  return Integer.parseInt(readword()); }  public double dread() throws Exception {  return Double.parseDouble(readword()); }  public long lread() throws Exception {  return Long.parseLong(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(); } }
5	public class d { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int N = in.nextInt();  int[] arr = new int[N];  for(int n=0;n<N;n++){  arr[n] = in.nextInt();  }   Wavelet waveyMcWaveFace = new Wavelet(arr);   BigInteger bigSum = BigInteger.ZERO;  for(int n=0;n<N;n++){            long amtPlus = arr[n] * (long)(waveyMcWaveFace.numValsBtwn(1, arr[n] - 2, 0, n)      + waveyMcWaveFace.numValsBtwn(arr[n] + 2, 2147483647, 0, n));        long amtMinus = waveyMcWaveFace.sumOfValsBtwn(1, arr[n] - 2, 0, n)    + waveyMcWaveFace.sumOfValsBtwn(arr[n] + 2, 2147483647, 0, n);     bigSum = bigSum.add(new BigInteger(""+(amtPlus - amtMinus)));  }   System.out.println(bigSum); } static class Wavelet{  int l = 2147483647, h = -2147483648;  int[] arr, ldex, hdex;  long[] sum;  Wavelet low = null, high = null;  Wavelet(int[] arr){  this.arr = arr;  for(int i : arr){   l = Math.min(l, i);   h = Math.max(h, i);  }  ldex = new int[arr.length + 1];  hdex = new int[arr.length + 1];  sum = new long[arr.length + 1];  int mid = l + (h - l) / 2;  for(int n = 0; n < arr.length; n++){   sum[n+1] = sum[n] + arr[n];   if(arr[n] > mid){   ldex[n+1] = ldex[n];   hdex[n+1] = hdex[n] + 1;   }   else{   ldex[n+1] = ldex[n] + 1;   hdex[n+1] = hdex[n];   }  }  if(l == h) return;  int[] larr = new int[ldex[arr.length]];  int[] harr = new int[hdex[arr.length]];  for(int n=0;n<arr.length;n++){   if(hdex[n] == hdex[n+1]){   larr[ldex[n]] = arr[n];   }   else{   harr[hdex[n]] = arr[n];   }  }  low = new Wavelet(larr);  high = new Wavelet(harr);  }   int kthLowest(int k, int ll, int rr){  if(l == h){   return arr[ll + k-1];  }  if(ldex[rr] - ldex[ll] >= k){   return low.kthLowest(k, ldex[ll], ldex[rr]);  }  return high.kthLowest(k - ldex[rr] + ldex[ll], hdex[ll], hdex[rr]);  }   int numValsBtwn(int lo, int hi, int ll, int rr){  if(hi < lo) return 0;  if(lo <= l && h <= hi){   return rr - ll;  }  if(l == h) return 0;  if(hi < high.l){   return low.numValsBtwn(lo, hi, ldex[ll], ldex[rr]);  }  if(low.h < lo){   return high.numValsBtwn(lo, hi, hdex[ll], hdex[rr]);  }  return low.numValsBtwn(lo, hi, ldex[ll], ldex[rr])   + high.numValsBtwn(lo, hi, hdex[ll], hdex[rr]);  }   long sumOfValsBtwn(int lo, int hi, int ll, int rr){  if(lo <= l && h <= hi){   return sum[rr] - sum[ll];  }  if(l == h) return 0;  if(hi < high.l){   return low.sumOfValsBtwn(lo, hi, ldex[ll], ldex[rr]);  }  if(low.h < lo){   return high.sumOfValsBtwn(lo, hi, hdex[ll], hdex[rr]);  }  return low.sumOfValsBtwn(lo, hi, ldex[ll], ldex[rr])   + high.sumOfValsBtwn(lo, hi, hdex[ll], hdex[rr]);  } } }
6	public class T { static Scanner in = new Scanner(); static PrintWriter out = new PrintWriter(System.out); static boolean adj[][]; static int n, m, from; static long memo[][]; static long Num_Cycle;  public static void main(String[] args) throws IOException {  n = in.nextInt();  m = in.nextInt();  adj = new boolean[n][n];  memo = new long[n][1 << n];  for (int i = 0; i < m; i++) {  int u = in.nextInt() - 1;  int v = in.nextInt() - 1;  adj[u][v] = adj[v][u] = true;  }  for (long arr[] : memo) {  Arrays.fill(arr, -1);  }  Num_Cycle = 0L;  for (int i = 0; i < n; i++) {  from = i;  Num_Cycle += dp(from, (1 << i));  }  out.println(Num_Cycle / 2);  out.flush();  out.close(); }  static long dp(int start, int mask) {  if (memo[start][mask] != -1) {  return (memo[start][mask]);  }  long ans = 0L;  if (adj[start][from] && Integer.bitCount(mask) >= 3) {                            ans++;  }  for (int i = from + 1; i < n; i++) {  if (adj[start][i] && ((mask & (1 << i)) == 0)) {   ans += dp(i, mask | (1 << i));  }  }  return memo[start][mask] = ans; }  static class Scanner {  BufferedReader br;  StringTokenizer st;  Scanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  Scanner(String file) throws FileNotFoundException {  br = new BufferedReader(new FileReader(file));  }  String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(next());  }  String nextLine() throws IOException {  return br.readLine();  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(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 boolean isSafe(int[][] chess, int row, int col) {  for (int i = row - 1, j = col; i >= 0; i--) {  if (chess[i][j] == 1) {   return false;  }  }  for (int i = col - 1, j = row - 1; i >= 0 && j >= 0; i--, j--) {  if (chess[i][j] == 1) {   return false;  }  }  for (int i = col - 1, j = row + 1; i >= 0 && j < chess.length; i--, j++) {  if (chess[i][j] == 1) {   return false;  }  }  return true; }  static String swap(String str, int i, int j) {  char temp;  char[] ch = str.toCharArray();  temp = ch[i];  ch[i] = ch[j];  ch[j] = temp;  return String.valueOf(ch); }  static String rev(String str) {  StringBuilder sb = new StringBuilder(str);  for (int i = str.length() - 1; i >= 0; i--) {  sb.append(str.charAt(i));  }  String s = sb.toString();  return s; }  static int swap(int a, int b) {  return a; }  static class pair {  int first;  int second;  public pair(int first, int second) {  this.first = first;  this.second = second;  } }  public static long power(long a, long b) {  long res = 1;  while (b > 0) {  if ((b & 1) != 0) {   res = (res * a) % 1000000007;  }  a = (a * a) % 1000000007;  b = b >> 1;  }  return res; }  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 String catoString(char[] ch) {  StringBuilder sb = new StringBuilder();  for (int i = 0; i < ch.length; i++) {  sb.append(ch[i]);  }  return sb.toString(); }  public static boolean isPrime(long n) {  if (n < 2) return false;  for (int i = 2; i * i <= n; i++) {  if (n % i == 0) return false;  }  return true; }  public static long gcd(long a, long b) {  if (b == 0) return a;  return gcd(b, a % b); }  public static long lcm(long a, long b) {  long d = gcd(a, b);  return (a * b) / d; }  static boolean isPowerOfTwo(long n) {  return (long)(Math.ceil(Math.log(n) / Math.log(2)))    == (long)(Math.floor(Math.log(n) / Math.log(2))); }  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());  }  double nextDouble() {  return Double.parseDouble(next());  }  String nextLine() {  String str = " ";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  } } }
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);   TaskF2 solver = new TaskF2();   solver.solve(1, in, out);   out.close();  }  static class TaskF2 {   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] = in.nextInt();    }    HashMap<Long, ArrayList<Interval>> map = new HashMap<>();    for (int i = 0; i < n; i++) {     long sum = 0;     for (int j = i; j < n; j++) {      sum += a[j];      if (map.containsKey(sum) == false) {       map.put(sum, new ArrayList<>());      }      ArrayList<Interval> arr = map.get(sum);      if (arr.isEmpty() || arr.get(arr.size() - 1).r < i) {       arr.add(new Interval(i, j));      } else if (arr.get(arr.size() - 1).r >= j) {       arr.set(arr.size() - 1, new Interval(i, j));      }     }    }    ArrayList<Interval> best = new ArrayList<>();    for (ArrayList<Interval> arr : map.values()) {     if (best.size() < arr.size()) {      best = arr;     }    }    out.println(best.size());    for (Interval i : best) {     out.println((i.l + 1) + " " + (i.r + 1));    }   }   class Interval {    int l;    int r;    Interval(int l, int r) {     this.l = l;     this.r = r;    }   }  }  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;   }  } }
1	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() {  public void run() {   try {   new Main().run();   } catch (IOException e) {   e.printStackTrace();   }  }  }.start(); }  BufferedReader in; PrintWriter out; StringTokenizer st = new StringTokenizer("");  private void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   boolean[] pr = new boolean[1001];  for (int i = 2; i <= 1000; i++)  if (!pr[i]) {   int l = 2 * i;   while (l <= 1000) {   pr[l] = true;   l += i;   }  }  Set<Integer> set = new HashSet<Integer>();  for (int i = 2; i < 1000; i++) {  for (int j = i + 1; j <= 1000; j++) {   if (!pr[j]) {   set.add(j + i + 1);   i = j - 1;   break;   }  }  }  int n = nextInt();  int k = nextInt();  int res = 0;  for (int i = 2; i <= n; i++) {  if (set.contains(i) && !pr[i])   res++;  }  if (res >= k)  out.println("YES");  else  out.println("NO");   in.close();  out.close(); }  void chk(boolean b) {  if (b)  return;  System.out.println(new Error().getStackTrace()[1]);  exit(999); } void deb(String fmt, Object... args) {  System.out.printf(Locale.US, fmt + "%n", args); } 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()); } String nextLine() throws IOException {  st = new StringTokenizer("");  return in.readLine(); } boolean EOF() throws IOException {  while (!st.hasMoreTokens()) {  String s = in.readLine();  if (s == null)   return true;  st = new StringTokenizer(s);  }  return false; } }
6	public class Main{     void pre() throws Exception{}  int n, t;  void solve(int TC) throws Exception{   n = ni();t = ni();   int[][] song = new int[n][];   for(int i = 0; i< n; i++)song[i] = new int[]{ni(), ni()-1};   long[][] dp = new long[1<<n][3];   for(int i = 0; i< dp.length; i++)    for(int j = 0; j< dp[i].length; j++)     dp[i][j] = -1;   pn(start(dp, song, 0, -1));  }  long start(long[][] dp, int[][] song, int mask, int prev){   long ti = 0;   for(int i = 0; i< n; i++){    if(((mask>>i)&1)==1)ti+=song[i][0];   }   if(ti==t)return 1;   if(prev != -1 && dp[mask][prev] != -1)return dp[mask][prev];   long ans = 0;   for(int i = 0; i< n; i++){    if(((mask>>i)&1)==0 && song[i][1] != prev && ti+song[i][0] <= t)     ans = (ans+start(dp, song, mask|(1<<i), song[i][1]))%mod;   }   if(prev!= -1)dp[mask][prev] = ans;   return ans;  }   void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}  long mod = (long)1e9+7, IINF = (long)1e18;  final int INF = (int)1e9, MX = (int)2e5+5;  DecimalFormat df = new DecimalFormat("0.00000000000");  double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-8;  static boolean multipleTC = false, memory = false;  FastReader in;PrintWriter out;  void run() throws Exception{   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();  }  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();  }  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 p(Object o){out.print(o);}  void pn(Object o){out.println(o);}  void pni(Object o){out.println(o);out.flush();}  String n()throws Exception{return in.next();}  String nln()throws Exception{return in.nextLine();}  int ni()throws Exception{return Integer.parseInt(in.next());}  long nl()throws Exception{return Long.parseLong(in.next());}  double nd()throws Exception{return Double.parseDouble(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;   }  } }
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());   }     long nextLong() {    return Long.parseLong(next());   }     double nextDouble() {    return Double.parseDouble(next());   }     String readNextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }     int[] readIntArray(int n) {    int[] a = new int[n];    for (int idx = 0; idx < n; idx++) {     a[idx] = nextInt();    }    return a;   }  } }
1	public class C {  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();  char[]a = next().toCharArray();  int[]cnt = new int[256];  for (int i = 0; i < n; i++) {  cnt[a[i]]++;  }  int alldiff = 0;  for (int i = 0; i < 256; i++) {  if (cnt[i] > 0)   alldiff++;  }  Arrays.fill(cnt, 0);  int diff = 0, right = -1, ans = n+5;  for (int i = 0; i < n; i++) {  if (right < i) {   cnt[a[i]]++;   diff = 1;   right = i;  }  while (right < n-1 && diff < alldiff) {   right++;   cnt[a[right]]++;   if (cnt[a[right]]==1)   diff++;  }  if (diff==alldiff && right-i+1 < ans) {   ans = right-i+1;  }  cnt[a[i]]--;  if (cnt[a[i]]==0)   diff--;  }  System.out.println(ans);  pw.close(); } private static int nextInt() throws IOException {  return Integer.parseInt(next()); } private static long nextLong() throws IOException {  return Long.parseLong(next()); } private static double nextDouble() throws IOException {  return Double.parseDouble(next()); } private static String next() throws IOException {  while (st==null || !st.hasMoreTokens())  st = new StringTokenizer(br.readLine());  return st.nextToken(); } }
1	public class Round1TaskB implements Runnable {  static PrintWriter pw = null;  static BufferedReader br = null;  StringTokenizer st = null;  public static void main(String[] args) throws IOException {   pw = new PrintWriter(new OutputStreamWriter(System.out));   br = new BufferedReader(new InputStreamReader(System.in));   (new Thread(new Round1TaskB())).start();  }  void nline() {   try {    st = new StringTokenizer(br.readLine());   } catch (IOException e) {   }  }  int ni() {   while (st == null || !st.hasMoreTokens())    nline();   return Integer.valueOf(st.nextToken());  }  double nd() {   while (st == null || !st.hasMoreTokens())    nline();   return Double.valueOf(st.nextToken());  }  long nl() {   while (st == null || !st.hasMoreTokens())    nline();   return Long.valueOf(st.nextToken());  }  String nwrd() {   while (st == null || !st.hasMoreTokens())    nline();   return st.nextToken();  }  String nextLine() {   try {    return br.readLine();   } catch (IOException e) {   }   return null;  }  boolean isDigit(char c) {   if (c <= '9' && c >= '0')    return true;   return false;  }   void rec(int t, int length) {   if (length == 0) {    return;   }   rec(t / 26, length - 1);   pw.print((char) ('A' + (t % 26)));  }  void RC(int i, int j) {   int num = 0;   for (int t = i; t < j; t++) {    num = num * 10 + format[t] - '0';   }   int len = 0, base = 1, total = 0;   while (true) {    base *= 26;    total += base;    len++;    if (num <= total)     break;   }   num -= total / 26;   rec(num, len);  }  void BC(int i, int j) {   int total = 0, base = 1, rest = 0;   for (int k = i; k< j; k++) {    total += base;    base *= 26;    rest = rest * 26 + format[k] - 'A';   }   pw.print(total + rest);  }  char format[];  public void solve() {   format = nwrd().toCharArray();   int L = format.length;   for (int i = 0; i < L - 1; i++) {    if (isDigit(format[i]) && (format[i + 1] == 'C')) {     RC(i + 2, L);     for (int j = 1; j <= i; j++) {      pw.print(format[j]);     }     pw.println();     return;    }   }   for (int i = 0; i < L; i++) {    if (isDigit(format[i])) {     pw.print('R');     for (int j = i; j < L; j++) {      pw.print(format[j]);     }     pw.print('C');     BC(0, i);     pw.println();     return;    }   }  }  public void run() {   int n = ni();   while (n-- > 0) {    solve();   }   pw.close();  } }
1	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) {    int n = in.nextInt();    int d = in.nextInt();    int[] x = new int[n + 1];    int ans = 2;    for (int i = 1; i <= n; i++) x[i] = in.nextInt();    for (int i = 1; i < n; i++) {     ans += (x[i + 1] - x[i] >= 2 * d) ? (x[i + 1] - x[i] == 2 * d ? 1 : 2) : 0;    }    out.print(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 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();   }  }  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 c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public interface SpaceCharFilter {    boolean isSpaceChar(int ch);   }  } }
4	public class p3 { 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()); }  byte nextByte() { return Byte.parseByte(next()); }  short nextShort() { return Short.parseShort(next()); }  long nextLong() { return Long.parseLong(next()); }  double nextDouble() { return Double.parseDouble(next()); }  String nextLine()  {   String str = "";   try {    str = br.readLine();   }   catch (IOException e) {    e.printStackTrace();   }   return str;  } }  public static void main(String[] args) {  FastReader fr=new FastReader();  byte t=fr.nextByte();  while(t-->0)  {  short n=fr.nextShort();  short a[]=new short [n];  for (short i=-1;++i<n;)   a[i]=fr.nextShort();    String s="1";  System.out.println(s);   for(short i=0;++i<n;)  {   if(a[i]==1)   {   s+=".1";   System.out.println(s);   }   else if(a[i]==a[i-1]+1)   {   int c=s.lastIndexOf(".");   s=s.substring(0,c+1)+a[i];   System.out.println(s);   }   else   {      for(;;)   {    s=s.substring(0,s.lastIndexOf("."));    int c=s.lastIndexOf(".");    int b=Integer.parseInt(s.substring(c+1,s.length()));    if(b+1==a[i])    {    s=s.substring(0,c+1)+a[i];    System.out.println(s);    break;    }   }   }  }  } } }
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 long scanLong() throws IOException {  return parseLong(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);  } } }
2	public class A {  public static void main(String[] args) {   FastScanner scanner = new FastScanner();   long x = scanner.nextLong();   long k = scanner.nextLong();   if (x==0) {    System.out.println("0");    return;   }   BigInteger M = BigInteger.valueOf(1000_000_000L+7);   BigInteger modus = BigInteger.valueOf(x).multiply(BigInteger.valueOf(2)).subtract(BigInteger.ONE).mod(M);   BigInteger operandi = BigInteger.valueOf(2).modPow(BigInteger.valueOf(k), M);   BigInteger result = modus.multiply(operandi).mod(M).add(BigInteger.ONE).mod(M);   System.out.println(result);  }  public static long gcd(long a, long b) {   if (b == 0) return a;   return gcd(b, a % b);  }  public static long lcm(long a, long b, long gcd) {   return a * (b / gcd);  }   public 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();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
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 printsp(int [] a) { for (int i = 0, n = a.length; i < n; print(a[i] + " "), i++); } 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()); } char nextChar() throws IOException { return (char) (br.read()); } String next() throws IOException { return nextToken(); } String nextLine() throws IOException { return br.readLine(); } int [] readInt(int size) throws IOException {  int [] array = new int [size];  for (int i = 0; i < size; i++) { array[i] = nextInt(); }  return array; } long [] readLong(int size) throws IOException {  long [] array = new long [size];  for (int i = 0; i < size; i++) { array[i] = nextLong(); }  return array; } double [] readDouble(int size) throws IOException {  double [] array = new double [size];  for (int i = 0; i < size; i++) { array[i] = nextDouble(); }  return array; } String [] readLines(int size) throws IOException {  String [] array = new String [size];  for (int i = 0; i < size; i++) { array[i] = nextLine(); }  return array; }  int gcd(int a, int b) {  if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);  a = Math.abs(a); b = Math.abs(b);  int az = Integer.numberOfTrailingZeros(a), bz = Integer.numberOfTrailingZeros(b);  a >>>= az; b >>>= bz;  while (a != b) {  if (a > b) { a -= b; a >>>= Integer.numberOfTrailingZeros(a); }    else { b -= a; b >>>= Integer.numberOfTrailingZeros(b); }  }  return (a << Math.min(az, bz)); }  long gcd(long a, long b) {  if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);  a = Math.abs(a); b = Math.abs(b);  int az = Long.numberOfTrailingZeros(a), bz = Long.numberOfTrailingZeros(b);  a >>>= az; b >>>= bz;  while (a != b) {  if (a > b) { a -= b; a >>>= Long.numberOfTrailingZeros(a); }    else { b -= a; b >>>= Long.numberOfTrailingZeros(b); }  }  return (a << Math.min(az, bz)); }  void shuffle(int [] a) {  Random r = new Random();  for (int i = a.length - 1, j, t; i >= 0; j = r.nextInt(a.length), t = a[i], a[i] = a[j], a[j] = t, i--); }  void shuffle(int [] a, int m) {  for (int i = 0, n = a.length, j = m % n, t; i < n; t = a[i], a[i] = a[j], a[j] = t, i++, j = (i * m) % n); }  void shuffle(long [] a) {  Random r = new Random();  for (int i = a.length - 1; i >= 0; i--) {  int j = r.nextInt(a.length);  long t = a[i]; a[i] = a[j]; a[j] = t;  } }  void shuffle(Object [] a) {  Random r = new Random();  for (int i = a.length - 1; i >= 0; i--) {  int j = r.nextInt(a.length);  Object t = a[i]; a[i] = a[j]; a[j] = t;  } }  int [] sort(int [] a) {  final int SHIFT = 16, MASK = (1 << SHIFT) - 1, SIZE = (1 << SHIFT) + 1;  int n = a.length, ta [] = new int [n], ai [] = new int [SIZE];  for (int i = 0; i < n; ai[(a[i] & MASK) + 1]++, i++);  for (int i = 1; i < SIZE; ai[i] += ai[i - 1], i++);  for (int i = 0; i < n; ta[ai[a[i] & MASK]++] = a[i], i++);  int [] t = a; a = ta; ta = t;  ai = new int [SIZE];  for (int i = 0; i < n; ai[(a[i] >> SHIFT) + 1]++, i++);  for (int i = 1; i < SIZE; ai[i] += ai[i - 1], i++);  for (int i = 0; i < n; ta[ai[a[i] >> SHIFT]++] = a[i], i++);  return ta; }  void flush() {  pw.flush(); }  void pause() {  flush(); System.console().readLine(); } }
2	public class Main { long sum ( long n ) { return (n*(n+1))/2; }  public void solve ( ) throws Exception {  Scanner in = new Scanner ( System.in );  long n = in.nextLong()-1;  long k = in.nextLong()-1;   long lo = 0, hi = k, mi;  while ( lo < hi )  {  mi = ( lo + hi ) / 2;  if ( sum(k)-sum(k-mi-1) <= n ) lo = mi+1;  else hi = mi;  }   long ans = lo;  n -= ( sum(k) - sum(k-ans) );  k -= ans;  if ( n > k ) println ( "-1" );  else if ( n == 0 ) println ( ans );  else println ( (ans+1) ); }  public static void main ( String[] args ) throws Exception { (new Main()).solve(); } public static void print ( Object o ) { System.out.print ( o ); } public static void println ( Object o ) { System.out.println ( o ); } public static void println ( ) { System.out.println ( ); } }
1	public class CFA {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  private static final long MOD = 1000L * 1000L * 1000L + 7;  private static final int[] dx = {0, -1, 0, 1};  private static final int[] dy = {1, 0, -1, 0};  private static final String yes = "Yes";  private static final String no = "No";  void solve() throws IOException {   int n = nextInt();   long d = nextInt();   long[] arr = nextLongArr(n);   Set<Long> res = new HashSet<>();   for (long cur : arr) {    if (findMin(cur - d, arr) == d) {     res.add(cur - d);    }    if (findMin(cur + d, arr) == d) {     res.add(cur + d);    }   }   outln(res.size());  }  long findMin(long cur, long[] arr) {   long res = Long.MAX_VALUE;   for (long v : arr) {    res = Math.min(res, Math.abs(v - cur));   }   return res;  }  void shuffle(int[] a) {   int n = a.length;   for(int i = 0; i < n; i++) {    int r = i + (int) (Math.random() * (n - i));    int tmp = a[i];    a[i] = a[r];    a[r] = tmp;   }  }  long gcd(long a, long b) {   while(a != 0 && b != 0) {    long c = b;    b = a % b;    a = c;   }   return a + b;  }  private void outln(Object o) {   out.println(o);  }  private void out(Object o) {   out.print(o);  }  private void formatPrint(double val) {   outln(String.format("%.9f%n", val));  }  public CFA() 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 CFA();  }  public long[] nextLongArr(int n) throws IOException{   long[] res = new long[n];   for(int i = 0; i < n; i++)    res[i] = nextLong();   return res;  }  public int[] nextIntArr(int n) throws IOException {   int[] res = new int[n];   for(int i = 0; i < n; i++)    res[i] = nextInt();   return res;  }  public String nextToken() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return null;    }   }   return st.nextToken();  }  public String nextString() {   try {    return br.readLine();   } catch (IOException e) {    eof = true;    return null;   }  }  public int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  public long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  public double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
4	public class A {  static int[] dx = {-1, 0, 1, 0};  static int[] dy = {0, 1, 0, -1};  public static void main(String[] args) throws Exception {   Scanner sc = new Scanner("input.txt");   PrintWriter out = new PrintWriter("output.txt");   int n = sc.nextInt(), m = sc.nextInt(), k = sc.nextInt();   int[][] dist = new int[n][m];   for(int[] a : dist) Arrays.fill(a, -1);   Queue<Point> q = new LinkedList<>();   for(int i = 0; i < k; i++)   {    int x = sc.nextInt() - 1, y = sc.nextInt() - 1;    dist[x][y] = 0;    q.add(new Point(x, y));   }   int ansX = -1, ansY = -1;   while(!q.isEmpty())   {    Point cur = q.remove();    ansX = cur.x; ansY = cur.y;    for(int i = 0; i < 4; i++)    {     int x = cur.x + dx[i], y = cur.y + dy[i];     if(x != -1 && y != -1 && x != n && y != m && dist[x][y] == -1)     {      q.add(new Point(x, y));      dist[x][y] = dist[cur.x][cur.y] + 1;     }    }   }   out.println((ansX + 1) + " " + (ansY + 1));   out.flush();   out.close();  }  static class Scanner  {   StringTokenizer st;   BufferedReader br;   public Scanner(InputStream system) {br = new BufferedReader(new InputStreamReader(system));}   public Scanner(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 String nextLine()throws IOException{return br.readLine();}   public int nextInt() throws IOException {return Integer.parseInt(next());}   public double nextDouble() throws IOException {return Double.parseDouble(next());}   public char nextChar()throws IOException{return next().charAt(0);}   public Long nextLong()throws IOException{return Long.parseLong(next());}   public boolean ready() throws IOException{return br.ready();}   public void waitForInput() throws InterruptedException {Thread.sleep(4000);}  } }
3	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[] arr = new int[n];   arr[0] = sc.nextInt();   for (int i = 1; i < n; i++) {    arr[i] = arr[i - 1] + sc.nextInt();   }   HashMap<Integer, List<Pair>> map = new HashMap<>();   for (int i = 0; i < n; i++) {    if (map.containsKey(arr[i])) map.get(arr[i]).add(new Pair(0, i));    else {     List<Pair> l = new ArrayList<>();     l.add(new Pair(0, i));     map.put(arr[i], l);    }    for (int j = 1; j <= i; j++) {     int ss = arr[i] - arr[j - 1];     if (map.containsKey(ss)) map.get(ss).add(new Pair(j, i));     else {      List<Pair> l = new ArrayList<>();      l.add(new Pair(j, i));      map.put(ss, l);     }    }   }   List<Pair> el = null;   for (List<Pair> value : map.values()) {    value.sort(Comparator.comparingInt(Pair::getStart));    ArrayList<Pair> ps = new ArrayList<>();    Pair last = value.get(0);    for (int i = 1; i < value.size(); i++) {     if (last.getEnd() < value.get(i).getStart()) {      ps.add(last);      last = value.get(i);     }     else if (last.getEnd() > value.get(i).getEnd()) last = value.get(i);    }    ps.add(last);    if (el == null) el = ps;    else if (ps.size() > el.size()) el = ps;   }   System.out.println(el.size());   for (Pair pair : el) {    System.out.println((pair.getStart() + 1) + " " + (pair.getEnd() + 1));   }  } } class Pair {  private final int start;  private final int end;  public int getStart() {   return start;  }  public int getEnd() {   return end;  }  public Pair(int start, int end) {   this.start = start;   this.end = end;  } }
4	public class P23A { public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  String input = scan.nextLine();  System.out.println(F(input)); }   static int F(String string){  int ans =0;  for (int i = 0; i < string.length(); i++) {  for (int j = 1; j < string.length()-i; j++) {   String s = string.substring(i, i+j);   int a=string.indexOf(s);   int b=string.lastIndexOf(s);   if ( a >= 0 && b >=0 && a !=b) ans =Math.max(ans, s.length());  }  }  return ans; } }
2	public class B {  public static void main(String[] args) {  PrintWriter out = new PrintWriter(System.out);  Scanner sc = new Scanner(System.in);  long N = sc.nextLong();  long K = sc.nextLong();  if (N == 1) {  out.println(0);  } else if (N <= K) {  out.println(1);  } else if (N > ((K - 1) * (K)) / 2 + 1) {  out.println(-1);  } else {   long lo = 1;  long hi = Math.max(K - 2, 1);   long big = ((K - 2) * (K - 1)) / 2;   long prevmid = -1;   for (int i = 0; i < 10000; i++) {   long mid = (lo + hi) / 2;              long tmp = ((K - 2 - mid) * (K - 2 - mid + 1)) / 2;      if (K + big - tmp > N) {   hi = mid;   } else if (K + big - tmp < N) {   lo = mid;   if (prevmid == mid)    lo++;   lo = Math.min(lo, hi);   prevmid = mid;   } else {   lo = mid;   break;   }  }  out.println((long) lo + 1);  }  sc.close();  out.close(); } }
5	public class Start {  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());  }  long readLong() throws IOException {   return Long.parseLong(readString());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  public static void main(String[] args) {   new Start().run();  }  public static void mergeSort(int[] a) {   mergeSort(a, 0, a.length - 1);  }  private static void mergeSort(int[] a, int levtIndex, int rightIndex) {   final int MAGIC_VALUE = 50;   if (levtIndex < rightIndex) {    if (rightIndex - levtIndex <= MAGIC_VALUE) {     insertionSort(a, levtIndex, rightIndex);    } else {     int middleIndex = (levtIndex + rightIndex) / 2;     mergeSort(a, levtIndex, middleIndex);     mergeSort(a, middleIndex + 1, rightIndex);     merge(a, levtIndex, middleIndex, rightIndex);    }   }  }  private static void merge(int[] a, int levtIndex, int middleIndex,    int rightIndex) {   int length1 = middleIndex - levtIndex + 1;   int length2 = rightIndex - middleIndex;   int[] levtArray = new int[length1];   int[] rightArray = new int[length2];   System.arraycopy(a, levtIndex, levtArray, 0, length1);   System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);   for (int k = levtIndex, i = 0, j = 0; k <= rightIndex; k++) {    if (i == length1) {     a[k] = rightArray[j++];    } else if (j == length2) {     a[k] = levtArray[i++];    } else {     a[k] = levtArray[i] <= rightArray[j] ? levtArray[i++]       : rightArray[j++];    }   }  }  private static void insertionSort(int[] a, int levtIndex, int rightIndex) {   for (int i = levtIndex + 1; i <= rightIndex; i++) {    int current = a[i];    int j = i - 1;    while (j >= levtIndex && a[j] > current) {     a[j + 1] = a[j];     j--;    }    a[j + 1] = current;   }  }  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);   }  }  class LoL implements Comparable<LoL> {   int x;   int y;   public LoL(int x, int y) {    this.x = x;    this.y = y;   }   @Override   public int compareTo(LoL arg0) {    if (arg0.x == x) {     return y - arg0.y;    }    return arg0.x - x;   }  }  public void solve() throws IOException {     int n = readInt();   int a = readInt()-1;   int b = readInt()-1;   int [] d = new int [n];   for (int i = 0; i <n; i++){    d[i] = readInt();   }   mergeSort(d);   out.print(d[b+1]-d[b]);  } }
2	public class Test {  private static long sum(long value) {  long ans = 0;  while (value > 0) {  ans += value % 10;  value /= 10;  }  return ans; }  public static void main(String[] args) {   Scanner scan = new Scanner(System.in);  long n , s , ans = 0;  n = scan.nextLong();  s = scan.nextLong();  long current = s;  while (current <= n && current <= s + 20 * 9) {    long temp = sum(current);  if (current - temp >= s) {   ans ++;  }  current ++;  }  if (current <= n) {  ans += (n - current + 1);  }  System.out.println(ans);   }   }
4	public class P {  static int N, M, K; static int dx[] = { 0, 0, 1, -1, 1, 1, -1, -1 }; static int dy[] = { 1, -1, 0, 0, 1, -1, 1, -1 }; static Pair[] b;  static boolean isValid(int x, int y) {  return x >= 0 && y >= 0 && x < N && y < M; }  static class Pair {  int x, y;  Pair(int i, int j) {  x = i;  y = j;  } }  static Pair bfs() {  Queue<Pair> q = new LinkedList<Pair>();  int[][] dist = new int[N][M];  for (int i = 0; i < N; i++)  for (int j = 0; j < M; j++)   dist[i][j] = -1;  for (int i = 0; i < K; i++) {  dist[b[i].x][b[i].y] = 0;  q.add(b[i]);  }  while (!q.isEmpty()) {  Pair cur = q.remove();  for (int d = 0; d < 4; d++) {   int X = cur.x + dx[d];   int Y = cur.y + dy[d];   if (isValid(X, Y) && dist[X][Y] == -1) {   dist[X][Y] = dist[cur.x][cur.y] + 1;   Pair P = new Pair(X, Y);   q.add(P);   }  }  }  int max = -1;  Pair MX = null;  for (int i = 0; i < N; i++)  for (int j = 0; j < M; j++) {   if (dist[i][j] > max) {   max = dist[i][j];   MX = new Pair(i + 1, j + 1);   }  }  return MX; }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner("input.txt");  PrintWriter out = new PrintWriter("output.txt");     N = sc.nextInt();  M = sc.nextInt();  K = sc.nextInt();  b = new Pair[K];  for (int i = 0; i < K; i++)  b[i] = new Pair(sc.nextInt() - 1, sc.nextInt() - 1);  Pair last = bfs();  out.println((last.x) + " " + (last.y));  out.flush();  out.close(); }  static class Scanner {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s));  }  public Scanner(String f) throws FileNotFoundException {  br = new BufferedReader(new FileReader(f));  }  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 String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(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;  }  public int[] nextIntArray1(int n) throws IOException {  int[] a = new int[n + 1];  for (int i = 1; i <= n; i++)   a[i] = nextInt();  return a;  }  public int[] nextIntArraySorted(int n) throws IOException {  int[] a = nextIntArray(n);  Random r = new Random();  for (int i = 0; i < n; i++) {   int j = i + r.nextInt(n - i);   int t = a[i];   a[i] = a[j];   a[j] = t;  }  Arrays.sort(a);  return a;  }  public long[] nextLongArray(int n) throws IOException {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  public long[] nextLongArray1(int n) throws IOException {  long[] a = new long[n + 1];  for (int i = 1; i <= n; i++)   a[i] = nextLong();  return a;  }  public long[] nextLongArraySorted(int n) throws IOException {  long[] a = nextLongArray(n);  Random r = new Random();  for (int i = 0; i < n; i++) {   int j = i + r.nextInt(n - i);   long t = a[i];   a[i] = a[j];   a[j] = t;  }  Arrays.sort(a);  return a;  } } }
0	public class p481a {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   long l = sc.nextLong();   long r = sc.nextLong();   if (r - l <= 1) {    System.out.println("-1");   } else if (r - l >= 3) {    if (l % 2 == 0) {     System.out.println(l + " " + (l + 1) + " " + (l + 2));    } else {     System.out.println((l + 1) + " " + (l + 2) + " " + (l + 3));    }   } else {    long g1 = GCD(l, (l + 1));    long g2 = GCD((l + 1), (l + 2));    long g3 = GCD(l, r);    if (g1 == 1 && g2 == 1 && g3 != 1) {     System.out.println(l + " " + (l + 1) + " " + r);    } else {     System.out.println("-1");    }   }  }  public static long GCD(long a, long b) {   if (b == 0) return a;   return GCD(b, a % b);  } }
4	public class Solution23A {     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());   }     long readLong() throws IOException{     return Long.parseLong(readString());   }     double readDouble() throws IOException{     return Double.parseDouble(readString());   }     public static void main(String[] args){     new Solution23A().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{   char[] t = readString().toCharArray();   int max = 0;   for(int i = 0; i < t.length; i++){    for(int j = i + 1; j < t.length; j++){    for(int k = 0; k < t.length - j; k++){     if(t[i+k] == t[j+k]) max = max(max, k+1);     else break;    }    }   }   out.println(max);   }     int ModExp(int a, int n, int mod){   int res = 1;   while (n!=0)    if ((n & 1) != 0) {    res = (res*a)%mod;    --n;    }    else {    a = (a*a)%mod;    n >>= 1;    }   return res;   }        static class Utils {      private Utils() {}      public static void mergeSort(int[] a) {       mergeSort(a, 0, a.length - 1);     }      private static void mergeSort(int[] a, int leftIndex, int rightIndex) {       final int MAGIC_VALUE = 50;       if (leftIndex < rightIndex) {         if (rightIndex - leftIndex <= MAGIC_VALUE) {           insertionSort(a, leftIndex, rightIndex);         } else {           int middleIndex = (leftIndex + rightIndex) / 2;           mergeSort(a, leftIndex, middleIndex);           mergeSort(a, middleIndex + 1, rightIndex);           merge(a, leftIndex, middleIndex, rightIndex);         }       }     }      private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {       int length1 = middleIndex - leftIndex + 1;       int length2 = rightIndex - middleIndex;       int[] leftArray = new int[length1];       int[] rightArray = new int[length2];       System.arraycopy(a, leftIndex, leftArray, 0, length1);       System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);       for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {         if (i == length1) {           a[k] = rightArray[j++];         } else if (j == length2) {           a[k] = leftArray[i++];         } else {           a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];         }       }     }      private static void insertionSort(int[] a, int leftIndex, int rightIndex) {       for (int i = leftIndex + 1; i <= rightIndex; i++) {         int current = a[i];         int j = i - 1;         while (j >= leftIndex && a[j] > current) {           a[j + 1] = a[j];           j--;         }         a[j + 1] = current;       }     }   }          boolean isPrime(int a){   for(int i = 2; i <= sqrt(a); i++)    if(a % i == 0) return false;   return true;   }     static double distance(long x1, long y1, long x2, long y2){   return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));   }     static long gcd(long a, long b){   if(min(a,b) == 0) return max(a,b);   return gcd(max(a, b) % min(a,b), min(a,b));   }     static long lcm(long a, long b){   return a * b /gcd(a, b);   } }
4	public class Main {  public static void main(String[] args) throws IOException {   Main m = new Main();   m.run();   m.out.close();  }  void run() throws IOException {   int n = nextInt();   int m = nextInt();   int k = nextInt();   long[][] r = new long[n][m - 1];   long[][] d = new long[n - 1][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m - 1; j++) {     r[i][j] = nextInt();    }   }   for (int i = 0; i < n - 1; i++) {    for (int j = 0; j < m; j++) {     d[i][j] = nextInt();    }   }   if (k % 2 != 0) {    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      out.print(-1+" ");     }     out.println();    }    return;   }   long[][][] dp = new long[n][m][k + 1];   for (int kk = 2; kk <= k; kk += 2)    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      long ans = (long) 1e18;      if (i + 1 < n) {       ans = Math.min(ans, dp[i + 1][j][kk - 2] + d[i][j]*2);      }      if (i - 1 > -1) ans = Math.min(ans, dp[i - 1][j][kk - 2] + d[i - 1][j]*2);      if (j + 1 < m) ans = Math.min(ans, dp[i][j + 1][kk - 2] + r[i][j]*2);      if (j - 1 > -1) ans = Math.min(ans, dp[i][j - 1][kk - 2] + r[i][j - 1]*2);      dp[i][j][kk] = ans;     }    }   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     out.print(dp[i][j][k] + " ");    }    out.println();   }  }   int gcd(int a, int b) {   while (a % b != 0) {    int h = a % b;    a = b;    b = h;   }   return b;  }  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  StringTokenizer in = new StringTokenizer("");    class pil implements Comparable<pil> {   int first;   long second;   pil(int f, long s) {    this.first = f;    this.second = s;   }   public int compareTo(pil o) {    if (first != o.first) return Integer.compare(first, o.first);    return Long.compare(second, o.second);   }  }  class pii implements Comparable<pii> {   int fi;   int se;   pii(int f, int s) {    se = s;    fi = f;   }   public int compareTo(pii o) {    if (fi != o.fi) return Integer.compare(fi, o.fi);    return Integer.compare(se, o.se);   }  }  class pis implements Comparable<pis> {   int fi;   String s;   pis(int f, String s) {    this.s = s;    fi = f;   }   public int compareTo(pis o) {    return Integer.compare(fi, o.fi);   }  }  class vert {   int to;   int iter;   int idx;   int ed;   vert(int s, int f, int zz, int gg) {    to = s;    iter = f;    idx = zz;    ed = gg;   }  }   class pll implements Comparable<pll> {   long first;   long second;   pll(long f, long s) {    this.first = f;    this.second = s;   }   public int compareTo(pll o) {    if (first != o.first) return Long.compare(first, o.first);    return Long.compare(second, o.second);   }  }  class pli implements Comparable<pli> {   long first;   int second;   pli(long f, int s) {    this.first = f;    this.second = s;   }   public int compareTo(pli o) {    if (first != o.first) return Long.compare(first, o.first);    return Integer.compare(second, o.second);   }  }  boolean hasNext() throws IOException {   if (in.hasMoreTokens()) return true;   String s;   while ((s = br.readLine()) != null) {    in = new StringTokenizer(s);    if (in.hasMoreTokens()) return true;   }   return false;  }  String nextToken() throws IOException {   while (!in.hasMoreTokens()) {    in = new StringTokenizer(br.readLine());   }   return in.nextToken();  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  } }
2	public class Div2_489C {  static final long MOD = 1_000_000_007;  public static void main(String[] args) throws IOException {  BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  PrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  StringTokenizer inputData = new StringTokenizer(reader.readLine());  long st = Long.parseLong(inputData.nextToken());  if(st == 0) {  printer.println(0);  printer.close();  return;  }  st %= MOD;  long years = Long.parseLong(inputData.nextToken());  long[][] res = exp(years);  long ans = (res[0][0] * st % MOD * 2 % MOD + res[0][1] * (-1 + MOD) % MOD) % MOD;  printer.println(ans);  printer.close(); }  static long[][] exp(long pow) {  long[][] cBase = base;  long[][] res = { { 1, 0 }, { 0, 1 } };  while (pow != 0) {  if ((pow & 1) != 0) {   res = mult(res, cBase);  }  cBase = mult(cBase, cBase);  pow >>= 1;  }  return res; }  static long[][] base = { { 2, 1 }, { 0, 1 } };  static long[][] mult(long[][] a, long[][] b) {  long[][] res = new long[2][2];  for (int i = 0; i < 2; i++) {  for (int j = 0; j < 2; j++) {   res[i][j] = (a[i][0] * b[0][j] % MOD + a[i][1] * b[1][j] % MOD) % MOD;  }  }  return res; } }
2	public class A992{  long mod = 1000000007L;  private void solve() throws Exception {  long x = nextLong();  long k = nextLong();  if(x == 0) {  out.println(0);  return;  }  x = x%mod;  long res = (((x*pow(2,k+1))%mod + (mod-pow(2,k))%mod)%mod+1)%mod;   out.println(res); }  long pow(long m, long n){  long res = 1;  while(n > 0){   if(n % 2 == 1)res = (res*m)%mod;   m = (m*m)%mod;   n = n/2;  }  return res; }   public static void main(String[] args) {  (new A992()).run(); }  private BufferedReader in; private PrintWriter out; private StringTokenizer tokenizer;  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  tokenizer = null;  out = new PrintWriter(System.out);  solve();  in.close();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  private int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  private long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  private float nextFloat() throws IOException {  return Float.parseFloat(nextToken()); }  private String nextLine() throws IOException {  return new String(in.readLine()); }  private String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  tokenizer = new StringTokenizer(in.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);  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;  }  @Override  public String toString() {  return String.format("(%d,%d)", val, 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;  }  public static int fsb(int n) {  return (int)((Math.log10(n & -n)) / Math.log10(2)) + 1;  }  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>() {   @Override   public int compare(final data o1, final data o2) {   return -(o1.val - o2.val);   }  });  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());  }  } }
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);   TaskF solver = new TaskF();   solver.solve(1, in, out);   out.close();  }  static class TaskF {   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] = in.nextInt(); }    Map<Integer, List<Range>> rgs = new HashMap<Integer, List<Range>>();    for (int i = 0; i < n; i++) {     int s = 0;     for (int j = i; j < n; j++) {      s += a[j];      if (rgs.get(s) == null) { rgs.put(s, new ArrayList<Range>()); }      rgs.get(s).add(new Range(i, j));     }    }    Iterator it = rgs.entrySet().iterator();    List<Range> ans = new ArrayList<Range>();    while (it.hasNext()) {     Map.Entry pair = (Map.Entry) it.next();     int sum = (int) pair.getKey();     List<Range> ranges = rgs.get(sum);     List<Range> cand = new ArrayList<Range>();     for (Range r : ranges) {      if (cand.size() == 0) {       cand.add(r);       continue;      }      if (cand.get(cand.size() - 1).j < r.i) {       cand.add(r);      } else {       if (cand.get(cand.size() - 1).j > r.j) {        cand.remove(cand.size() - 1);        cand.add(r);       }      }     }     if (cand.size() > ans.size()) {      ans = cand;     }    }    out.println(ans.size());    for (Range r : ans) {     out.println((r.i + 1) + " " + (r.j + 1));    }   }   public class Range implements Comparable {    public int i;    public int j;    public Range(int i, int j) {     this.i = i;     this.j = j;    }    public int compareTo(Object o) {     Range t = (Range) o;     if (this.i == t.i) {      if (this.j < t.j) return 1;      else return 0;     }     if (this.i < t.i) return 1;     return 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());   }  } }
3	public class Main{ class Node implements Comparable<Node>{  int l;  int r;  public Node(int l,int r){   this.l=l;   this.r=r;  }  public int compareTo(Node c){   int t=Integer.compare(this.r,c.r);   if(t!=0) return t;   t=Integer.compare(this.l,c.l);   return t;  } }  void solve() {   int n=ni();   int a[]=new int[n+1];   long pref[]=new long[n+1];   for(int i=1;i<=n;i++){    a[i]=ni();    pref[i]=pref[i-1]+a[i];   }   PriorityQueue<Long> q=new PriorityQueue<>();   for(int i=1;i<=n;i++){    for(int j=i;j<=n;j++) q.offer(pref[j]-pref[i-1]);   }   int sz=1;   while(!q.isEmpty()){    long val=q.poll();    if(!mp.containsKey(val)){     mp.put(val,sz++);    }   }   vec=new Node[sz][];   int size[]=new int[sz];   for(int i=1;i<=n;i++){    for(int j=i;j<=n;j++) size[mp.get(pref[j]-pref[i-1])]++;   }   for(int i=1;i<sz;i++) vec[i]=new Node[size[i]];   for(int i=1;i<=n;i++){    for(int j=i;j<=n;j++) {     int idx=mp.get(pref[j]-pref[i-1]);     vec[idx][--size[idx]]=new Node(i,j);    }   }   for(int i=1;i<sz;i++) Arrays.sort(vec[i]);   for(int i=1;i<sz;i++){    solve(vec[i]);   }   pw.println(ans.size());   for(Node p : ans) pw.println(p.l+" "+p.r);   }  HashMap<Long,Integer> mp=new HashMap<>();  Node vec[][];  int cnt=0;  ArrayList<Node> ans=new ArrayList<>();  void solve(Node [] v){   int n=v.length;   if(n==0) return;   int dp[]=new int[n+1];   int prev[]=new int[n+1];   int mx[]=new int[n+1];   int mxid[]=new int[n+1];   for(int i=1;i<=n;i++){    Node p=v[i-1];    dp[i]=dp[i-1];    prev[i]=-1;    int l=1,r=i-1;    int idx=0;    while(l<=r){     int mid=(l+r)>>1;     if(v[mid-1].r<p.l){      idx=mid;      l=mid+1;     }else r=mid-1;    }    if(1+mx[idx]>dp[i]){     dp[i]=1+mx[idx];     prev[i]=mxid[idx];    }    mx[i]=mx[i-1];    mxid[i]=mxid[i-1];    if(dp[i]>mx[i]){     mx[i]=dp[i];     mxid[i]=i;    }    }   if (dp[n] > cnt){    cnt=dp[n];    ans.clear();    int id=n;    while(id>0){     if(dp[id]==dp[id-1]){      id--;      continue;     }     ans.add(new Node(v[id-1].l,v[id-1].r));     id=prev[id];    }   }  }  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 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 double nd() {   return Double.parseDouble(ns());  }  private char nc() {   return (char) skip();  }  private String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while (!(isSpaceChar(b))) {    sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }  private char[] ns(int n) {   char[] buf = new char[n];   int b = skip(), p = 0;   while (p < n && !(isSpaceChar(b))) {    buf[p++] = (char) b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }  private char[][] nm(int n, int m) {   char[][] map = new char[n][];   for (int i = 0; i < n; i++) map[i] = ns(m);   return map;  }  private int[] na(int n) {   int[] a = new int[n];   for (int i = 0; i < n; i++) a[i] = ni();   return a;  }  private int ni() {   int num = 0, b;   boolean minus = false;   while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;   if (b == '-') {    minus = true;    b = readByte();   }   while (true) {    if (b >= '0' && b <= '9') {     num = num * 10 + (b - '0');    } else {     return minus ? -num : num;    }    b = readByte();   }  }  private long nl() {   long num = 0;   int b;   boolean minus = false;   while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;   if (b == '-') {    minus = true;    b = readByte();   }   while (true) {    if (b >= '0' && b <= '9') {     num = num * 10 + (b - '0');    } else {     return minus ? -num : num;    }    b = readByte();   }  }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null;  private void tr(Object... o) {   if (INPUT.length() > 0) System.out.println(Arrays.deepToString(o));  } }
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 B {  public static void main(String[] args) throws IOException {   InputReader in = new InputReader();   int n = in.nextInt();   int k = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = in.nextInt();   if (k > n) {    System.out.println(-1 + " " + -1);    return;   }   int[] v = new int[100010];   int cnt = 0;   for (int i = 0; i < k; i++) {    if (v[a[i]] == 0) {     cnt++;    }    v[a[i]]++;   }   int i = k;   while (cnt < k && i < n) {    if (v[a[i]] == 0) {     cnt++;    }    v[a[i]]++;    i++;   }   if (cnt != k) {    System.out.println(-1 + " " + -1);   } else {    int st = 0;    while (st < n && st < i && v[a[st]] > 1) {     v[a[st]]--;     st++;    }    System.out.println((st+1) + " " + (i));   }  }  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());   }  } }
