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];   var ansMap = new HashMap<Integer, ArrayDeque<Pair>>();   for (int j = 1; j <= N; j++) {    pre[j] = pre[j - 1] + sc.nextInt();    for (int i = j; i >= 1; i--) {     int sum = pre[j] - pre[i - 1];         if (!ansMap.containsKey(sum) || ansMap.get(sum).getLast().r < i) {      var dq = ansMap.computeIfAbsent(sum, val -> new ArrayDeque<>());      dq.add(new Pair(i, j, sum));     }    }   }   var ans = new ArrayDeque<Pair>();   for (var group : ansMap.values()) {    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, 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 Main { 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=(new Num()).pow(2L,k+1);  long b=(new Num()).pow(2L,k);  long res=(a*x)%MOD-b+1;  if(res<0){res+=MOD;}  System.out.println(res%MOD); } } class Num{ long MOD=1000000007; 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; } }
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 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; } }
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();  } }
4	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() {  String s = nextToken();  for (int len = s.length(); len >= 1; len--) {  for (int i = 0; i + len <= s.length(); i++) {   int cnt = 0;   for (int j = 0; j + len <= s.length(); j++) {   boolean ok = true;   for (int k = 0; k < len; k++) {    if (s.charAt(i + k) != s.charAt(j + k)) {    ok = false;    break;    }   }   if (ok) {    cnt++;   }   }   if (cnt > 1) {   out.println(len);   return;   }  }  }  out.println(0); } }
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());  }   } }
6	public class Main {  static ArrayList<Integer> cols;  static int ans, n, a[][];  public static void main(String[] args) throws Exception {   Scanner sc = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int tc = sc.nextInt();   while (tc-- > 0) {    ans = 0;    n = sc.nextInt();    int m = sc.nextInt();    boolean[] taken = new boolean[m];    PriorityQueue<Pair> pq = new PriorityQueue<>();    a = new int[n][m];    for (int i = 0; i < n; i++)     for (int j = 0; j < m; j++) {      int cur = sc.nextInt();      pq.add(new Pair(i, j, cur));      a[i][j] = cur;     }    cols = new ArrayList<>();    while (!pq.isEmpty() && cols.size() < 8) {     Pair cur = pq.remove();     if (!taken[cur.j]) cols.add(cur.j);     taken[cur.j] = true;    }    solve(0,new int [cols.size()]);    out.println(ans);   }   out.flush();   out.close();  }  static void solve(int i, int[] p) {   if (i == cols.size()) {    int[] max = new int[n];    for (int k = 0; k < cols.size(); k++) {     int j = cols.get(k);     for (int ii = 0; ii < n; ii++) {      int idx = (ii + p[k]) % n;      max[idx] = Math.max(max[idx], a[ii][j]);     }    }    int poss = 0;    for (int x : max)     poss += x;    ans = Math.max(ans, poss);    return;   }   for (int j = 0; j < n; j++) {    p[i] = j;    solve(i + 1, p);   }  }   static class Pair implements Comparable<Pair> {   int i, j, val;   public Pair(int i, int j, int val) {    this.i = i;    this.j = j;    this.val = val;   }   @Override   public int compareTo(Pair o) {    return o.val - val;   }  }   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());   }   int[] nextIntArray(int n) throws IOException {    int[] a = new int[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }   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 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()); }  }
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;   }  } }
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 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) {   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;  } }
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 Dummy { private static long mod = 1000000007; public static void main(String[] args) throws IOException {  BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  String[] strs = reader.readLine().split(" ");  long x = Long.parseLong(strs[0]);  long k = Long.parseLong(strs[1]);  long twoPK = modPow(2, k);  long twoPK_1 = (twoPK * 2) % mod;  long res = ((twoPK_1 * (x % mod)) % mod - (twoPK - 1) + mod) % mod;  System.out.println(x == 0? x: res); }  private static long modPow(long base, long pow) {  long res = 1;  while(pow != 0) {  if((pow & 1) != 0) {   res = (res % mod * base % mod)%mod;  }  base = (base % mod * base % mod) % mod;  pow >>= 1;  }  return res; } }
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;  } } }
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 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");  } }
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(); } }
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();  } } }
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();  } }
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); } }
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;  } }
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); } }
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);  } }
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]); } }
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()); } }
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);  } }
4	public class a{ public static void main(String[] args) {  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(); j++) {   String first = str.substring(i,j);   for(int k=i+1; k<=str.length()-first.length(); k++) {   if(str.substring(k,k+first.length()).equals(first))    max = Math.max(max,first.length());   }  }  }  System.out.println(max); } }
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");   }  } }
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());   }  } }
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 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;  } }
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);  } }
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");  } }
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(); } }
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());  } }
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();  } }
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;  } }
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)); } }
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();  }}
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 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)));   }  } }
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()); } }
0	public class HelloWorld {  public static void main (String args [])  {   Scanner read = new Scanner(System.in);   int n = read.nextInt();   int n1 = n; boolean q = true;   while (n1 > 0)   {    if (n % n1 == 0)    {     if (check(n1))     {      System.out.print("YES");      q = false;      break;     }     }    n1--;   }   if (q) System.out.print("NO");    }  public static boolean check (int n)  {   int n1 = n;   while (n1 != 0)   {    if (n1 % 10 != 4 && n1 % 10 != 7) return false;    n1 /= 10;   }   return true;  } }
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);   }  } }
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 [] nums = new int[n];   args = br.readLine().split(" ");   for (int i = 0; i < n; i++) {    nums[i] = Integer.parseInt(args[i]);   }   Arrays.sort(nums);   int min = nums[0];   for (int i = 1; i < n; i++) {    if (nums[i]>min) {     System.out.println(nums[i]); return;    }   }   System.out.println("NO");  } }
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];   }  } }
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(); } }
1	public class E46A { public static void main(String[] args) {  FastScanner in = new FastScanner(System.in);  String[] sizes = {"XXXS", "XXS", "XS", "S", "M", "L", "XL", "XXL", "XXXL"};  int n = in.nextInt();  HashMap<String, Integer> a = new HashMap<>();  HashMap<String, Integer> b = new HashMap<>();  for (String s : sizes) {  a.put(s, 0);  b.put(s, 0);  }  for (int i = 0; i < n; i++) {  String s = in.next();  a.put(s, a.get(s) + 1);  }  for (int i = 0; i < n; i++) {  String s = in.next();  b.put(s, b.get(s) + 1);  }  for (String s : sizes) {  int cut = Math.min(a.get(s), b.get(s));  a.put(s, a.get(s) - cut);  b.put(s, b.get(s) - cut);  }  int changes = 0;  for (String s : sizes)  changes += a.get(s);  System.out.println(changes); }   public 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();  } } }
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();   }   }   }
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--;  }  } }
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) {  }  } } }
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");  } } }
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();}  } }
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);   }  } }
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];    String[] b = new String[n];    for (int i = 0; i < n; i++) {     a[i] = in.next();    }    for (int i = 0; i < n; i++) {     b[i] = in.next();    }    int ans = 0;    for (int i = 1; i < 5; i++) {     int a1 = 0, b1 = 0, c1 = 0;     for (int j = 0; j < n; j++) {      if (a[j].length() == i) {       if (a[j].charAt(i - 1) == 'M') {        a1++;       } else if (a[j].charAt(i - 1) == 'S') {        b1++;       } else {        c1++;       }      }     }     for (int j = 0; j < n; j++) {      if (b[j].length() == i) {       if (b[j].charAt(i - 1) == 'M') {        a1--;       } else if (b[j].charAt(i - 1) == 'S') {        b1--;       } else {        c1--;       }      }     }     if (a1 > 0) ans += a1;     if (b1 > 0) ans += b1;     if (c1 > 0) ans += c1;    }    out.println(ans);   }  }  static class InputReader {   private InputStream stream;   private byte[] inbuf = new byte[1024];   private int lenbuf = 0;   private int ptrbuf = 0;   public InputReader(InputStream stream) {    this.stream = stream;   }   private int readByte() {    if (lenbuf == -1) throw new UnknownError();    if (ptrbuf >= lenbuf) {     ptrbuf = 0;     try {      lenbuf = stream.read(inbuf);     } catch (IOException e) {      throw new UnknownError();     }     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;   }   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 * 10 + (b - '0');     } else {      return minus ? -num : num;     }     b = readByte();    }   }  }  static class OutputWriter extends PrintWriter {   public OutputWriter(OutputStream out) {    super(out);   }   public OutputWriter(Writer out) {    super(out);   }   public void close() {    super.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(((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 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 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 {  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);  } } }
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);  }  }
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);  } }
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;  }  }
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(); } }
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 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 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;  }   } }
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();} }
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--;  }  } }
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{  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 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(); }  }
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);   }  } }
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(); } }
4	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());  int len=s.length();  int ans=0;  for (int i=0;i<len-1;i++) {  for (int j=i+1;j<len;j++) {   int score=0;   boolean flag=true;   for (int k=0;k+j<len && flag;k++) {   if (s.charAt(i+k)==s.charAt(j+k)) {    score++;   } else {    flag=false;   }   }   if (score>ans) {   ans=score;   }  }  }  System.out.println(ans); } }
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;    }   }    } }
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;  } }  }
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; } }
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");  } }
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);   }  } }
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);   }  } }
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);  } }
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"); } }
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 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 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();  } }
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());  } }
6	public class Main { static int a[][],n; static boolean isClique[]; static int maxClique[]; static void DFS1(int p,int n,int S) {  if(p>n)  {  isClique[S]=true;  return ;  }  DFS1(p+1,n,S);  boolean mark=true;  for(int i=1;i<p;++i)  if((S>>(i-1)&1)==1&&a[p][i]==0)   mark=false;  if(mark)  DFS1(p+1,n,1<<(p-1)|S); } static void DFS2(int p,int n,int m,int S) {  if(p>n)  {  int cnt=0;  for(int i=m;i<=n;++i)   if((S>>(i-m)&1)==1)   ++cnt;  maxClique[S]=cnt;  return ;  }  DFS2(p+1,n,m,S);  boolean mark=true;  for(int i=m;i<p;++i)  if((S>>(i-m)&1)==1&&a[p][i]==0)   mark=false;  if(mark)  DFS2(p+1,n,m,1<<(p-m)|S); } public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  n=Integer.parseInt(sc.next());  a=new int [n+10][n+10];  int cap=Integer.parseInt(sc.next());  for(int i=1;i<=n;++i)  for(int j=1;j<=n;++j)   a[i][j]=Integer.parseInt(sc.next());  int m=(n+1)>>1;  isClique=new boolean [1<<m];  Arrays.fill(isClique,false);  DFS1(1,m,0);  maxClique=new int [1<<(n-m)];  Arrays.fill(maxClique,0);  DFS2(m+1,n,m+1,0);  for(int i=1;i<1<<(n-m);++i)  for(int j=m+1;j<=n;++j)   if((i>>(j-m-1)&1)==1)   maxClique[i]=Math.max(maxClique[i],maxClique[i-(1<<(j-m-1))]);  int ans=0,tmp[]=new int [m+10];  for(int i=0;i<1<<m;++i)  if(isClique[i])  {   int mask=0,cnt=0;   for(int j=1;j<=m;++j)   if((i>>(j-1)&1)==1)    tmp[++cnt]=j;   for(int j=m+1;j<=n;++j)   {   boolean mark=true;   for(int k=1;k<=cnt;++k)    if(a[j][tmp[k]]==0)    mark=false;   if(mark)    mask|=1<<(j-m-1);   }   ans=Math.max(ans,cnt+maxClique[mask]);  }  System.out.printf("%.9f\n",cap*cap*(ans-1)/2.0/ans); } }
2	public class C{ public static void main (String[] args) throws java.lang.Exception{  Scanner scan=new Scanner(System.in);  long x=scan.nextLong(), k=scan.nextLong();  long MOD = 1000000007;  if(x==0){  System.out.println("0");  return;  }  x %= MOD;  long ans= (((new myC()).fastPow(2L, k+1)*x)%MOD - (new myC()).fastPow(2L, k) + MOD + 1)% MOD;  ans %= MOD;  System.out.println(ans); } } class myC{ long MOD = 1000000007; long fastPow(long x, long k){  long bb=x%MOD, ans=1;  while(k > 0){  if((k&1)==1){   ans=(ans*bb)%MOD;  }  bb=(bb*bb)%MOD;  k>>=1;  }  return ans; } }
1	public class A {  public static void main(String[] args) throws Exception {   BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));          StringTokenizer st = new StringTokenizer(bf.readLine());     int n = Integer.parseInt(st.nextToken());   int d = Integer.parseInt(st.nextToken());   st = new StringTokenizer(bf.readLine());   int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());   int ans = 2;   for(int i=0; i<n-1; i++) {   int diff = a[i+1]-a[i];   if(diff == 2*d) ans++;   else if(diff > 2*d) ans += 2;   }   System.out.println(ans);       } }
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);  } }
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();  } }
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[]){  Scanner in = new Scanner(System.in);  int a = in.nextInt();  int x[] = new int[a];  for(int n=0;n<a;n++){  x[n] = in.nextInt();  }  int max = 1;  int t = 0;  HashMap<Integer, ArrayList<node>> map = new HashMap<Integer, ArrayList<node>>();  for(int n=0;n<a;n++){  int num = 0;  for(int m=n;m<a;m++){   num += x[m];   node node = new node(n, m);   if(!map.containsKey(num)){   ArrayList<node> list = new ArrayList<node>();   list.add(node);   map.put(num, list);   if(max == 1)t = num;   }   else{   ArrayList<node> list = map.get(num);   int left = 0;   int right = list.size()-1;     int res = list.size();   while(left <= right){    int mid = (left + right) >> 1;       if(list.get(mid).r >= n){    res = mid;    right = mid - 1;    }    else{    left = mid + 1;    }   }   if(res == list.size()){    list.add(node);    if(max < res+1){    max = res+1;    t = num;    }   }   else if(list.get(res).r>m){    list.set(res, node);    if(max < res){    max = list.size();    t = num;    }   }      }  }  }  System.out.println(max);  for(int n=0;n<max;n++){  System.out.println((map.get(t).get(n).l+1)+" "+(map.get(t).get(n).r+1));  }   } }
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());  } }
1	public class Main {  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  int n = s.nextInt(), d = s.nextInt();  int[] arr = new int[n];  for(int i = 0; i < n; i++){  arr[i] = s.nextInt();  }  Arrays.sort(arr);  int count = 0;  for(int i = 1; i < n; i++){  int dist = arr[i] - arr[i - 1];  if(dist > 2 * d){   count += 2;  }else if(dist == 2 * d){   count++;  }    }  System.out.println(count + 2);  } }
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();   String [] s={"M","L","S","XL","XS","XXL","XXS","XXXL","XXXS"};   int [] cnt=new int [9];   for(int i=0;i<n;i++){    String t=sc.next();    for(int j=0;j<9;j++)     if(t.equals(s[j]))      cnt[j]++;   }   for(int i=0;i<n;i++){    String t=sc.next();    for(int j=0;j<9;j++)     if(t.equals(s[j]))      cnt[j]--;   }   for(int i=0;i<9;i++)    cnt[i]=Math.abs(cnt[i]);   int ans=0;   for(int i=0;i<9;i++)    ans+=cnt[i];   pw.println(ans/2);   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 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;  } }
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 Main { static final long MOD = 998244353;  static boolean[] visited;  public static void main(String[] args) throws IOException {   FastScanner sc = new FastScanner();   int Q = sc.nextInt();   for (int q = 0; q < Q; q++) {   int N = sc.nextInt();   int M = sc.nextInt();   int[][] grid = new int[N][M];   int[][] maxes = new int[M][2];   for (int i = 0; i < M; i++)    maxes[i][1] = i;   for (int i = 0; i < N; i++) {    for (int j = 0; j < M; j++) {    grid[i][j] = sc.nextInt();    maxes[j][0] = Math.max(maxes[j][0],grid[i][j]);    }   }   maxes = sort(maxes);   int[] keyCols = new int[Math.min(M, N)];   for (int i = 0; i < keyCols.length; i++)    keyCols[i] = maxes[i][1];      int ans = 0;   for (int x = 0; x < (int)Math.pow(N,N); x++) {    int[] base = baseN(keyCols.length,x);    int ansx = 0;    for (int i = 0; i < N; i++) {     int r = 0;     for (int j = 0; j < keyCols.length; j++) {     r = Math.max(r,grid[(i+base[j])%N][keyCols[j]]);     }     ansx += r;    }    ans = Math.max(ans,ansx);   }   System.out.println(ans);   }  }   public static int[] baseN(int N, int num) {  int[] ans = new int[N];  for (int i = N-1; i >= 0; i--) {   int pow = (int)Math.pow(N,i);   ans[i] = num/pow;   num -= ans[i]*pow;  }  return ans;  }   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) {      return arr2[0]-arr1[0];   }  });  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;   }  } }
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 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 {  BufferedReader br; StringTokenizer in; PrintWriter out;  public static void main(String[] args) {  new Thread(new A()).start(); }  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 long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  public double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  public void solve() throws IOException {  String s = nextToken();  int max = 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 kv = 0;   for(int k = 0 ; k<= s.length() - sub.length(); k ++){   boolean ok = true;   for(int g = 0 ; g < sub.length(); g ++)   if (sub.charAt(g) != s.charAt(g+k)){    ok = false;    break;   }   if (ok) kv ++;   }   if (kv > 1)   max = Math.max(max, sub.length());  }    out.println(max); }  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 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(); } }
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]);  } } }
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);}     }
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(); } }
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();  } }
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);  } } }
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");  } }
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();  } }
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));    }   }
2	public class C {  static int mod = (int) (1e9+7);  static InputReader in;  static PrintWriter out;   public static void main(String[] args)  {   in = new InputReader(System.in);   out = new PrintWriter(System.out);      long x = in.nextLong();   long k = in.nextLong();     if(x == 0){    out.println(0);   }   else{     long mul = pow(2, k + 1, mod);   x %= mod;   mul = (mul * x) % mod;   long sub = pow(2, k, mod);   sub = (sub - 1 + mod) % mod;   mul = (mul - sub + mod) % mod;   out.println(mul);   }     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 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;   }   @Override   public String toString()   {    return x + " "+ y + " "+i;   }     }    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);   }  } }
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());  } } }
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)); }
6	public class E { public static void main(String[] args) {  MyScanner sc = new MyScanner();  int t = sc.nextInt();  for(int w = 0; w < t; w++) {  int n = sc.nextInt(), m = sc.nextInt();  TreeSet<X> set = new TreeSet<X>();  int[][] grid = new int[n][m];  for(int i = 0; i < n; i++)   for(int j = 0; j < m; j++) {   grid[i][j] = sc.nextInt();   set.add(new X(i, j, grid[i][j]));   }  Y[] top4 = new Y[n];  int sum = 0;  for(int i = 0; i < n; i++) {   top4[i] = new Y(set.pollLast());   sum += top4[i].a;  }  Arrays.sort(top4);  HashSet<String> strs = new HashSet<String>();  AAA[] sss = new AAA[n];  boolean[] used = new boolean[n];  if(n == 4) {   for(int i = 0; i < 4; i++) {   int max = -1, jj = -1;   for(int j = 0; j < 4; j++) {    if(!used[j] && top4[j].a > max) {    max = top4[j].a;    jj = j;    }   }   used[jj] = true;   sss[i] = new AAA(max, jj);   }   for(int i = 0; i < n; i++)   strs.add(top4[i].i + " " + top4[i].j);  }  int ans = sum;  if(n == 4 && top4[0].j == top4[1].j && top4[2].j == top4[3].j && top4[0].j != top4[2].j) {   if(two(top4[0], top4[1]) != two(top4[2], top4[3])) {   ans = 0;   int oneCol = two(top4[0], top4[1]) ? top4[2].j : top4[0].j;   for(int i = 0; i < n; i++)    for(int j = 0; j < m; j++)    if(!strs.contains(i + " " + j)){     int no = -1;     for(int k = 0; k < 4; k++)     if(j == oneCol && top4[k].j == oneCol && two(top4[k], new Y(new X(i, j, 0))))      no = k;     ans = max(ans, sum - sss[no == sss[3].i ? 2 : 3].a + grid[i][j]);    }   }  }  out.println(ans);  }  out.close(); } static class AAA {  int a, i;  public AAA(int A, int I) {  a = A;   i = I;  } } static boolean two(Y y1, Y y2) {  return (y1.i - y2.i + 4) % 4 == 2; } static class Y implements Comparable<Y> {  int i, j, a;  public Y(X x) {  i = x.i;  j = x.j;  a = x.a;  }  public int compareTo(Y x) {  if(j == x.j)   return i - x.i;  return j - x.j;  } } static class X implements Comparable<X> {  int i, j, a;  public X(int I, int J, int A) {  i = I;  j = J;  a = A;  }  public int compareTo(X x) {  if(a == x.a && i == x.i)   return j - x.j;  else if(a == x.a)   return i - x.i;  return a - x.a;  } } 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 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);  } }
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);   }  } }
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();  }   }   }
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;   }   } }
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);  } } }
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();  }  } }
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;   }  } }
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); } }
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();  } }
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]; }  }
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());   }  } }
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();  } }    }
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();} } }
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;   }  } }
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) {    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 {   }  } }
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);    }   }  } }
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 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);   }  } }
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(); } }
3	public class lets_do {  FastReader in;  PrintWriter out;  Helper_class h;  final long mod = 1000000009;  final int MAXN = 1000005;  final int lgN = 20;  final long INF = (long)1e18;  final long MAX_Ai = (long)1e12;  public static void main(String[] args) throws java.lang.Exception{   new lets_do().run();  }  void run() throws Exception{   in=new FastReader(System.in);   out = new PrintWriter(System.out);   h = new Helper_class();   int t = 1;   while(t--> 0)    solve();   out.flush();   out.close();  }  void solve(){   int n = h.ni();   long[] arr = new long[n];   int i = 0, j = 0;   for(i = 0; i < n; i++)    arr[i] = h.nl();   HashMap<Long, Integer> hmap = new HashMap<Long, Integer>();   int cnt = 0;   for(i = 0; i < n; i++){    long sum = 0;    for(j = i; j < n; j++){     sum += arr[j];     Integer x = hmap.get(sum);     if(x == null)      hmap.put(sum, cnt++);    }   }   TreeSet<Pair>[] tset = new TreeSet[cnt];   for(i = 0; i < cnt; i++)    tset[i] = new TreeSet<Pair>(com);   for(i = 0; i < n; i++){    long sum = 0;    for(j = i; j < n; j++){     sum += arr[j];     tset[hmap.get(sum)].add(new Pair(i, j));    }   }   int max = 0;   int ind = -1;   int max_x = 0, max_y = 0;   for(i = 0; i < cnt; i++){   int curr_y = tset[i].first().y;   int cnt1 = 1;    for(Pair yo : tset[i]){     if(yo.x > curr_y) {     cnt1++;     curr_y = yo.y;     }    }    if(max < cnt1) {    max = cnt1;    ind = i;    }   }   h.pn(max);   Pair hola_yee = new Pair(tset[ind].first().x, tset[ind].first().y);   h.pn((tset[ind].first().x + 1) +" "+(tset[ind].first().y + 1));   int curr_y = tset[ind].first().y;   for(Pair yo : tset[ind]){    if(yo.x > curr_y) {    curr_y = yo.y;    h.pn((yo.x + 1) +" "+(yo.y + 1));    }   }  }   static final Comparator<Pair> com=new Comparator<Pair>(){   public int compare(Pair a, Pair b){    if(Integer.compare(a.y, b.y) != 0)     return Integer.compare(a.y, b.y);    else     return Integer.compare(a.x, b.x);   }  };  class Pair{   int x;   int y;   Pair(int p, int q){    x = p;    y = q;   }  }  class Edge{   int u , v;   long wt;   Edge(int a, int b, long w){    u = a;    v = b;    wt = w;   }   int other(int x) {    return u ^ v ^ x;   }  }   class Helper_class{   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());}   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 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 add(long a, long b){    if(a>=mod)a%=mod;    if(b>=mod)b%=mod;    if(b<0)b+=mod;    a+=b;    if(a>=mod)a-=mod;    return a;   }  }  class FastReader{   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   public FastReader(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 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;   }  } }
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()); } }
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); } }
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(); } }
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();  } }
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);  } }
1	public class Test11 {  public static void main(String[] Args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   String s0 = sc.nextLine();   int s = 0;   int m = 0;   int l = 0;   int s1 = 0;   int l1 = 0;   int s2 = 0;   int l2 = 0;   int s3 = 0;   int l3 = 0;   for (int i = 0; i < n; i++) {    s0 = sc.nextLine();    if (s0.charAt(0) == 'S') s++;    if (s0.charAt(0) == 'M') m++;    if (s0.charAt(0) == 'L') l++;    if (s0.charAt(0) == 'X' && s0.length() == 2 && s0.charAt(s0.length() - 1) == 'S') s1++;    if (s0.charAt(0) == 'X' && s0.length() == 3 && s0.charAt(s0.length() - 1) == 'S') s2++;    if (s0.charAt(0) == 'X' && s0.length() == 4 && s0.charAt(s0.length() - 1) == 'S') s3++;    if (s0.charAt(0) == 'X' && s0.length() == 2 && s0.charAt(s0.length() - 1) == 'L') l1++;    if (s0.charAt(0) == 'X' && s0.length() == 3 && s0.charAt(s0.length() - 1) == 'L') l2++;    if (s0.charAt(0) == 'X' && s0.length() == 4 && s0.charAt(s0.length() - 1) == 'L') l3++;   }    int rs = 0;   int rm = 0;   int rl = 0;   int rs1 = 0;   int rl1 = 0;   int rs2 = 0;   int rl2 = 0;   int rs3 = 0;   int rl3 = 0;   for (int i = 0; i < n; i++) {    s0 = sc.nextLine();    if (s0.charAt(0) == 'S') rs++;    if (s0.charAt(0) == 'M') rm++;    if (s0.charAt(0) == 'L') rl++;    if (s0.charAt(0) == 'X' && s0.length() == 2 && s0.charAt(s0.length() - 1) == 'S') rs1++;    if (s0.charAt(0) == 'X' && s0.length() == 3 && s0.charAt(s0.length() - 1) == 'S') rs2++;    if (s0.charAt(0) == 'X' && s0.length() == 4 && s0.charAt(s0.length() - 1) == 'S') rs3++;    if (s0.charAt(0) == 'X' && s0.length() == 2 && s0.charAt(s0.length() - 1) == 'L') rl1++;    if (s0.charAt(0) == 'X' && s0.length() == 3 && s0.charAt(s0.length() - 1) == 'L') rl2++;    if (s0.charAt(0) == 'X' && s0.length() == 4 && s0.charAt(s0.length() - 1) == 'L') rl3++;   }    int ans = Math.abs(s1 - rs1) + Math.abs(s2 - rs2) + Math.abs(s3 - rs3) + (Math.abs(s - rs) + Math.abs(l - rl) + Math.abs(m - rm))/2;   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);   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);   }  } }
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;   }  } }
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());  } }
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);   }  } }
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 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);  } }
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);  } }
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);  } }
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)); } }
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);  } }
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);  } }
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; } }
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);   }  } }
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();  } }
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();  }  }
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;   }  } }
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);  } }
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);  } }
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"); } }
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");    } }
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);     } }
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 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"); } }
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);   }  } }
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 {  } }
1	public class Main {  FastScanner in;  PrintWriter out;  private void solve() throws IOException {   solveA();              }  private void solveA() throws IOException {   int n = in.nextInt();   TreeMap<String, Integer> map = new TreeMap<>();   for (int i = 0; i < n; i++) {    String s = in.next();    map.put(s, map.getOrDefault(s, 0) + 1);   }   for (int i = 0; i < n; i++) {    String s = in.next();    map.put(s, map.getOrDefault(s, 0) - 1);   }   long ans = 0;   for (String i : map.keySet())    ans += abs(map.get(i));   out.println(ans / 2);  }  private void solveB() throws IOException {   int n = in.nextInt();   int time = (int) 1e9, ans = -1;   for (int i = 0; i < n; i++) {    int a = in.nextInt() - i;    if ((a + (n - 1)) / n < time) {     time = (a + (n - 1)) / n;     ans = i;    }   }   out.println(ans + 1);  }  class PairC {   int i, j;   PairC(int i, int j) {    this.i = i;    this.j = j;   }   public String toString() {    return "(" + i + ", " + j + ")";   }  }  private void solveC() throws IOException {   int n = in.nextInt(), k = in.nextInt();   int[][] a = new int[4][n];   for (int i = 0; i < 4; i++)    for (int j = 0; j < n; j++)     a[i][j] = in.nextInt() - 1;   int[] empty = new int[4];   PairC[] from = new PairC[k];   for (int i = 1; i < 3; i++)    for (int j = 0; j < n; j++)     if (a[i][j] != -1)      from[a[i][j]] = new PairC(i, j);     else      empty[i]++;   PairC[] to = new PairC[k];   for (int i = 0; i < 4; i += 3)    for (int j = 0; j < n; j++)     if (a[i][j] != -1)      to[a[i][j]] = new PairC(i, j);   out.println(Arrays.toString(from));   out.println(Arrays.toString(to));   ArrayList<int[]> ans = new ArrayList<>();   int cnt = 0;   for (int i = 0; i < k; i++) {    if (abs(from[i].i - to[i].i) == 1) {     if (from[i].j == to[i].j) {      ans.add(new int[]{i, to[i].i, to[i].j});      a[from[i].i][from[i].j] = 0;      empty[from[i].i]++;      cnt++;     }    } else if (from[i].j == to[i].j && a[(from[i].i + to[i].i) / 2][to[i].j] == 0) {     ans.add(new int[]{i, (from[i].i + to[i].i) / 2, to[i].j});     ans.add(new int[]{i, to[i].i, to[i].j});     a[from[i].i][from[i].j] = 0;     empty[from[i].i]++;     cnt++;    }   }   for (int i = 1; i < 3; i++) {    if (empty[i] > 0) {     for (int j = 0; j < k; j++) {      if (from[j].i == i && true) {      }     }    }   }    while (true) {    boolean flag = false;    for (int i = 0; i < k; i++) {     if (abs(from[i].i - to[i].i) == 1 && abs(from[i].j - to[i].j) <= empty[i]) {     }    }    if (!flag)     break;   }   if (cnt == k) {    out.println(ans.size());    for (int[] i : ans) {     for (int j : i)      out.print(j + 1 + " ");     out.println();    }   } else    out.println(-1);  }  private void solveD() throws IOException {   int n = in.nextInt();   int[] a = new int[n * 2];   for (int i = 0; i < n * 2; i++)    a[i] = in.nextInt();   long ans = 0;   for (int i = 0; i < 2 * n; i += 2) {    int j = i + 1;    while (a[i] != a[j])     j++;    ans += j - i - 1;    while (j > i + 1)     a[j] = a[--j];   }   out.println(ans);  }  class PairE implements Comparable<PairE> {   long x, y;   int id;   boolean b;   PairE(long x, long y, int id) {    this.x = x;    this.y = y;    this.id = id;    b = false;   }   @Override   public int compareTo(PairE o) {    return x != o.x ? Long.compare(x, o.x) : Long.compare(y, o.y);   }  }  private void solveE() throws IOException {   int n = in.nextInt();   PairE[] p = new PairE[n];   for (int i = 0; i < n; i++)    p[i] = new PairE(in.nextLong(), in.nextLong(), i);   shuffle(p);   sort(p);   long X = 0, Y = 0;   long max = 225 * (long) 1e10;   for (int i = 0; i < n; i++) {    if ((X + p[i].x) * (X + p[i].x) + (Y + p[i].y) * (Y + p[i].y) < (X - p[i].x) * (X - p[i].x) + (Y - p[i].y) * (Y - p[i].y)) {     p[i].b = true;     X += p[i].x;     Y += p[i].y;    } else {     p[i].b = false;     X -= p[i].x;     Y -= p[i].y;    }   }   sort(p, comparingInt(o -> o.id));   for (int i = 0; i < n; i++) {    out.print(p[i].b ? 1 : -1);    if (i + 1 < n)     out.print(" ");   }   out.println();  }  void shuffle(PairE[] a) {   PairE b;   Random r = new Random();   for (int i = a.length - 1, j; i > 0; i--) {    j = r.nextInt(i + 1);    b = a[j];    a[j] = a[i];    a[i] = b;   }  }  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().replace(',', '.'));   }   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 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]);  }  Map memo=new HashMap();  int[] f=new int[n];  for(int i=0;i<n;i++){  if(!memo.containsKey(A[i])){   memo.put(A[i],1);  }  else{   int ct=(int)memo.get(A[i]);   memo.put(A[i],ct+1);  }  int tot=0;  if(memo.containsKey(A[i]-1)){   tot+=(int)memo.get(A[i]-1);  }  if(memo.containsKey(A[i]+1)){   tot+=(int)memo.get(A[i]+1);  }  tot+=(int)memo.get(A[i]);  f[i]=tot;  }  BigInteger res=new BigInteger("0");  for(int i=0;i<n;i++){  int tot1=i+1-f[i];  int tot2=0;  if(memo.containsKey(A[i]-1)){   tot2+=(int)memo.get(A[i]-1);  }  if(memo.containsKey(A[i]+1)){   tot2+=(int)memo.get(A[i]+1);  }  tot2+=(int)memo.get(A[i]);  tot2=n-i-1-(tot2-f[i]);    res=res.add(BigInteger.valueOf((long)(tot1-tot2)*(long)A[i]));  }  System.out.println(res); } }
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();  } }
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();  } }
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);    }   }    } }
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;  } }
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;  } } }
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(); } }
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();  } }
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");  } } }
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);  }  }
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); } }
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;  } } }
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);  } }
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);  } }
1	public class lets_do {  InputReader in;  PrintWriter out;  Helper_class h;  final long mod=1000000007;  public static void main(String[] args) throws java.lang.Exception{   new lets_do().run();  }  void run() throws Exception{   in=new InputReader();   out = new PrintWriter(System.out);   h = new Helper_class();   int t=1;   while(t-->0)    solve();   out.flush();    out.close();  }  long[] arr;  int n;  HashMap<Integer,Integer> hmap=new HashMap<Integer,Integer>();  HashSet<Integer> hset=new HashSet<Integer>();  void solve(){   n=h.ni();   long d=h.nl();   int i=0;   arr=new long[n];   for(i=0;i<n;i++)    arr[i]=h.nl();   int count=2;   for(i=0;i<n-1;i++){    if(Math.abs(arr[i]-arr[i+1])>(2*d))     count+=2;    else if(Math.abs(arr[i]-arr[i+1])==(2*d))     count+=1;   }   h.pn(count);  }  class Helper_class{   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());}   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 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 add(long a, long b){    if(a>=mod)a%=mod;    if(b>=mod)b%=mod;    if(b<0)b+=mod;    a+=b;    if(a>=mod)a-=mod;    return a;   }  }  class InputReader{   BufferedReader br;   StringTokenizer st;   public InputReader(){    br = new BufferedReader(new InputStreamReader(System.in));   }    public InputReader(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;   }  } }
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);  }  } }
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);   }  } }
4	public class YouAreGivenAString { public static void main(String[] args) throws Exception {   BufferedReader r = new BufferedReader(new InputStreamReader(System.in));  String s=r.readLine();  int max=0;  for(int i=1;i<s.length();i++){  for (int j = 0; j <= s.length()-i; j++) {   String sub=s.substring(j,j+i);   if(count(s,sub)>=2)   max=Math.max(max, i);  }  }  System.out.println(max); }  private static int count(String s, String sub) {  int l=sub.length();  int c=0;  for(int i=0;i<=s.length()-l;i++){  if(s.substring(i,i+l).equals(sub))   c++;  }  return c; } }
6	public class e1 {  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();  for(int q = 1; q <= t; q++){  ans = 0;  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] = Math.max(max[i], mat[j][i]);   }   pq.add(new Item(i, max[i]));  }  ArrayList<Item> guys = new ArrayList<Item>();  while(!pq.isEmpty() && guys.size() < 8){   Item tt = pq.poll();   guys.add(tt);  }  perm(guys, 0, new int[guys.size()]);  out.println(ans);  }  out.flush(); }  static int ans = 0;  static void perm(ArrayList<Item> guys, int me, int[] shift){  if(me == guys.size()){    int res = 0;  int[] best = new int[n];  for(int j = 0; j < guys.size(); j++){   Item g = guys.get(j);   int pp = g.a;   for(int i = 0; i < n; i++){   best[(i+shift[j])%n] = Math.max(best[(i+shift[j])%n], mat[i][pp]);   }  }  for(int i = 0; i < n; i++) res += best[i];  ans = Math.max(res, ans);  return;  }  for(int i = 0; i < n; i++){  shift[me] = i;  perm(guys, me+1, shift);  } }  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 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);   }     } }
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();} }
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(); } }
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(); } }
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) {   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);    } }
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);  } }
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();  } }
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;   }  } }
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 {   }  } }
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); } }
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());  } }
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);  } }
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());  } } }
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(); } }
4	public class CodeF { 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] = nextDouble();  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];  }  public String[] nextStringArray(int n)  {   String[] vals = new String[n];  for(int i = 0; i < n; i++)   vals[i] = next();  return vals;  }   Integer nextInteger()  {  String s = next();  if(s == null)   return null;  return Integer.parseInt(s);  }   int[][] nextIntMatrix(int n, int m)  {  int[][] ans = new int[n][];  for(int i = 0; i < n; i++)   ans[i] = nextIntArray(m);  return ans;  } }  static int[] compute_prefix_function(char[] p) {  int[] pi = new int[p.length]; pi[0] = -1; int k = -1;  for (int i = 1; i < p.length; i++) {   while (k >= 0 && p[k + 1] != p[i]) k = pi[k];   if (p[k + 1] == p[i]) k++; pi[i] = k;  }  return pi; }  static boolean KMP_Matcher(String pattern, String text) {  char[] p = pattern.toCharArray(); char[] t = text.toCharArray();  int[] pi = compute_prefix_function(p); int q = -1;  int cuenta = 0;  for (int i = 0; i < text.length(); i++) {   while (q >= 0 && p[q + 1] != t[i]) q = pi[q];   if (p[q + 1] == t[i]) q++;   if (q == p.length - 1) {    cuenta++;    q = pi[q];   }  }  return cuenta >= 2; }  public static void main(String[] args) {  Scanner sc = new Scanner();  String entrada = sc.next();  int mejor = 0;  for(int i = 0; i < entrada.length(); i++)  {  for(int j = i + 1; j <= entrada.length(); j++)  {   String sub = entrada.substring(i, j);   if(KMP_Matcher(sub, entrada))   mejor = Math.max(j - i, mejor);  }  }  System.out.println(mejor); } }
2	public class Main {  public static void main (String[] argv)  {  new Main(); }       boolean test = false;  int n;  long mod = 1000000007; public Main() {  FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));    long x = in.nextLong();  long k = in.nextLong();    if (x == 0) {   System.out.println(0);   return;  }    if (k == 0) {   x %= mod;   System.out.println((2*x%mod));   return;  }    x %= mod;    long f = pow(2, k);  long ans = ((2 * f * x % mod - f + 1) % mod + mod) % mod;    System.out.println(ans);   }  private long pow(long x, long y) {  long ans = 1;  while (y > 0) {   if (y % 2 == 1)     ans = ans * x % mod;   x = x * x % mod;   y /= 2;  }  return ans; }  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 int min(int a, int 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;   }  } }
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);  } }
3	public class Main{  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);   PrintWriter out=new PrintWriter(System.out);   int n=sc.nextInt();   int a[]=new int[n];   for (int i = 0; i <n ; i++) {    a[i]=sc.nextInt();   }   HashMap<Integer,ArrayList<Node>> h=new HashMap<>();   for (int i = 0; i <n ; i++) {    int sum=0;    for (int j = i; j <n ; j++) {     sum+=a[j];     if(h.containsKey(sum)){      h.get(sum).add(new Node(i,j));     }     else{      ArrayList<Node> temp=new ArrayList<>();      temp.add(new Node(i,j));      h.put(sum,temp);     }    }   }   long ans=0;   ArrayList<Integer> ansList=new ArrayList<>();   for(int x:h.keySet()){    Collections.sort(h.get(x), new Comparator<Node>() {     @Override     public int compare(Node o1, Node o2) {      return Integer.compare(o1.r,o2.r);     }    });     ArrayList<Node> l=h.get(x);       ArrayList<Integer> temp=new ArrayList<>();    int lasty=Integer.MIN_VALUE;    for (int i = 0; i <l.size() ; i++) {     if(l.get(i).l>lasty){      lasty=l.get(i).r;      temp.add(l.get(i).l);      temp.add(l.get(i).r);     }    }    if(ans<temp.size()){     ansList=temp;     ans=ansList.size();    }   }   out.println(ans/2);   for (int i = 0; i <ansList.size() ; i++) {    out.print((ansList.get(i)+1)+" ");    i++;    out.println((ansList.get(i)+1)+" ");   }    out.close();  }  static class Node{   int l,r;   public Node(int a,int b){    l=a;    r=b;   }  } }
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)); } }
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)); } }
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());  } }
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();  } }
2	public class C { 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); }  long mod = 1000000007;  public long pow(long k) {  if (k == 0) {  return 1L;  }  if (k == 1) {  return 2L;  }  if (k % 2 == 1) {  return (2L * pow(k - 1)) % mod;  }  long x = pow(k / 2);  return (x * x) % mod; }  public void solve() {  long x = in.nextLong();  if (x == 0) {  out.println(0);  return;  }  x %= mod;  long k = in.nextLong();  long pow = pow(k);  long ans = 1;  ans = (ans - pow + mod) % mod;  ans = (ans + (((2 * pow) % mod) * x) % mod) % mod;  out.println(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[] args) {  new C().run(); } }
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;   }  } }
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;   }  } }
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()); } }
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);  } }
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;   }  } }
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(); } }
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) {   }  }   }
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);    } }
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); } }
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 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();  } }
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");   }   }  } } }
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();  } } }
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();   }  } }
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);  } }
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);  } }
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);  } }
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); } }
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(); } }
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); }  }
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;  } } }
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];  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[] dp = new int[1<<n];  Arrays.fill(dp, -1);  dp[0] = 0;  for (int c : cols) {   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]);  } } }
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);  } }
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();  } }
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; } }
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 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);  } }
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());   }  } }
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;   }  } }
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; } }
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);   }  } }
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();   }  } }
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(); } }
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());}    } }
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");       } }
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();  } } }
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;  } } }
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 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)); } }
4	public class Solution {  public static void main(String[] args)  {   new Solution().calc();  }  void calc()  {   Scanner cin = new Scanner(System.in);   String s = cin.next();   int ret = 0;   for (int i = 0; i < s.length(); i++)   {    for (int j = i + 1; j < s.length(); j++)    {     for (int k = 0; j + k < s.length(); k++)     {      if (s.charAt(i + k) != s.charAt(j + k)) break;      ret = Math.max(k + 1, ret);     }    }   }   System.out.println(ret);  } }
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;} }
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();   }  } }
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());  } }
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 Task {  public static void solve() throws Exception { int n = nextInt(); int[] S = new int[n]; for(int i=0;i<n;i++) {  S[i] = nextInt();  if(i > 0) {  S[i] += S[i-1];  } } Map<Integer, List<L>> map = new HashMap<>(); for(int j=0;j<n;j++) {  for(int i=j;i>=0;i--) {  int sum = S[j];  if(i > 0) {   sum -= S[i-1];  }  L l = new L();  l.a = i;  l.b = j;  List<L> list = map.get(sum);  if(list == null) {   list = new ArrayList<>();   map.put(sum, list);  }  list.add(l);  } } List<L> longest = null; for(Integer sum: map.keySet()) {  List<L> list = map.get(sum);  Collections.sort(list);  List<L> list2 = new ArrayList<>(list.size());  int from = list.get(0).a;  for(L l: list) {  if(l.a >= from) {   list2.add(l);   from = l.b + 1;  }  }  if(longest == null || longest.size() < list2.size()) {  longest = list2;  } }  println(longest.size()); for(int i=0;i<longest.size();i++) {  L l = longest.get(i);  println((l.a+1) + " " + (l.b+1)); }  }   private static class L implements Comparable<L>{ int a; int b;  @Override public int compareTo(L l2) {  return Integer.valueOf(b).compareTo(l2.b); }  }   public static void main(String[] args) throws Exception { try {  fastReader = new FastReader(System.in);  systemOut = new BufferedOutputStream(System.out);  solve(); } finally {  systemOut.close(); }  }  private static FastReader fastReader = null;  private static BufferedOutputStream systemOut = null;  public static void print(Object obj) { print(obj.toString());  }  public static void print(String str) { try {  systemOut.write(str.getBytes("utf-8")); } catch (Exception ex) {  throw new RuntimeException(ex); }  }  public static void println(Object obj) { println(obj.toString());  }  public static void println(String str) { try {  print(str);  systemOut.write('\n'); } catch (Exception ex) {  throw new RuntimeException(ex); }  }  public static String next() { return fastReader.readNextToken(false);  }  public static String nextLine() { return fastReader.readNextToken(true);  }  public static int nextInt() { return Integer.parseInt(fastReader.readNextToken(false));  }  public static long nextLong() { return Long.parseLong(fastReader.readNextToken(false));  }  public static double nextDouble() { return Double.parseDouble(fastReader.readNextToken(false));  }  static class FastReader { private byte[] buf = new byte[65536]; private int ind = 0; private int maxInd = -1; private InputStream is = null; private boolean eof = false; private boolean lastCharRead = false;  public FastReader(InputStream is) {  this.is = is; }  public String readNextToken(boolean endOfLine) {  try {  StringBuilder sb = new StringBuilder();  boolean found = false;  while (true) {   if (lastCharRead) {  return null;   } else if (ind > maxInd) {  if (eof) {   lastCharRead = true;  } else {   fillBuffer();  }   }   byte b = '\n';   if (!lastCharRead) {  b = buf[ind++];   }   if (b == '\r') {     } else if ((b == '\n' && endOfLine) || (Character.isWhitespace(b) && !endOfLine)) {  if (found) {   break;  }   } else {  sb.append((char) b);  found = true;   }  }  return sb.toString();  } catch (Exception ex) {  throw new RuntimeException(ex);  } }  private void fillBuffer() {  try {  int read = is.read(buf, 0, buf.length);  if (read < buf.length) {   eof = true;  }  ind = 0;  maxInd = read - 1;  } catch (Exception ex) {  throw new RuntimeException(ex);  } }  }  public static class LST { public long[][] set; public int n;  public LST(int n) {  this.n = n;  int d = 1;  for (int m = n; m > 1; m >>>= 6, d++)  ;   set = new long[d][];  for (int i = 0, m = n >>> 6; i < d; i++, m >>>= 6) {  set[i] = new long[m + 1];  } }   public LST setRange(int r) {  for (int i = 0; i < set.length; i++, r = r + 63 >>> 6) {  for (int j = 0; j < r >>> 6; j++) {   set[i][j] = -1L;  }  if ((r & 63) != 0)   set[i][r >>> 6] |= (1L << r) - 1;  }  return this; }   public LST unsetRange(int r) {  if (r >= 0) {  for (int i = 0; i < set.length; i++, r = r + 63 >>> 6) {   for (int j = 0; j < r + 63 >>> 6; j++) {  set[i][j] = 0;   }   if ((r & 63) != 0)  set[i][r >>> 6] &= ~((1L << r) - 1);  }  }  return this; }  public LST set(int pos) {  if (pos >= 0 && pos < n) {  for (int i = 0; i < set.length; i++, pos >>>= 6) {   set[i][pos >>> 6] |= 1L << pos;  }  }  return this; }  public LST unset(int pos) {  if (pos >= 0 && pos < n) {  for (int i = 0; i < set.length && (i == 0 || set[i - 1][pos] == 0L); i++, pos >>>= 6) {   set[i][pos >>> 6] &= ~(1L << pos);  }  }  return this; }  public boolean get(int pos) {  return pos >= 0 && pos < n && set[0][pos >>> 6] << ~pos < 0; }  public LST toggle(int pos) {  return get(pos) ? unset(pos) : set(pos); }  public int prev(int pos) {  for (int i = 0; i < set.length && pos >= 0; i++, pos >>>= 6, pos--) {  int pre = prev(set[i][pos >>> 6], pos & 63);  if (pre != -1) {   pos = pos >>> 6 << 6 | pre;   while (i > 0)  pos = pos << 6 | 63 - Long.numberOfLeadingZeros(set[--i][pos]);   return pos;  }  }  return -1; }  public int next(int pos) {  for (int i = 0; i < set.length && pos >>> 6 < set[i].length; i++, pos >>>= 6, pos++) {  int nex = next(set[i][pos >>> 6], pos & 63);  if (nex != -1) {   pos = pos >>> 6 << 6 | nex;   while (i > 0)  pos = pos << 6 | Long.numberOfTrailingZeros(set[--i][pos]);   return pos;  }  }  return -1; }  private static int prev(long set, int n) {  long h = set << ~n;  if (h == 0L)  return -1;  return -Long.numberOfLeadingZeros(h) + n; }  private static int next(long set, int n) {  long h = set >>> n;  if (h == 0L)  return -1;  return Long.numberOfTrailingZeros(h) + n; }  @Override public String toString() {  List<Integer> list = new ArrayList<Integer>();  for (int pos = next(0); pos != -1; pos = next(pos + 1)) {  list.add(pos);  }  return list.toString(); }  } }
6	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);   TaskE solver = new TaskE();   solver.solve(1, in, out);   out.close();  }  static class TaskE {   public void solve(int testNumber, Input in, PrintWriter out) {    try {     int kt = in.readInt();     for (int nt = 0; nt < kt; nt++) {      int n = in.readInt();      int m = in.readInt();      int[][] a = new int[m][n];      for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {        a[j][i] = in.readInt();       }      }      Arrays.sort(a, (x, y) -> {       int xMax = 0;       for (int i = 0; i < x.length; i++) {        xMax = Math.max(xMax, x[i]);       }       int yMax = 0;       for (int i = 0; i < y.length; i++) {        yMax = Math.max(yMax, y[i]);       }       return Integer.compare(-xMax, -yMax);      });      int ans = 0;      int[] s = new int[4];      for (s[0] = 0; s[0] < n; s[0]++) {       for (s[1] = 0; s[1] < n; s[1]++) {        for (s[2] = 0; s[2] < n; s[2]++) {         for (s[3] = 0; s[3] < n; s[3]++) {          int cur = 0;          for (int i = 0; i < n; i++) {           int max = 0;           for (int j = 0; j < Math.min(m, n); j++) {            max = Math.max(max, a[j][(i + s[j]) % n]);           }           cur += max;          }          ans = Math.max(cur, 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;     }    }   }  } }
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"));    }   }  } }
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() );  } }
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 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;   }  } }
4	public class Main{   private static int[] T;   public static void main(String[] args){     Scanner in = new Scanner(System.in);   char[] input = in.nextLine().toCharArray();   int length = input.length;   int max = 0;   for(int i=0; i<length; i++){    char[] subString = Arrays.copyOfRange(input, 1, input.length);    int temp = solve(input, subString);    if(temp > max) max = temp;    input = Arrays.copyOfRange(input, 1, input.length);   }   System.out.println(max);    }  private static int solve(char[] P, char[] S) {     T = new int[P.length+1];     preKmp(P, P.length, T);   int max = 0;   int i = 0, j = 0;   while (j < S.length) {    while (i > -1 && (P[i] != S[j]))     i = T[i];    i++;    j++;    if ( i > max) max = i;    if (i >= P.length) {     i = T[i];    }   }     return max;       }  private static void preKmp(char[] x, int m, int[] kmpNext) {    int i = 0, j = kmpNext[0] = -1;       while (i < m-1) {    while (j > -1 && x[i] != x[j])     j = kmpNext[j];    i++;    j++;    if (x[i] == x[j])     kmpNext[i] = kmpNext[j];    else     kmpNext[i] = j;    }     } }
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{ 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));  } }
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); } }
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;} }
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); } }
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"); } }
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);  } }
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); }  }
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)); } }
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"); } }
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 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<Integer>[] g;  int[] a;  void solve() throws IOException {   int n = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = in.nextInt();   HashMap<Integer, ArrayList<Pair>> segs = new HashMap<>();   for (int i = 0; i < n; i++) {    int sum = 0;    for (int j = i; j < n; j++) {     sum += a[j];     if (!segs.containsKey(sum))      segs.put(sum, new ArrayList<>());     segs.get(sum).add(new Pair(i, j));    }   }   int max = 0;   ArrayList<Pair> ans = new ArrayList<>();   for (Integer k : segs.keySet()) {    ArrayList<Pair> list = segs.get(k);    ArrayList<Pair> blocks = new ArrayList<>();    Collections.reverse(list);    int prev = inf;    for (Pair p : list) {     int l = p.a;     int r = p.b;     if (r < prev) {      blocks.add(p);      prev = l;     }    }    if (blocks.size() > max) {     ans = blocks;     max = blocks.size();    }   }   out.println(ans.size());   for (Pair p : ans)    out.println((p.a+1)+" "+(p.b+1));  }   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();   }  } }
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 --;   }  } }
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();  } }
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();  } } }
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");  }   } }
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;  }  }
1	public class Main {  public static void main(String[] args) {   Scanner reader = new Scanner(System.in);   int n = reader.nextInt();   long d = reader.nextLong();   int[] a = new int[n];   for(int i = 0; i < n; i++)    a[i] = reader.nextInt();   Arrays.sort(a);   int ans = 2;   for(int i = 0; i < n - 1; i++){    if(a[i + 1] - a[i] > 2 * d) {     ans += 2;    }    else if(a[i + 1] - a[i] == 2 * d)     ans++;   }   System.out.println(ans);  } }
1	public class Main {  static MyScanner scan;  static PrintWriter pw;  public static void main(String[] args) {   new Thread(null,null,"_",1<<25)   {    public void run()    {     try     {      solve();     }     catch(Exception e)     {      e.printStackTrace();      System.exit(1);     }    }   }.start();  }  static void solve() throws IOException {   scan = new MyScanner();   pw = new PrintWriter(System.out, true);   StringBuilder sb = new StringBuilder();   int n = ni();   int d = ni();   int arr[] = new int[n];   int cnt = 2;   for(int i=0;i<n;++i)    arr[i] = ni();   for(int i=0;i<n-1;++i)   {    if(arr[i+1]-d==arr[i]+d)    {     ++cnt;     continue;    }    if(arr[i+1]-(arr[i]+d)>d)     ++cnt;    if((arr[i+1]-d)-arr[i]>d)     ++cnt;   }   pl(cnt);   pw.flush();   pw.close();  }  static long MMI(long A,long MOD)  {   return modpow(A,MOD-2,MOD);  }  static long modpow(long x,long y,long MOD)  {   if(y==0)    return 1;   if((y&1)==0)    return modpow((x*x)%MOD,y>>1,MOD);   else return (x*modpow(x,y-1,MOD))%MOD;  }  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 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 class MyScanner  {   BufferedReader br;   StringTokenizer st;   MyScanner()   {    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());   }  } }
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 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;   }  } }
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; } }
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(); } }
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();  } }
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);  }  } }
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 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;   } }
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 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 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);   }  }
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(); }  }
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;   }  } }
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");   } }
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;   }  } }
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());   }  } }
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()); } }
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 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());  } }
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[] cnt = new int[10];    Arrays.fill(cnt, 0);    List<String> a = new ArrayList<>();    for (int i = 0; i < n; i++) {     a.add(in.readLine());    }    List<String> b = new ArrayList<>();    for (int i = 0; i < n; i++) {     String temp = in.readLine();     if (a.contains(temp)) {      a.remove(temp);     } else      b.add(temp);    }    int[] cnta = new int[10];    for (int i = 0; i < a.size(); i++) {     cnta[a.get(i).length()]++;    }    int[] cntb = new int[10];    Arrays.fill(cnta, 0);    Arrays.fill(cntb, 0);    for (int i = 0; i < b.size(); i++) {     cntb[a.get(i).length()]++;    }    int ans = 0;    for (int i = 0; i < 10; i++) {     ans += Math.abs(cnta[i] - cntb[i]);    }    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;   }   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 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);   }  } }
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());   }  } }
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; }
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();  } }
4	public class P023A {  public static void main(String[] args)  {   Scanner in = new Scanner(System.in);   String line = in.next();     HashSet<String> hash = new HashSet<String>();     int ans = 0;   for (int len = line.length()-1; len > 0; --len)   {    for (int i = 0; i + len <= line.length(); ++i)    {     String sub = line.substring(i, i+len);     if (hash.contains(sub))     {      ans = Math.max(ans, sub.length());     }         hash.add(sub);    }   }     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 == 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 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(); }  }
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 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(); } }
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());    } }
4	public class A { private Scanner in; private PrintWriter out;  private String INPUT = "";  public void solve() {  String str = in.next();  int n = str.length();  for(int k = n - 1;k >= 1;k--){  HashSet<String> set = new HashSet<String>();  for(int i = 0;i < str.length() - k + 1;i++){   if(!set.add(str.substring(i, i + k))){   out.println(k);   return;   }  }  }  out.println(0); }  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 String add(String str, int k) {  StringBuilder mul = new StringBuilder(str);  StringBuilder ret = new StringBuilder();  for(int i = k;i > 0;i >>= 1){  if((i & 1) == 1)ret.append(mul);  mul.append(mul);  }  return ret.toString(); }  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)); } }
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;   }  } }
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);  } } }
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 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"); } }
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; } }
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 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; } }
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;  } }
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;   }  } }
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);  } }
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");  } }
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;   }  } }
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();  } } }
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]);  } } }
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;   }  } }
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(); } }
1	public class Main{  final long mod = (int)1e9+7, IINF = (long)1e19;  final int MAX = (int)5e5+1, MX = (int)1e7+1, INF = (int)1e9, root = 3;  DecimalFormat df = new DecimalFormat("0.0000000000000");  double eps = 1e-9, PI = 3.141592653589793238462643383279502884197169399375105820974944;  static boolean multipleTC = false, memory = false;  FastReader in;PrintWriter out;  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();   long d = nl();   long ans = 2;   long[] p = new long[n];   for(int i = 0; i< n; i++)p[i] = nl();   for(int i = 1; i< n; i++){    if(p[i]-p[i-1] == 2*d)ans++;    else if(p[i]-p[i-1]>2*d)ans+=2;   }   pn(ans);  }    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;   }  } }
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();   } }
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;  }  } }
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);  } }
2	public class Main { public static void main(String[] args) {  long x=nl(),k=nl();  if(x==0)  {  pr(0);  exit();  }  x%=mod;  pr((((x*powm(2,k+1,mod))%mod-powm(2,k,mod)+1)%mod+mod)%mod);  System.out.print(output); }    static class pair {  long a, b;  pair(){}  pair(long c,long d){a=c;b=d;} } static interface combiner {  public long combine(long a, long b); } static final int 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 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();   }  } }
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]);  } }; }
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();   } }
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;   }  } }
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 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());   } }
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());   }  } }
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();  } }
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);   }     } }
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();  } }
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(); } } }
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 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; } }
4	public class StringRepeat { static Scanner in = new Scanner( new BufferedReader( new InputStreamReader( System.in ) ) );  public static void main( String[] args ) {  String s = in.next();  int n = s.length(), ans = 0;  for( int i = 0; i < n; i++ ) for( int j = i+1; j < n; j++ )  {  int l = 0;  while( j+l<n && s.charAt(i+l)==s.charAt(j+l) ) l++;  ans = Math.max( ans, l );  }  System.out.println( ans ); } }
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 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);  } }
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 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 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"); } }
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 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 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]);  } } }
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();   } }
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();   }  } }
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); }  }
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;  }  } } }
4	public class Main {  static BufferedReader reader   = new BufferedReader(new InputStreamReader(System.in));    static StringBuilder out = new StringBuilder();  public static void main(String[] args){   solve();   return;  }    static int nextInt(){   return Integer.parseInt(nextLine());  }  static long nextLong(){   return Long.parseLong(nextLine());  }  static int[] nextIntArray(){   String[] inp = nextLine().split("\\s+");   int[] ary = new int[inp.length];   for (int i = 0; i < ary.length; i++){    ary[i] = Integer.parseInt(inp[i]);   }   return ary;  }  static int[] nextIntArrayFrom1(){   String[] inp = nextLine().split("\\s+");   int[] ary = new int[inp.length + 1];   for (int i = 0; i < inp.length; i++){    ary[i+1] = Integer.parseInt(inp[i]);   }   return ary;  }  static long[] nextLongArray(){   String[] inp = nextLine().split("\\s+");   long[] ary = new long[inp.length];   for (int i = 0; i < inp.length; i++){    ary[i] = Long.parseLong(inp[i]);   }   return ary;  }  static long[] nextLongArrayFrom1(){   String[] inp = nextLine().split("\\s+");   long[] ary = new long[inp.length + 1];   for (int i = 0; i < inp.length; i++){    ary[i+1] = Long.parseLong(inp[i]);   }   return ary;  }  static String nextLine(){   try {    return reader.readLine().trim();   } catch (Exception e){}   return null;  }  static void solve(){   String str = nextLine();   int max=0;   int index=0;   for(int i=0;i<str.length();i++){    for(int j=i+1;j<str.length();j++){     if(str.charAt(i)==str.charAt(j)){      int count=1;      while(true){       if(str.length()<=i+count || str.length()<=j+count || str.charAt(i+count)!=str.charAt(j+count) )        break;       count++;      }      if(max<count){       max=count;       index=i;      }     }    }   }   System.out.println(max);   return;  } }
0	public class Main { public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  int n=sc.nextInt();  while(n-->0){   long a=sc.nextLong(),b=sc.nextLong();   long ans=0,cur=0;   while(a>0 && b>0){    if(b>a)a=a+b-(b=a);    cur=(a/b);    ans+=cur;    a-=(cur*b);   }   System.out.println(ans);  } } }
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();   }  } }
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);  } }
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();  }   } }
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);    }  }
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(); } }
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{ static HashMap<Integer,ArrayList<seg>> ma; static class seg{  seg(int a,int b){  l=a;r=b;  }  int l,r; } static int n,sum,dex; static int arr[]=new int[1600]; public static void main(String argas[]){  Scanner cin=new Scanner(System.in);  ma=new HashMap();  n=cin.nextInt();  for(int i=1;i<=n;i++){  arr[i]=cin.nextInt();  sum=0;  for(int j=i;j>0;j--){   sum+=arr[j];   if(ma.containsKey(sum)) ma.get(sum).add(new seg(j,i));   else {   ma.put(sum, new ArrayList<seg>());   ma.get(sum).add(new seg(j,i));   }  }  }  int ans=0,te;  ArrayList<seg> best=new ArrayList(),now,temp;  Iterator it=ma.entrySet().iterator();  while(it.hasNext()){  now=new ArrayList();  te=0;  Map.Entry entry=(Map.Entry) it.next();  temp=(ArrayList<seg>) entry.getValue();  dex=0;  for(int i=0;i<temp.size();i++){   if(temp.get(i).l>dex){   dex=temp.get(i).r;   te++;   now.add(new seg(temp.get(i).l,temp.get(i).r));   }  }  if(te>ans){   ans=te;   best=now;  }  }  System.out.println(ans);  for(int i=0;i<best.size();i++){  System.out.println(best.get(i).l+" "+best.get(i).r);  } } }
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(); } }
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);  }  }
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();   }  } }
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 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];   }  } }
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 {    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);    } }
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");  }  }
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;    }   }  } }
1	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) {   int n = nextInt();   int a[] = new int[9];   int b[] = new int[9];   for(int i=0;i<n;i++){    String s = next();    if(s.equals("M")){     a[0]++;    }else if (s.equals("L")){     a[1]++;    }    else if (s.equals("XL")){     a[2]++;    }    else if (s.equals("XXL")){     a[3]++;    }    else if (s.equals("XXXL")){     a[4]++;    }    else if (s.equals("S")){     a[5]++;    }    else if (s.equals("XS")){     a[6]++;    }    else if (s.equals("XXS")){     a[7]++;    }    else if (s.equals("XXXS")){     a[8]++;    }   }   for(int i=0;i<n;i++){    String s = next();    if(s.equals("M")){     b[0]++;    }else if (s.equals("L")){     b[1]++;    }    else if (s.equals("XL")){     b[2]++;    }    else if (s.equals("XXL")){     b[3]++;    }    else if (s.equals("XXXL")){     b[4]++;    }    else if (s.equals("S")){     b[5]++;    }    else if (s.equals("XS")){     b[6]++;    }    else if (s.equals("XXS")){     b[7]++;    }    else if (s.equals("XXXS")){     b[8]++;    }   }   int ans = 0;   ans+=Math.abs(a[2]-b[2]);   ans+=Math.abs(a[3]-b[3]);   ans+=Math.abs(a[4]-b[4]);   int max = Math.abs(a[0]-b[0]);   max = max(max,Math.abs(a[1]-b[1]));   max = max(max,Math.abs(a[5]-b[5]));   ans+=max;   out.print(ans);   out.flush();  }  public static int max(int a,int b){   return a>b?a:b;  } }
3	public class Q3 {  static class Pair {   int a;   int b;   Pair(int p, int q) {    a = p;    b = q;   }  }  public static void main(String[] args) {   InputReader in = new InputReader();   int N = in.nextInt();   int arr[] = new int[N];   for (int i = 0; i < N; i++)    arr[i] = in.nextInt();   HashMap<Integer, ArrayList<Pair>> name = new HashMap<>();   for (int i = 0; i < N; i++) {    int sum = 0;    for (int j = i; j < N; j++) {     sum += arr[j];     if (name.get(sum) == null)      name.put(sum, new ArrayList());     name.get(sum).add(new Pair(i+1, j+1));    }   }   HashSet<Pair> ans = new HashSet<>();   for (ArrayList<Pair> n : name.values()) {    Collections.sort(n, new Comparator<Pair>() {     @Override     public int compare(Pair o1, Pair o2) {      if (Integer.compare(o1.b, o2.b) == 0)       return Integer.compare(o1.a, o2.a);      return Integer.compare(o1.b, o2.b);     }    });     HashSet<Pair> temp = new HashSet<>();    temp.add(n.get(0));    int num = 1;    int r = n.get(0).b;    for (int i = 1; i < n.size(); i++) {     if (n.get(i).a > r) {      num++;      r = n.get(i).b;      temp.add(n.get(i));     }    }     if (num > ans.size())     ans = temp;   }   System.out.println(ans.size());   for (Pair val : ans)    System.out.println(val.a + " " + val.b);   }  static class InputReader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public 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;   }   public InputReader() {    reader = new BufferedReader(new InputStreamReader(System.in), 32768);    tokenizer = null;   }   public InputReader(InputStream stream) {    reader = new BufferedReader(new InputStreamReader(System.in), 32768);    tokenizer = null;   }   public String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }   public 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 int[] nextIntArr(int n) {    int[] arr = new int[n];    for (int i = 0; i < n; i++) {     arr[i] = this.nextInt();    }    return arr;   }   public Integer[] nextIntegerArr(int n) {    Integer[] arr = new Integer[n];    for (int i = 0; i < n; i++)     arr[i] = new Integer(this.nextInt());    return arr;   }   public int[][] next2DIntArr(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] = this.nextInt();     }    }    return arr;   }   public int[] nextSortedIntArr(int n) {    int[] arr = new int[n];    for (int i = 0; i < n; i++) {     arr[i] = this.nextInt();    }    Arrays.sort(arr);    return arr;   }   public long[] nextLongArr(int n) {    long[] arr = new long[n];    for (int i = 0; i < n; i++) {     arr[i] = this.nextLong();    }    return arr;   }   public char[] nextCharArr(int n) {    char[] arr = new char[n];    for (int i = 0; i < n; i++) {     arr[i] = this.nextChar();    }    return arr;   }    public static int gcd(int a, int b) {    return b == 0 ? a : gcd(b, a % b);   }   public static int[] uwiSieve(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[] isp = 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 i = 0; i < tp; i++) {      for (int j = i; j < sup; j += tp)       isp[j] |= 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 = ~isp[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;      for (int q = pp; q <= h; q += p)       isp[q >> 5] |= 1 << (q & 31);     }    }    return Arrays.copyOf(ret, pos);   }   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 + (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;   }  } }
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 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();   }  } }
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);   }  } }
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();  } }
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()); } }
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 {  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();  } }
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;  } } }
5	public class CFA {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  private static 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 m;  char[][] mat;  long base = 397;  void solve() throws IOException {   n = nextInt();   m = nextInt();   mat = new char[n][m];   for (int i = 0; i < n; i++) {    mat[i] = nextString().toCharArray();   }   int alpha = 26;   long[] pow = new long[alpha];   pow[0] = 1;   for (int i = 1; i < alpha; i++) {    pow[i] = pow[i - 1] * base % MOD;   }   long res = 0;   for (int l = 0; l < m; l++) {       long[] hash = new long[n];    long[] mask = new long[n];    for (int r = l; r < m; r++) {     for (int i = 0; i < n; i++) {      hash[i] += pow[mat[i][r] - 'a'];      hash[i] %= MOD;      mask[i] = mask[i] ^ (1L << (mat[i][r] - 'a'));     }     int start = 0;     while (start < n) {      if ((mask[start] & (mask[start] - 1)) != 0) {       start++;       continue;      }      int end = start;      List<Long> l1 = new ArrayList<>();      while (end < n && (mask[end] & (mask[end] - 1)) == 0) {       l1.add(hash[end]);       end++;      }      start = end;      res += manacher(l1);     }    }   }   outln(res);  }  long manacher(List<Long> arr) {   int len = arr.size();   long[] t = new long[len * 2 + 3];   t[0] = -1;   t[len * 2 + 2] = -2;   for (int i = 0; i < len; i++) {    t[2 * i + 1] = -3;    t[2 * i + 2] = arr.get(i);   }   t[len * 2 + 1] = -3;   int[] p = new int[t.length];   int center = 0, right = 0;   for (int i = 1; i < t.length - 1; i++) {    int mirror = 2 * center - i;    if (right > i) {     p[i] = Math.min(right - i, p[mirror]);    }        while (t[i + (1 + p[i])] == t[i - (1 + p[i])]) {     p[i]++;    }           if (i + p[i] > right) {     center = i;     right = i + p[i];    }   }   long res = 0;   for (int i = 0; i < 2 * len; i++) {    int parLength = p[i + 2];    if (i % 2 == 0) {     res += (parLength + 1) / 2;    }    else {     res += parLength / 2;    }   }   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 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 {  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");  } }
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 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 A[]=new int[n];    for(int i=0;i<n;i++){     A[i]=Int();    }    Solution sol=new Solution();    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 Solution{  public void solution(PrintWriter out,int A[]){   Map<Integer,List<int[]>>f=new HashMap<>();   List<int[]>res=new ArrayList<>();   for(int i=0;i<A.length;i++){    int sum=0;    for(int j=i;j<A.length;j++){     sum+=A[j];     if(!f.containsKey(sum))f.put(sum,new ArrayList<>());     List<int[]>list=f.get(sum);     list.add(new int[]{i,j});    }   }    for(Integer key:f.keySet()){    List<int[]>list=f.get(key);    Collections.sort(list,(a,b)->{     return a[1]-b[1];    });    int pre[]=new int[list.size()];    Arrays.fill(pre,-1);     int dp[][]=new int[list.size()][2];    dp[0][0]=1;    dp[0][1]=0;    for(int i=1;i<list.size();i++){     int pair[]=list.get(i);     int l=0,r=i-1;     int pos=-1;     while(l<=r){      int mid=l+(r-l)/2;      if(list.get(mid)[1]<pair[0]){       pos=mid;       l=mid+1;      }      else{       r=mid-1;      }     }     if(pos!=-1){      int mx=1+dp[pos][0];      if(mx>=dp[i-1][0]){       dp[i][0]=mx;       dp[i][1]=i;       pre[i]=dp[pos][1];      }      else{       dp[i][0]=dp[i-1][0];       dp[i][1]=dp[i-1][1];      }     }     else{      dp[i][0]=dp[i-1][0];      dp[i][1]=dp[i-1][1];     }    }    int n=list.size();    if(dp[n-1][0]>res.size()){     res=new ArrayList<>();     int j=dp[n-1][1];     while(j!=-1){      res.add(list.get(j));      j=pre[j];     }    }       }     out.println(res.size());   for(int p[]:res){    out.println((p[0]+1)+" "+(p[1]+1));   }  }   }
2	public class Test5{  static long mod=1000000007;  public static void main(String[] z) throws Exception{   Scanner s = new Scanner(System.in);   long a = s.nextLong(), b=s.nextLong(), c=(a*2-1)%mod, i=binpow(2,b)%mod;   System.out.println(a<1 ? a : (c*i+1)%mod);  }  static long binpow(long c, long step){   if(step==0) return 1;   if(step==1) return c%mod;   if(step%2<1){    return binpow(((c%mod)*(c%mod))%mod, step/2)%mod;   }   else{    return (c%mod)*(binpow(c%mod, step-1)%mod);   }  }  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];   }  } }
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 prob {   public static long ans(long x, long y, long p)  {   long r = 1;    x = x % p;   while (y > 0)   {    if((y & 1)==1)     r = (r * x) % p;    y = y >> 1;    x = (x * x) % p;   }   return r;  } 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 v = 1000000007L;  if(x>0){  long p = ((2*x)-1)%v;  long a = ans(2L,k,v);  long b = (p*a)%v;  System.out.println((b+1)%v);  }  else{  System.out.println(0);  } } }
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"); } }
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");  } }
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();   } }
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 CodeforcesProblems {   static class Pair {   public Pair(int key, int val) {    this.key = key;    this.val = val;   }   int key;   int val;  }   public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));      int n = Integer.parseInt(br.readLine());   String[] strings = br.readLine().split(" ");   int[] arr = new int[n];   for(int i = 0; i<n; i++) {    arr[i] = Integer.parseInt(strings[i]);   }    HashMap<Integer, ArrayList<Pair>> segments = new HashMap<>();   for(int r = 0; r<arr.length; r++) {    int sum = 0;    for(int l = r; l>=0; l--) {     sum += arr[l];     ArrayList<Pair> pairs = segments.get(sum);     if(pairs == null) {      pairs = new ArrayList<>();      segments.put(sum, pairs);     }     pairs.add(new Pair(l, r));    }   }   int res = 0;   ArrayList<Pair> result = new ArrayList<>();   for(ArrayList<Pair> pairs: segments.values()) {    ArrayList<Pair> temp = new ArrayList<>();    int count = 0;    int r = -1;    for(Pair p : pairs) {     if(p.key>r) {      count++;      temp.add(p);      r = p.val;     }    }    if(count>res) {     res = count;     result = temp;    }   }   System.out.println(res);   StringBuilder sb = new StringBuilder();   for(Pair p : result){    sb.append(p.key+1).append(' ').append(p.val+1).append('\n');   }   System.out.print(sb);  } }
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;   }  } }
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;  } }
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);    }     } }
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);  } } }
4	public class A {  public void run() {   Scanner sc = new Scanner(System.in);   String s = sc.next();   int n = s.length();   String[] ss = new String[n];   for (int i = 0; i < n; i++)    ss[i] = s.substring(i);   sort(ss);   int res = 0;   for (int i = 1; i < n; i++)    res = max(res, count(ss[i - 1], ss[i]));   System.out.println(res);  }  int count(String s, String t) {   int ret = 0;   for (int i = 0; i < min(s.length(), t.length()); i++)    if (s.charAt(i) != t.charAt(i))     return ret;    else     ret++;   return ret;  }  void debug(Object... os) {   System.err.println(Arrays.deepToString(os));  }  public static void main(String... args) {   new A().run();  } }
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 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();  } }
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;   }  } }
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();  } } }
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);   }  }  }
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");       } }
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);  } }
2	public class C {  private static Solver solver = new Solver();  private static long m = 1000000000L + 7L;  public static void main(String[] args) throws IOException {   solver.withProcedure(() -> {    String[] input = solver.readString().split(" ");    BigInteger x = new BigInteger(input[0]);    BigInteger k = new BigInteger(input[1]);    if (x.compareTo(BigInteger.ZERO) == 0) {     solver.println("" + 0);     return;    }    BigInteger two = BigInteger.valueOf(2);    BigInteger mm = BigInteger.valueOf(m);    BigInteger binpowedK = two.modPow(k, mm);    BigInteger binpowedKPlusOne = two.modPow(k.add(BigInteger.ONE), mm);    BigInteger res = binpowedKPlusOne.multiply(x).subtract(binpowedK.subtract(BigInteger.ONE)).mod(mm);    if (res.compareTo(BigInteger.ZERO) < 0) {     res = BigInteger.ZERO;    }    solver.println("" + res);   }).solve();  }  private static long binpow(long a, long n) {   a = a % m;   long res = 1L;   while (n > 0) {    if ((n & 1L) != 0)     res = (res * a) % m;    a = (a * a) % m;    n >>= 1L;   }   return res;  }   @FunctionalInterface  private interface Procedure {   void run() throws IOException;  }  private static class Solver {   private Procedure procedure;   private StreamTokenizer in;   private PrintWriter out;   private BufferedReader bufferedReader;   Solver() {    try {     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");     bufferedReader = new BufferedReader(reader);     in = new StreamTokenizer(bufferedReader);     out = new PrintWriter(writer);    } catch (Exception e) {     throw new RuntimeException("Initialization has failed");    }   }   void solve() throws IOException {    procedure.run();   }   int readInt() throws IOException {    in.nextToken();    return (int) in.nval;   }   long readLong() throws IOException {    in.nextToken();    return (long) in.nval;   }   String readString() throws IOException {    return bufferedReader.readLine();   }   char readChar() throws IOException {    in.nextToken();    return in.sval.charAt(0);   }   void println(String str) {    out.println(str);    out.flush();   }   void print(String str) {    out.print(str);    out.flush();   }   Solver withProcedure(Procedure procedure) {    this.procedure = procedure;    return this;   }  } }
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();  } } }
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); } }
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;  }  } } }
5	public class A {  public static void main(String[] args) throws IOException {   new A().run();  }  BufferedReader br;  StringTokenizer st = new StringTokenizer("");  private void run() throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));   int n = nextInt();   Set<Integer> set = new TreeSet<Integer>();   for (int i = 0; i < n; i++) {    set.add(nextInt());   }   set.remove(set.iterator().next());   PrintWriter pw = new PrintWriter(System.out);   if (set.isEmpty()) {    pw.println("NO");   } else {    pw.println(set.iterator().next());   }   pw.close();  }  int nextInt() throws IOException {   while (!st.hasMoreElements()) {    st = new StringTokenizer(br.readLine());   }   return Integer.parseInt(st.nextToken());  } }
1	public class Main {  public static void main (String[] argv)  {  new Main(); }       boolean test = false;     public Main() {  FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));    int n = in.nextInt();  int nM = 0;  int[] nS = new int[4];  int[] nL = new int[4];  for (int i = 0; i < n; i++) {   String s = in.next();   int ns = s.length();   if (s.charAt(0) == 'M') nM++;   else if (s.charAt(ns - 1) == 'S') nS[ns-1]++;   else nL[ns-1]++;  }  int c = 0;  int[] nSr = new int[4];  int[] nLr = new int[4];  int nMr = 0;  for (int i = 0; i < n; i++) {   String s = in.next();   int ns = s.length();   if (s.charAt(0) == 'M') {    if (nM > 0) --nM;    else ++nMr;   }else if (s.charAt(ns - 1) == 'S') {    if (nS[ns-1] > 0) --nS[ns-1];    else ++nSr[ns-1];   }else {    if (nL[ns-1] > 0) --nL[ns-1];    else ++nLr[ns-1];   }    }    for (int i = 0; i < 4; i++) c += nS[i] + nL[i];  c += nM;    System.out.println(c); }      private int nBit1(int v) {  int v0 = v;  int c = 0;  while (v != 0) {   ++c;   v = v & (v - 1);  }  return c; }  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 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 int min(int a, int 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;   }  } }
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);  } }
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++];  } }
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));  } } }
0	public class A122 {  public static void main(String aa[])  {   Scanner ob=new Scanner(System.in);   int n;     n=ob.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");  } }
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 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;  }  } }
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);   }  } }
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);   }  } }
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());   }  } }
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();   }  } }
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();  } }
0	public class LuckyDivision {  public LuckyDivision(Scanner in)  {  int n;   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.printf("YES%n");  else   System.out.printf("NO%n");  }   public static void main(String[] args)  {  new LuckyDivision(new Scanner(System.in));  } }
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;  } }
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);  }  } }
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"); }}
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");  } }
5	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();   boolean[] use = new boolean[500];   ArrayList<Integer> a = new ArrayList<Integer>();   for (int i = 0; i < n; i++) {    int v = nextInt();    if (!use[250 + v]) {     use[250 + v] = true;     a.add(v);    }   }   Collections.sort(a);   if (a.size() < 2) {    out.println("NO");   } else {    out.println(a.get(1));   }  }  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 IOException {   return Integer.parseInt(nextString());  }  static double nextDouble() throws IOException {   return Double.parseDouble(nextString());  } }
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();  } }
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");   }  } }
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();  } }
4	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;  }   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 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;  }   String s;  int l;   void solve() throws IOException {   s = nextString();   l = s.length();   int max = 0;   for (int i = 0; i < l - 1; i++) {    for (int j = i + 1; j < l; j++) {     if (countOccurences(s.substring(i, j), s) > 1)      if (j - i > max) max = j - i;    }   }   out.println(max);  } }
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 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");   } }
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);   }  } }
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; }  }
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();  } }
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]);   }  } }
3	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 b==0?a:gcd(b,a%b); } void work() {  int n=in.nextInt();  int[] A=new int[n];  for(int i=0;i<n;i++)A[i]=in.nextInt();  HashMap<Integer,Integer> map=new HashMap<>();  HashMap<Integer,ArrayList<int[]>> rec=new HashMap<>();  for(int i=0;i<n;i++) {  for(int j=i,cur=0;j>=0;j--) {   cur+=A[j];   if(map.get(cur)==null) {   map.put(cur,i);   rec.put(cur,new ArrayList<>());   rec.get(cur).add(new int[] {j,i});   }else if(map.get(cur)<j) {   map.put(cur,i);   rec.get(cur).add(new int[] {j,i});   }  }  }  ArrayList<int[]> ret=null;  for(ArrayList<int[]> list:rec.values()) {  if(ret==null||ret.size()<list.size()) {   ret=list;  }  }  out.println(ret.size());  for(int[] r:ret) {  out.println((r[0]+1)+" "+(r[1]+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()); } }
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();  } }
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 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);  } }
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;   }  } }
1	public class JavaApplication2 {    public static void main(String[] args) throws IOException {     BufferedReader sc= new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(sc.readLine().split(" ")[0]);   ArrayList<String> tshr = new ArrayList<>(n);   for (int i = 0; i < n; i++) {    tshr.add(sc.readLine());   }   for (int i = 0; i < n; i++) {    tshr.remove(sc.readLine());   }   System.out.println(tshr.size());                 }  }
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);  } }
6	public class E {  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[n][m];    for (int i = 0; i < n; i++)    {     ntok();     mat[i] = iapar(m);    }    long[][] dp = new long[1 << n][m+1];    for (int i = 0; i < 1 << n; i++)    {     dp[i][m] = -1000000000;    }    dp[(1 << n) - 1][m] = 0;    for (int i = m-1; i >= 0; i--)    {     for (int e = 0; e < 1 << n; e++)     {      dp[e][i] = dp[e][i+1];      for (int w = 0; w < 1 << n; w++)      {       if ((e & w) == 0)       {        dp[e][i] = Math.max(dp[e][i], best(w, mat, i) + dp[e|w][i+1]);       }      }     }    }                  out.println(dp[0][0]);   }   out.flush();   in.close();  }  public long best(int mask, int[][] mat, int col)  {   long max = 0;   for (int t = 0; t < mat.length; t++)   {    long sum = 0;    int mk = mask;    for (int i = 0; i < mat.length; i++)    {     if (mk % 2 == 1)     {      sum += mat[i][col];     }     mk /= 2;    }    max = Math.max(max, sum);    cycle(mat, col);   }   return max;  }  public void cycle(int[][] mat, int col)  {   int temp = mat[0][col];   for (int i = 0; i < mat.length-1; i++)   {    mat[i][col] = mat[i+1][col];   }   mat[mat.length-1][col] = 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 E().go();  } }
5	public class Seq2 {  static void metod() {   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 = a[0];   for (int i = 1; i < a.length; i++) {    if (a[i] < min)     min = a[i];   }     int min2 = min;   boolean t = false;   for (int i = 0; i < a.length; i++) {    if (a[i] != min) {     if (!t) {      min2 = a[i];      t = true;     } else {      if (min2 > a[i])       min2 = a[i];     }    }   }   System.out.println((min == min2) ? "NO" : min2);    }  public static void main(String[] args) {   Seq2.metod();  } }
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; } }
0	public class lucky {  public static void main(String args[]) throws IOException  {  BufferedReader cin=new BufferedReader(new InputStreamReader(System.in));   String s=cin.readLine();  int l=s.length();  int n=Integer.parseInt(s);  if(s.equals("47") || s.equals("4") || s.equals("7") || s.equals("74") || s.equals("447") || s.equals("477") || s.equals("474") || s.equals("44") || s.equals("77") || s.equals("444") || s.equals("777") || s.equals("747") || s.equals("774") || s.equals("744"))      System.out.println("YES");  else if(n%(47)==0 || n%(4)==0 || n%(7)==0 || n%(74)==0 || n%(447)==0 || n%(477)==0 || n%(474)==0 || n%(44)==0 || n%(77)==0 || n%(444)==0 || n%(777)==0 || n%(747)==0 || n%(774)==0 || n%(744)==0)    System.out.println("YES");  else    System.out.println("NO");    } }
4	public class P23A {  public P23A() {   Scanner sc = new Scanner(System.in);   String str = sc.next();   sc.close();     String maxStr = "";   for (int i = 0; i < str.length() - 1; i++){    for (int j = i + 1; j < str.length(); j++){     String pattern = str.substring(i, j);     if (str.substring(i+1).contains(pattern) && pattern.length() > maxStr.length()){      maxStr = pattern;     }    }   }   System.out.println(maxStr.length());  }   public static void main (String []args){   new P23A();  } }
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();   }  } }
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");  } }
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)); } }
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());   }  } }
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;    }   }  } }
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;  }  } } }
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;} } }
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 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); } }
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;   }  } }
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");   } }
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); } }
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();  } } }
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()); } }
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(); } }
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();    }  }
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);   }  } }
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);   }  } }
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 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);  } }
0	public class Solution{  public static void main(String[] args){   Scanner in = new Scanner(System.in);   int pairs = in.nextInt();   while (pairs > 0){    in.nextLine();    int a = in.nextInt();    int b = in.nextInt();    int count = 0;    while (a != 0 && b != 0){     if (b >= a && a != 0){      count += b/a;      b = b%a;     }     if (a > b && b != 0){      count += a/b;      a = a%b;     }    }    System.out.println(count);    pairs--;   }  } }
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++];  } }
0	public class E {  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();   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%744 == 0||n%774 == 0||n%747 == 0||n%477 == 0||n%777==0) out.println("YES");   else out.println("NO");   out.println();   out.close();  } }
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));  } }
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;   }  } }
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);  } }
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);   }  } }
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]); } }
4	public class A {  public static void main(String[] args){   try{    Scanner scanner = new Scanner(System.in);    String in = scanner.next();    int max = 0;    for(int j=0;j<in.length()-1;j++){     for(int i=j;i<in.length();i++){      if(in.indexOf(in.substring(j, i)) != in.lastIndexOf(in.substring(j, i)) && (i-j)>max){       max = i-j;      }     }    }    System.out.println(max);   }catch(Exception e){    e.printStackTrace();   }  } }
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 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);   } }
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();   }  } }
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 {  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 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);   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());   }  } }
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 {    }    }
3	public class SameSumBlocksHard {  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in .nextInt();  long[] a = new long[n + 1];  long[] sum = new long[n + 1];  for (int i = 1; i <= n; i++) {  a[i] = in.nextInt();  sum[i] = sum[i - 1] + a[i];  }  Map<Long, List<int[]>> map = new HashMap<>();  for (int i = 1; i <= n; i++) {  for (int j = i; j <= n; j++) {   long x = sum[j] - sum[i - 1];   List<int[]> list = map.get(x);   if (list == null) {   list = new ArrayList<>();   map.put(x, list);   }   list.add(new int[] {i, j});  }  }  List<int[]> ans = new ArrayList<>();  for (Map.Entry<Long, List<int[]>> entry : map.entrySet()) {  List<int[]> list = entry.getValue();  List<int[]> tmp = new ArrayList<>();  calc(list, tmp);  if (tmp.size() > ans.size()) {   ans.clear();   ans.addAll(tmp);  }  }  System.out.println(ans.size());  for (int[] pair : ans) {  System.out.println(pair[0] + " " + pair[1]);  }  in.close(); }  static void calc(List<int[]> list, List<int[]> tmp) {  Collections.sort(list, new Comparator<int[]>() {  @Override  public int compare(int[] o1, int[] o2) {   if (o1[1] < o2[1]) {   return -1;   } else if (o1[1] > o2[1]) {   return 1;   } else {   return 0;   }  }  });  int last = -1;  for (int[] p : list) {  if (last == -1) {   last = p[1];   tmp.add(p);  } else if (p[0] > last) {   last = p[1];   tmp.add(p);  }  } } }
0	public class Main{ public static void main(String[] args){  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  if (n % 4 == 0 || n % 7 == 0 || n % 47 == 0 || n % 77 == 0 || n % 74 == 0 || n % 447 == 0 || n % 474 == 0 || n % 477 == 0 || n % 747 == 0 || n % 774 == 0 || n % 777 == 0)  System.out.println("YES");  else  System.out.println("NO"); } }
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); } }
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 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(); } }
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))]);   }   }  }  } } }
0	public class Main { static int mod = 1000000007; static int size = 200000; static long[] fac = new long[size]; static long[] finv = new long[size]; static long[] inv = new long[size]; static int INF = Integer.MAX_VALUE;  public static void main(String[] args){  Scanner scanner = new Scanner(System.in);  String[] s = new String[2];  for(int i = 0; i < 2; i++){  s[i] = scanner.next();  }  int n = s[0].length();  char[][] c = new char[2][n];  for(int i = 0; i < 2; i++){  for(int j = 0; j < n; j++){   c[i][j] = s[i].charAt(j);  }  }  int count = 0;  for(int i = 0; i < n-1; i++){  if(c[0][i] == '0' && c[1][i] == '0' && c[0][i+1] == '0'){   c[0][i] = 'X';   c[1][i] = 'X';   c[0][i+1] = 'X';   count++;  }  if(c[0][i] == '0' && c[1][i] == '0' && c[1][i+1] == '0'){   c[0][i] = 'X';   c[1][i] = 'X';   c[1][i+1] = 'X';   count++;  }  if(c[0][i] == '0' && c[0][i+1] == '0' && c[1][i+1] == '0'){   c[0][i] = 'X';   c[0][i+1] = 'X';   c[1][i+1] = 'X';   count++;  }  if(c[0][i+1] == '0' && c[1][i+1] == '0' && c[1][i] == '0'){   c[1][i] = 'X';   c[0][i+1] = 'X';   c[1][i+1] = 'X';   count++;  }  }  System.out.println(count); } public static boolean isPrime(int n){  if(n == 1) return false;  if(n == 2 || n == 3) return true;  for(int i = 2; i <= Math.sqrt(n); i++){  if(n % i == 0) return false;  }  return true; }  static boolean compare(String tar, String src) {  if (src == null) return true;  if (src.length() == tar.length()) {  int len = tar.length();  for (int i = 0; i < len; i++) {   if (src.charAt(i) > tar.charAt(i)) {   return false;   } else if (src.charAt(i) < tar.charAt(i)) {   return true;   }  }  return tar.compareTo(src) > 0 ? true : false;  } else if (src.length() < tar.length()) {  return true;  } else if (src.length() > tar.length()) {  return false;  }  return false; } public static class Edge{  int to;  Edge(int to){  this.to = to;  } } public static void swap(long a, long b){  long tmp = 0;  if(a > b){  tmp = a;  a = b;  b = tmp;  } } 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;          } }   public static long pow(long x, long n){  long ans = 1;  while(n > 0){  if((n & 1) == 1){   ans = ans * x;   ans %= mod;  }  x = x * x % mod;  n >>= 1;  }  return ans; }  public static long div(long x, long y){  return (x*pow(y, mod-2))%mod; }   public static void initComb(){  fac[0] = finv[0] = inv[0] = fac[1] = finv[1] = inv[1] = 1;  for (int i = 2; i < size; ++i) {  fac[i] = fac[i - 1] * i % mod;  inv[i] = mod - (mod / i) * inv[(int) (mod % i)] % mod;  finv[i] = finv[i - 1] * inv[i] % mod;  } }   public static long comb(int n, int k){  return fac[n] * finv[k] % mod * finv[n - k] % mod; }   public static long fact(int n){  return fac[n]; }   public static long finv(int n){  return finv[n]; }  static class UnionFind {  int[] parent;  public UnionFind(int size) {  parent = new int[size];  Arrays.fill(parent, -1);  }  public boolean unite(int x, int y) {  x = root(x);  y = root(y);  if (x != y) {   if (parent[y] < parent[x]) {   int tmp = y;   y = x;   x = tmp;   }   parent[x] += parent[y];   parent[y] = x;   return true;  }  return false;  }  public boolean same(int x, int y) {  return root(x) == root(y);  }  public int root(int x) {  return parent[x] < 0 ? x : (parent[x] = root(parent[x]));  }  public int size(int x) {  return -parent[root(x)];  } } public static int upperBound(int[] array, int value) {   int low = 0;   int high = array.length;   int mid;   while( low < high ) {    mid = ((high - low) >>> 1) + low;    if( array[mid] <= value ) {     low = mid + 1;    } else {     high = mid;    }   }   return low;  }  public static final int lowerBound(final int[] arr, final int value) {  int low = 0;  int high = arr.length;  int mid;  while (low < high){   mid = ((high - low) >>> 1) + low;    if (arr[mid] < value) {    low = mid + 1;   } else {    high = mid;   }  }  return low;  }  public static long gcd(long n, long m){  if(m > n) return gcd(m,n);  if(m == 0) return n;  return gcd(m, n%m); }  private class Pair2 implements Comparable<Pair2> {  String s;  int p;  int index;  public Pair2(String s, int p, int index) {   this.s = s;   this.p = p;   this.index = index;  }  public int compareTo(Pair2 other) {   if (s.equals(other.s)) {    return other.p - this.p;   }   return this.s.compareTo(other.s);  } }  public static int c2i(char c){ if('A' <= c && c <= 'Z'){  return c - 'A'; }else{  return c - 'a' + 26; } } public static char i2c(int i){ if(0 <= i && i < 26){  return (char)(i + 'A'); }else{  return (char)(i + 'a' - 26); } } }
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(); } }
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);  } }
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();} }
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;   }  } }
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;  }    } }
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());   }  } }
3	public class A {  String filename = "";  final int INF = 1_000_000_000;  void solve() {   int n = readInt();   int[] a = new int[n];   for(int i = 0;i<n;i++){    a[i] = readInt();   }   Map<Integer, Integer>[] maps = new Map[n];   Map<Integer, Integer> sums = new HashMap();   for(int i = 0;i<n;i++){    maps[i] = new HashMap<>();   }   for(int i = 0;i<n;i++){    int summ = 0;    for(int j = i;j<n;j++){     summ += a[j];     if(!maps[i].containsKey(summ)) maps[i].put(summ, j);     int x = sums.getOrDefault(summ, 0);     sums.put(summ, x + 1);    }   }   int max = 0;   int goodSumm = 0;   for(int summ : sums.keySet()){    if(sums.get(summ) <= max) continue;    int right = -1;    int ans = 0;    for(int j = 0;j<n;j++){     if(!maps[j].containsKey(summ)) continue;     int end = maps[j].get(summ);     if(right == -1){      right = end;      ans++;      continue;     }     if(j > right){      right = end;      ans++;      continue;     }     if(end < right){      right = end;     }    }    if(max < ans){     max = ans;     goodSumm = summ;    }   }   int left = -1;   int right = -1;   List<Integer> ans = new ArrayList<>();   for(int j = 0;j<n;j++){    if(!maps[j].containsKey(goodSumm)) continue;    int start = j;    int end = maps[j].get(goodSumm);    if(right == -1){     left = j;     right = end;     continue;    }    if(start > right){     ans.add(left + 1);     ans.add(right + 1);     left = start;     right = end;     continue;    }    if(end < right){     left = start;     right = end;    }   }   ans.add(left + 1);   ans.add(right + 1);   out.println(max);   for(int i = 0;i<ans.size();i+=2){    out.println(ans.get(i) + " " + ans.get(i + 1));   }  }  public static void main(String[] args) throws FileNotFoundException {   new A().run();  }  void run() throws FileNotFoundException {   init();   solve();   out.close();  }  BufferedReader in;  PrintWriter out;  StringTokenizer tok = new StringTokenizer("");  void init() throws FileNotFoundException {   if(!filename.equals("")) {    in = new BufferedReader(new FileReader(new File(filename + ".in")));    out = new PrintWriter(new File(filename + ".out"));    return;   }   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);  }  String readLine(){   try{    return in.readLine();   }catch (Exception e){    throw new RuntimeException(e);   }  }  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());  } }
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());   }  } }
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();   }  } }
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());     } }
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 {  public static void main(String args[])  {   FastReader input=new FastReader();   PrintWriter out=new PrintWriter(System.out);   int T=1;   while(T-->0)   {    int n=input.nextInt();    int a[]=new int[n];    for(int i=0;i<n;i++)    {     a[i]=input.nextInt();    }    HashMap<Integer,ArrayList<Pair>> 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))      {       map.get(sum).add(new Pair(i,j));      }      else      {       map.put(sum,new ArrayList<>());       map.get(sum).add(new Pair(i,j));      }     }    }    int max=Integer.MIN_VALUE;    Iterator it=map.entrySet().iterator();    ArrayList<Pair> setBlocks=new ArrayList<>();    while(it.hasNext())    {     Map.Entry e=(Map.Entry)it.next();     ArrayList<Pair> list=(ArrayList)e.getValue();     Collections.sort(list, new Comparator<Pair>() {      @Override      public int compare(Pair o1, Pair o2) {       if(o1.l==o2.l)       {        return o1.r-o2.r;       }       else       {        return o1.l-o2.l;       }      }     });     Pair1 sufMin[]=new Pair1[list.size()];     TreeSet<Pair> set=new TreeSet<>(new Comparator<Pair>() {      @Override      public int compare(Pair o1, Pair o2) {       if(o1.l==o2.l)       {        return o1.r-o2.r;       }       else       {        return o1.l-o2.l;       }      }     });     int min=Integer.MAX_VALUE;     int index=-1;     for(int j=list.size()-1;j>=0;j--)     {      if(min>=list.get(j).r)      {       min=list.get(j).r;       index=j;      }      sufMin[j]=new Pair1(min,index);      set.add(new Pair(list.get(j).l,j));     }     int count=0;     int j=0;     ArrayList<Pair> blocks=new ArrayList<>();     while(j<list.size())     {      int m=sufMin[j].min;      int ind=sufMin[j].index;      blocks.add(list.get(ind));      count++;      Pair p=new Pair(m+1,0);      if(set.ceiling(p)==null)      {       break;      }      else      {       Pair p1=set.ceiling(p);       j=p1.r;      }     }     if(max<count)     {      max=count;      setBlocks=blocks;     }    }    out.println(max);    for(int i=0;i<setBlocks.size();i++)    {     out.println((setBlocks.get(i).l+1)+" "+(setBlocks.get(i).r+1));    }   }   out.close();  }  public static class Pair1  {   int min,index;   Pair1(int min,int index)   {    this.min=min;    this.index=index;   }  }  public static class Pair  {   int l,r;   Pair(int l,int r)   {    this.l=l;    this.r=r;   }  }  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 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(); }  } }
3	public class Main {  static class Node implements Comparable<Node>{   public int l,r;   public long s;   Node(int l,int r,long s){    this.l=l;    this.r=r;    this.s=s;   }   public int compareTo(Node o) {    if(o.s==s){     if(r>o.r) return 1;     else if(r==o.r) {      return 0;     }     else return -1;    } else if(s>o.s){     return 1;    } else {     return -1;    }   }  }  static long[] sum=new long[1550];  public static void main(String[] args) {   TreeMap<Long, ArrayList<Node> > mp = new TreeMap<>();   Scanner cin = new Scanner(System.in);   int N=cin.nextInt();   for(int i=1;i<=N;i++){    int x=cin.nextInt();    sum[i]=sum[i-1]+x;   }     ArrayList<Node> arr = new ArrayList<>();   for(int l=1;l<=N;l++){    for(int r=l;r<=N;r++){     arr.add(new Node(l,r,sum[r]-sum[l-1]));    }   }   Collections.sort(arr);   for(int i=0;i<arr.size();i++){    ArrayList<Node> a=mp.get(arr.get(i).s);    if(a==null) {     a=new ArrayList<>();     mp.put(arr.get(i).s,a);    }    a.add(arr.get(i));   }   int mx=-1;   long mxv=-1;   Iterator<Long> it=mp.keySet().iterator();   while(it.hasNext()){    int ans=0,t=0;    long v=it.next();    ArrayList<Node> vec= mp.get(v);    for(int i=0;i<vec.size();i++){     if(t<vec.get(i).l){      ans++;      t=vec.get(i).r;     }    }       if(ans>mx){     mx=ans;     mxv=v;        }   }   ArrayList<Node> vec=mp.get(mxv);   System.out.println(mx);   int t=0;   for(int i=0;i<vec.size();i++){           if(t<vec.get(i).l){     System.out.println(vec.get(i).l+" "+vec.get(i).r);     t=vec.get(i).r;    }   }  } }
0	public class luckydivision { public static int i(String s){  return Integer.parseInt(s); } public static boolean solve(String k, int n){  int temp = i(k);  if(temp > n){  return false;  }  if(n % temp == 0)  return true;  if(solve(k + "7", n))  return true;  return solve(k + "4", n); } public static void main(String args[]) throws Exception {  BufferedReader r = new BufferedReader(new InputStreamReader(System.in));  int n = i(r.readLine());  boolean i = solve("7", n);  boolean j = solve("4", n);  if(i || j){  System.out.println("YES");  } else {  System.out.println("NO");  } } }
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 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() {    int t = io.readInt();    while (t-- > 0)     solve1();   }    public void solve1() {    cache.clear();    int n = io.readInt();    int m = io.readInt();    Col[] mat = new Col[m];    for (int i = 0; i < m; i++) {     mat[i] = new Col();     mat[i].data = new int[n];    }    for (int i = 0; i < n; i++) {     for (int j = 0; j < m; j++) {      int v = io.readInt();      mat[j].data[i] = v;      mat[j].max = Math.max(mat[j].max, v);     }    }    Arrays.sort(mat, (a, b) -> -(a.max - b.max));    mat = Arrays.copyOf(mat, Math.min(n, m));    io.cache.append(bf(mat, getCol(n), n, 0)).append('\n');   }   public void enhance(Col mask, Col c, Col ans, int n) {    for (int i = 0; i < n; i++) {     ans.data[i] = Math.max(mask.get(i), c.get(i));    }   }   Deque<Col> cache = new ArrayDeque<>();   public Col getCol(int n) {    if (cache.isEmpty()) {     Col col = new Col();     col.data = new int[n];     return col;    }    return cache.removeFirst();   }   public void destroy(Col c) {    c.offset = 0;    c.max = 0;    cache.addLast(c);   }   public int bf(Col[] cols, Col mask, int n, int k) {    if (k >= cols.length) {     int sum = 0;     for (int i = 0; i < n; i++) {      sum += mask.data[i];     }     return sum;    }    int max = 0;    cols[k].offset = 0;    for (int i = 0; i < n; i++) {     Col c = getCol(n);     enhance(mask, cols[k], c, n);     max = Math.max(max, bf(cols, c, n, k + 1));     destroy(c);     cols[k].turn();    }    return max;   }  }  public static class Col {   int[] data;   int offset;   public int get(int i) {    return data[(i + offset) % data.length];   }   public void turn() {    offset++;   }   int max;  }   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));   }  } }
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"); } }
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); } }
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 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();}}
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);  } }
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)); } }
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);   }  } }
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 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);  } }
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");  } }
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); } }
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());   }  } }
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;}  } }
3	public class Solution {  public static void main(String[] args) throws Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  StringTokenizer st = new StringTokenizer(br.readLine());  long[] a = new long[n];  for (int i = 0; i < a.length; i++) {  a[i] = Long.parseLong(st.nextToken());  }  long[] sum = new long[n];  sum[0] = a[0];  for (int i = 1; i < sum.length; i++) {  sum[i] = sum[i - 1] + a[i];  }  solve(a, sum);  }  private static void solve(long[] a, long[] sum) {  int n = a.length;  Map<Long, List<Pair>> map = new HashMap<>();  for (int j = 0; j < sum.length; j++) {  for (int i = 0; i <= j; i++) {   long k = getSum(sum, i, j);   if (map.containsKey(k)) {   map.get(k).add(new Pair(i, j));   } else {   List<Pair> arr = new ArrayList<>();   arr.add(new Pair(i, j));   map.put(k, arr);   }  }  }  int max = -1;  List<Pair> ans = null;  for (Map.Entry<Long, List<Pair>> entry : map.entrySet()) {  List<Pair> pairs = entry.getValue();   int prev = -1;  int count = 0;  List<Pair> temp = new ArrayList<Pair>();  for (Pair p : pairs) {   if (p.x > prev) {   prev = p.y;   temp.add(p);   count++;   }  }   if (count > max) {   ans = temp;   max = count;  }  }  if (max != -1) {  System.out.println(ans.size());  for (Pair p : ans) {   System.out.println((p.x + 1) + " " + (p.y + 1));  }  } }  private static long getSum(long[] sum, int l, int r) {  if (l == 0) {  return sum[r];  }  return sum[r] - sum[l - 1]; } } class Pair {  int x; int y;  Pair(int x, int y) {  this.x = x;  this.y = y; }  @Override public int hashCode() {  int h = 171 << 4;  h = h * x;  h = h * y;  return h; }  @Override public boolean equals(Object o) {  if (o instanceof Pair) {  Pair other = (Pair) o;  return this.x == other.x && this.y == other.y;  }  return false; }  @Override public String toString() {  return "Pair [x=" + x + ", y=" + y + "]"; } }
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();    long k = in.nextLong();    HashMap<Long, Integer> hm = new HashMap<>();    long ar[] = in.nextLongArray(n);    for (int i = 0; i < n; i++) {     long dist = ar[i] + k;     long min = k;     for (int j = 0; j < n; j++) {      min = Math.min(min, Math.abs(ar[j] - dist));     }     if (min == k) {      hm.put(dist, 1);     }     dist = ar[i] - k;     min = k;     for (int j = 0; j < n; j++) {      min = Math.min(min, Math.abs(ar[j] - dist));     }     if (min == k) {      hm.put(dist, 1);     }    }    out.print(hm.size());   }  }  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 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 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) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
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);   }  } }
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();  } }
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); } }
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());  } }
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");  } }
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");  } } }
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();  }  }
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; }  } }
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);  } } }
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;   }  } }
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 Solution {  private static int n;  private static PrintWriter writer;  private static int maxstep;   private static void g(int src, int step) {   if (step != 0 && n % src == 0) {    writer.print("YES");    writer.close();    System.exit(0);   }     if (step == maxstep) return;     int p = (int)Math.pow(10, step);     g(src + 4 * p, step + 1);   g(src + 7 * p, step + 1);  }   public static void main(String[] args) throws Exception {          Scanner reader = new Scanner(System.in);   writer = new PrintWriter(System.out);     n = reader.nextInt();   maxstep = String.valueOf(n).length() + 1;     g(0, 0);     writer.print("NO");   writer.close();  } }
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");  } }
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;   }  } }
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);  } }
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);  } } }
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);  } } }
3	public class F2 {  private static int n;  private static int[] a;  private static Collection<Segment> answer;  public static void main(String[] args) {   in();   solution();   out();  }  private static void in() {   Scanner in = new Scanner(System.in);   n = in.nextInt();   a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }  }  private static void solution() {   HashMap<Long, LinkedList<Segment>> segments = new HashMap<>();   for (int i = 0; i < n; i++) {    long sum = 0;    for (int j = i; j < n; j++) {     sum += a[j];     if (segments.containsKey(sum)) {      segments.get(sum).add(new Segment(i, j));     } else {      LinkedList<Segment> toPut = new LinkedList<>();      toPut.add(new Segment(i, j));      segments.put(sum, toPut);     }    }   }   answer = null;   for (Map.Entry<Long, LinkedList<Segment>> sums : segments.entrySet()) {     LinkedList<Segment> currentSegments = sums.getValue();    Collections.sort(currentSegments);    LinkedList<Segment> segmentsWithoutCrossing = new LinkedList<>();    for (Segment segment : currentSegments) {      if ( segmentsWithoutCrossing.isEmpty() || !segmentsWithoutCrossing.getLast().isCrossingToNextSegment(segment)) {      segmentsWithoutCrossing.add(segment);     } else if (segmentsWithoutCrossing.getLast().getR() > segment.getR()) {      segmentsWithoutCrossing.removeLast();      segmentsWithoutCrossing.add(segment);     }    }    answer = segmentsWithoutCrossing.size() > (answer != null ? answer.size() : 0) ? segmentsWithoutCrossing : answer;   }  }  private static void out() {   System.out.println(answer.size());   for (Segment segment : answer) {    System.out.println( (segment.getL() + 1) + " " + (segment.getR() + 1));   }  } } class Segment implements Comparable<Segment>{  private int l, r;  Segment(int l, int r) {   this.l = l;   this.r = r;  }   int getL() {   return l;  }  int getR() {   return r;  }  @Override  public int compareTo(Segment segment) {   if (l == segment.l && r == segment.r) {    return 0;   }   return l != segment.l ? l - segment.l : r - segment.r;  }  boolean isCrossingToNextSegment(Segment segment) {   if (l == segment.l || r == segment.r) {    return true;   } else if (l < segment.l) {    return r >= segment.l;   } else if (r > segment.r) {    return l <= segment.r;   } else {    return true;   }  } }
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(); } }
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(); } }
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 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();}  } }
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 ; }  }
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);  }      } }
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(); } }
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;   }  } }
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;  } } }
5	public class Main {   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);  int min = a[0];  if (a[0] == a[n-1]){   System.out.println("NO");  }else{   for(int i=1;;i++){    if (a[i] > min) {     System.out.println(a[i]);     break;    }   }  } } }
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;  } } }
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--;  } } }
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);  } }
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);   }  } }
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));   }  } }
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); } }
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) ;  }   }  }
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();   }  } }
4	public class LRS {    public static String lcp(String s, String t) {   int n = Math.min(s.length(), t.length());   for (int i = 0; i < n; i++) {    if (s.charAt(i) != t.charAt(i))     return s.substring(0, i);   }   return s.substring(0, n);  }    public static String lrs(String s) {      int N = s.length();   String[] suffixes = new String[N];   for (int i = 0; i < N; i++) {    suffixes[i] = s.substring(i, N);   }      Arrays.sort(suffixes);      String lrs = "";   for (int i = 0; i < N - 1; i++) {    String x = lcp(suffixes[i], suffixes[i+1]);    if (x.length() > lrs.length())     lrs = x;   }   return lrs;  }      public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   String s = br.readLine();   s = s.replaceAll("\\s+", " ");   System.out.println(lrs(s).length());  } }
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);   }  } }
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 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();   }  } }
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();  } }    }
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)); } }
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 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();}}   }   }
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); } }
0	public class LuckyDivision {  public final String check (String s) {   String result = "NO";   StringTokenizer stringTokenizer = new StringTokenizer(s, "47");   if(!stringTokenizer.hasMoreTokens()) return "YES";   int S = Integer.parseInt(s);   generateSimpleAndDivide(S, 4, 4, 7);   generateSimpleAndDivide(S, 7, 4, 7);   if(lucky) return "YES";   return result;  }  public static final void main(String[] args) {   Scanner scanner = new Scanner(System.in);   System.out.print(new LuckyDivision().check(scanner.next()));  }  public void generateSimpleAndDivide(int divided, int n, int n1, int n2) {   if(lucky || n >= divided) return;   if(divided % n == 0) lucky = true;   generateSimpleAndDivide(divided, Integer.parseInt(n + "" + n1), n1, n2);   generateSimpleAndDivide(divided, Integer.parseInt(n + "" + n2), n1, n2);  }  private boolean lucky = false; }
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(); } }
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 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);  } } }
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);  } } }
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();  } }
3	public class Main {  static final long MOD = 1_000_000_007, INF = 1_000_000_000_000_000_000L;  static final int INf = 1_000_000_000;  static FastReader reader;  static PrintWriter writer;  public static void main(String[] args) {   Thread t = new Thread(null, new O(), "Integer.MAX_VALUE", 100000000);   t.start();  }  static class O implements Runnable {   public void run() {    try {     magic();    }    catch (Exception e) {     e.printStackTrace();     System.exit(1);    }   }  }  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();   }  }  static void magic() throws IOException {   reader = new FastReader();   writer = new PrintWriter(System.out, true);   Map<Integer, ArrayList<Pair>> map = new HashMap<>();   int n = reader.nextInt();   int arr[] = new int[n];   for(int i=0;i<n;++i) {    arr[i] = reader.nextInt();   }   for(int i=0;i<n;++i) {    int sum = 0;    for(int j=i;j<n;++j) {     sum+=arr[j];     ArrayList<Pair> list = map.get(sum);     if(list==null) {      list = new ArrayList<>();     }     list.add(new Pair(i+1,j+1));     map.put(sum, list);    }   }   int ans = 0,at = -1;   for(int e : map.keySet()) {    ArrayList<Pair> list = map.get(e);    Collections.sort(list);       int ispe = 0;    int len = list.size();    for(int i=0;i<len;++i) {     ispe++;     int r = list.get(i).y;     while(i+1<len && list.get(i+1).x<=r) {      i++;     }    }    if(ans<ispe) {     ans = ispe;     at = e;    }   }   writer.println(ans);   ArrayList<Pair> list = map.get(at);   Collections.sort(list);   int len = list.size();   for(int i=0;i<len;++i) {    writer.println(list.get(i).x+" "+list.get(i).y);    int r = list.get(i).y;    while(i+1<len && list.get(i+1).x<=r) {     i++;    }   }  }  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.y!=other.y) {     return this.y - other.y;    }    return this.x - other.x;   }   public String toString() {    return "{" + x + "," + y + "}";   }  } }
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); } }
4	public class P1 { public static void main(String[] args) {  String s = null;   try {   Scanner sc = new Scanner(System.in);  s = sc.next();    }  catch (Exception e) {  e.printStackTrace();  }   int n = s.length();   HashSet<String> h = new HashSet<String>();  String t=null;  boolean b;  int lmax = 0;  for (int i=0; i<n; i++) {  for (int j=i+1; j<=n; j++) {   t = s.substring(i, j);   b = h.add(t);   if (b==false) {   if (j-i>lmax) {    lmax = j-i;    }   }  }  }  System.out.println(lmax); } }
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());   }  } }
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");   }  } }
1	public class TaskA { public static void main(String[] args) {  new TaskA(System.in, System.out); }  static class Solver implements Runnable {  int n;  String[] last, curr;  BufferedReader in;  PrintWriter out;  void solve() throws IOException  {  n = Integer.parseInt(in.readLine());  last = new String[n];  curr = new String[n];   for (int i = 0; i < n; i++)   last[i] = in.readLine();   for (int i = 0; i < n; i++)   curr[i] = in.readLine();   int changes = 0;  String[] sizes = new String[]{"S", "M", "L", "XS", "XXS", "XXXS", "XL", "XXL", "XXXL"};  int[] old = count(last, sizes);  int[] now = count(curr, sizes);   for (int i= 0; i < sizes.length; i++)  {   changes += Math.abs(old[i] - now[i]);  }   out.println(changes / 2);   }  int[] count(String[] s, String[] sizes)  {  int len = sizes.length;  int[] cnt = new int[len];   for (int i = 0; i < len; i++)  {   for (String str : s)   {   if (str.equals(sizes[i]))    cnt[i]++;   }  }   return cnt;  }  void debug(Object... o)  {  System.err.println(Arrays.deepToString(o));  }  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 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) {  BufferedReader in = new BufferedReader(new InputStreamReader(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  {  try  {   in.close();  }  catch (IOException e)  {   e.printStackTrace();  }   out.flush();  out.close();  } } }
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;   }  } }
6	public class MotherOfDragons { static boolean[][] adjMatrix; public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int k = sc.nextInt();   adjMatrix = new boolean[n][n];  for (int i = 0; i < n; i++)  for (int j = 0; j < n; j++)   adjMatrix[i][j] = sc.nextInt() == 1;   long[] edges = new long[n];  for (int i = 0; i < n; i++)  {  long val = 0;  for (int j = 0; j < n; j++)   if(adjMatrix[i][j] || i == j)   val |= 1l<<j;  edges[i] = val;  }   int h = n/2;   int[] cliques = new int[1<<h];  for (int i = 1; i < 1<<h; i++)  {  int nodes = i;  for (int j = 0; j < h; j++)   if((i & (1 << j)) != 0)   nodes &= edges[j];  if(nodes == i)   cliques[i] = Integer.bitCount(i);  }   for (int i = 1; i < 1<<h; i++)  for (int j = 0; j < h; j++)   if((i & (1 << j)) != 0)   cliques[i] = Math.max(cliques[i], cliques[i ^ (1<<j)]);   int max = 0;  for (int i = 0; i < cliques.length; i++)  max = Math.max(max, cliques[i]);  for (int i = 1; i < 1<<(n-h); i++)  {  long all = -1l;  long tmp = (1l*i)<<h;  for (int j = h; j < n; j++)   if((tmp & (1l << j)) != 0)   all &= edges[j];  long node = all&tmp;  if(node != tmp)   continue;  int connected = (int)(all & ((1<<h)-1));  max = Math.max(max, cliques[connected] + Integer.bitCount(i));  }   System.out.printf("%.12f\n", (k*k*((max-1)/(2.0*max)))); }  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()); }  } }
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(); } }
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;  } } }
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();  } } }
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(); } }
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); } }
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 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();   } }
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; } }
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);  } }
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();  } }
6	public class code839E {  public static void main(String[] args) throws Exception{   BufferedReader bff=new BufferedReader(new InputStreamReader(System.in));   PrintWriter wff=new PrintWriter(System.out);   String[] st=bff.readLine().split(" ");   int V=Integer.parseInt(st[0]);   int K=Integer.parseInt(st[1]);   BronKerbosch bk=new BronKerbosch(V);   for(int i=0;i<V;i++){    st=bff.readLine().split(" ");    for(int j=0;j<V;j++){     if(st[j].equals("1")){      bk.anadir(i,j);     }    }   }   long num=bk.numeroCamarilla();   wff.printf("%.12f\n", num * (num - 1.0) / 2 * K / num * K / num);   wff.flush();  }     static class BronKerbosch {  int V;  long[] neig;  Random random = new Random();  long maxClique;  public BronKerbosch(int v){   V=v;   neig=new long[V];  }  public void anadir(int a,int b){   long aux=1;   neig[a] |= aux << (long)b;  }   public long numeroCamarilla(){   long numero = Long.bitCount(bronKerbosch());   return numero;  }   public long bronKerbosch() {   maxClique = 0;   bronKerbosch2(0, (1L << V) - 1, 0);   return maxClique;  }  public 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 & ~neig[u];   for (int v = 0; v < V; v++){    if ((ne >>> v & 1) != 0) {     bronKerbosch2(r | 1L << v, p & neig[v], x & neig[v]);     p &= ~(1L << v);     x |= 1L << v;    }   }  } }   }
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);  } }
0	public class Main {  StreamTokenizer in;  BufferedReader inb;  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)));   inb = 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 int parseInt() throws Exception {   return Integer.parseInt(inb.readLine());  }  public String nextLine() throws Exception {   return inb.readLine();  }    public void solve() throws Exception {   int n = nextInt();   if ((n%4==0)||(n%44==0)||(n%47==0)||(n%74==0)     ||(n%744==0)||(n%747==0)||(n%774==0)||(n%777==0)     ||(n%7==0)||(n%444==0)||(n%447==0)||(n%474==0)||(n%477==0)||(n%77==0))   {    out.print("YES");   }   else   {    out.print("NO");   }  } }
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);  }  } }
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;  } } }
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(); } }
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;   }  }  } } }
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);  } }
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.");  } }
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());   }  } }
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"); } }
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();  } }
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;  } }
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 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;       }      }     }    }   }  } }
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;   }  } }
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 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();  } }
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());   } }
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); } }
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(); } }
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();  }         }
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());  } }
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(); } }
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);  } }
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); } }
2	public class C { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int[][] M = {   {2, mod-1},   {0, 1}  };  long n = nl();  if(n == 0){  out.println(0);  return;  }   n = n*2%mod;  long K = nl();  int[] v = new int[]{(int)n, 1};  out.println(pow(M, v, K)[0]); }   public static final int mod = 1000000007; public static final long m2 = (long)mod*mod; public static final long BIG = 8L*m2;   public static int[] pow(int[][] A, int[] v, long e) {  for(int i = 0;i < v.length;i++){  if(v[i] >= mod)v[i] %= mod;  }  int[][] MUL = A;  for(;e > 0;e>>>=1) {  if((e&1)==1)v = mul(MUL, v);  MUL = p2(MUL);  }  return v; }   public static int[] mul(int[][] A, int[] v) {  int m = A.length;  int n = v.length;  int[] w = new int[m];  for(int i = 0;i < m;i++){  long sum = 0;  for(int k = 0;k < n;k++){   sum += (long)A[i][k] * v[k];   if(sum >= BIG)sum -= BIG;  }  w[i] = (int)(sum % mod);  }  return w; }   public static int[][] p2(int[][] A) {  int n = A.length;  int[][] C = new int[n][n];  for(int i = 0;i < n;i++){  long[] sum = new long[n];  for(int k = 0;k < n;k++){   for(int j = 0;j < n;j++){   sum[j] += (long)A[i][k] * A[k][j];   if(sum[j] >= BIG)sum[j] -= BIG;   }  }  for(int j = 0;j < n;j++){   C[i][j] = (int)(sum[j] % mod);  }  }  return C; }   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)); } }
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(); } }
3	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();  int[] arr=new int[n+1];  for(int i=1;i<=n;i++)   arr[i]=in.nextInt();  Map<Integer,TreeMap<Integer,Integer>> map=new HashMap();  for(int i=1;i<=n;i++)  {   int sum=0;   for(int j=i;j<=n;j++)   {   sum+=arr[j];   if(map.containsKey(sum))   {    TreeMap<Integer,Integer> t=map.get(sum);       Map.Entry<Integer,Integer> e=t.lastEntry();    if(e.getKey()>j)    {    t.remove(e.getKey());    t.put(j,i);    map.put(sum,t);    }    else if(e.getKey()<i)    {    t.put(j,i);    map.put(sum,t);    }   }   else   {    TreeMap<Integer,Integer> t=new TreeMap();    t.put(j,i);    map.put(sum,t);   }   }  }  int ans=0,size=0;  for(Map.Entry<Integer,TreeMap<Integer,Integer>> e:map.entrySet())  {   if(e.getValue().size()>size)   {   ans=e.getKey();   size=e.getValue().size();   }  }  pw.println(size);  for(Map.Entry e:map.get(ans).entrySet())   pw.println(e.getValue()+" "+e.getKey());  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());  } }
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();  } }
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;     }    }  } }
3	public class B implements Runnable { FastReader scn; PrintWriter out; String INPUT = "";  void solve() {  int n = scn.nextInt();  int[] arr = scn.nextIntArray(n);  int[][] a = new int[n * (n + 1) / 2][];  int[] need = new int[a.length];  int pos = 0;  for (int l = 0; l < n; l++) {  int sum = 0;  for (int r = l; r < n; r++) {   sum += arr[r];   a[pos] = new int[] { l, r, sum };   need[pos++] = sum;  }  }  need = scn.uniq(need);  int[][][] list = new int[need.length][][];  int[] size = new int[list.length];  for (int i = 0; i < pos; i++) {  size[Arrays.binarySearch(need, a[i][2])]++;  }  for (int i = 0; i < list.length; i++) {  list[i] = new int[size[i]][];  }  for (int i = 0; i < pos; i++) {  int ind = Arrays.binarySearch(need, a[i][2]);  list[ind][--size[ind]] = new int[] { a[i][0], a[i][1] };  }  int ind = -1, max = 0;  for (int i = 0; i < list.length; i++) {  if(list[i].length == 0) {   continue;  }  Arrays.sort(list[i], (o1, o2) -> o1[1] - o2[1]);   int count = 1, last = list[i][0][1];  for(int j = 1; j < list[i].length; j++) {   if(list[i][j][0] > last) {   count++;   last = list[i][j][1];   }  }    if (count > max) {   max = count;   ind = i;  }  }   out.println(max);  int last = list[ind][0][1];  out.println((list[ind][0][0] + 1) + " " + (list[ind][0][1] + 1));   for(int i = 1; i < list[ind].length; i++) {  if(list[ind][i][0] > last) {   out.println((list[ind][i][0] + 1) + " " + (list[ind][i][1] + 1));   last = list[ind][i][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 B(), "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);   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);  }  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;  }  } }
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 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());  }  } }
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)); } }
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);   }  } }
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);   }  } }
4	public class Task {  private static final boolean readFromFile = false;  public static void main(String args[]){  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FileOutputStream fileOutputStream;  FileInputStream fileInputStream;  if (readFromFile){  try{   fileInputStream = new FileInputStream(new File("input.txt"));   fileOutputStream = new FileOutputStream(new File("output.txt"));  }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{ InputReader in; PrintWriter out;  public void solve(){  String s = in.nextLine();  for (int len=s.length()-1;len>=1;len--)  for (int i=0;i<s.length()-len+1;i++)   for (int j=i+1;j<s.length()-len+1;j++)   if (s.substring(i,i+len).equals(s.substring(j,j+len))){    out.println(len);    return;   }  out.println(0); }   Solver(InputReader in, PrintWriter out){  this.in=in;  this.out=out; } } class InputReader{ private BufferedReader buf; private StringTokenizer tok;  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;  } }  }
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();} }
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);   } }
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 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 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 A {  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());   ArrayList<String> s1 = new ArrayList<String>();   ArrayList<String> s2 = new ArrayList<String>();   for(int i=0; i<n; i++) s1.add(bf.readLine());   for(int i=0; i<n; i++) s2.add(bf.readLine());   Map<String, Integer> mp1 = new HashMap<String, Integer>();   Map<String, Integer> mp2 = new HashMap<String, Integer>();   for(String s : s1) mp1.put(s, 0);   for(String s : s1) mp1.put(s, mp1.get(s)+1);   for(String s : s2) mp2.put(s, 0);   for(String s : s2) mp2.put(s, mp2.get(s)+1);   for(String s : mp1.keySet()) {   while(mp1.get(s) > 0) {    if(mp2.containsKey(s)) {     if(mp2.get(s) > 0) {     mp1.put(s, mp1.get(s)-1);     mp2.put(s, mp2.get(s)-1);    }    else break;    }    else break;   }   }   for(String s : mp2.keySet()) {   while(mp2.get(s) > 0) {    if(mp1.containsKey(s)) {     if(mp1.get(s) > 0) {     mp2.put(s, mp2.get(s)-1);     mp1.put(s, mp1.get(s)-1);    }    else break;    }    else break;   }   }   long sum = 0;   for(String s : mp1.keySet()) sum += mp1.get(s);   out.println(sum);                  out.close(); System.exit(0);  } }
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;  } }
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());  } } }
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;    }   }  } }
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();    }   }  } }
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();  } }
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();    }   }  } }
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;    }   }  } }
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);   }  } }
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());   }  } }
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;   }  } }
3	public class CF1141F { public static void main(String[] args) throws Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  String[] split = br.readLine().split(" ");  int[] terms = new int[n];  int[] sums = new int[n+1];  for(int i=0; i<n; i++) {  terms[i] = Integer.parseInt(split[i]);  sums[i+1] = sums[i]+terms[i];  }  ArrayList<Block> blocks = new ArrayList<>();  for(int i=0; i<n; i++)  for(int j=i; j<n; j++){   int s = sums[j+1]-sums[i];   blocks.add(new Block(i, j, s));  }  Collections.sort(blocks);  ArrayList<Block> best = new ArrayList<>();  int i = 0;  while(i<blocks.size()){  int curSum = blocks.get(i).sum;  ArrayList<Block> curBlocks = new ArrayList<>();  while(i<blocks.size() && blocks.get(i).sum==curSum) curBlocks.add(blocks.get(i++));  int[] memo = new int[curBlocks.size()+1];  Arrays.fill(memo, -1);  memo[curBlocks.size()] = 0;  for(int j=curBlocks.size()-1; j>=0; j--){   int idx = Collections.binarySearch(curBlocks, new Block(curBlocks.get(j).r+1, curBlocks.get(j).r+1, curBlocks.get(j).sum));   if(idx<0) idx = -(idx+1);   memo[j] = Math.max(memo[j+1], 1+memo[idx]);  }  if(memo[0]>best.size()){   best = new ArrayList<>();   int idx = 0;   while(memo[idx]>=1){   if(memo[idx]>memo[idx+1]) best.add(curBlocks.get(idx));   idx++;   }  }  }  StringBuilder sb = new StringBuilder();  sb.append(best.size()).append("\n");  for(Block b : best){  sb.append(b.l+1).append(" ").append(b.r+1).append("\n");  }  System.out.print(sb); }  static class Block implements Comparable<Block>{  int l, r, sum;   Block(int a, int b, int c){  l = a;  r = b;  sum = c;  }  @Override  public int compareTo(Block o) {  if(sum==o.sum){   if(l==o.l) return r-o.r;   return l-o.l;  }  return sum-o.sum;  } } }
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();    } }
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 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();   }  } }
2	public class C {                         public static void main(String[] args)  {   Scanner sc = new Scanner(System.in);   BigInteger x = sc.nextBigInteger();   BigInteger k = sc.nextBigInteger();   BigInteger zero = new BigInteger("0");   BigInteger one = new BigInteger("1");   BigInteger two = new BigInteger("2");   BigInteger modulo = new BigInteger("1000000007");   BigInteger ans = two.modPow(k.add(one),modulo);   ans = ans.multiply(x);   ans = ans.subtract(two.modPow(k,modulo));   ans = ans.add(one);   ans = ans.mod(modulo);   if (x.equals(zero))   {   System.out.println(0);   }   else   {   System.out.println(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);   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;   }  } }
1	public class Main {  static MyScanner scan;  static PrintWriter pw;  public static void main(String[] args) {   new Thread(null,null,"_",1<<25)   {    public void run()    {     try     {      solve();     }     catch(Exception e)     {      e.printStackTrace();      System.exit(1);     }    }   }.start();  }  static void solve() throws IOException {   scan = new MyScanner();   pw = new PrintWriter(System.out, true);   StringBuilder sb = new StringBuilder();   Map<String,Integer> map = new HashMap<>();   map.put("M",0);   map.put("L",1);   map.put("S",2);   map.put("XL",3);   map.put("XS",4);   map.put("XXL",5);   map.put("XXS",6);   map.put("XXXL",7);   map.put("XXXS",8);   int freqa[] = new int[9];   int freqb[] = new int[9];   int n = ni();   for(int i=0;i<n;++i)    ++freqa[map.get(ne())];   for(int i=0;i<n;++i)    ++freqb[map.get(ne())];   for(int i=0;i<9;++i)   {    int xx = min(freqa[i],freqb[i]);    freqa[i]-=xx;    freqb[i]-=xx;   }   long res = 0;   for(int i=0;i<9;++i)    res+=freqa[i]+freqb[i];   pl(res/2);   pw.flush();   pw.close();  }  static long MMI(long A,long MOD)  {   return modpow(A,MOD-2,MOD);  }  static long modpow(long x,long y,long MOD)  {   if(y==0)    return 1;   if((y&1)==0)    return modpow((x*x)%MOD,y>>1,MOD);   else return (x*modpow(x,y-1,MOD))%MOD;  }  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 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 class MyScanner  {   BufferedReader br;   StringTokenizer st;   MyScanner()   {    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 _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();  } }
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);    } }
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);  } }
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 ); } }
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, ""));   }  } }
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();  } }
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);  } }  }
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();  } }
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; } }
2	public class cf3 implements Runnable{   final static long mod = (long)1e9 + 7;   static long modExp(long x, long pow) {   x = x % mod;    long res = 1;     while (pow > 0) {     if (pow % 2 == 1)    res = res * x % mod;     pow = pow / 2;   x = x * x % mod;   }    return res; }  public void run() {    InputReader s = new InputReader(System.in);  PrintWriter w = new PrintWriter(System.out);   int t = 1;    while(t-- > 0) {    long x = s.nextLong(), k = s.nextLong();    if(x == 0) {   w.println(0); continue;  }    x = x % mod;    long res = (modExp(2, k + 1) * x % mod + 1) % mod;  res = (res + mod - modExp(2, k)) % mod;    w.println(res);  }   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 cf3(),"cf3",1<<26).start(); } }
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 Edu_46A {  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 nE = Integer.parseInt(reader.readLine());  int[][] cnt = new int[][] { { 0, 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };  for (int i = 0; i < nE; i++) {  String nxt = reader.readLine();  if (nxt.equals("S")) {   cnt[0][0]++;  }  if (nxt.equals("M")) {   cnt[0][1]++;  }  if (nxt.equals("L")) {   cnt[0][2]++;  }  if (nxt.equals("XS")) {   cnt[1][0]++;  }  if (nxt.equals("XL")) {   cnt[1][1]++;  }  if (nxt.equals("XXS")) {   cnt[2][0]++;  }  if (nxt.equals("XXL")) {   cnt[2][1]++;  }  if (nxt.equals("XXXS")) {   cnt[3][0]++;  }  if (nxt.equals("XXXL")) {   cnt[3][1]++;  }  }  for (int i = 0; i < nE; i++) {  String nxt = reader.readLine();  if (nxt.equals("S")) {   cnt[0][0]--;  }  if (nxt.equals("M")) {   cnt[0][1]--;  }  if (nxt.equals("L")) {   cnt[0][2]--;  }  if (nxt.equals("XS")) {   cnt[1][0]--;  }  if (nxt.equals("XL")) {   cnt[1][1]--;  }  if (nxt.equals("XXS")) {   cnt[2][0]--;  }  if (nxt.equals("XXL")) {   cnt[2][1]--;  }  if (nxt.equals("XXXS")) {   cnt[3][0]--;  }  if (nxt.equals("XXXL")) {   cnt[3][1]--;  }  }  int ans = 0;  for (int i = 1; i <= 3; i++) {  ans += Math.abs(cnt[i][0]);  }  int max = 0;  for (int i = 0; i < 3; i++) {  max = Math.max(max, Math.abs(cnt[0][i]));  }  ans += max;  printer.println(ans);  printer.close(); } }
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 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); } }
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;  } }
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, ArrayList<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 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;   }  } }
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());   }  } }
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)); } }
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 {  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();   }  } }
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 arr1[] = new String[n];    String arr2[] = new String[n];    int i, j, count = 0;    for (i = 0; i < n; i++) {     arr1[i] = in.nextString();    }    for (i = 0; i < n; i++) {     arr2[i] = in.nextString();     for (j = 0; j < n; j++) {      if (arr2[i].equals(arr1[j])) {       arr1[j] = "";       count++;       break;      }     }    }    out.println(n - count);   }  }  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 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);   }  }  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);   }  } }
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);   }  } }
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);   }  } }
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);  } }
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 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 _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); } }
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));  } }
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 {  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 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);  } }
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;  } } }
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;  }   } }
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 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);   } }
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;  } } }
0	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));     StringTokenizer st = new StringTokenizer(bf.readLine());     int n = Integer.parseInt(st.nextToken());   int m = Integer.parseInt(st.nextToken());   StringBuilder ans1 = new StringBuilder();   StringBuilder ans2 = new StringBuilder();   for(int i=0; i<2229; i++) ans1.append('5');   ans1.append('6');   for(int i=0; i<2230; i++) ans2.append('4');   out.println(ans1.toString());   out.println(ans2.toString());   out.close(); System.exit(0);  } }
5	public class Main2 {  public static void main(String[] args) throws Exception {   new Main2().run();  }  public void solve() throws Exception {   n = nextInt();   int a[]= new int[n], pos = 1;   for(int i=0; i<n; i++)    a[i] = nextInt();   Arrays.sort(a);   if(n == 1){    out.println("NO"); return;   }   boolean has = false;   for(; pos<n; pos++){    if(a[pos] != a[0]){     has = true;     break;    }   }   if(!has){    out.println("NO");   }   else{    out.println(a[pos]);   }  }  public int n, m;  public void run() throws Exception {   inter = new StreamTokenizer(new BufferedReader(new InputStreamReader(     System.in)));   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(new OutputStreamWriter(System.out));   solve();   out.flush();  }  public BufferedReader in;  public StreamTokenizer inter;  public PrintWriter out;  public int nextInt() throws Exception {   inter.nextToken();   return (int) inter.nval;  }  public String nextLine() throws Exception{   return in.readLine();  } }
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;   }  } }
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);  } }
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;   }  } }
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"); } }
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;   }  } }
6	public class Main {  public static class Pair implements Comparable<Pair> {   int k, x;   public Pair(int k) {    this.k = k;   }   public void update(int x) {    this.x = Math.max(this.x, x);   }   public int compareTo(Pair other) {    if (x != other.x) {     return other.x - x;    }    return k - other.k;   }  }  public static int sum(int[] arr) {   int sum = 0;   for (int x : arr) {    sum += x;   }   return sum;  }  public static int[] join(int[] a, int[] b) {   int n = a.length;   int[] best = new int[n];   int sum = 0;   for (int shift = 0; shift < n; shift++) {    int[] curr = new int[n];    for (int i = 0; i < n; i++) {     curr[i] = Math.max(a[i], b[(i + shift) % n]);    }    int now = sum(curr);    if (now > sum) {     sum = now;     best = curr;    }   }   return best;  }  public static int n;  public static int[] pow;  public static int[][] dp, real;  public static void calc(int mask) {   int[] best = new int[n];   int sum = 0;   for (int i = 0; i < n; i++) {    if ((mask & pow[i]) != 0) {     int to = mask ^ pow[i];     int[] init = new int[n];     for (int j = 0; j < n; j++) {      init[j] = real[j][i];     }     int[] curr = join(dp[to], init);     int s = sum(curr);     if (s > sum) {      sum = s;      best = curr;     }    }   }   dp[mask] = best;  }  public static void main(String[] args) {   pow = new int[15];   pow[0] = 1;   for (int i = 1; i < pow.length; i++) {    pow[i] = pow[i - 1] * 2;   }   Scanner in = new Scanner(System.in);   int t = in.nextInt();   for (int i = 0; i < t; i++) {    n = in.nextInt();    int m = in.nextInt();    int[][] arr = new int[n][m];    for (int j = 0; j < n; j++) {     for (int k = 0; k < m; k++) {      arr[j][k] = in.nextInt();     }    }    Pair[] best = new Pair[m];    for (int j = 0; j < m; j++) {     best[j] = new Pair(j);     for (int k = 0; k < n; k++) {      best[j].update(arr[k][j]);     }    }    Arrays.sort(best);    real = new int[n][n];    for (int j = 0; j < n; j++) {     for (int k = 0; k < Math.min(n, m); k++) {      real[j][k] = arr[j][best[k].k];     }    }    dp = new int[1 << n][];    Stack<Integer>[] min = new Stack[n + 1];    for (int j = 0; j <= n; j++) {     min[j] = new Stack<>();    }    for (int j = 0; j < dp.length; j++) {     int cnt = 0;     for (int k = 0; k < n; k++) {      if ((j & pow[k]) != 0) {       cnt++;      }     }     min[cnt].add(j);    }    for (int j = 0; j < min.length; j++) {     for (int x : min[j]) {      if (j == 0) {       dp[x] = new int[n];      } else {       calc(x);      }     }    }    System.out.println(sum(dp[dp.length - 1]));   }  } }
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");    } }
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();   }  } }
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)); } }
