import java.io.InputStreamReader;
import java.util.Scanner;

/**
 *
 * @author Bader Bushnaq
 */
public class ACM_training_q1
{
    public static void main(String[] args)
    {
        Scanner s=new Scanner(new InputStreamReader(System.in));
        String x=s.next();
        int c=1;
        char n=x.charAt(0);
        for(int i=1;i<x.length();i++)
        {
            if(n==x.charAt(i))
            {
                c++;
                 if(c>=7)
                 {
                     System.out.println("YES");
                    break;
                 }
                 continue;
            }
            else
                if(n!=x.charAt(i))
                {
                    c=1;
                    n=x.charAt(i);
                }

        }
        if(c<7)
        {
            System.out.println("NO");
        }
    }

}

import java.util.Scanner;

/**
 *
 * @author DELL
 */
public class CodeForce96AFootball {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner s = new Scanner(System.in);
        String ss = s.nextLine();

        if(ss.contains("1111111")||ss.contains("0000000")){
            System.out.println("YES");
        }else{
        System.out.println("NO");
        }

    }
}

import java.util.Scanner;

public class A96{

    public static void main(String[] args){
        String football;
        int count=0;
        Scanner input = new Scanner(System.in);
        football = input.next();
        char current=football.charAt(0);
        for(int i=0;i<football.length();i++){
            if(football.charAt(i) == current){
                count++;
            }
            else{
                current = (current == '0') ? '1':'0';
                count=1;
            }
            if(count >= 7){
                System.out.println("YES");
                break;
            }
        }
        if(count < 7){
            System.out.println("NO");
        }
    }
}

import java.util.Scanner;

/**
 * User: rakh1213
 */
public class AR_96A {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String[] split = s.split("");
        int countOne = 0;
        int countTwo = 0;
        for (int i = 1; i < split.length; i++) {
            if (split[i].equals("1")) {
                countOne++;
                countTwo = 0;
            } else {
                countOne = 0;
                countTwo++;
            }
            if (countOne > 6 || countTwo > 6) {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}

import java.util.Scanner;

public class Main {
    private static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        String pos = scanner.nextLine();
        int l = pos.length();
        char ch[] = pos.toCharArray();
        int i=0,count=0;
        while(i<l-1){
            if(ch[i]==ch[i+1]){
                count++;
                if (count>=6){
                    System.out.println("YES");
                    break;
                }
            }
            else {
                count=0;
            }
            i++;
        }
        if(count<6){
            System.out.println("NO");
        }

    }
}

import java.util.*;
public class Football
{
	public static void main(String [] args)
	{
		Scanner in = new Scanner(System.in);
		String s = in.next();
		if(s.length() < 7)
		{
			System.out.println("NO");
			return;
		}
		for(int i=0;i<=s.length()-7;i++)
		{
			String sub = s.substring(i, i+7);
			if(allZeros(sub) || allOnes(sub))
			{
				System.out.println("YES");
				return;
			}

		}
		System.out.println("NO");
	}
	static boolean allZeros(String s)
	{
		for(int i=0;i<s.length();i++)
		{
			if(s.charAt(i) != '0')
				return false;
		}
		return true;
	}
	static boolean allOnes(String s)
	{
		for(int i=0;i<s.length();i++)
		{
			if(s.charAt(i) != '1')
				return false;
		}
		return true;
	}
}

import java.util.Scanner;

public class Football {
		public static void main(String[] args) {
			Scanner number = new Scanner(System.in);

			String players = number.nextLine();
			int i=0;
			int numberOfOnes=0;
			int flagI=0;
			String isDangerous = "NO";
			for(i=0; i<players.length(); i++){
				if(players.charAt(i) == '1'){
					flagI=i;
					while(i<players.length()&&players.charAt(i)!='0'){
						numberOfOnes++;
						i++;
					}
					i=flagI;
					if(numberOfOnes>=7){
						isDangerous="YES";
					}
					numberOfOnes=0;

				}
				else if(players.charAt(i)== '0'){
					flagI=i;
					while(i<players.length()&&players.charAt(i)!='1'){
						numberOfOnes++;
						i++;
					}
					i=flagI;
					if(numberOfOnes>=7){
						isDangerous="YES";
					}

				numberOfOnes=0;
				}
				i=flagI;

			}
			System.out.println(isDangerous);
}
}

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

public class main {

    public static void main(String args[]) throws Exception {
        Scanner in = new Scanner(System.in);

        String s="";
        int sum = 1;
        int n=0;
        while(in.hasNext()){
            s =in.next();
        }
        for (int i = 1; i < s.length(); i++){
            if(s.charAt(i)==s.charAt(i-1))sum++;
            else if ((s.charAt(i)!=s.charAt(i-1))){
                sum=1;
            }
            if(sum==7){
                System.out.println("YES"); n=1;
                break;
            }
        }if(n!=1)
        System.out.println("NO");
    }
}

import java.util.Scanner;

public class Football {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);

		String players = input.next();
		int ptr1 = 0;
		int ptr2 = 6;
		boolean result = false;

		while (ptr2 < players.length()) {
			int temp = ptr1;
			while((players.charAt(ptr1) == players.charAt(ptr2))) {
				ptr1++;
				if (ptr1 == ptr2 && (players.charAt(ptr1) == players.charAt(ptr2))) {
					result = true;
					break;
				}
			}
			if (result == true) {
				break;
			}
			ptr1 = temp + 1;
			ptr2++;
		}

		if (result == true) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}

	}
}

// package Codeforces;

import java.util.*;

public class TestCodeforces {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        int len = s.length();
        int n0 = 0, n1 = 0; // number0 / number1
        for (int i = 0; i < len; i++) {
            char c = s.charAt(i);
            if (c == '0') n0++;
            else n0 = 0;
            if (c == '1') n1++;
            else n1 = 0;
            if (n0 == 7 || n1 == 7) {
                System.out.print("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder s = new StringBuilder(sc.nextLine());
        int f = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '0') {
                int a = 0;
                for (int j = i; j < s.length(); j++) {
                    if (s.charAt(j) == '0') a++;
                    if (s.charAt(j) == '1' && a < 7) break;
                }
                if (a >= 7) {
                    System.out.println("YES");
                    f = 1;
                    break;
                } else continue;
            }
            if (s.charAt(i) == '1') {
                int b = 0;
                for (int j = i; j < s.length(); j++) {
                    if (s.charAt(j) == '1') b++;
                    if (s.charAt(j) == '0' && b < 7) break;
                }
                if (b >= 7) {
                    System.out.println("YES");
                    f = 1;
                    break;
                } else continue;
            }
        }
        if(f==0) System.out.println("NO");

    }
}

import java.util.Scanner;
public class Football
{
    public static void main(String args[])
    {
        Scanner ip = new Scanner(System.in);
        String s = ip.next();
        if(s.contains("1111111")||s.contains("0000000"))
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.util.Scanner;

/**
 *
 * @author Assem
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        // TODO code application logic here

        Scanner scanner = new Scanner(System.in);
        String input = scanner.next();
        int zeros =0;
        int ones =0;
        boolean Exceeded =false;
        for (int i = 0 ; i < input.length() ; i++)
        {
            if (input.charAt(i)=='0')
            {
                zeros++;
                ones =0;
                if (zeros==7)
                {
                    Exceeded = true ;
                    System.out.println("YES");
                    break;
                }

            }
            else if (input.charAt(i)== '1')
            {

                ones++;
                zeros=0;
                if (ones==7)
                {
                    Exceeded = true ;
                    System.out.println("YES");
                    break;
                }

            }

        }

            if (!Exceeded)
            {
                System.out.println("NO");
            }
        }

}

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

public class Football {

    public static void main(String [] args) throws IOException
    {
Football object=new Football();
        BufferedReader input = new BufferedReader( new InputStreamReader( System.in ) );

        String one=input.readLine();

System.out.println(object.Football(one));

    }
    public String   Football(String one)
    {

if(one.contains("0000000")  || one.contains("1111111") )
{
    return "YES";
}
else{
          return "NO";
}

    }
}

import java.util.Scanner;

public class Football {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next(); int length = s.length();
		boolean dang = false;
		if(length <  7)
			dang = false;
		else if(length == 7) {
			if(s == "0000000" || s == "1111111")
				dang = true;
			else
				dang = false;
		}
		else {
					for(int i = 0; i <= length - 7; i++) {
		//don't use '==' because it's a string
		if(s.substring(i, i+7).equals("0000000") ||
				s.substring(i, i+7).equals("1111111")) {
			dang = true;
			break;
		}
	}
		}
		if(dang)
			System.out.println("YES");
		else
			System.out.println("NO");
	}

}

import java.io.IOException;
import java.util.Scanner;

import javax.swing.JFrame;

public class Zadan extends JFrame{

    public static void main(String[] args) throws NumberFormatException, IOException, ClassNotFoundException {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        if(str.matches(".*([1]{7,}|[0]{7,}).*")) System.out.println("YES"); else System.out.println("NO");
        // TODO Auto-generated method stub

    }

}

import java.util.Scanner;

public class Taxi{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a=sc.next();
        int n = a.length();
        String answer="NO";
        for (int i=0;i<(n-6);i++ )
        {
        if ((a.charAt(i)=='1' && a.charAt(i+1)=='1' && a.charAt(i+2)=='1' && a.charAt(i+3)=='1' && a.charAt(i+4)=='1' && a.charAt(i+5)=='1' && a.charAt(i+6)=='1')||(a.charAt(i)=='0' && a.charAt(i+1)=='0' && a.charAt(i+2)=='0' && a.charAt(i+3)=='0' && a.charAt(i+4)=='0' && a.charAt(i+5)=='0' && a.charAt(i+6)=='0')){answer="YES";break;}

        }

        System.out.print(answer);

    }
}

import java.util.Scanner;

public class Footbal {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		if(s.contains("0000000") || s.contains("1111111"))
			System.out.println("YES");
		else
			System.out.println("NO");
	}
}

import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Mohammad
 */
public class FootBall {
    public static void main(String[] args)throws IOException {

        Scanner cs=new Scanner(new InputStreamReader(System.in));

        String s=cs.next();

        if(s.contains("0000000")||s.contains("1111111"))
        {
            System.out.println("YES");
        }
        else
        {
            System.out.println("NO");
        }

    }

}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        boolean OK = false;
        int one = 0;
        int zero = 0;
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == '1') {
                one++;
                zero = 0;
            } else {
                zero++;
                one = 0;
            }
            if (one == 7 || zero == 7) {
                OK = true;
                break;
            }
        }
        if (OK == true) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

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

public class Football {

	public static void main(String[] args) throws IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

		String str=br.readLine();
		int count =1;
		boolean status=false;
		for(int i=0;i<str.length();i++){
			if(i!=0 && str.charAt(i)==str.charAt(i-1)){
				count++;
				if(count>=7){
					System.out.println("YES");
					status=true;
					break;

				}
			}else{
				count =1;
			}
		}
		if(!status){
		System.out.println("NO");
		}
	}

}

import java.util.*;
public class Main{
     public static void main(String ... S){
       Scanner sc = new Scanner(System.in);
       String s = sc.nextLine();
       int zero = 0;
       int one = 0;
       for(int i = 0; i<s.length(); i++){

            if(s.charAt(i) == '1'){
                 zero = 0;
            }
            else zero++;
            if(zero >= 7){
              System.out.println("YES");
               return ;
              }
       }

       for(int i = 0;i<s.length(); i++){

                 if(s.charAt(i) == '0')
                   one = 0;
                 else one++;
                 if(one >= 7){
                      System.out.println("YES");
                      return ;
                 }
       }

       System.out.println("NO");
     }
}

import java.util.Scanner;

public class Football_900 {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String inputPlayers = sc.next();
		sc.close();

		String checkThe0 = "0000000";
		String check1 = "1111111";

		boolean dangerous0 = inputPlayers.contains(checkThe0);
		boolean dangerous1 = inputPlayers.contains(check1);

		if(dangerous0 || dangerous1) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}

import java.util.Scanner;
public class Main {
  public static void main(String[] args){
Scanner odb = new Scanner(System.in);

		String text = odb.nextLine();
		int leng = 1;
		if (text.length() <= 100 && text.length()>=1) {

			for (int i = 0; i < text.length()-1; i++) {
				if (leng <= 6) {
					if (text.charAt(i) == text.charAt(i + 1)) {
						leng++;
					}else

						leng = 1;
				}

			}
		}else {
			System.out.println("NO");

		}

		if(leng>=7) {
			System.out.println("YES");
		}else
			System.out.println("NO");
  }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class foo {
	public static void main(String[] args) throws IOException{
		BufferedReader sin= new BufferedReader(new InputStreamReader(System.in));
		int now=99;
		int one=0;
		int zero=0;
		while(now!='\n'){
			now=sin.read();
			if(now==49){
				if(one==0)
					zero=0;
				if((++one)>=7){
					System.out.println("YES");
					return;
				}

			}
			else{
				if(now==48){
					if(zero==0)
						one=0;
					if((++zero)>=7){
						System.out.println("YES");
						return;
					}
				}
			}
		}
		System.out.println("NO");

	}

}

import java.util.Scanner;
public class Stone {
public static void main(String[] args) {

Scanner s=new Scanner(System.in);

String  f=s.next();
  boolean a=false;
  int c=0;

           for(int i=0;i<=f.length()-7;i++)
     {
         if(f.substring(i, i+7).equals("1111111")||f.substring(i, i+7).equals("0000000")){
          a= true;}

        }
if(a)
     System.out.println("YES");
else
     System.out.println("NO");

}

 }

import java.util.Scanner;
public class Main
{
	public static void main(String[] args)
	{
	     Scanner sc = new Scanner(System.in);
	     String s = sc.nextLine();
	     int count = 0;
	     int flag=0;
	     for(int i=0;i<s.length();i++)
	     {
	         if(s.charAt(i) == '1')
	         {
	             if(flag>=7)
	             {
	                 count++;
	             }
	             else
	             {
	                 flag = 0;
	                 count++;
	             }
	         }
	         if(s.charAt(i) == '0')
	         {
	             if(count>=7)
	             {
	                 flag++;
	             }
	             else
	             {
	                 count = 0;
	                 flag++;
	             }
	         }
	     }

	     if(count>=7 && flag>=7)
	     {
	         System.out.println("NO");
	         return;
	     }
	     else if(count >=7 || flag>=7)
	     {
	         System.out.println("YES");

	     }
	     else
	     {
	         System.out.println("NO");
	     }
	}
}

import java.util.Scanner;

public class Football {

    public static void main (String [] args) {
        Scanner sc= new Scanner (System.in);
        String s=sc.nextLine();
        int count =1;
        boolean dang=false;
        for (int i=0; i<s.length()-1 && dang==false; i++){
            while (i<s.length()-1 && s.charAt(i)==s.charAt(i+1)){
                count++;
                i++;
            }
            if (count>=7)
                dang=true;
            count=1;

        }
        if (dang==true)
            System.out.println("YES");
        else
            System.out.println("NO");
    }

}

import java.util.Scanner;

public class Football {

    public static void main (String [] args) {
    	Scanner sc= new Scanner (System.in);
    	String s=sc.nextLine();
    	int count =1;
    	boolean dang=false;
    	for (int i=0; i<s.length()-1 && dang==false; i++){
    		while (i<s.length()-1 && s.charAt(i)==s.charAt(i+1)){
    			count++;
    			i++;
    		}
    		if (count>=7)
    			dang=true;
    		count=1;

    	}
    	if (dang==true)
    		System.out.println("YES");
    	else
    		System.out.println("NO");
    }

}

import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main{
    public static void main(String[]args)throws Exception
    {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

        String str = bf.readLine();

        if(str.contains("0000000")||str.contains("1111111"))
        {
            System.out.println("YES");
        }
        else
        {
            System.out.println("NO");
        }

    }
}

import java.util.Scanner;

public class Football {

public static void main(String[] args) {

Scanner s=new Scanner(System.in);
String  f=s.next();

  int c=0;int g=0;

           for(int i=0;i<=f.length()-1;i++)
     {
         if(f.charAt(i)=='0'){
          c++;
          g=0;    }

     else
         {
           c=0;
           g++;

         }

          if(g>=7||c>=7){

     System.out.println("YES");
       return;
          }

        }

     System.out.println("NO");

}

 }

import java.util.Scanner;
public class Football{
    public static void main(String[]args){
        Scanner x=new Scanner(System.in);
        String y=x.next();
        if(y.contains("1111111")||y.contains("0000000"))
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}

/**
 * @(#)Main.java
 *
 *
 * @author
 * @version 1.00 2011/8/13
 */
import java.util.*;

public class Main {
    public static void main(String[] args) {
        // TODO code application logic here
    	Scanner in = new Scanner(System.in);
    	String s = in.next();
    	if(s.equals("10000000") || s.equals("01111111")){
    		System.out.println ("YES");
    	}else{
    	if(s.length()<7){
    		System.out.println ("NO");
    	}else{
    		int count = 0;
    		for(int i=0;i<(s.length()-7);i++){
    			if(s.substring(i,i+7).equals("0000000") || s.substring(i,i+7).equals("1111111")){
    				count++;
    			}
    		}
    		if(count > 0){
    			System.out.println ("YES");
    		}else{
    			System.out.println ("NO");
    		}
    	}
    	}
    }
}

import java.util.Scanner;

public class Football {
    public static void main(String[] args) {
        Scanner cs=new Scanner(System.in);
        String m=cs.next();
        if(m.contains("0000000")||m.contains("1111111"))
            System.out.println("YES");
        else
            System.out.println("NO");
    }

}

import java.io.IOException;
import java.util.Scanner;

public class Football {

    public static void main(String[] args)  throws IOException
    {

        Scanner cs= new Scanner(System.in);
        String no=cs.next();

      String st1="0000000";
      String st2="1111111";
      if(no.contains(st2)||no.contains(st1)){
          System.out.println("YES");
      }
      else {
          System.out.println("NO");
      }

//

       }
    }

import java.util.Scanner;

/**
 *
 * @author Simran
 */
public class Football1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here

         String str;
        Scanner s = new Scanner(System.in);
        str = s.nextLine();
        int n;
        n = str.length();
      int count =0;
      int x=0;
       for(int i =0; i<n; i++){

       count =0;
        for(int j =i+1; j<n;j++){
        if(str.charAt(i)==str.charAt(j)){
        count += 1;
            if(count==6){
                x=1;
         System.out.println("YES");
         break;
            }//if closed
            }//if closed
           else{
           break;
             }//else closed

        }
         if(x==1)
         {break;}}//for closed
      if(x==0){
        System.out.println("NO");
      }//if closed

    }

}//main closed

import java.util.Scanner;

public class Football {
    public static String solve(String player)
    {
        String result = "";

        outer: for(int i = 0; i < player.length(); i++)
        {
            int count = 0;
            for(int h = i; h < player.length(); h++)
            {
                if(player.charAt(i) == player.charAt(h))
                {
                    count++;
                    if(count == 7)
                    {
                        result = "YES";
                        break outer;
                    }
                }
                else
                {
                    //i = h - 1;
                    break;
                }
            }
        }

        if(result.equals("YES"))
        {
            return "YES";
        }
        else
        {
            return "NO";
        }

    }

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        String player = input.nextLine();
        System.out.println(solve(player));
    }
}

import java.util.Scanner;

public class Football {

public static void main(String args[])
{

Scanner sc = new Scanner(System.in);

String ch=sc.next();
int  count=0,k=0;

if(ch.length()!=0 && ch.length()<=100 && ch.contains("1") && ch.contains("0") )
{
    for (int i = 1; i < ch.length(); i++) {
      if(ch.charAt(i)==ch.charAt(i-1))count++;
      else count=0;
      if(count ==6){
      k=1;
          System.out.println("YES");
          break;
      }
    }
    if(k==0) System.out.println("NO");

}}}

import java.util.Scanner;

public class A {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (s.indexOf("1111111") >= 0 || s.indexOf("0000000") >= 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

}

import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		String situation = scanner.next();
		if(determineSituation(situation) >= 7){
			System.out.print("YES");
		}
		else{
			System.out.print("NO");
		}
		scanner.close();
	}

	public static int determineSituation(String situation){
		int counter = 1; //counter = number of things in a row
		for(int i = 1; i < situation.length(); ++i){
			if(situation.charAt(i) == situation.charAt(i-1)){
				counter++;
				if(counter == 7){
					return counter;
				}
			}
			else{
				counter = 1;
			}
		}
		return counter;
	}

}

import java.util.Scanner;

public class test{

	public static void main(String lol[]){
		Scanner in = new Scanner(System.in);
		String s = in.next();
		int count =0,flag =1;
		for(int i=0;i<s.length()-1;i++){
			if(s.charAt(i)==s.charAt(i+1)){
				count++;
				flag=1;
				if(count==6){
					System.out.println("YES");
					//break;
					System.exit(0);
				}
				//System.out.println("YES " + i + "= "+ (i+1));
				//System.out.println("count " + count);
				//System.out.println("YES");

			}
			/*if(count ==6){
				System.out.println("YES");
				break;
			} */
			else{
				count =0;
				//System.out.println("no " + i + " != "+ (i+1));
				flag =0;
			}
		}
		if(flag !=1 || count!=0 ){
			System.out.println("NO");
		}

	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.IntStream;

/**
 *
 * @author Aniis
 */
public class Main {

    public static void main(String[] args) {
        InputStream inputStream = null;
        /*    try {
            inputStream = new FileInputStream("test.txt");
        } catch (IOException e) {
           throw new RuntimeException(e);
        }*/
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        FuckTheWorld solver = new FuckTheWorld();
        solver.solve(1, in, out);
        out.close();
    }

static boolean allCharactersSame(String s)
{
    int n = s.length();
    for (int i = 1; i < n; i++)
        if (s.charAt(i) != s.charAt(0))
            return false;

    return true;
}
 static long countDivisibles(long A, long B, long K) {
long firstDivisible = A%K == 0 ? A : A + (K - A%K);
        long lastDivisible = B%K == 0 ? B : B - B%K; //B/K behaves this way by default.
        return (lastDivisible - firstDivisible)/K + 1;
    }
  static String join(String x, String y){

   Set<Character> cx=new HashSet<Character>();
   Set<Character> cy=new HashSet<Character>();

   for (int k=0;k<x.length();k++)
       cx.add(x.charAt(k));

   for (int k=0;k<y.length();k++)
       cy.add(y.charAt(k));

   String result="";

   for (Character common: cx)
       if (cy.contains(common))
           result+=common;

   return result;
 }
   static String swap(String str, int i, int j)
    {
        if (j == str.length() - 1)
            return str.substring(0, i) + str.charAt(j)
             + str.substring(i + 1, j) + str.charAt(i);

        return str.substring(0, i) + str.charAt(j)
               + str.substring(i + 1, j) + str.charAt(i)
               + str.substring(j + 1, str.length());
    }
   static int count(final String string, final String substring)
  {
     int count = 0;
     int idx = 0;

     while ((idx = string.indexOf(substring, idx)) != -1)
     {
        idx++;
        count++;
     }

     return count;
  }
   static  int search(String a)
{
	int ans = 0;
	for(int i=1;i<a.length();i++)
	{
		int flag = 1;
		for(int j=i;j<a.length();j++)
		{
			if(a.charAt(j)!=a.charAt(j-i))
			{
				flag = 0;
				break;
			 }
		}
			ans = i;
		if(flag ==1)
		{
			return ans;
		}
	}
	return ans+1;
}

static int countUniqueCharacters(String input) {
    boolean[] isItThere = new boolean[Character.MAX_VALUE];
    for (int i = 0; i < input.length(); i++) {
        isItThere[input.charAt(i)] = true;
    }

    int count = 0;
    for (int i = 0; i < isItThere.length; i++) {
        if (isItThere[i] == true){
            count++;
        }
    }

    return count;
}
 static int count(String s, char c)
    {
        int res = 0;

        for (int i=0; i<s.length(); i++)
        {
            // checking character in string
            if (s.charAt(i) == c)
            res++;
        }
        return res;
    }
    static class FuckTheWorld {

      public void solve(int testNumber, FastScanner in, PrintWriter out) {
         String ch = in.next();
         int a=0;
         int one=0,ze=0;
          for (int i = 0; i < ch.length(); i++) {
               if(ch.charAt(i)=='1'){one++;ze=0;}
               else {ze++;one=0;}
               if(one>=7) {a=1;break;}
               else if(ze>=7){a=1;break;}
          }
          if(a==1)out.println("YES");
          else out.println("NO");
      }
    }
    static class FastScanner {

        private BufferedReader br;
        private StringTokenizer st;

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

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

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

import java.util.*;
public class Solution{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
       String s=sc.nextLine();
       boolean check=false;
       for(int i=0;i<=s.length()-7;i++){
           String str=s.substring(i,i+7);
           HashSet<Character> h=new HashSet<>();
           for(int j=0;j<str.length();j++)
           {
                h.add(str.charAt(j));
           }
           if(h.size()==1)
           {
             check=true;
               break;
           }
       }
       if(check==true)
       System.out.println("YES");
       else
       System.out.println("NO");

    }
}

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String cad = sc.nextLine();
        boolean sw = false;
        int cont = 0;
        for (int i = 0; i < cad.length(); i++) {
            cont=0;
            for (int j = 0; j < cad.length(); j++) {
                if (cad.charAt(i) == cad.charAt(j)) {
                    cont++;
                    if (cont == 7) {
                        sw = true;
                        break;
                    }
                } else {
                    cont = 0;
                }

            }
        }
        if (sw) {
            System.out.println("YES");
        } else {
            System.out.println("NO");

        }

    }
}

import java.util.Scanner;

public class ej10 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);
		String h = sc.nextLine(), a = "", b = "";
		int c = 0, l = h.length(), loc = 0, loc1 = 0;
		boolean sw1 = true, sw2 = false;
		for (int i = 2; i <= l; i++) {
			if (sw1) {
				sw1 = false;
				loc = i;
				c++;
				a = h.substring(i - 1, i);

			} else {
				b = h.substring(i - 1, i);
				if (b.compareTo(a) == 0) {
					c++;
					if (c == 7) {
						loc1 = loc;
						sw2 = true;
					}
				} else {
					c = 0;
					sw1 = true;

				}
			}

		}
		if (h.length() == 8) {
			if (h.substring(0, 7).compareTo("1111111") == 0
					&& h.substring(h.length() - 1, h.length()).compareTo("0") == 0) {
				sw2 = true;
			} else {
				if (h.substring(0, 7).compareTo("0000000") == 0
						&& h.substring(h.length() - 1, h.length()).compareTo("1") == 0) {
					sw2 = true;
				}
			}

		}

		if (sw2) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}

}

import java.util.*;
public class Test
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
int l = s.length();
int flag=0;
for(int i=0;i<(l-6);i++)
{
    int p=i+7;

    if((s.substring(i,p)).equals("1111111") || (s.substring(i,p)).equals("0000000"))
    {
        flag=1;
        break;
    }
}
if(flag==1)
{
    System.out.print("YES");
}
else
{
    System.out.print("NO");
}
}
}

import java.util.Scanner;

/**
 *
 * @author Ahmed Ghalib
 */
public class JavaApplication52 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

      Scanner input = new Scanner (System.in);
  String a = input.next();
  boolean k = false ;
    int x  = 0 ;
 if(a.length()>=7)

        for (int i = 0; i < a.length(); i++) {

            if(a.length()-i>=7){
            if(a.charAt(i)=='1'&&a.charAt(i+1)=='1'&&a.charAt(i+2)=='1'&&a.charAt(i+3)=='1'&&a.charAt(i+4)=='1'&&a.charAt(i+5)=='1'&&a.charAt(i+5)=='1'&&a.charAt(i+6)=='1' )
                    k=true;
             if(a.charAt(i)=='0'&&a.charAt(i+1)=='0'&&a.charAt(i+2)=='0'&&a.charAt(i+3)=='0'&&a.charAt(i+4)=='0'&&a.charAt(i+5)=='0'&&a.charAt(i+5)=='0'&&a.charAt(i+6)=='0' )
                    k=true;
            }
        }
        if(k==true)
           System.out.println("YES");
        else
        System.out.println("NO");
    }}

import java.util.Scanner;
public class Trial{
    public static void main(String[] args){
    	Scanner sc=new Scanner(System.in);
    	String s=sc.nextLine();

    	if(s.length()<7)System.out.println("NO");
    	else if(s.contains("0000000") | s.contains("1111111")) System.out.println("YES");
    	else System.out.println("NO");
     }
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

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

public class football {

    public static void main(String[] args) {
        Scanner r = new Scanner(System.in);

        String s = r.next();
        int c = 1;
        char[] ch = s.toCharArray();
        char cur = ch[0];
        boolean works = false;
        for (int i = 0; i < s.length(); i++) {
            if (c == 7) {
                works = true;
                break;
            }
            if (i == 0) {
            } else {
                if (ch[i] == cur) {
                    c++;
                } else {
                    c = 1;
                    cur = ch[i];
                }

            }
            //System.out.println(c);
        }
        if (c == 7) {
                works = true;

            }
        if (works) {
            System.out.println("YES");
        } else {
            System.out.println("NO");

        }
    }
}

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.InputMismatchException;

public class hsdf {

    public static void main(String args[]) {

        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);

        String s=in.next();
        int n=s.length();
        int current;
        int pre = Integer.valueOf(s.charAt(0));
        int count=0;
        boolean flag=false;
        for(int i=0;i<s.length();i++){
             current=Integer.valueOf(s.charAt(i));
             if(current==pre){
                 count++;
             }
             else{
                 count=1;
             }

             if(count==7){
                 flag=true;
                 out.printLine("YES");
                 break;
             }
             pre=current;

        }
        if(flag==false)
            out.printLine("NO");

        out.close();

    }

}

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

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

    public int read(){
            if (numChars == -1)
            throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
    }
    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }
    public 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();
    }
    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }
    public String next() {
        return readString();
    }
    }

class OutputWriter {
    private final PrintWriter writer;
    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(outputStream);
    }
    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }
    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }
    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }
    public void close() {
    writer.close();
    }
    }

import java.util.*;

public class Football96A {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();
        String ans="NO";
        int i = 0; int k =0;
        while(i+1<input.length()){
            int streak=0; k=i+1;
            while(k<input.length() && input.charAt(i)==input.charAt(k)){
                streak++;
                k++;
//              System.out.println(streak);
                if(streak==6){
                    ans="YES";
                    break;
                }
                }
            i=k;

        }
        System.out.print(ans);
    }

}

import java.util.*;
public class CF96A9 {
  public static void main(  String[] args){
    Scanner input=new Scanner(System.in);
    String s1=input.nextLine();
    int l=s1.length();
    int max_zeros=0;
    int max_ones=0;
    int temp=0;
    int temp2=0;
    for (int i=0; i < l; i++) {
      if (s1.charAt(i) == '0') {
        temp2=0;
        if (temp2 > max_ones) {
          max_ones=temp2;
        }
        temp=temp + 1;
      }
 else {
        temp=0;
        if (temp > max_zeros) {
          max_zeros=temp;
        }
        temp2=temp2 + 1;
      }
      if (s1.length() != 0 && s1 != "") {
        if (temp > max_zeros) {
          max_zeros=temp;
        }
      }
      if (temp2 > max_ones) {
        max_ones=temp2;
      }
    }
    if (max_zeros >= 7 || max_ones >= 7) {
      System.out.print("YES");
    }
 else {
      System.out.print("NO");
    }
  }
}

import java.util.*;

public class Domino
{
  public static void main(String[] args)
  {
    Scanner s= new Scanner(System.in);
    String a =s.next();
    char perChar =a.charAt(0);
    int count=1;
    boolean w =true;
    for(int i=1;i<a.length();i++)
    {
      if(perChar == a.charAt(i))
      {
        count++;
      }
      else
      {
        count=1;
        perChar=a.charAt(i);
      }
      if(count>=7)
      {
        w= false;
        break;
      }
    }
    if(w==false)
    {
      System.out.print("YES");
    }
    else
      System.out.print("NO");
  }
}

import java.util.Scanner;
import java.util.Arrays;
public class Main{

	public static void main (String args[]){

		Scanner inp =new Scanner(System.in);

		String s = inp.nextLine();
		if(s.contains("1111111")||s.contains("0000000"))
		System.out.print("YES");
		else
			System.out.print("NO");

	}

	}

import java.util.Scanner;

public class Football_96A {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String playersOrder = sc.next();
        System.out.println(isDangerous(playersOrder));

    }

    public static String isDangerous(String playersOrder) {
        for (int i = 0; i <= playersOrder.length() - 7; i++) {
            String toCheck = playersOrder.substring(i, i + 7);
            if (toCheck.equals("1111111") || toCheck.equals("0000000")) {
                return "YES";
            }
        }
        return "NO";
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Football
{

    public static void main(String[] args)throws IOException
    {
        BufferedReader scan=new BufferedReader(new InputStreamReader(System.in));
        String nums=scan.readLine();
        int aux=0;
        int aux1=0;
        System.out.println(funcion(nums,aux,aux1));

    }
    public static String funcion(String nums,int aux,int aux1)
    {
        for(int i=0;i<nums.length()-2;i++)
    {
        aux=1;
        aux1=i+1;
        while(aux1<nums.length())
        {

            if(nums.charAt(i)==nums.charAt(aux1))
            {
                aux++;
                if(aux>=7)
                {

                 return "YES";
                }
            }
            else
            {

                aux=0;
            }
            aux1++;
        }

    }
        return "NO";

    }
}

import java.util.Scanner;
public class CF96A4 {
  public static void main(  String[] args){
   // System.out.println("bitse207 1");
    Scanner scan=new Scanner(System.in);
    String bitString=scan.nextLine();
    boolean zeroRoll=bitString.charAt(1) == '0';
    boolean danger=false;
    int count=1;
    for (int i=1; i < bitString.length(); i++) {
     // System.out.println("bitse207 2");
      if (count == 7) {
       // System.out.println("bitse207 3");
        danger=true;
      }
      if (zeroRoll) {
       // System.out.println("bitse207 4");
        if (bitString.charAt(i) == '0') {
        //  System.out.println("bitse207 6");
          count++;
        }
 else {
        //  System.out.println("bitse207 7");
          zeroRoll=false;
          count=1;
        }
      }
 else {
       // System.out.println("bitse207 5");
        if (bitString.charAt(i) == '1') {
         // System.out.println("bitse207 8");
          count++;
        }
 else {
        //  System.out.println("bitse207 9");
          zeroRoll=true;
          count=1;
        }
      }
    }
    if (danger) {
     // System.out.println("bitse207 10");
      System.out.println("YES");
    }
 else {
     // System.out.println("bitse207 11");
      System.out.println("NO");
    }
  }
}

import java.util.Scanner;

public class Football_96A {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //Players
        System.out.println(isDangerous(sc.next()));

    }

    public static String isDangerous(String playersOrder) {
        for (int i = 0; i <= playersOrder.length() - 7; i++) {
            String toCheck = playersOrder.substring(i, i + 7);
            if (toCheck.equals("1111111") || toCheck.equals("0000000")) {
                return "YES";
            }
        }
        return "NO";
    }
}

import java.util.Scanner;

public class Football_96A {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //Players
        String playersOrder = sc.next();
        String forRtn = "NO";

        if (playersOrder.length() > 7) {
            for (int i = 0; i <= playersOrder.length() - 7; i++) {
                String toCheck = playersOrder.substring(i, i + 7);
                if (playersOrder.charAt(i) == '1' && toCheck.equals("1111111")) {
                    forRtn = "YES";

                } else if (toCheck.equals("0000000")) {
                    forRtn = "YES";
                }
            }
        }

        System.out.println(forRtn);
    }

}

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

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);
        Task solver = new A();
        solver.solve(1, in, out);
        out.close();
    }
}

interface Task {
    public void solve(int testNumber, InputReader in, OutputWriter out);
}

class A implements Task {

    public void solve(int testNumber, InputReader in, OutputWriter out){
        String str=in.next();
        boolean val=str.contains("0000000") || str.contains("1111111");
        out.printLine(val?"YES":"NO");
    }

}

class B implements Task {

	public void solve(int testNumber, InputReader in, OutputWriter out) {

    }

}

class C implements Task {

	public void solve(int testNumber, InputReader in, OutputWriter out){

    }

}

class D implements Task {

	public void solve(int testNumber, InputReader in, OutputWriter out){

    }

}

class E implements Task {

	public void solve(int testNumber, InputReader in, OutputWriter out){

	}

}

class F implements Task {

	public void solve (int testNumber, InputReader in, OutputWriter out) {

	}

}

class IOUtils {
	public static Pair<Integer, Integer> readIntPair(InputReader in) {
		int first = in.readInt();
		int second = in.readInt();
		return Pair.makePair(first, second);
	}

	public static Pair<Long, Long> readLongPair(InputReader in) {
		long first = in.readLong();
		long second = in.readLong();
		return Pair.makePair(first, second);
	}

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

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

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

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

	public static char[] readCharArray(InputReader in, int size) {
		char[] array = new char[size];
		for (int i = 0; i < size; i++)
			array[i] = in.readCharacter();
		return array;
	}

	public static Pair<Integer, Integer>[] readIntPairArray(InputReader in, int size) {
		@SuppressWarnings({"unchecked"})
		Pair<Integer, Integer>[] result = new Pair[size];
		for (int i = 0; i < size; i++)
			result[i] = readIntPair(in);
		return result;
	}

	public static Pair<Long, Long>[] readLongPairArray(InputReader in, int size) {
		@SuppressWarnings({"unchecked"})
		Pair<Long, Long>[] result = new Pair[size];
		for (int i = 0; i < size; i++)
			result[i] = readLongPair(in);
		return result;
	}

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

	public static void readLongArrays(InputReader in, long[]... arrays) {
		for (int i = 0; i < arrays[0].length; i++) {
			for (int j = 0; j < arrays.length; j++)
				arrays[j][i] = in.readLong();
		}
	}

	public static void readDoubleArrays(InputReader in, double[]...arrays) {
		for (int i = 0; i < arrays[0].length; i++) {
			for (int j = 0; j < arrays.length; j++)
				arrays[j][i] = in.readDouble();
		}
	}

	public static char[][] readTable(InputReader in, int rowCount, int columnCount) {
		char[][] table = new char[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readCharArray(in, columnCount);
		return table;
	}

	public static int[][] readIntTable(InputReader in, int rowCount, int columnCount) {
		int[][] table = new int[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readIntArray(in, columnCount);
		return table;
	}

	public static double[][] readDoubleTable(InputReader in, int rowCount, int columnCount) {
		double[][] table = new double[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readDoubleArray(in, columnCount);
		return table;
	}

	public static long[][] readLongTable(InputReader in, int rowCount, int columnCount) {
		long[][] table = new long[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readLongArray(in, columnCount);
		return table;
	}

	public static String[][] readStringTable(InputReader in, int rowCount, int columnCount) {
		String[][] table = new String[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readStringArray(in, columnCount);
		return table;
	}

	public static String readText(InputReader in) {
		StringBuilder result = new StringBuilder();
		while (true) {
			int character = in.read();
			if (character == '\r')
				continue;
			if (character == -1)
				break;
			result.append((char) character);
		}
		return result.toString();
	}

	public static void readStringArrays(InputReader in, String[]... arrays) {
		for (int i = 0; i < arrays[0].length; i++) {
			for (int j = 0; j < arrays.length; j++)
				arrays[j][i] = in.readString();
		}
	}

	public static void printTable(OutputWriter out, char[][] table) {
		for (char[] row : table)
			out.printLine(new String(row));
	}
}

class InputReader {
	private boolean finished = false;

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

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

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

	public int peek() {
		if (numChars == -1)
			return -1;
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				return -1;
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar];
	}

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

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

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

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

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

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

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

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

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

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

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

	public boolean isExhausted() {
		int value;
		while (isSpaceChar(value = peek()) && value != -1)
			read();
		return value == -1;
	}

	public String next() {
		return readString();
	}

	public SpaceCharFilter getFilter() {
		return filter;
	}

	public void setFilter(SpaceCharFilter filter) {
		this.filter = filter;
	}

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

class OutputWriter {
	private final PrintWriter writer;

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

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

	public void print(char[] array) {
		writer.print(array);
	}

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

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

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

    public void print(IntCollection collection) {
		boolean first = true;
		for (IntIterator iterator = collection.iterator(); iterator.isValid(); iterator.advance()) {
			if (first)
				first = false;
			else
				writer.print(' ');
			writer.print(iterator.value());
		}
	}

	public void printLine(int[] array) {
        print(array);
        writer.println();
    }

    public void printLine(long[] array) {
        print(array);
        writer.println();
    }

    public void printLine(IntCollection collection) {
		print(collection);
		writer.println();
	}

	public void printLine() {
		writer.println();
	}

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

	public void print(char i) {
		writer.print(i);
	}

	public void printLine(char i) {
		writer.println(i);
	}

	public void printLine(char[] array) {
		writer.println(array);
	}

	public void printFormat(String format, Object...objects) {
		writer.printf(format, objects);
	}

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

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

	public void print(long i) {
		writer.print(i);
	}

	public void printLine(long i) {
		writer.println(i);
	}

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

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

class Pair<U, V> implements Comparable<Pair<U, V>> {
	public final U first;
	public final V second;

	public static<U, V> Pair<U, V> makePair(U first, V second) {
		return new Pair<U, V>(first, second);
	}

	private Pair(U first, V second) {
		this.first = first;
		this.second = second;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		Pair pair = (Pair) o;

		return !(first != null ? !first.equals(pair.first) : pair.first != null) && !(second != null ? !second.equals(pair.second) : pair.second != null);

	}

	@Override
	public int hashCode() {
		int result = first != null ? first.hashCode() : 0;
		result = 31 * result + (second != null ? second.hashCode() : 0);
		return result;
	}

	public Pair<V, U> swap() {
		return makePair(second, first);
	}

	@Override
	public String toString() {
		return "(" + first + "," + second + ")";
	}

	@SuppressWarnings({"unchecked"})
	public int compareTo(Pair<U, V> o) {
		int value = ((Comparable<U>)first).compareTo(o.first);
		if (value != 0)
			return value;
		return ((Comparable<V>)second).compareTo(o.second);
	}
}

abstract class IntCollection {
	public abstract IntIterator iterator();
	public abstract int size();
	public abstract void add(int value);
	public abstract void remove(int value);

	public void forEach(IntTask task) {
		for (IntIterator iterator = iterator(); iterator.isValid(); iterator.advance())
			task.process(iterator.value());
	}

	public boolean contains(int value) {
		for (IntIterator iterator = iterator(); iterator.isValid(); iterator.advance()) {
			if (iterator.value() == value)
				return true;
		}
		return false;
	}

	public int count(int value) {
		int result = 0;
		for (IntIterator iterator = iterator(); iterator.isValid(); iterator.advance()) {
			if (iterator.value() == value)
				result++;
		}
		return result;
	}

	public int min() {
		if (size() == 0)
			throw new NoSuchElementException();
		int result = Integer.MAX_VALUE;
		for (IntIterator iterator = iterator(); iterator.isValid(); iterator.advance())
			result = Math.min(result, iterator.value());
		return result;
	}

	public int max() {
		if (size() == 0)
			throw new NoSuchElementException();
		int result = Integer.MIN_VALUE;
		for (IntIterator iterator = iterator(); iterator.isValid(); iterator.advance())
			result = Math.max(result, iterator.value());
		return result;
	}

	public IntCollection union(final IntCollection other) {
		return new IntCollection() {
			@Override
			public IntIterator iterator() {
				return new IntIterator() {
					private IntIterator first = IntCollection.this.iterator();
					private IntIterator second;

					public int value() throws NoSuchElementException {
						if (first.isValid())
							return first.value();
						return second.value();
					}

					public void advance() throws NoSuchElementException {
						if (first.isValid()) {
							first.advance();
							if (!first.isValid())
								second = other.iterator();
						} else
							second.advance();
					}

					public boolean isValid() {
						return first.isValid() || second.isValid();
					}
				};
			}

			@Override
			public int size() {
				return IntCollection.this.size() + other.size();
			}

			@Override
			public void add(int value) {
				throw new UnsupportedOperationException();
			}

			@Override
			public void remove(int value) {
				throw new UnsupportedOperationException();
			}
		};
	}

	public IntCollection map(final IntFunction function) {
		return new IntCollection() {
			@Override
			public IntIterator iterator() {
				return new IntIterator() {
					private IntIterator iterator = IntCollection.this.iterator();

					public int value() throws NoSuchElementException {
						return function.value(iterator.value());
					}

					public void advance() throws NoSuchElementException {
						iterator().advance();
					}

					public boolean isValid() {
						return iterator().isValid();
					}
				};
			}

			@Override
			public int size() {
				return IntCollection.this.size();
			}

			@Override
			public void add(int value) {
				throw new UnsupportedOperationException();
			}

			@Override
			public void remove(int value) {
				throw new UnsupportedOperationException();
			}
		};
	}

	public int[] toArray() {
		int size = size();
		int[] array = new int[size];
		int i = 0;
		for (IntIterator iterator = iterator(); iterator.isValid(); iterator.advance())
			array[i++] = iterator.value();
		return array;
	}

	public long sum() {
		long result = 0;
		for (IntIterator iterator = iterator(); iterator.isValid(); iterator.advance())
			result += iterator.value();
		return result;
	}

	public void addAll(IntCollection values) {
		for (IntIterator it = values.iterator(); it.isValid(); it.advance()) {
			add(it.value());
		}
	}

	public void removeAll(IntCollection values) {
		for (IntIterator it = values.iterator(); it.isValid(); it.advance()) {
			remove(it.value());
		}
	}

	public void retainAll(IntCollection values) {
		for (IntIterator it = iterator(); it.isValid(); it.advance()) {
			if (!values.contains(it.value())) {
				remove(it.value());
			}
		}
	}
}

interface IntIterator {
	public int value() throws NoSuchElementException;
	/*
	 * @throws NoSuchElementException only if iterator already invalid
	 */
	public void advance() throws NoSuchElementException;
	public boolean isValid();
}

interface IntTask {
	public void process(int value);
}

interface IntFunction {
	public int value(int key);
}

class Date implements Comparable<Date> {
	private static final int[] DAYS_IN_MONTH = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	public static final String[] WEEKDAYS = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};

	public final int year;
	public final int month;
	public final int day;
	private int weekday;

	public Date(int year, int month, int day) {
		this.year = year;
		this.month = month;
		this.day = day;
		weekday = -1;
	}

	public int getWeekday() {
		if (weekday == -1) {
			weekday = asInt();
			weekday += 6;
			weekday %= 7;
		}
		return weekday;
	}

	public int asInt() {
		int day = (year - 1) * 365;
		day += (year - 1) / 4;
		day -= (year - 1) / 100;
		day += (year - 1) / 400;
		for (int i = 1; i < month; i++)
			day += DAYS_IN_MONTH[i];
		day += this.day;
		if (isLeapYear(year) && month > 2)
			day++;
		return day;
	}

	public boolean isValid() {
		return !(month > 12 || month < 1) && !(day > DAYS_IN_MONTH[month] &&
			(day != 29 || month != 2 || !isLeapYear(year))) && day >= 1;
	}

	public Date next() {
		int year = this.year;
		int month = this.month;
		int day = this.day;
		day++;
		Date next = new Date(year, month, day);
		if (!next.isValid())
			next = new Date(year, month + 1, 1);
		if (!next.isValid())
			next = new Date(year + 1, 1, 1);
		if (weekday != -1)
			next.weekday = (weekday + 1) % 7;
		return next;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		Date date = (Date) o;

		return day == date.day && month == date.month && year == date.year;
	}

	@Override
	public int hashCode() {
		int result = year;
		result = 31 * result + month;
		result = 31 * result + day;
		return result;
	}

	public static Date parse(String date, String pattern) {
		int length = date.length();
		if (length != pattern.length())
			throw new IllegalArgumentException();
		int year = 0;
		int month = 0;
		int day = 0;
		for (int i = 0; i < length; i++) {
			if (Character.toUpperCase(pattern.charAt(i)) == 'Y') {
				year *= 10;
				year += date.charAt(i) - '0';
			} else if (Character.toUpperCase(pattern.charAt(i)) == 'M') {
				month *= 10;
				month += date.charAt(i) - '0';
			} else if (Character.toUpperCase(pattern.charAt(i)) == 'D') {
				day *= 10;
				day += date.charAt(i) - '0';
			}
		}
		return new Date(year, month, day);
	}

	public static boolean isLeapYear(int year) {
		return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
	}

	public int compareTo(Date o) {
		return asInt() - o.asInt();
	}

	@Override
	public String toString() {
		return toString("DD.MM.YYYY");
	}

	public String toString(String pattern) {
		int copyYear = year;
		int copyMonth = month;
		int copyDay = day;
		StringBuilder result = new StringBuilder();
		for (int i = pattern.length() - 1; i >= 0; i--) {
			char character = pattern.charAt(i);
			switch (character) {
			case 'D': case 'd':
				result.append(copyDay % 10);
				copyDay /= 10;
				break;
			case 'M': case 'm':
				result.append(copyMonth % 10);
				copyMonth /= 10;
				break;
			case 'Y': case 'y':
				result.append(copyYear % 10);
				copyYear /= 10;
				break;
			default:
				result.append(character);
			}
		}
		return result.reverse().toString();
	}
}

class DateTimeUtils {
	public static Time timePassed(Time from, Time to) {
		int hours = to.getHours() - from.getHours();
		int minutes = to.getMinutes() - from.getMinutes();
		int seconds = to.getSeconds() - from.getSeconds();
		if (seconds < 0) {
			seconds += 60;
			minutes--;
		}
		if (minutes < 0) {
			minutes += 60;
			hours--;
		}
		if (hours < 0)
			hours += 24;
		return new Time(hours, minutes, seconds);
	}
}

enum Month {
	NULL(null),
	JANUARY("January"),
	FEBRUARY("February"),
	MARCH("March"),
	APRIL("April"),
	MAY("May"),
	JUNE("June"),
	JULY("July"),
	AUGUST("August"),
	SEPTEMBER("September"),
	OCTOBER("October"),
	NOVEMBER("November"),
	DECEMBER("December");

	public final String longName;
	public final String shortName;

	private Month(String longName) {
		this.longName = longName;
		shortName = longName == null ? null : longName.substring(0, 3);
	}
}

class Time implements Comparable<Time> {
	private final int hours;
	private final int minutes;
	private final int seconds;

	public static Time parse(String time, String pattern) {
		int length = time.length();
		if (length != pattern.length())
			throw new IllegalArgumentException();
		int hours = 0;
		int minutes = 0;
		int seconds = 0;
		for (int i = 0; i < length; i++) {
			if (Character.toUpperCase(pattern.charAt(i)) == 'H') {
				hours *= 10;
				hours += time.charAt(i) - '0';
			} else if (Character.toUpperCase(pattern.charAt(i)) == 'M') {
				minutes *= 10;
				minutes += time.charAt(i) - '0';
			} else if (Character.toUpperCase(pattern.charAt(i)) == 'S') {
				seconds *= 10;
				seconds += time.charAt(i) - '0';
			}
		}
		return new Time(hours, minutes, seconds);
	}

	public Time(int hours, int minutes, int seconds) {
		this.hours = hours;
		this.minutes = minutes;
		this.seconds = seconds;
	}

	public int getHours() {
		return hours;
	}

	public int getMinutes() {
		return minutes;
	}

	public int getSeconds() {
		return seconds;
	}

	public boolean isValid() {
		return hours >= 0 && hours < 24 && minutes >= 0 && minutes < 60 && seconds >= 0 && seconds < 60;
	}

	@Override
	public String toString() {
		return toString("HH:MM:SS");
	}

	public String toString(String pattern) {
		int copyHours = hours;
		int copyMinutes = minutes;
		int copySeconds = seconds;
		StringBuilder result = new StringBuilder();
		for (int i = pattern.length() - 1; i >= 0; i--) {
			char character = pattern.charAt(i);
			switch (character) {
			case 'S': case 's':
				result.append(copySeconds % 10);
				copySeconds /= 10;
				break;
			case 'M': case 'm':
				result.append(copyMinutes % 10);
				copyMinutes /= 10;
				break;
			case 'H': case 'h':
				result.append(copyHours % 10);
				copyHours /= 10;
				break;
			default:
				result.append(character);
			}
		}
		return result.reverse().toString();
	}

	public int totalMinutes() {
		return hours * 60 + minutes;
	}

	public Time normalize() {
		if (isValid())
			return this;
		int copySeconds = seconds;
		int copyMinutes = minutes;
		int copyHours = hours;
		copyMinutes += IntegerUtils.trueDivide(copySeconds, 60);
		copySeconds = IntegerUtils.trueMod(copySeconds, 60);
		copyHours += IntegerUtils.trueDivide(copyMinutes, 60);
		copyMinutes = IntegerUtils.trueMod(copyMinutes, 60);
		copyHours = IntegerUtils.trueMod(copyHours, 24);
		return new Time(copyHours, copyMinutes, copySeconds);
	}

	public int totalSeconds() {
		return totalMinutes() * 60 + seconds;
	}

	public int compareTo(Time o) {
		return totalSeconds() - o.totalSeconds();
	}

	public Time advance(int seconds) {
		int total = totalSeconds() + seconds;
		return new Time(total / (60 * 60), total / 60 % 60, total % 60);
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		Time time = (Time) o;

		if (hours != time.hours) return false;
		if (minutes != time.minutes) return false;
		if (seconds != time.seconds) return false;

		return true;
	}

	@Override
	public int hashCode() {
		int result = hours;
		result = 31 * result + minutes;
		result = 31 * result + seconds;
		return result;
	}
}

class IntegerUtils {
	public static long gcd(long a, long b) {
        a = Math.abs(a);
        b = Math.abs(b);
		while (b != 0) {
			long temp = a % b;
			a = b;
			b = temp;
		}
		return a;
	}

    public static int gcd(int a, int b) {
        a = Math.abs(a);
        b = Math.abs(b);
        while (b != 0) {
            int temp = a % b;
            a = b;
            b = temp;
        }
        return a;
    }

    public static int[] generatePrimes(int upTo) {
		int[] isPrime = generateBitPrimalityTable(upTo);
		IntList primes = new IntArrayList();
		for (int i = 0; i < upTo; i++) {
			if ((isPrime[i >> 5] >>> (i & 31) & 1) == 1)
				primes.add(i);
		}
		return primes.toArray();
	}

	public static boolean[] generatePrimalityTable(int upTo) {
		boolean[] isPrime = new boolean[upTo];
		if (upTo < 2)
			return isPrime;
		Arrays.fill(isPrime, true);
		isPrime[0] = isPrime[1] = false;
		for (int i = 2; i * i < upTo; i++) {
			if (isPrime[i]) {
				for (int j = i * i; j < upTo; j += i)
					isPrime[j] = false;
			}
		}
		return isPrime;
	}

	public static int[] generateBitPrimalityTable(int upTo) {
		int[] isPrime = new int[(upTo + 31) >> 5];
		if (upTo < 2)
			return isPrime;
		Arrays.fill(isPrime, -1);
		isPrime[0] &= -4;
		for (int i = 2; i * i < upTo; i++) {
			if ((isPrime[i >> 5] >>> (i & 31) & 1) == 1) {
				for (int j = i * i; j < upTo; j += i)
					isPrime[j >> 5] &= -1 - (1 << (j & 31));
			}
		}
		return isPrime;
	}

	public static int[] generateDivisorTable(int upTo) {
		int[] divisor = new int[upTo];
		for (int i = 1; i < upTo; i++)
			divisor[i] = i;
		for (int i = 2; i * i < upTo; i++) {
			if (divisor[i] == i) {
				for (int j = i * i; j < upTo; j += i)
					divisor[j] = i;
			}
		}
		return divisor;
	}

	public static long powerInFactorial(long n, long p) {
		long result = 0;
		while (n != 0) {
			result += n /= p;
		}
		return result;
	}

	public static int sumDigits(CharSequence number) {
		int result = 0;
		for (int i = number.length() - 1; i >= 0; i--)
			result += digitValue(number.charAt(i));
		return result;
	}

	public static int digitValue(char digit) {
		if (Character.isDigit(digit))
			return digit - '0';
		if (Character.isUpperCase(digit))
			return digit + 10 - 'A';
		return digit + 10 - 'a';
	}

	public static int longCompare(long a, long b) {
		if (a < b)
			return -1;
		if (a > b)
			return 1;
		return 0;
	}

	public static long[][] generateBinomialCoefficients(int n) {
		long[][] result = new long[n + 1][n + 1];
		for (int i = 0; i <= n; i++) {
			result[i][0] = 1;
			for (int j = 1; j <= i; j++)
				result[i][j] = result[i - 1][j - 1] + result[i - 1][j];
		}
		return result;
	}

	public static long[][] generateBinomialCoefficients(int n, long module) {
		long[][] result = new long[n + 1][n + 1];
		if (module == 1)
			return result;
		for (int i = 0; i <= n; i++) {
			result[i][0] = 1;
			for (int j = 1; j <= i; j++) {
				result[i][j] = result[i - 1][j - 1] + result[i - 1][j];
				if (result[i][j] >= module)
					result[i][j] -= module;
			}
		}
		return result;
	}

	public static long[] generateBinomialRow(int n, long module) {
		long[] result = generateReverse(n + 1, module);
		result[0] = 1;
		for (int i = 1; i <= n; i++)
			result[i] = result[i - 1] * (n - i + 1) % module * result[i] % module;
		return result;
	}

	public static int[] representationInBase(long number, int base) {
		long basePower = base;
		int exponent = 1;
		while (number >= basePower) {
			basePower *= base;
			exponent++;
		}
		int[] representation = new int[exponent];
		for (int i = 0; i < exponent; i++) {
			basePower /= base;
			representation[i] = (int) (number / basePower);
			number %= basePower;
		}
		return representation;
	}

	public static int trueDivide(int a, int b) {
		return (a - trueMod(a, b)) / b;
	}

	public static long trueDivide(long a, long b) {
		return (a - trueMod(a, b)) / b;
	}

	public static int trueMod(int a, int b) {
		a %= b;
		a += b;
		a %= b;
		return a;
	}

	public static long trueMod(long a, long b) {
		a %= b;
		a += b;
		a %= b;
		return a;
	}

	public static long factorial(int n) {
		long result = 1;
		for (int i = 2; i <= n; i++)
			result *= i;
		return result;
	}

	public static long factorial(int n, long mod) {
		long result = 1;
		for (int i = 2; i <= n; i++)
			result = result * i % mod;
		return result % mod;
	}

	public static List<Pair<Long, Integer>> factorize(long number) {
		List<Pair<Long, Integer>> result = new ArrayList<Pair<Long, Integer>>();
		for (long i = 2; i * i <= number; i++) {
			if (number % i == 0) {
				int power = 0;
				do {
					power++;
					number /= i;
				} while (number % i == 0);
				result.add(Pair.makePair(i, power));
			}
		}
		if (number != 1)
			result.add(Pair.makePair(number, 1));
		return result;
	}

	public static List<Long> getDivisors(long number) {
		List<Pair<Long, Integer>> primeDivisors = factorize(number);
		return getDivisorsImpl(primeDivisors, 0, 1, new ArrayList<Long>());
	}

	private static List<Long> getDivisorsImpl(List<Pair<Long, Integer>> primeDivisors, int index, long current,
		List<Long> result)
	{
		if (index == primeDivisors.size()) {
			result.add(current);
			return result;
		}
		long p = primeDivisors.get(index).first;
		int power = primeDivisors.get(index).second;
		for (int i = 0; i <= power; i++) {
			getDivisorsImpl(primeDivisors, index + 1, current, result);
			current *= p;
		}
		return result;
	}

	public static long power(long base, long exponent) {
		if (exponent == 0)
			return 1;
		long result = power(base, exponent >> 1);
		result = result * result;
		if ((exponent & 1) != 0)
			result = result * base;
		return result;
	}

	public static long power(long base, long exponent, long mod) {
		if (base >= mod)
			base %= mod;
		if (exponent == 0)
			return 1 % mod;
		long result = power(base, exponent >> 1, mod);
		result = result * result % mod;
		if ((exponent & 1) != 0)
			result = result * base % mod;
		return result;
	}

	public static long lcm(long a, long b) {
		return a / gcd(a, b) * b;
	}

	public static long[] generateFibonacci(long upTo) {
		int count = 0;
		long last = 0;
		long current = 1;
		while (current <= upTo) {
			long next = last + current;
			last = current;
			current = next;
			count++;
		}
		return generateFibonacci(count, -1);
	}

	public static long[] generateFibonacci(int count, long module) {
		long[] result = new long[count];
		if (module == -1) {
			if (count != 0)
				result[0] = 1;
			if (count > 1)
				result[1] = 1;
			for (int i = 2; i < count; i++)
				result[i] = result[i - 1] + result[i - 2];
		} else {
			if (count != 0)
				result[0] = 1 % module;
			if (count > 1)
				result[1] = 1 % module;
			for (int i = 2; i < count; i++)
				result[i] = (result[i - 1] + result[i - 2]) % module;
		}
		return result;
	}

	public static long[] generateHappy(int digits) {
		long[] happy = new long[(1 << (digits + 1)) - 2];
		happy[0] = 4;
		happy[1] = 7;
		int first = 0;
		int last = 2;
		for (int i = 2; i <= digits; i++) {
			for (int j = 0; j < last - first; j++) {
				happy[last + 2 * j] = 10 * happy[first + j] + 4;
				happy[last + 2 * j + 1] = 10 * happy[first + j] + 7;
			}
			int next = last + 2 * (last - first);
			first = last;
			last = next;
		}
		return happy;
	}

	public static long[] generateFactorial(int count, long module) {
		long[] result = new long[count];
		if (module == -1) {
			if (count != 0)
				result[0] = 1;
			for (int i = 1; i < count; i++)
				result[i] = result[i - 1] * i;
		} else {
			if (count != 0)
				result[0] = 1 % module;
			for (int i = 1; i < count; i++)
				result[i] = (result[i - 1] * i) % module;
		}
		return result;
	}

	public static long reverse(long number, long module) {
		return power(number, module - 2, module);
	}

	public static boolean isPrime(long number) {
		if (number < 2)
			return false;
		for (long i = 2; i * i <= number; i++) {
			if (number % i == 0)
				return false;
		}
		return true;
	}

	public static long[] generateReverse(int upTo, long module) {
		long[] result = new long[upTo];
		if (upTo > 1)
			result[1] = 1;
		for (int i = 2; i < upTo; i++)
			result[i] = (module - module / i * result[((int) (module % i))] % module) % module;
		return result;
	}

	public static long[] generateReverseFactorials(int upTo, long module) {
		long[] result = generateReverse(upTo, module);
		if (upTo > 0)
			result[0] = 1;
		for (int i = 1; i < upTo; i++)
			result[i] = result[i] * result[i - 1] % module;
		return result;
	}

	public static long[] generatePowers(long base, int count, long mod) {
		long[] result = new long[count];
		if (count != 0)
			result[0] = 1 % mod;
		for (int i = 1; i < count; i++)
			result[i] = result[i - 1] * base % mod;
		return result;
	}

    public static long nextPrime(long from) {
        if (from <= 2)
            return 2;
        from += 1 - (from & 1);
        while (!isPrime(from))
            from += 2;
        return from;
    }

	public static long binomialCoefficient(int n, int m, long mod) {
		if (m < 0 || m > n)
			return 0;
		if (2 * m > n)
			m = n - m;
		long result = 1;
		for (int i = n - m + 1; i <= n; i++)
			result = result * i % mod;
		return result * BigInteger.valueOf(factorial(m, mod)).modInverse(BigInteger.valueOf(mod)).longValue() % mod;
	}

	public static boolean isSquare(long number) {
		long sqrt = Math.round(Math.sqrt(number));
		return sqrt * sqrt == number;
	}

	public static long findCommon(long aRemainder, long aMod, long bRemainder, long bMod) {
		long modGCD = gcd(aMod, bMod);
		long gcdRemainder = aRemainder % modGCD;
		if (gcdRemainder != bRemainder % modGCD)
			return -1;
		aMod /= modGCD;
		aRemainder /= modGCD;
		bMod /= modGCD;
		bRemainder /= modGCD;
		long aReverse = BigInteger.valueOf(aMod).modInverse(BigInteger.valueOf(bMod)).longValue();
		long bReverse = BigInteger.valueOf(bMod).modInverse(BigInteger.valueOf(aMod)).longValue();
		long mod = aMod * bMod;
		return (bReverse * aRemainder % mod * bMod + aReverse * bRemainder % mod * aMod) % mod * modGCD + gcdRemainder;
	}

	public static long[] generatePowers(long base, long maxValue) {
		if (maxValue <= 0)
			return new long[0];
		int size = 1;
		long current = 1;
		while (maxValue / base >= current) {
			current *= base;
			size++;
		}
		return generatePowers(base, size, Long.MAX_VALUE);
	}
}

class IntArrayList extends IntList {
	private int[] array;
	private int size;

	public IntArrayList() {
		this(10);
	}

	public IntArrayList(int capacity) {
		array = new int[capacity];
	}

	public IntArrayList(IntList list) {
		this(list.size());
		addAll(list);
	}

	@Override
	public int get(int index) {
		if (index >= size)
			throw new IndexOutOfBoundsException();
		return array[index];
	}

	@Override
	public void set(int index, int value) {
		if (index >= size)
			throw new IndexOutOfBoundsException();
		array[index] = value;
	}

	@Override
	public int size() {
		return size;
	}

	@Override
	public void add(int value) {
		ensureCapacity(size + 1);
		array[size++] = value;
	}

	public void ensureCapacity(int newCapacity) {
		if (newCapacity > array.length) {
			int[] newArray = new int[Math.max(newCapacity, array.length << 1)];
			System.arraycopy(array, 0, newArray, 0, size);
			array = newArray;
		}
	}

	@Override
	public int[] toArray() {
		int[] array = new int[size];
		System.arraycopy(this.array, 0, array, 0, size);
		return array;
	}

    @Override
    public int popBack() {
        return array[--size];
    }
}

abstract class IntList extends IntCollection implements Comparable<IntList> {
	private static final int INSERTION_THRESHOLD = 16;
	private static IntList EMPTY_LIST;

	public abstract int get(int index);
	public abstract void set(int index, int value);

	@Override
	public IntIterator iterator() {
		return new IntIterator() {
			private int size = size();
			private int index = 0;

			public int value() throws NoSuchElementException {
				if (!isValid())
					throw new NoSuchElementException();
				return get(index);
			}

			public void advance() throws NoSuchElementException {
				if (!isValid())
					throw new NoSuchElementException();
				index++;
			}

			public boolean isValid() {
				return index < size;
			}
		};
	}

	@Override
	public void remove(int value) {
		throw new UnsupportedOperationException();
	}

	public int find(int value) {
		int size = size();
		for (int i = 0; i < size; i++) {
			if (get(i) == value)
				return i;
		}
		return -1;
	}

	public int findLast(int value) {
		int size = size();
		for (int i = size - 1; i >= 0; i--) {
			if (get(i) == value)
				return i;
		}
		return -1;
	}

	public boolean nextPermutation() {
		return nextPermutation(IntComparator.DEFAULT);
	}

	private boolean nextPermutation(IntComparator comparator) {
		int size = size();
		int last = get(size - 1);
		for (int i = size - 2; i >= 0; i--) {
			int current = get(i);
			if (comparator.compare(last, current) > 0) {
				for (int j = size - 1; j > i; j--) {
					if (comparator.compare(get(j), current) > 0) {
						swap(i, j);
						subList(i + 1, size).inPlaceReverse();
						return true;
					}
				}
			}
			last = current;
		}
		return false;
	}

	public void inPlaceReverse() {
		for (int i = 0, j = size() - 1; i < j; i++, j--)
			swap(i, j);
	}

	public IntList subList(final int from, final int to) {
		return new SubList(from, to);
	}

	private void swap(int first, int second) {
		if (first == second)
			return;
		int temp = get(first);
		set(first, get(second));
		set(second, temp);
	}

	public IntSortedList inPlaceSort() {
		return inPlaceSort(IntComparator.DEFAULT);
	}

	public IntSortedList inPlaceSort(IntComparator comparator) {
		quickSort(0, size() - 1, (Integer.bitCount(Integer.highestOneBit(size()) - 1) * 5) >> 1, comparator);
		return new IntSortedArray(this, comparator);
	}

	private void quickSort(int from, int to, int remaining, IntComparator comparator) {
		if (to - from < INSERTION_THRESHOLD) {
			insertionSort(from, to, comparator);
			return;
		}
		if (remaining == 0) {
			heapSort(from, to, comparator);
			return;
		}
		remaining--;
		int pivotIndex = (from + to) >> 1;
		int pivot = get(pivotIndex);
		swap(pivotIndex, to);
		int storeIndex = from;
		int equalIndex = to;
		for (int i = from; i < equalIndex; i++) {
			int value = comparator.compare(get(i), pivot);
			if (value < 0)
				swap(storeIndex++, i);
			else if (value == 0)
				swap(--equalIndex, i--);
		}
		quickSort(from, storeIndex - 1, remaining, comparator);
		for (int i = equalIndex; i <= to; i++)
			swap(storeIndex++, i);
		quickSort(storeIndex, to, remaining, comparator);
	}

	private void heapSort(int from, int to, IntComparator comparator) {
		for (int i = (to + from - 1) >> 1; i >= from; i--)
			siftDown(i, to, comparator, from);
		for (int i = to; i > from; i--) {
			swap(from, i);
			siftDown(from, i - 1, comparator, from);
		}
	}

	private void siftDown(int start, int end, IntComparator comparator, int delta) {
		int value = get(start);
		while (true) {
			int child = ((start - delta) << 1) + 1 + delta;
			if (child > end)
				return;
			int childValue = get(child);
			if (child + 1 <= end) {
				int otherValue = get(child + 1);
				if (comparator.compare(otherValue, childValue) > 0) {
					child++;
					childValue = otherValue;
				}
			}
			if (comparator.compare(value, childValue) >= 0)
				return;
			swap(start, child);
			start = child;
		}
	}

	private void insertionSort(int from, int to, IntComparator comparator) {
		for (int i = from + 1; i <= to; i++) {
			int value = get(i);
			for (int j = i - 1; j >= from; j--) {
				if (comparator.compare(get(j), value) <= 0)
					break;
				swap(j, j + 1);
			}
		}
	}

	public IntSortedList sort() {
		return sort(IntComparator.DEFAULT);
	}

	public IntSortedList sort(IntComparator comparator) {
		return new IntArray(this).inPlaceSort(comparator);
	}

	public int back() {
		return get(size() - 1);
	}

    public int popBack() {
        throw new UnsupportedOperationException();
    }

	public int hashCode() {
		int hashCode = 1;
		for (IntIterator i = iterator(); i.isValid(); i.advance())
			hashCode = 31 * hashCode + i.value();
		return hashCode;
	}

	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof IntList))
			return false;
		IntList list = (IntList)obj;
		if (list.size() != size())
			return false;
		IntIterator i = iterator();
		IntIterator j = list.iterator();
		while (i.isValid()) {
			if (i.value() != j.value())
				return false;
			i.advance();
			j.advance();
		}
		return true;
	}

	public int compareTo(IntList o) {
		IntIterator i = iterator();
		IntIterator j = o.iterator();
		while (true) {
			if (i.isValid()) {
				if (j.isValid()) {
					if (i.value() != j.value()) {
						if (i.value() < j.value())
							return -1;
						else
							return 1;
					}
				} else
					return 1;
			} else {
				if (j.isValid())
					return -1;
				else
					return 0;
			}
			i.advance();
			j.advance();
		}
	}

	public static IntList emptyList() {
		if (EMPTY_LIST == null)
			EMPTY_LIST = new IntArray(new int[0]);
		return EMPTY_LIST;
	}

	private class SubList extends IntList {
        private final int to;
        private final int from;
        private int size;

        public SubList(int from, int to) {
            this.to = to;
            this.from = from;
            size = to - from;
        }

        @Override
        public int get(int index) {
            if (index < 0 || index >= size)
                throw new IndexOutOfBoundsException();
            return IntList.this.get(index + from);
        }

        @Override
        public void set(int index, int value) {
            if (index < 0 || index >= size)
                throw new IndexOutOfBoundsException();
            IntList.this.set(index + from, value);
        }

        @Override
        public int size() {
            return size;
        }

        @Override
        public void add(int value) {
            throw new UnsupportedOperationException();
        }
    }
}

interface IntComparator {
    public static final IntComparator DEFAULT = new IntComparator() {
        public int compare(int first, int second) {
            if (first < second)
                return -1;
            if (first > second)
                return 1;
            return 0;
        }
    };

	public static final IntComparator REVERSE = new IntComparator() {
		public int compare(int first, int second) {
			if (first < second)
				return 1;
			if (first > second)
				return -1;
			return 0;
		}
	};

	public int compare(int first, int second);
}

abstract class IntSortedList extends IntList {
	protected final IntComparator comparator;

	protected IntSortedList(IntComparator comparator) {
		this.comparator = comparator;
	}

	@Override
	public void set(int index, int value) {
		throw new UnsupportedOperationException();
	}

	@Override
	public void add(int value) {
		throw new UnsupportedOperationException();
	}

	@Override
	public IntSortedList inPlaceSort(IntComparator comparator) {
		if (comparator == this.comparator)
			return this;
		throw new UnsupportedOperationException();
	}

	@Override
	public boolean contains(int value) {
		int index = lowerBound(value);
		return index != size() && get(index) == value;
	}

	public int lowerBound(int value) {
		int left = 0;
		int right = size();
		while (left < right) {
			int middle = (left + right) >> 1;
			if (comparator.compare(get(middle), value) >= 0)
				right = middle;
			else
				left = middle + 1;
		}
		return left;
	}

	public int upperBound(int value) {
		int left = 0;
		int right = size();
		while (left < right) {
			int middle = (left + right) >> 1;
			if (comparator.compare(get(middle), value) > 0)
				right = middle;
			else
				left = middle + 1;
		}
		return left;
	}

	protected void ensureSorted() {
		int size = size();
		if (size == 0)
			return;
		int last = get(0);
		for (int i = 1; i < size; i++) {
			int current = get(i);
			if (comparator.compare(last, current) > 0)
				throw new IllegalArgumentException();
			last = current;
		}
	}

	@Override
	public IntSortedList subList(final int from, final int to) {
		return new IntSortedList(comparator) {
			private int size = to - from;

			@Override
			public int get(int index) {
				if (index < 0 || index >= size)
					throw new IndexOutOfBoundsException();
				return IntSortedList.this.get(index + from);
			}

			@Override
			public int size() {
				return size;
			}
		};
	}
}

class IntSortedArray extends IntSortedList {
	private final int[] array;

	public IntSortedArray(int[] array) {
		this(array, IntComparator.DEFAULT);
	}

	public IntSortedArray(IntCollection collection) {
		this(collection, IntComparator.DEFAULT);
	}

	public IntSortedArray(int[] array, IntComparator comparator) {
		super(comparator);
		this.array = array;
		ensureSorted();
	}

	public IntSortedArray(IntCollection collection, IntComparator comparator) {
		super(comparator);
		array = new int[collection.size()];
		int i = 0;
		for (IntIterator iterator = collection.iterator(); iterator.isValid(); iterator.advance())
			array[i++] = iterator.value();
		ensureSorted();
	}

	@Override
	public int get(int index) {
		return array[index];
	}

	@Override
	public int size() {
		return array.length;
	}
}

class IntArray extends IntList {
	private final int[] array;

	public IntArray(int[] array) {
		this.array = array;
	}

	public IntArray(IntCollection collection) {
		array = new int[collection.size()];
		int i = 0;
		for (IntIterator iterator = collection.iterator(); iterator.isValid(); iterator.advance())
			array[i++] = iterator.value();
	}

	@Override
	public int get(int index) {
		return array[index];
	}

	@Override
	public void set(int index, int value) {
		array[index] = value;
	}

	@Override
	public int size() {
		return array.length;
	}

	@Override
	public void add(int value) {
		throw new UnsupportedOperationException();
	}

	@Override
	public int[] toArray() {
		return array;
	}
}

class Graph {
	public static final int REMOVED_BIT = 0;

	protected int vertexCount;
	protected int edgeCount;

	private int[] firstOutbound;
	private int[] firstInbound;

	private Edge[] edges;
	private int[] nextInbound;
	private int[] nextOutbound;
	private int[] from;
	private int[] to;
	private long[] weight;
	private long[] capacity;
	private int[] reverseEdge;
	private int[] flags;

	public Graph(int vertexCount) {
		this(vertexCount, vertexCount);
	}

	public Graph(int vertexCount, int edgeCapacity) {
		this.vertexCount = vertexCount;
		firstOutbound = new int[vertexCount];
		Arrays.fill(firstOutbound, -1);

		from = new int[edgeCapacity];
		to = new int[edgeCapacity];
		nextOutbound = new int[edgeCapacity];
		flags = new int[edgeCapacity];
	}

	public static Graph createGraph(int vertexCount, int[] from, int[] to) {
		Graph graph = new Graph(vertexCount, from.length);
		for (int i = 0; i < from.length; i++)
			graph.addSimpleEdge(from[i], to[i]);
		return graph;
	}

	public static Graph createWeightedGraph(int vertexCount, int[] from, int[] to, long[] weight) {
		Graph graph = new Graph(vertexCount, from.length);
		for (int i = 0; i < from.length; i++)
			graph.addWeightedEdge(from[i], to[i], weight[i]);
		return graph;
	}

	public static Graph createFlowGraph(int vertexCount, int[] from, int[] to, long[] capacity) {
		Graph graph = new Graph(vertexCount, from.length * 2);
		for (int i = 0; i < from.length; i++)
			graph.addFlowEdge(from[i], to[i], capacity[i]);
		return graph;
	}

	public static Graph createFlowWeightedGraph(int vertexCount, int[] from, int[] to, long[] weight, long[] capacity) {
		Graph graph = new Graph(vertexCount, from.length * 2);
		for (int i = 0; i < from.length; i++)
			graph.addFlowWeightedEdge(from[i], to[i], weight[i], capacity[i]);
		return graph;
	}

	public static Graph createTree(int[] parent) {
		Graph graph = new Graph(parent.length + 1, parent.length);
		for (int i = 0; i < parent.length; i++)
			graph.addSimpleEdge(parent[i], i + 1);
		return graph;
	}

	public int addEdge(int fromID, int toID, long weight, long capacity, int reverseEdge) {
		ensureEdgeCapacity(edgeCount + 1);
		if (firstOutbound[fromID] != -1)
			nextOutbound[edgeCount] = firstOutbound[fromID];
		else
			nextOutbound[edgeCount] = -1;
		firstOutbound[fromID] = edgeCount;
		if (firstInbound != null) {
			if (firstInbound[toID] != -1)
				nextInbound[edgeCount] = firstInbound[toID];
			else
				nextInbound[edgeCount] = -1;
			firstInbound[toID] = edgeCount;
		}
		this.from[edgeCount] = fromID;
		this.to[edgeCount] = toID;
		if (capacity != 0) {
			if (this.capacity == null)
				this.capacity = new long[from.length];
			this.capacity[edgeCount] = capacity;
		}
		if (weight != 0) {
			if (this.weight == null)
				this.weight = new long[from.length];
			this.weight[edgeCount] = weight;
		}
		if (reverseEdge != -1) {
			if (this.reverseEdge == null) {
				this.reverseEdge = new int[from.length];
				Arrays.fill(this.reverseEdge, 0, edgeCount, -1);
			}
			this.reverseEdge[edgeCount] = reverseEdge;
		}
		if (edges != null)
			edges[edgeCount] = createEdge(edgeCount);
		return edgeCount++;
	}

	protected final GraphEdge createEdge(int id) {
		return new GraphEdge(id);
	}

	public final int addFlowWeightedEdge(int from, int to, long weight, long capacity) {
		if (capacity == 0) {
			return addEdge(from, to, weight, 0, -1);
		} else {
			int lastEdgeCount = edgeCount;
			addEdge(to, from, -weight, 0, lastEdgeCount + entriesPerEdge());
			return addEdge(from, to, weight, capacity, lastEdgeCount);
		}
	}

	protected int entriesPerEdge() {
		return 1;
	}

	public final int addFlowEdge(int from, int to, long capacity) {
		return addFlowWeightedEdge(from, to, 0, capacity);
	}

	public final int addWeightedEdge(int from, int to, long weight) {
		return addFlowWeightedEdge(from, to, weight, 0);
	}

	public final int addSimpleEdge(int from, int to) {
		return addWeightedEdge(from, to, 0);
	}

	public final int vertexCount() {
		return vertexCount;
	}

	public final int edgeCount() {
		return edgeCount;
	}

	protected final int edgeCapacity() {
		return from.length;
	}

	public final Edge edge(int id) {
		initEdges();
		return edges[id];
	}

	public final int firstOutbound(int vertex) {
		int id = firstOutbound[vertex];
		while (id != -1 && isRemoved(id))
			id = nextOutbound[id];
		return id;
	}

	public final int nextOutbound(int id) {
		id = nextOutbound[id];
		while (id != -1 && isRemoved(id))
			id = nextOutbound[id];
		return id;
	}

	public final int firstInbound(int vertex) {
		initInbound();
		int id = firstInbound[vertex];
		while (id != -1 && isRemoved(id))
			id = nextInbound[id];
		return id;
	}

	public final int nextInbound(int id) {
		initInbound();
		id = nextInbound[id];
		while (id != -1 && isRemoved(id))
			id = nextInbound[id];
		return id;
	}

	public final int source(int id) {
		return from[id];
	}

	public final int destination(int id) {
		return to[id];
	}

	public final long weight(int id) {
		if (weight == null)
			return 0;
		return weight[id];
	}

	public final long capacity(int id) {
		if (capacity == null)
			return 0;
		return capacity[id];
	}

	public final long flow(int id) {
		if (reverseEdge == null)
			return 0;
		return capacity[reverseEdge[id]];
	}

	public final void pushFlow(int id, long flow) {
		if (flow == 0)
			return;
		if (flow > 0) {
			if (capacity(id) < flow)
				throw new IllegalArgumentException("Not enough capacity");
		} else {
			if (flow(id) < -flow)
				throw new IllegalArgumentException("Not enough capacity");
		}
		capacity[id] -= flow;
		capacity[reverseEdge[id]] += flow;
	}

	public int transposed(int id) {
		return -1;
	}

	public final int reverse(int id) {
		if (reverseEdge == null)
			return -1;
		return reverseEdge[id];
	}

	public final void addVertices(int count) {
		ensureVertexCapacity(vertexCount + count);
		Arrays.fill(firstOutbound, vertexCount, vertexCount + count, -1);
		if (firstInbound != null)
			Arrays.fill(firstInbound, vertexCount, vertexCount + count, -1);
		vertexCount += count;
	}

	protected final void initEdges() {
		if (edges == null) {
			edges = new Edge[from.length];
			for (int i = 0; i < edgeCount; i++)
				edges[i] = createEdge(i);
		}
	}

	public final void removeVertex(int vertex) {
		int id = firstOutbound[vertex];
		while (id != -1) {
			removeEdge(id);
			id = nextOutbound[id];
		}
		initInbound();
		id = firstInbound[vertex];
		while (id != -1) {
			removeEdge(id);
			id = nextInbound[id];
		}
	}

	private void initInbound() {
		if (firstInbound == null) {
			firstInbound = new int[firstOutbound.length];
			Arrays.fill(firstInbound, 0, vertexCount, -1);
			nextInbound = new int[from.length];
			for (int i = 0; i < edgeCount; i++) {
				nextInbound[i] = firstInbound[to[i]];
				firstInbound[to[i]] = i;
			}
		}
	}

	public final boolean flag(int id, int bit) {
		return (flags[id] >> bit & 1) != 0;
	}

	public final void setFlag(int id, int bit) {
		flags[id] |= 1 << bit;
	}

	public final void removeFlag(int id, int bit) {
		flags[id] &= -1 - (1 << bit);
	}

	public final void removeEdge(int id) {
		setFlag(id, REMOVED_BIT);
	}

	public final void restoreEdge(int id) {
		removeFlag(id, REMOVED_BIT);
	}

	public final boolean isRemoved(int id) {
		return flag(id, REMOVED_BIT);
	}

	public final Iterable<Edge> outbound(final int id) {
		initEdges();
		return new Iterable<Edge>() {
			public Iterator<Edge> iterator() {
				return new EdgeIterator(id, firstOutbound, nextOutbound);
			}
		};
	}

	public final Iterable<Edge> inbound(final int id) {
		initEdges();
		initInbound();
		return new Iterable<Edge>() {
			public Iterator<Edge> iterator() {
				return new EdgeIterator(id, firstInbound, nextInbound);
			}
		};
	}

	protected void ensureEdgeCapacity(int size) {
		if (from.length < size) {
			int newSize = Math.max(size, 2 * from.length);
			if (edges != null)
				edges = resize(edges, newSize);
			from = resize(from, newSize);
			to = resize(to, newSize);
			nextOutbound = resize(nextOutbound, newSize);
			if (nextInbound != null)
				nextInbound = resize(nextInbound, newSize);
			if (weight != null)
				weight = resize(weight, newSize);
			if (capacity != null)
				capacity = resize(capacity, newSize);
			if (reverseEdge != null)
				reverseEdge = resize(reverseEdge, newSize);
			flags = resize(flags, newSize);
		}
	}

	private void ensureVertexCapacity(int size) {
		if (firstOutbound.length < size) {
			int newSize = Math.max(size, 2 * from.length);
			firstOutbound = resize(firstOutbound, newSize);
			if (firstInbound != null)
				firstInbound = resize(firstInbound, newSize);
		}
	}

	protected final int[] resize(int[] array, int size) {
		int[] newArray = new int[size];
		System.arraycopy(array, 0, newArray, 0, array.length);
		return newArray;
	}

	private long[] resize(long[] array, int size) {
		long[] newArray = new long[size];
		System.arraycopy(array, 0, newArray, 0, array.length);
		return newArray;
	}

	private Edge[] resize(Edge[] array, int size) {
		Edge[] newArray = new Edge[size];
		System.arraycopy(array, 0, newArray, 0, array.length);
		return newArray;
	}

	public final boolean isSparse() {
		return vertexCount == 0 || edgeCount * 20 / vertexCount <= vertexCount;
	}

	protected class GraphEdge implements Edge {
		protected int id;

		protected GraphEdge(int id) {
			this.id = id;
		}

		public int getSource() {
			return source(id);
		}

		public int getDestination() {
			return destination(id);
		}

		public long getWeight() {
			return weight(id);
		}

		public long getCapacity() {
			return capacity(id);
		}

		public long getFlow() {
			return flow(id);
		}

		public void pushFlow(long flow) {
			Graph.this.pushFlow(id, flow);
		}

		public boolean getFlag(int bit) {
			return flag(id, bit);
		}

		public void setFlag(int bit) {
			Graph.this.setFlag(id, bit);
		}

		public void removeFlag(int bit) {
			Graph.this.removeFlag(id, bit);
		}

		public int getTransposedID() {
			return transposed(id);
		}

		public Edge getTransposedEdge() {
			int reverseID = getTransposedID();
			if (reverseID == -1)
				return null;
			initEdges();
			return edge(reverseID);
		}

		public int getReverseID() {
			return reverse(id);
		}

		public Edge getReverseEdge() {
			int reverseID = getReverseID();
			if (reverseID == -1)
				return null;
			initEdges();
			return edge(reverseID);
		}

		public int getID() {
			return id;
		}

		public void remove() {
			removeEdge(id);
		}

		public void restore() {
			restoreEdge(id);
		}
	}

	public class EdgeIterator implements Iterator<Edge> {
		private int edgeID;
		private final int[] next;
		private int lastID = -1;

		public EdgeIterator(int id, int[] first, int[] next) {
			this.next = next;
			edgeID = nextEdge(first[id]);
		}

		private int nextEdge(int id) {
			while (id != -1 && isRemoved(id))
				id = next[id];
			return id;
		}

		public boolean hasNext() {
			return edgeID != -1;
		}

		public Edge next() {
			if (edgeID == -1)
				throw new NoSuchElementException();
			lastID = edgeID;
			edgeID = nextEdge(next[lastID]);
			return edges[lastID];
		}

		public void remove() {
			if (lastID == -1)
				throw new IllegalStateException();
			removeEdge(lastID);
			lastID = -1;
		}
	}

}

interface Edge {
	public int getSource();
	public int getDestination();
	public long getWeight();
	public long getCapacity();
	public long getFlow();
	public void pushFlow(long flow);
	public boolean getFlag(int bit);
	public void setFlag(int bit);
	public void removeFlag(int bit);
	public int getTransposedID();
	public Edge getTransposedEdge();
	public int getReverseID();
	public Edge getReverseEdge();
	public int getID();
	public void remove();
	public void restore();
}

interface Filter<T> {
	public boolean accept(T value);
}

interface Function<A, V> {
	public abstract V value(A argument);
}

abstract class ReadOnlyIterator<T> implements Iterator<T>  {
	public final void remove() {
		throw new UnsupportedOperationException();
	}
}

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

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);
        Task solver = new A();
        solver.solve(1, in, out);
        out.close();
    }
}

interface Task {
    public void solve(int testNumber, InputReader in, OutputWriter out);
}

class A implements Task {

    public void solve(int testNumber, InputReader in, OutputWriter out){
        String str=in.next();
        boolean val=str.contains("0000000") || str.contains("1111111");
        out.printLine(val?"YES":"NO");
    }

}

class B implements Task {

	public void solve(int testNumber, InputReader in, OutputWriter out) {

    }

}

class C implements Task {

	public void solve(int testNumber, InputReader in, OutputWriter out){

    }

}

class D implements Task {

	public void solve(int testNumber, InputReader in, OutputWriter out){

    }

}

class E implements Task {

	public void solve(int testNumber, InputReader in, OutputWriter out){

	}

}

class F implements Task {

	public void solve (int testNumber, InputReader in, OutputWriter out) {

	}

}

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 peek() {
        if (numChars == -1)
            return -1;
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                return -1;
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar];
    }

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

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

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

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return isWhitespace(c);
    }

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

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

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

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

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

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

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

    public boolean isExhausted() {
        int value;
        while (isSpaceChar(value = peek()) && value != -1)
            read();
        return value == -1;
    }

    public String next() {
        return readString();
    }

    public SpaceCharFilter getFilter() {
        return filter;
    }

    public void setFilter(SpaceCharFilter filter) {
        this.filter = filter;
    }

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

class OutputWriter {
    private final PrintWriter writer;

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

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

    public void print(char[] array) {
        writer.print(array);
    }

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

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

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

    public void printLine(int[] array) {
        print(array);
        writer.println();
    }

    public void printLine(long[] array) {
        print(array);
        writer.println();
    }

    public void printLine() {
        writer.println();
    }

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

    public void print(char i) {
        writer.print(i);
    }

    public void printLine(char i) {
        writer.println(i);
    }

    public void printLine(char[] array) {
        writer.println(array);
    }

    public void printFormat(String format, Object...objects) {
        writer.printf(format, objects);
    }

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

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

    public void print(long i) {
        writer.print(i);
    }

    public void printLine(long i) {
        writer.println(i);
    }

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

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

interface Filter<T> {
	public boolean accept(T value);
}

interface Function<A, V> {
	public abstract V value(A argument);
}

class CollectionUtils {
	public static int[] toArray(Collection<Integer> collection) {
		int[] array = new int[collection.size()];
		int index = 0;
		for (int element : collection)
			array[index++] = element;
		return array;
	}

	public static List<Integer> range(int from, int to) {
		List<Integer> result = new ArrayList<Integer>(Math.max(from, to) - Math.min(from, to) + 1);
		if (to > from) {
			for (int i = from; i <= to; i++)
				result.add(i);
		} else {
			for (int i = from; i >= to; i--)
				result.add(i);
		}
		return result;
	}

	public static void rotate(List<Integer> list) {
		list.add(list.remove(0));
	}

	public static<T extends Comparable<T>> T minElement(Iterable<T> collection) {
		T result = null;
		for (T element : collection) {
			if (result == null || result.compareTo(element) > 0)
				result = element;
		}
		return result;
	}

	public static<T extends Comparable<T>> T maxElement(Iterable<T> collection) {
		T result = null;
		for (T element : collection) {
			if (result == null || result.compareTo(element) < 0)
				result = element;
		}
		return result;
	}

	public static<T> T minElement(Iterable<T> collection, Comparator<T> comparator) {
		T result = null;
		for (T element : collection) {
			if (result == null || comparator.compare(result, element) > 0)
				result = element;
		}
		return result;
	}

	public static<T> T maxElement(Iterable<T> collection, Comparator<T> comparator) {
		T result = null;
		for (T element : collection) {
			if (result == null || comparator.compare(result, element) < 0)
				result = element;
		}
		return result;
	}

	public static<T> List<T> asList(Iterable<T> iterable) {
		List<T> list = new ArrayList<T>();
		for (T element : iterable)
			list.add(element);
		return list;
	}

	public static<T> int count(Iterable<T> array, T sample) {
		int result = 0;
		for (T element : array) {
			if (element.equals(sample))
				result++;
		}
		return result;
	}

	public static<T> int count(Iterable<T> array, Filter<T> filter) {
		int result = 0;
		for (T element : array) {
			if (filter.accept(element))
				result++;
		}
		return result;
	}

	public static<T> List<T> filter(Iterable<T> sequence, Filter<T> filter) {
		List<T> result = new ArrayList<T>();
		for (T element : sequence) {
			if (filter.accept(element))
				result.add(element);
		}
		return result;
	}

	public static<A, V> List<V> apply(Iterable<A> sequence, Function<A, V> function) {
		List<V> result = new ArrayList<V>();
		for (A element : sequence)
			result.add(function.value(element));
		return result;
	}

	public static void main(String[] args) {
		System.out.println("Hello world!");
	}

}

class Pair<U, V> implements Comparable<Pair<U, V>> {
	public final U first;
	public final V second;

	public static<U, V> Pair<U, V> makePair(U first, V second) {
		return new Pair<U, V>(first, second);
	}

	private Pair(U first, V second) {
		this.first = first;
		this.second = second;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		Pair pair = (Pair) o;

		return !(first != null ? !first.equals(pair.first) : pair.first != null) && !(second != null ? !second.equals(pair.second) : pair.second != null);

	}

	@Override
	public int hashCode() {
		int result = first != null ? first.hashCode() : 0;
		result = 31 * result + (second != null ? second.hashCode() : 0);
		return result;
	}

	public Pair<V, U> swap() {
		return makePair(second, first);
	}

	@Override
	public String toString() {
		return "(" + first + "," + second + ")";
	}

	@SuppressWarnings({"unchecked"})
	public int compareTo(Pair<U, V> o) {
		int value = ((Comparable<U>)first).compareTo(o.first);
		if (value != 0)
			return value;
		return ((Comparable<V>)second).compareTo(o.second);
	}
}

abstract class ReadOnlyIterator<T> implements Iterator<T>  {
	public final void remove() {
		throw new UnsupportedOperationException();
	}
}

class IOUtils {
	public static Pair<Integer, Integer> readIntPair(InputReader in) {
		int first = in.readInt();
		int second = in.readInt();
		return Pair.makePair(first, second);
	}

	public static Pair<Long, Long> readLongPair(InputReader in) {
		long first = in.readLong();
		long second = in.readLong();
		return Pair.makePair(first, second);
	}

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

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

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

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

	public static char[] readCharArray(InputReader in, int size) {
		char[] array = new char[size];
		for (int i = 0; i < size; i++)
			array[i] = in.readCharacter();
		return array;
	}

	public static Pair<Integer, Integer>[] readIntPairArray(InputReader in, int size) {
		@SuppressWarnings({"unchecked"})
		Pair<Integer, Integer>[] result = new Pair[size];
		for (int i = 0; i < size; i++)
			result[i] = readIntPair(in);
		return result;
	}

	public static Pair<Long, Long>[] readLongPairArray(InputReader in, int size) {
		@SuppressWarnings({"unchecked"})
		Pair<Long, Long>[] result = new Pair[size];
		for (int i = 0; i < size; i++)
			result[i] = readLongPair(in);
		return result;
	}

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

	public static void readLongArrays(InputReader in, long[]... arrays) {
		for (int i = 0; i < arrays[0].length; i++) {
			for (int j = 0; j < arrays.length; j++)
				arrays[j][i] = in.readLong();
		}
	}

	public static void readDoubleArrays(InputReader in, double[]...arrays) {
		for (int i = 0; i < arrays[0].length; i++) {
			for (int j = 0; j < arrays.length; j++)
				arrays[j][i] = in.readDouble();
		}
	}

	public static char[][] readTable(InputReader in, int rowCount, int columnCount) {
		char[][] table = new char[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readCharArray(in, columnCount);
		return table;
	}

	public static int[][] readIntTable(InputReader in, int rowCount, int columnCount) {
		int[][] table = new int[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readIntArray(in, columnCount);
		return table;
	}

	public static double[][] readDoubleTable(InputReader in, int rowCount, int columnCount) {
		double[][] table = new double[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readDoubleArray(in, columnCount);
		return table;
	}

	public static long[][] readLongTable(InputReader in, int rowCount, int columnCount) {
		long[][] table = new long[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readLongArray(in, columnCount);
		return table;
	}

	public static String[][] readStringTable(InputReader in, int rowCount, int columnCount) {
		String[][] table = new String[rowCount][];
		for (int i = 0; i < rowCount; i++)
			table[i] = readStringArray(in, columnCount);
		return table;
	}

	public static String readText(InputReader in) {
		StringBuilder result = new StringBuilder();
		while (true) {
			int character = in.read();
			if (character == '\r')
				continue;
			if (character == -1)
				break;
			result.append((char) character);
		}
		return result.toString();
	}

	public static void readStringArrays(InputReader in, String[]... arrays) {
		for (int i = 0; i < arrays[0].length; i++) {
			for (int j = 0; j < arrays.length; j++)
				arrays[j][i] = in.readString();
		}
	}

	public static void printTable(OutputWriter out, char[][] table) {
		for (char[] row : table)
			out.printLine(new String(row));
	}
}

interface IntComparator {
    public static final IntComparator DEFAULT = new IntComparator() {
        public int compare(int first, int second) {
            if (first < second)
                return -1;
            if (first > second)
                return 1;
            return 0;
        }
    };

	public static final IntComparator REVERSE = new IntComparator() {
		public int compare(int first, int second) {
			if (first < second)
				return 1;
			if (first > second)
				return -1;
			return 0;
		}
	};

	public int compare(int first, int second);
}

class ReverseComparator<T extends Comparable<T>> implements Comparator<T> {
	public int compare(T o1, T o2) {
		return o2.compareTo(o1);
	}
}

class Angle {
	public final Point o;
	public final Point a;
	public final Point b;

	public Angle(Point o, Point a, Point b) {
		this.o = o;
		this.a = a;
		this.b = b;
	}

	public double value() {
		double ab = a.distance(b);
		double ao = a.distance(o);
		double bo = b.distance(o);
		return Math.acos((ao * ao + bo * bo - ab * ab) / (2 * ao * bo));
	}

}

class Circle {
	public final Point center;
	public final double radius;

	public Circle(Point center, double radius) {
		this.center = center;
		this.radius = radius;
	}

	public boolean contains(Point point) {
		return center.distance(point) < radius + GeometryUtils.epsilon;
	}

	public boolean strictContains(Point point) {
		return center.distance(point) < radius - GeometryUtils.epsilon;
	}

    public Point[] findTouchingPoints(Point point) {
        double distance = center.distance(point);
        if (distance < radius - GeometryUtils.epsilon)
            return new Point[0];
        if (distance < radius + GeometryUtils.epsilon)
            return new Point[]{point};
        Circle power = new Circle(point, Math.sqrt((distance - radius) * (distance + radius)));
        return intersect(power);
    }

    public Point[] intersect(Circle other) {
        double distance = center.distance(other.center);
        if (distance > radius + other.radius + GeometryUtils.epsilon || Math.abs(radius - other.radius) > distance + GeometryUtils.epsilon)
            return new Point[0];
        double p = (radius + other.radius + distance) / 2;
        double height = 2 * Math.sqrt(p * (p - radius) * (p - other.radius) * (p - distance)) / distance;
        double l1 = Math.sqrt(radius * radius - height * height);
        double l2 = Math.sqrt(other.radius * other.radius - height * height);
        if (radius * radius + distance * distance < other.radius * other.radius)
            l1 = -l1;
        if (radius * radius > distance * distance + other.radius * other.radius)
            l2 = -l2;
        Point middle = new Point((center.x * l2 + other.center.x * l1) / (l1 + l2),
            (center.y * l2 + other.center.y * l1) / (l1 + l2));
        Line line = center.line(other.center).perpendicular(middle);
        return line.intersect(this);
    }
}

class GeometryUtils {
	public static double epsilon = 1e-8;

	public static double fastHypot(double...x) {
		if (x.length == 0)
			return 0;
		else if (x.length == 1)
			return Math.abs(x[0]);
		else {
			double sumSquares = 0;
			for (double value : x)
				sumSquares += value * value;
			return Math.sqrt(sumSquares);
		}
	}

    public static double fastHypot(double x, double y) {
        return Math.sqrt(x * x + y * y);
    }

	public static double fastHypot(double[] x, double[] y) {
		if (x.length == 0)
			return 0;
		else if (x.length == 1)
			return Math.abs(x[0]- y[0]);
		else {
			double sumSquares = 0;
			for (int i = 0; i < x.length; i++) {
				double diff = x[i] - y[i];
				sumSquares += diff * diff;
			}
			return Math.sqrt(sumSquares);
		}
	}

	public static double fastHypot(int[] x, int[] y) {
		if (x.length == 0)
			return 0;
		else if (x.length == 1)
			return Math.abs(x[0]- y[0]);
		else {
			double sumSquares = 0;
			for (int i = 0; i < x.length; i++) {
				double diff = x[i] - y[i];
				sumSquares += diff * diff;
			}
			return Math.sqrt(sumSquares);
		}
	}

	public static double missileTrajectoryLength(double v, double angle, double g) {
		return (v * v * Math.sin(2 * angle)) / g;
	}

	public static double sphereVolume(double radius) {
		return 4 * Math.PI * radius * radius * radius / 3;
	}

	public static double triangleSquare(double first, double second, double third) {
		double p = (first + second + third) / 2;
		return Math.sqrt(p * (p - first) * (p - second) * (p - third));
	}

	public static double canonicalAngle(double angle) {
		while (angle > Math.PI)
			angle -= 2 * Math.PI;
		while (angle < -Math.PI)
			angle += 2 * Math.PI;
		return angle;
	}

	public static double positiveAngle(double angle) {
		while (angle > 2 * Math.PI - GeometryUtils.epsilon)
			angle -= 2 * Math.PI;
		while (angle < -GeometryUtils.epsilon)
			angle += 2 * Math.PI;
		return angle;
	}
}

class Line {
	public final double a;
	public final double b;
	public final double c;

	public Line(Point p, double angle) {
		a = Math.sin(angle);
		b = -Math.cos(angle);
		c = -p.x * a - p.y * b;
	}

	public Line(double a, double b, double c) {
		double h = GeometryUtils.fastHypot(a, b);
		this.a = a / h;
		this.b = b / h;
		this.c = c / h;
	}

	public Point intersect(Line other) {
		if (parallel(other))
			return null;
		double determinant = b * other.a - a * other.b;
		double x = (c * other.b - b * other.c) / determinant;
		double y = (a * other.c - c * other.a) / determinant;
		return new Point(x, y);
	}

	public boolean parallel(Line other) {
		return Math.abs(a * other.b - b * other.a) < GeometryUtils.epsilon;
	}

	public boolean contains(Point point) {
		return Math.abs(value(point)) < GeometryUtils.epsilon;
	}

	public Line perpendicular(Point point) {
		return new Line(-b, a, b * point.x - a * point.y);
	}

	public double value(Point point) {
		return a * point.x + b * point.y + c;
	}

	public Point[] intersect(Circle circle) {
		double distance = distance(circle.center);
		if (distance > circle.radius + GeometryUtils.epsilon)
			return new Point[0];
		Point intersection = intersect(perpendicular(circle.center));
		if (Math.abs(distance - circle.radius) < GeometryUtils.epsilon)
			return new Point[]{intersection};
		double shift = Math.sqrt(circle.radius * circle.radius - distance * distance);
		return new Point[]{new Point(intersection.x + shift * b, intersection.y - shift * a),
			new Point(intersection.x - shift * b, intersection.y + shift * a)};
	}

	public double distance(Point center) {
		return Math.abs(value(center));
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		Line line = (Line) o;

		if (!parallel(line)) return false;
		if (Math.abs(a * line.c - c * line.a) > GeometryUtils.epsilon || Math.abs(b * line.c - c * line.b) > GeometryUtils.epsilon) return false;

		return true;
	}
}

class Point implements Comparable<Point> {
	public static final Point ORIGIN = new Point(0, 0);
	public final double x;
	public final double y;

	public int compareTo(Point other) {
        int value = Double.compare(this.x, other.x);
        if (value != 0)
            return value;
        return Double.compare(this.y, other.y);
    }

	@Override
	public String toString() {
		return "(" + x + ", " + y + ")";
	}

	public Point(double x, double y) {
		this.x = x;
		this.y = y;
	}

	public Line line(Point other) {
		if (equals(other))
			return null;
		double a = other.y - y;
		double b = x - other.x;
		double c = -a * x - b * y;
		return new Line(a, b, c);
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		Point point = (Point) o;

		return Math.abs(x - point.x) <= GeometryUtils.epsilon && Math.abs(y - point.y) <= GeometryUtils.epsilon;
	}

	@Override
	public int hashCode() {
		int result;
		long temp;
		temp = x != +0.0d ? Double.doubleToLongBits(x) : 0L;
		result = (int) (temp ^ (temp >>> 32));
		temp = y != +0.0d ? Double.doubleToLongBits(y) : 0L;
		result = 31 * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	public double distance(Point other) {
		return GeometryUtils.fastHypot(x - other.x, y - other.y);
	}

	public double distance(Line line) {
		return Math.abs(line.a * x + line.b * y + line.c);
	}

	public double value() {
		return GeometryUtils.fastHypot(x, y);
	}

	public double angle() {
		return Math.atan2(y, x);
	}

	public static Point readPoint(InputReader in) {
		double x = in.readDouble();
		double y = in.readDouble();
		return new Point(x, y);
	}

	public Point rotate(double angle) {
		double nx = x * Math.cos(angle) - y * Math.sin(angle);
		double ny = y * Math.cos(angle) + x * Math.sin(angle);
		return new Point(nx, ny);
	}
}

class Polygon {
	public final Point[] vertices;
	private Segment[] sides;

	public Polygon(Point...vertices) {
		this.vertices = vertices.clone();
	}

	public double square() {
		double sum = 0;
		for (int i = 1; i < vertices.length; i++)
			sum += (vertices[i].x - vertices[i - 1].x) * (vertices[i].y + vertices[i - 1].y);
		sum += (vertices[0].x - vertices[vertices.length - 1].x) * (vertices[0].y + vertices[vertices.length - 1].y);
		return Math.abs(sum) / 2;
	}

	public Point center() {
		double sx = 0;
		double sy = 0;
		for (Point point : vertices) {
			sx += point.x;
			sy += point.y;
		}
		return new Point(sx / vertices.length, sy / vertices.length);
	}

    public static boolean over(Point a, Point b, Point c) {
        return a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y) < -GeometryUtils.epsilon;
    }

    private static boolean under(Point a, Point b, Point c) {
        return a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y) > GeometryUtils.epsilon;
    }

    public static Polygon convexHull(Point[] points) {
        if (points.length == 1)
            return new Polygon(points);
        Arrays.sort(points);
        Point left = points[0];
        Point right = points[points.length - 1];
        List<Point> up = new ArrayList<Point>();
        List<Point> down = new ArrayList<Point>();
        for (Point point : points) {
            if (point == left || point == right || !under(left, point, right)) {
                while (up.size() >= 2 && under(up.get(up.size() - 2), up.get(up.size() - 1), point))
                    up.remove(up.size() - 1);
                up.add(point);
            }
            if (point == left || point == right || !over(left, point, right)) {
                while (down.size() >= 2 && over(down.get(down.size() - 2), down.get(down.size() - 1), point))
                    down.remove(down.size() - 1);
                down.add(point);
            }
        }
        Point[] result = new Point[up.size() + down.size() - 2];
        int index = 0;
        for (Point point : up)
            result[index++] = point;
        for (int i = down.size() - 2; i > 0; i--)
            result[index++] = down.get(i);
        return new Polygon(result);
    }

	public boolean contains(Point point) {
		return contains(point, false);
	}

    public boolean contains(Point point, boolean strict) {
		for (Segment segment : sides()) {
			if (segment.contains(point, true))
				return !strict;
		}
        double totalAngle = GeometryUtils.canonicalAngle(Math.atan2(vertices[0].y - point.y, vertices[0].x - point.x) -
			Math.atan2(vertices[vertices.length - 1].y - point.y, vertices[vertices.length - 1].x - point.x));
        for (int i = 1; i < vertices.length; i++) {
            totalAngle += GeometryUtils.canonicalAngle(Math.atan2(vertices[i].y - point.y, vertices[i].x - point.x) -
				Math.atan2(vertices[i - 1].y - point.y, vertices[i - 1].x - point.x));
        }
        return Math.abs(totalAngle) > Math.PI;
    }

	public Segment[] sides() {
		if (sides == null) {
			sides = new Segment[vertices.length];
			for (int i = 0; i < vertices.length - 1; i++)
				sides[i] = new Segment(vertices[i], vertices[i + 1]);
			sides[sides.length - 1] = new Segment(vertices[vertices.length - 1], vertices[0]);
		}
		return sides;
	}

	public static double triangleSquare(Point a, Point b, Point c) {
		return Math.abs((a.x - b.x) * (a.y + b.y) + (b.x - c.x) * (b.y + c.y) + (c.x - a.x) * (c.y + a.y)) / 2;
	}

	public double perimeter() {
		double result = vertices[0].distance(vertices[vertices.length - 1]);
		for (int i = 1; i < vertices.length; i++)
			result += vertices[i].distance(vertices[i - 1]);
		return result;
	}
}

class Ray {
	public final Point base;
	public final Line line;
	private final Line perpendicular;

	public Ray(Point base, double direction) {
		this.base = base;
		line = new Line(base, direction);
		this.perpendicular = line.perpendicular(base);
	}

	public Ray(Point base, Point other) {
		this.base = base;
		line = base.line(other);
		this.perpendicular = line.perpendicular(base);
	}

	public boolean contains(Point point) {
		return line.contains(point) && perpendicular.value(point) > -GeometryUtils.epsilon;
	}

	public double distance(Point point) {
		if (perpendicular.value(point) > -GeometryUtils.epsilon)
			return line.distance(point);
		return base.distance(point);
	}
}

class Segment {
	public final Point a;
	public final Point b;
    private double distance = Double.NaN;
    private Line line = null;

	public Segment(Point a, Point b) {
		this.a = a;
		this.b = b;
	}

	public double length() {
        if (Double.isNaN(distance))
            distance = a.distance(b);
        return distance;
	}

	public double distance(Point point) {
		double length = length();
		double left = point.distance(a);
		if (length < GeometryUtils.epsilon)
			return left;
		double right = point.distance(b);
		if (left * left > right * right + length * length)
			return right;
		if (right * right > left * left + length * length)
			return left;
		return point.distance(line());
	}

	public Point intersect(Segment other, boolean includeEnds) {
		Line line = line();
		Line otherLine = other.a.line(other.b);
		if (line.parallel(otherLine))
			return null;
		Point intersection = line.intersect(otherLine);
		if (contains(intersection, includeEnds) && other.contains(intersection, includeEnds))
			return intersection;
		else
			return null;
	}

	public boolean contains(Point point, boolean includeEnds) {
		if (a.equals(point) || b.equals(point))
			return includeEnds;
		if (a.equals(b))
			return false;
		Line line = line();
		if (!line.contains(point))
			return false;
		Line perpendicular = line.perpendicular(a);
		double aValue = perpendicular.value(a);
		double bValue = perpendicular.value(b);
		double pointValue = perpendicular.value(point);
		return aValue < pointValue && pointValue < bValue || bValue < pointValue && pointValue < aValue;
	}

	public Line line() {
        if (line == null)
            line = a.line(b);
		return line;
	}

	public Point middle() {
		return new Point((a.x + b.x) / 2, (a.y + b.y) / 2);
	}

	public Point[] intersect(Circle circle) {
		Point[] result = line().intersect(circle);
		if (result.length == 0)
			return result;
		if (result.length == 1) {
			if (contains(result[0], true))
				return result;
			return new Point[0];
		}
		if (contains(result[0], true)) {
			if (contains(result[1], true))
				return result;
			return new Point[]{result[0]};
		}
		if (contains(result[1], true))
			return new Point[]{result[1]};
		return new Point[0];
	}

	public Point intersect(Line line) {
		Line selfLine = line();
		Point intersect = selfLine.intersect(line);
		if (intersect == null)
			return null;
		if (contains(intersect, true))
			return intersect;
		return null;
	}

	public double distance(Segment other) {
		Line line = line();
		Line otherLine = other.line();
		Point p = line == null || otherLine == null ? null : line.intersect(otherLine);
		if (p != null && contains(p, true) && other.contains(p, true))
			return 0;
		return Math.min(Math.min(other.distance(a), other.distance(b)), Math.min(distance(other.a), distance(other.b)));
	}
}

class Vector {
	public final double x;
	public final double y;
	public final Point point;

	public Vector(double x, double y) {
		this.x = x;
		this.y = y;
		point = new Point(x, y);
	}

	public Vector(Point point) {
		this.x = point.x;
		this.y = point.y;
		this.point = point;
	}

	public Vector(Point from, Point to) {
		this(to.x - from.x, to.y - from.y);
	}

	public double angleTo(Vector other) {
		return GeometryUtils.canonicalAngle(other.point.angle() - point.angle());
	}

	public double length() {
		return point.value();
	}

	public double angle() {
		return point.angle();
	}
}

class Heap {
	private IntComparator comparator;
	private int size = 0;
	private int[] elements;
	private int[] at;

	public Heap(int maxElement) {
		this(10, maxElement);
	}

	public Heap(IntComparator comparator, int maxElement) {
		this(10, comparator, maxElement);
	}

	public Heap(int capacity, int maxElement) {
		this(capacity, IntComparator.DEFAULT, maxElement);
	}

	public Heap(int capacity, IntComparator comparator, int maxElement) {
		this.comparator = comparator;
		elements = new int[capacity];
		at = new int[maxElement];
		Arrays.fill(at, -1);
	}

	public int getSize() {
		return size;
	}

    public void setComparator(IntComparator comparator) {
        this.comparator = comparator;
    }

    public boolean isEmpty() {
		return size == 0;
	}

	public int add(int element) {
		ensureCapacity(size + 1);
		elements[size] = element;
		at[element] = size;
		shiftUp(size++);
		return at[element];
	}

	public void shiftUp(int index) {
//		if (index < 0 || index >= size)
//			throw new IllegalArgumentException();
		int value = elements[index];
		while (index != 0) {
			int parent = (index - 1) >>> 1;
			int parentValue = elements[parent];
			if (comparator.compare(parentValue, value) <= 0) {
				elements[index] = value;
				at[value] = index;
				return;
			}
			elements[index] = parentValue;
			at[parentValue] = index;
			index = parent;
		}
		elements[0] = value;
		at[value] = 0;
	}

	public void shiftDown(int index) {
		if (index < 0 || index >= size)
			throw new IllegalArgumentException();
		while (true) {
			int child = (index << 1) + 1;
			if (child >= size)
				return;
			if (child + 1 < size && comparator.compare(elements[child], elements[child + 1]) > 0)
				child++;
			if (comparator.compare(elements[index], elements[child]) <= 0)
				return;
			swap(index, child);
			index = child;
		}
	}

	public int getIndex(int element) {
		return at[element];
	}

	private void swap(int first, int second) {
		int temp = elements[first];
		elements[first] = elements[second];
		elements[second] = temp;
		at[elements[first]] = first;
		at[elements[second]] = second;
	}

	private void ensureCapacity(int size) {
		if (elements.length < size) {
			int[] oldElements = elements;
			elements = new int[Math.max(2 * elements.length, size)];
			System.arraycopy(oldElements, 0, elements, 0, this.size);
		}
	}

	public int peek() {
		if (isEmpty())
			throw new IndexOutOfBoundsException();
		return elements[0];
	}

	public int poll() {
		if (isEmpty())
			throw new IndexOutOfBoundsException();
		int result = elements[0];
		at[result] = -1;
		if (size == 1) {
			size = 0;
			return result;
		}
		elements[0] = elements[--size];
		at[elements[0]] = 0;
		shiftDown(0);
		return result;
	}

    public void clear() {
        size = 0;
		Arrays.fill(at, -1);
    }
}

class BidirectionalGraph extends Graph {
	public int[] transposedEdge;

	public BidirectionalGraph(int vertexCount) {
		this(vertexCount, vertexCount);
	}

	public BidirectionalGraph(int vertexCount, int edgeCapacity) {
		super(vertexCount, 2 * edgeCapacity);
		transposedEdge = new int[2 * edgeCapacity];
	}

	public static BidirectionalGraph createGraph(int vertexCount, int[] from, int[] to) {
		BidirectionalGraph graph = new BidirectionalGraph(vertexCount, from.length);
		for (int i = 0; i < from.length; i++)
			graph.addSimpleEdge(from[i], to[i]);
		return graph;
	}

	public static BidirectionalGraph createWeightedGraph(int vertexCount, int[] from, int[] to, long[] weight) {
		BidirectionalGraph graph = new BidirectionalGraph(vertexCount, from.length);
		for (int i = 0; i < from.length; i++)
			graph.addWeightedEdge(from[i], to[i], weight[i]);
		return graph;
	}

	public static BidirectionalGraph createFlowGraph(int vertexCount, int[] from, int[] to, long[] capacity) {
		BidirectionalGraph graph = new BidirectionalGraph(vertexCount, from.length * 2);
		for (int i = 0; i < from.length; i++)
			graph.addFlowEdge(from[i], to[i], capacity[i]);
		return graph;
	}

	public static BidirectionalGraph createFlowWeightedGraph(int vertexCount, int[] from, int[] to, long[] weight, long[] capacity) {
		BidirectionalGraph graph = new BidirectionalGraph(vertexCount, from.length * 2);
		for (int i = 0; i < from.length; i++)
			graph.addFlowWeightedEdge(from[i], to[i], weight[i], capacity[i]);
		return graph;
	}

	@Override
	public int addEdge(int fromID, int toID, long weight, long capacity, int reverseEdge) {
		int lastEdgeCount = edgeCount;
		super.addEdge(fromID, toID, weight, capacity, reverseEdge);
		super.addEdge(toID, fromID, weight, capacity, reverseEdge == -1 ? -1 : reverseEdge + 1);
		this.transposedEdge[lastEdgeCount] = lastEdgeCount + 1;
		this.transposedEdge[lastEdgeCount + 1] = lastEdgeCount;
		return lastEdgeCount;
	}

	@Override
	protected int entriesPerEdge() {
		return 2;
	}

	@Override
	public final int transposed(int id) {
		return transposedEdge[id];
	}

	@Override
	protected void ensureEdgeCapacity(int size) {
		if (size > edgeCapacity()) {
			super.ensureEdgeCapacity(size);
			transposedEdge = resize(transposedEdge, edgeCapacity());
		}
	}
}

class DFSOrder {
	public final int[] position;
	public final int[] end;

	public DFSOrder(Graph graph) {
		this(graph, 0);
	}

	public DFSOrder(Graph graph, int root) {
		int count = graph.vertexCount();
		position = new int[count];
		end = new int[count];
		int[] edge = new int[count];
		int[] stack = new int[count];
		for (int i = 0; i < count; i++)
			edge[i] = graph.firstOutbound(i);
		stack[0] = root;
		int size = 1;
		position[root] = 0;
		int index = 0;
		while (size > 0) {
			int current = stack[size - 1];
			if (edge[current] == -1) {
				end[current] = index;
				size--;
			} else {
				int next = graph.destination(edge[current]);
				edge[current] = graph.nextOutbound(edge[current]);
				position[next] = ++index;
				stack[size++] = next;
			}
		}
	}

	public DFSOrder(BidirectionalGraph graph) {
		this(graph, 0);
	}

	public DFSOrder(BidirectionalGraph graph, int root) {
		int count = graph.vertexCount();
		position = new int[count];
		end = new int[count];
		int[] edge = new int[count];
		int[] stack = new int[count];
		int[] last = new int[count];
		for (int i = 0; i < count; i++)
			edge[i] = graph.firstOutbound(i);
		stack[0] = root;
		last[root] = -1;
		int size = 1;
		position[root] = 0;
		int index = 0;
		while (size > 0) {
			int current = stack[size - 1];
			if (edge[current] == -1) {
				end[current] = index;
				size--;
			} else {
				int next = graph.destination(edge[current]);
				if (next == last[current]) {
					edge[current] = graph.nextOutbound(edge[current]);
					continue;
				}
				edge[current] = graph.nextOutbound(edge[current]);
				position[next] = ++index;
				last[next] = current;
				stack[size++] = next;
			}
		}
	}
}

interface Edge {
	public int getSource();
	public int getDestination();
	public long getWeight();
	public long getCapacity();
	public long getFlow();
	public void pushFlow(long flow);
	public boolean getFlag(int bit);
	public void setFlag(int bit);
	public void removeFlag(int bit);
	public int getTransposedID();
	public Edge getTransposedEdge();
	public int getReverseID();
	public Edge getReverseEdge();
	public int getID();
	public void remove();
	public void restore();
}

class Graph {
	public static final int REMOVED_BIT = 0;

	protected int vertexCount;
	protected int edgeCount;

	private int[] firstOutbound;
	private int[] firstInbound;

	private Edge[] edges;
	private int[] nextInbound;
	private int[] nextOutbound;
	private int[] from;
	private int[] to;
	private long[] weight;
	private long[] capacity;
	private int[] reverseEdge;
	private int[] flags;

	public Graph(int vertexCount) {
		this(vertexCount, vertexCount);
	}

	public Graph(int vertexCount, int edgeCapacity) {
		this.vertexCount = vertexCount;
		firstOutbound = new int[vertexCount];
		Arrays.fill(firstOutbound, -1);

		from = new int[edgeCapacity];
		to = new int[edgeCapacity];
		nextOutbound = new int[edgeCapacity];
		flags = new int[edgeCapacity];
	}

	public static Graph createGraph(int vertexCount, int[] from, int[] to) {
		Graph graph = new Graph(vertexCount, from.length);
		for (int i = 0; i < from.length; i++)
			graph.addSimpleEdge(from[i], to[i]);
		return graph;
	}

	public static Graph createWeightedGraph(int vertexCount, int[] from, int[] to, long[] weight) {
		Graph graph = new Graph(vertexCount, from.length);
		for (int i = 0; i < from.length; i++)
			graph.addWeightedEdge(from[i], to[i], weight[i]);
		return graph;
	}

	public static Graph createFlowGraph(int vertexCount, int[] from, int[] to, long[] capacity) {
		Graph graph = new Graph(vertexCount, from.length * 2);
		for (int i = 0; i < from.length; i++)
			graph.addFlowEdge(from[i], to[i], capacity[i]);
		return graph;
	}

	public static Graph createFlowWeightedGraph(int vertexCount, int[] from, int[] to, long[] weight, long[] capacity) {
		Graph graph = new Graph(vertexCount, from.length * 2);
		for (int i = 0; i < from.length; i++)
			graph.addFlowWeightedEdge(from[i], to[i], weight[i], capacity[i]);
		return graph;
	}

	public static Graph createTree(int[] parent) {
		Graph graph = new Graph(parent.length + 1, parent.length);
		for (int i = 0; i < parent.length; i++)
			graph.addSimpleEdge(parent[i], i + 1);
		return graph;
	}

	public int addEdge(int fromID, int toID, long weight, long capacity, int reverseEdge) {
		ensureEdgeCapacity(edgeCount + 1);
		if (firstOutbound[fromID] != -1)
			nextOutbound[edgeCount] = firstOutbound[fromID];
		else
			nextOutbound[edgeCount] = -1;
		firstOutbound[fromID] = edgeCount;
		if (firstInbound != null) {
			if (firstInbound[toID] != -1)
				nextInbound[edgeCount] = firstInbound[toID];
			else
				nextInbound[edgeCount] = -1;
			firstInbound[toID] = edgeCount;
		}
		this.from[edgeCount] = fromID;
		this.to[edgeCount] = toID;
		if (capacity != 0) {
			if (this.capacity == null)
				this.capacity = new long[from.length];
			this.capacity[edgeCount] = capacity;
		}
		if (weight != 0) {
			if (this.weight == null)
				this.weight = new long[from.length];
			this.weight[edgeCount] = weight;
		}
		if (reverseEdge != -1) {
			if (this.reverseEdge == null) {
				this.reverseEdge = new int[from.length];
				Arrays.fill(this.reverseEdge, 0, edgeCount, -1);
			}
			this.reverseEdge[edgeCount] = reverseEdge;
		}
		if (edges != null)
			edges[edgeCount] = createEdge(edgeCount);
		return edgeCount++;
	}

	protected final GraphEdge createEdge(int id) {
		return new GraphEdge(id);
	}

	public final int addFlowWeightedEdge(int from, int to, long weight, long capacity) {
		if (capacity == 0) {
			return addEdge(from, to, weight, 0, -1);
		} else {
			int lastEdgeCount = edgeCount;
			addEdge(to, from, -weight, 0, lastEdgeCount + entriesPerEdge());
			return addEdge(from, to, weight, capacity, lastEdgeCount);
		}
	}

	protected int entriesPerEdge() {
		return 1;
	}

	public final int addFlowEdge(int from, int to, long capacity) {
		return addFlowWeightedEdge(from, to, 0, capacity);
	}

	public final int addWeightedEdge(int from, int to, long weight) {
		return addFlowWeightedEdge(from, to, weight, 0);
	}

	public final int addSimpleEdge(int from, int to) {
		return addWeightedEdge(from, to, 0);
	}

	public final int vertexCount() {
		return vertexCount;
	}

	public final int edgeCount() {
		return edgeCount;
	}

	protected final int edgeCapacity() {
		return from.length;
	}

	public final Edge edge(int id) {
		initEdges();
		return edges[id];
	}

	public final int firstOutbound(int vertex) {
		int id = firstOutbound[vertex];
		while (id != -1 && isRemoved(id))
			id = nextOutbound[id];
		return id;
	}

	public final int nextOutbound(int id) {
		id = nextOutbound[id];
		while (id != -1 && isRemoved(id))
			id = nextOutbound[id];
		return id;
	}

	public final int firstInbound(int vertex) {
		initInbound();
		int id = firstInbound[vertex];
		while (id != -1 && isRemoved(id))
			id = nextInbound[id];
		return id;
	}

	public final int nextInbound(int id) {
		initInbound();
		id = nextInbound[id];
		while (id != -1 && isRemoved(id))
			id = nextInbound[id];
		return id;
	}

	public final int source(int id) {
		return from[id];
	}

	public final int destination(int id) {
		return to[id];
	}

	public final long weight(int id) {
		if (weight == null)
			return 0;
		return weight[id];
	}

	public final long capacity(int id) {
		if (capacity == null)
			return 0;
		return capacity[id];
	}

	public final long flow(int id) {
		if (reverseEdge == null)
			return 0;
		return capacity[reverseEdge[id]];
	}

	public final void pushFlow(int id, long flow) {
		if (flow == 0)
			return;
		if (flow > 0) {
			if (capacity(id) < flow)
				throw new IllegalArgumentException("Not enough capacity");
		} else {
			if (flow(id) < -flow)
				throw new IllegalArgumentException("Not enough capacity");
		}
		capacity[id] -= flow;
		capacity[reverseEdge[id]] += flow;
	}

	public int transposed(int id) {
		return -1;
	}

	public final int reverse(int id) {
		if (reverseEdge == null)
			return -1;
		return reverseEdge[id];
	}

	public final void addVertices(int count) {
		ensureVertexCapacity(vertexCount + count);
		Arrays.fill(firstOutbound, vertexCount, vertexCount + count, -1);
		if (firstInbound != null)
			Arrays.fill(firstInbound, vertexCount, vertexCount + count, -1);
		vertexCount += count;
	}

	protected final void initEdges() {
		if (edges == null) {
			edges = new Edge[from.length];
			for (int i = 0; i < edgeCount; i++)
				edges[i] = createEdge(i);
		}
	}

	public final void removeVertex(int vertex) {
		int id = firstOutbound[vertex];
		while (id != -1) {
			removeEdge(id);
			id = nextOutbound[id];
		}
		initInbound();
		id = firstInbound[vertex];
		while (id != -1) {
			removeEdge(id);
			id = nextInbound[id];
		}
	}

	private void initInbound() {
		if (firstInbound == null) {
			firstInbound = new int[firstOutbound.length];
			Arrays.fill(firstInbound, 0, vertexCount, -1);
			nextInbound = new int[from.length];
			for (int i = 0; i < edgeCount; i++) {
				nextInbound[i] = firstInbound[to[i]];
				firstInbound[to[i]] = i;
			}
		}
	}

	public final boolean flag(int id, int bit) {
		return (flags[id] >> bit & 1) != 0;
	}

	public final void setFlag(int id, int bit) {
		flags[id] |= 1 << bit;
	}

	public final void removeFlag(int id, int bit) {
		flags[id] &= -1 - (1 << bit);
	}

	public final void removeEdge(int id) {
		setFlag(id, REMOVED_BIT);
	}

	public final void restoreEdge(int id) {
		removeFlag(id, REMOVED_BIT);
	}

	public final boolean isRemoved(int id) {
		return flag(id, REMOVED_BIT);
	}

	public final Iterable<Edge> outbound(final int id) {
		initEdges();
		return new Iterable<Edge>() {
			public Iterator<Edge> iterator() {
				return new EdgeIterator(id, firstOutbound, nextOutbound);
			}
		};
	}

	public final Iterable<Edge> inbound(final int id) {
		initEdges();
		initInbound();
		return new Iterable<Edge>() {
			public Iterator<Edge> iterator() {
				return new EdgeIterator(id, firstInbound, nextInbound);
			}
		};
	}

	protected void ensureEdgeCapacity(int size) {
		if (from.length < size) {
			int newSize = Math.max(size, 2 * from.length);
			if (edges != null)
				edges = resize(edges, newSize);
			from = resize(from, newSize);
			to = resize(to, newSize);
			nextOutbound = resize(nextOutbound, newSize);
			if (nextInbound != null)
				nextInbound = resize(nextInbound, newSize);
			if (weight != null)
				weight = resize(weight, newSize);
			if (capacity != null)
				capacity = resize(capacity, newSize);
			if (reverseEdge != null)
				reverseEdge = resize(reverseEdge, newSize);
			flags = resize(flags, newSize);
		}
	}

	private void ensureVertexCapacity(int size) {
		if (firstOutbound.length < size) {
			int newSize = Math.max(size, 2 * from.length);
			firstOutbound = resize(firstOutbound, newSize);
			if (firstInbound != null)
				firstInbound = resize(firstInbound, newSize);
		}
	}

	protected final int[] resize(int[] array, int size) {
		int[] newArray = new int[size];
		System.arraycopy(array, 0, newArray, 0, array.length);
		return newArray;
	}

	private long[] resize(long[] array, int size) {
		long[] newArray = new long[size];
		System.arraycopy(array, 0, newArray, 0, array.length);
		return newArray;
	}

	private Edge[] resize(Edge[] array, int size) {
		Edge[] newArray = new Edge[size];
		System.arraycopy(array, 0, newArray, 0, array.length);
		return newArray;
	}

	public final boolean isSparse() {
		return vertexCount == 0 || edgeCount * 20 / vertexCount <= vertexCount;
	}

	protected class GraphEdge implements Edge {
		protected int id;

		protected GraphEdge(int id) {
			this.id = id;
		}

		public int getSource() {
			return source(id);
		}

		public int getDestination() {
			return destination(id);
		}

		public long getWeight() {
			return weight(id);
		}

		public long getCapacity() {
			return capacity(id);
		}

		public long getFlow() {
			return flow(id);
		}

		public void pushFlow(long flow) {
			Graph.this.pushFlow(id, flow);
		}

		public boolean getFlag(int bit) {
			return flag(id, bit);
		}

		public void setFlag(int bit) {
			Graph.this.setFlag(id, bit);
		}

		public void removeFlag(int bit) {
			Graph.this.removeFlag(id, bit);
		}

		public int getTransposedID() {
			return transposed(id);
		}

		public Edge getTransposedEdge() {
			int reverseID = getTransposedID();
			if (reverseID == -1)
				return null;
			initEdges();
			return edge(reverseID);
		}

		public int getReverseID() {
			return reverse(id);
		}

		public Edge getReverseEdge() {
			int reverseID = getReverseID();
			if (reverseID == -1)
				return null;
			initEdges();
			return edge(reverseID);
		}

		public int getID() {
			return id;
		}

		public void remove() {
			removeEdge(id);
		}

		public void restore() {
			restoreEdge(id);
		}
	}

	public class EdgeIterator implements Iterator<Edge> {
		private int edgeID;
		private final int[] next;
		private int lastID = -1;

		public EdgeIterator(int id, int[] first, int[] next) {
			this.next = next;
			edgeID = nextEdge(first[id]);
		}

		private int nextEdge(int id) {
			while (id != -1 && isRemoved(id))
				id = next[id];
			return id;
		}

		public boolean hasNext() {
			return edgeID != -1;
		}

		public Edge next() {
			if (edgeID == -1)
				throw new NoSuchElementException();
			lastID = edgeID;
			edgeID = nextEdge(next[lastID]);
			return edges[lastID];
		}

		public void remove() {
			if (lastID == -1)
				throw new IllegalStateException();
			removeEdge(lastID);
			lastID = -1;
		}
	}

}

class GraphAlgorithms {
	public static int[] topologicalSort(Graph graph) {
		int count = graph.vertexCount();
		int[] queue = new int[count];
		int[] degree = new int[count];
		int size = 0;
		for (int i = 0; i < graph.edgeCount(); i++) {
			if (!graph.isRemoved(i))
				degree[graph.destination(i)]++;
		}
		for (int i = 0; i < count; i++) {
			if (degree[i] == 0)
				queue[size++] = i;
		}
		for (int i = 0; i < size; i++) {
			int current = queue[i];
			for (int j = graph.firstOutbound(current); j != -1; j = graph.nextOutbound(j)) {
				int next = graph.destination(j);
				if (--degree[next] == 0)
					queue[size++] = next;
			}
		}
		if (size != count)
			return null;
		return queue;
	}
}

class MaxFlow {
	private final Graph graph;
	private int source;
	private int destination;
	private int[] queue;
	private int[] distance;
	private int[] nextEdge;

	private MaxFlow(Graph graph, int source, int destination) {
		this.graph = graph;
		this.source = source;
		this.destination = destination;
		int vertexCount = graph.vertexCount();
		queue = new int[vertexCount];
		distance = new int[vertexCount];
		nextEdge = new int[vertexCount];
	}

	public static long dinic(Graph graph, int source, int destination) {
		return new MaxFlow(graph, source, destination).dinic();
	}

	private long dinic() {
		long totalFlow = 0;
		while (true) {
			edgeDistances();
			if (distance[destination] == -1)
				break;
			Arrays.fill(nextEdge, -2);
			totalFlow += dinicImpl(source, Long.MAX_VALUE);
		}
		return totalFlow;
	}

	private void edgeDistances() {
		Arrays.fill(distance, -1);
		distance[source] = 0;
		int size = 1;
		queue[0] = source;
		for (int i = 0; i < size; i++) {
			int current = queue[i];
			int id = graph.firstOutbound(current);
			while (id != -1) {
				if (graph.capacity(id) != 0) {
					int next = graph.destination(id);
					if (distance[next] == -1) {
						distance[next] = distance[current] + 1;
						queue[size++] = next;
					}
				}
				id = graph.nextOutbound(id);
			}
		}
	}

	private long dinicImpl(int source, long flow) {
		if (source == destination)
			return flow;
		if (flow == 0 || distance[source] == distance[destination])
			return 0;
		int id = nextEdge[source];
		if (id == -2)
			nextEdge[source] = id = graph.firstOutbound(source);
		long totalPushed = 0;
		while (id != -1) {
			int nextDestinationID = graph.destination(id);
			if (graph.capacity(id) != 0 && distance[nextDestinationID] == distance[source] + 1) {
				long pushed = dinicImpl(nextDestinationID, Math.min(flow, graph.capacity(id)));
				if (pushed != 0) {
					graph.pushFlow(id, pushed);
					flow -= pushed;
					totalPushed += pushed;
					if (flow == 0)
						return totalPushed;
				}
			}
			nextEdge[source] = id = graph.nextOutbound(id);
		}
		return totalPushed;
	}
}

interface Factory<V> {
	public V create();
}

interface Operation<V> extends Factory<V> {
	public V operation(V first, V second);
}

interface PowerOperation<V> extends Operation<V> {
	public V power(V base, int exponent);
}

//package com.company;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s=scan.nextLine();
        int count=1;
        for(int i=0;i<s.length()-1;i++){
            if (s.charAt(i)!=s.charAt(i+1)) {
               count=0;
            }
            else{
                count++;
                if(count==6){
                    break;
                }
            }
        }
        if(count==6){
            System.out.println("YES");
        }
        else
        {
            System.out.println("NO");
        }
    }
}

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

public class C {

    public static void main(String[] args) throws IOException {
            BufferedReader b= new BufferedReader(new InputStreamReader(System.in));

  String s=b.readLine();
   String t;
  for(int i = 0;i<s.length();i++){

      if(i+6<=s.length()-1){
  t=s.substring(i,i+7);
     if(t.equalsIgnoreCase("0000000")||t.equalsIgnoreCase("1111111")){
          System.out.println("YES");return;
      }

      }
  }
        System.out.println("NO");
    }
}

import java.io.*;
import java.util.*;
public class Football
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(f.readLine());
        PrintWriter out = new PrintWriter(System.out);
        int length = 1;
        int runs = 1;
        String string = st.nextToken();
        int state = (int)string.charAt(0) - 48;
        for (int i = 1; i < string.length(); i++)
        {
            if (runs == 7)
            {
                out.print("YES");
                out.close();
                return;
            }
            switch (state)
            {
                case 0:
                    if (string.charAt(i) == '0') runs++;
                    else
                    {
                        runs = 1;
                        state = 1;
                    }
                    break;

                case 1:
                    if (string.charAt(i) == '1') runs++;
                    else
                    {
                        runs = 1;
                        state = 0;
                    }
                    break;
            }
        }
        if (runs == 7)
        {
            out.print("YES");
            out.close();
            return;
        }
        out.print("NO");
        out.close();
    }
}

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

/**
 *
 * This Thing was created and developed by Homich
 */
public class Main {

    StreamTokenizer in;
    PrintWriter out;

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

    public void run() throws Exception {
        in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(new OutputStreamWriter(System.out));
        solve();
        out.flush();
    }

    int nextInt() throws Exception {
        in.nextToken();
        return (int) in.nval;
    }

    long nextLong() throws Exception {
        in.nextToken();
        return (long) in.nval;
    }

    double nextDouble() throws Exception {
        in.nextToken();
        return in.nval;
    }

    String next() throws Exception {
        in.nextToken();
        return in.sval;
    }

    public void solve() throws Exception {
        in.ordinaryChars('0', '1');
        in.wordChars('0', '1');
        String s = next();
        out.println(s.contains("0000000") || s.contains("1111111") ? "YES" : "NO");
    }//End Solve
}

import java.util.*;
public class CF_96A {
    public static void main(String[] args) {
        Scanner in = new Scanner (System.in);
        String str = in.next();
        if(str.contains("0000000")==true||str.contains("1111111")==true)
            System.out.println("YES");
        else System.out.println("NO");
    }
}

import java.util.Scanner;

public class Problem96A {
    public static void main(String[] args) {
        Scanner entrada = new Scanner(System.in);
        String sit = entrada.next();
        String aux = "";
        String aux2 = "";
        String aux3 = "";
        String aux4 = "";
        for (int i = 0; i < sit.length(); i++) {
            if (sit.charAt(i) == '1') {
                aux = "";
                aux2 = "";
                for (int j = i + 1; j < sit.length(); j++) {
                    aux += sit.charAt(j);
                }
                for (int j = i - 1; j >= 0; j--) {
                    aux2 += sit.charAt(j);
                }
            } else if (sit.charAt(i) == '0') {
                aux3 = "";
                aux4 = "";
                for (int j = i + 1; j < sit.length(); j++) {
                    aux3 += sit.charAt(j);
                }
                for (int j = i - 1; j >= 0; j--) {
                    aux4 += sit.charAt(j);
                }
            }
        }
        if (!aux.contains("0000000") && !aux2.contains("0000000") && !aux3.contains("1111111") && !aux4.contains("1111111") ){
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }
}

import java.util.Scanner;
public class Codeforces {
    public static void main(String[] args) {
        Scanner sc = new Scanner (System.in);
        String s = sc.nextLine();
        int count = 1;
        for (int i=0; i<s.length()-1; i++) {
            if (count >= 7)
                break;
            else if (s.charAt(i) != s.charAt(i+1)) {
                    count=1;
                    continue;
                }
                else
                    count++;
        }
        if (count >= 7) System.out.println("YES");
        else System.out.println("NO");
    }
}

import java.util.*;
public class football
{
  public static void main(String...arg)
  {
    Scanner sc=new Scanner(System.in);
    String s=sc.nextLine();
    int i,k=0,l=0;
    //System.out.println(s.length());
    if(s.length()<7)
    System.out.println("NO");
    else{
  for(i=0;i<(s.length())-6;i++)
  {
	  l=0;
	  if(k!=1)
	  {
    for(int j=i;j<(i+6);j++)
  {

    if(s.charAt(j)==s.charAt(j+1))
    {

     l++;
     if(l==6)
     {
    System.out.println("YES");
    k++;
    break;
     }
    else
    continue;

    }
   else
  break;

  }
}
else{
//System.out.println("no");
//System.out.println("1");
break;
  }
}
 if(k==0)
  System.out.println("NO");
}
  }
}

import java.util.Scanner;

public class Problem96A {

    public static void main(String args[]) {
    // write your code here
        Scanner input = new Scanner(System.in);

        String nums = input.nextLine();
        boolean dangerousflag = false;
        char prevchar = ' ';
        int count = 0;

        for (char c: nums.toCharArray())
        {
            if(c == prevchar)
            {
                count ++;
                if (count >= 7)
                {
                    dangerousflag = true;
                    System.out.print("YES");
                    break;
                }
            }
            else { count = 1;}

            prevchar = c;
        }
        if(!dangerousflag)
        {
            System.out.print("NO");
        }
    }
}

import java.io.*;
public class Main {
    public static void main (String [] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        int count1 = 0, count0 = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '1') {
                count1++;
                count0 = 0;
                if(count1 >= 7) {
            System.out.println("YES");
            return;
            }
            }
            else {
            count0++;
                count1 = 0;
                if(count0 >= 7) {
            System.out.println("YES");
            return;
            }
            }

        }
        if(count1 >= 7 || count0 >= 7) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

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

public class C {

    public static void main(String[] args) throws IOException {
            BufferedReader b= new BufferedReader(new InputStreamReader(System.in));

  String s=b.readLine();
  if(s.length()<7){
      System.out.println("NO");return ;
  }else if(s.length()==7){
        if(s.equalsIgnoreCase("0000000")||s.equalsIgnoreCase("1111111")){
          System.out.println("YES");return;
  }}
  for(int i = 0;i<=s.length()-7;i++){
      String t;

     t=s.substring(i,i+7);
     if(t.equalsIgnoreCase("0000000")||t.equalsIgnoreCase("1111111")){
          System.out.println("YES");return;

      }
  }
        System.out.println("NO");
    }
}

import java.io.*;
public class Football{
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int c = 1;
		for(int i = 0 ; i < str.length()-1 ; i++)
		{
			if(str.charAt(i)== str.charAt(i+1))
				c++;
			if(c==7)
				break;
			if(str.charAt(i) != str.charAt(i+1))
				c=1;
		}
		if(c==7)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
}

//Football
import java.util.Scanner;
public class Football {
    public static void main(String[] args) {
        Scanner input =new Scanner(System.in) ; String val=input.next();
        if (val.contains("1111111") ||val.contains("0000000")) System.out.println("YES");
        else System.out.println("NO");}}

import java.util.Scanner;
/**
 *
 * @author net
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner ca=new Scanner(System.in);
        String v1=ca.next();
        int c1=0,c2=0;
        for (int i = 0; i < v1.length(); i++) {
             if(c2==7||c1==7)
                    break;
            if(v1.charAt(i)=='0'){

                c1++;
             c2=0;
            }
 else  {
                if(c2==7)
                    break;
     c2++;
     c1=0;
 }

    }
        if(c1==7 || c2==7){
            System.out.println("YES");
        }
 else
            System.out.println("NO");

}

}

import java.util.Scanner;

public class foot {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		String s = in.next();
		char c = s.charAt(0);
		int t = 0 ;
		for(int i = 0 ; i < s.length() ; i++){

			if(s.charAt(i) == c)
				t++;
			else {
				c = s.charAt(i);
				t = 1 ;
			}
			if(t >= 7 ){
				System.out.println("YES");
				break;
			}
		}
		if(t < 7 )
			System.out.println("NO");
	}

}

import java.util.Scanner;

public class Football {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String a = in.next();
		int m = 1;
		char[] b = a.toCharArray();
		if (a.length() < 8) {
			System.out.println("NO");
			return;
		}
		for (int i = 0; i < a.length() - 1; i++) {

			if (b[i] == b[i + 1]) {
				m++;
			} else {
				m = 1;
			}
			if (m > 6) {
				System.out.println("YES");
				return;
			}
		}
		System.out.println("NO");

	}
}

import java.util.*;
public class strings
{
public static void main(String[] args)
{
String s;
int x;
Scanner sc=new Scanner(System.in);
s=sc.next();
if((s.contains("0"))&&(s.contains("1"))&&s.length()>0)
{
if(((s.contains("1111111"))||s.contains("0000000")))
{
System.out.print("YES");
}
else
{
System.out.print("NO");
}
}
else
{
System.out.print("NO");
}
}
}

import java.util.Scanner;

/**
 *
 * @author Twins
 */
public class ACM
{

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {

        Scanner c=new Scanner(System.in);
        String word =c.next();
        int one =1;int zero=1;
        for (int i = 0; i < word.length(); i++)
        {
            if (word.charAt(i)=='1')
            {
                if (one>=7)
                {
                    break;
                }
                else
                    one++;zero=1;

            }
            else
            {
                if (zero>=7)
                {
                    break;
                }
                else
                {
                    zero++;one=1;
                }

            }
        }
        if (one==7||zero==7)
        {
            System.out.println("YES");
        }
        else
            System.out.println("NO");

    }//Main

}//ACM Class

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc= new Scanner (System.in);
        String s = sc.next();
        char arr[]= s.toCharArray();
        int count = 0 ;
        boolean a = false;

        for(int i = 0 ; i<arr.length ; i++){

            count = 0;
            for(int j= i ; j<arr.length; j++){
           if(arr[i] == arr[j])
               count++;
           else break;
           }
           if(count>=7)
           {System.out.println("YES");
               a = true;
               break;
        }
        }
        if(a ==false)

            System.out.println("NO");
    }
}

import java.util.Scanner;
public class FootBall {
public static void main(String[] args) {
String test = new Scanner(System.in).next();
System.out.println((test.contains("1111111")||test.contains("0000000"))?"YES":"NO");}}

import java.util.Scanner;

public class main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        char[] a_players;
        String s_number;
        int in_counter=1;

        s_number = input.next();
        a_players = new char[s_number.length()];

        for(int i=0 ; i<s_number.length(); i++){

            a_players[i]=s_number.charAt(i);

        }
        for(int i =0 ; i<a_players.length-1; i++){

            if(a_players[i]==a_players[i+1]&&in_counter<7){

                in_counter++;
            }else if(a_players[i]!=a_players[i+1]){
                in_counter=1;
            }
            if(in_counter>=7){
                System.out.println("YES");
                break;
            }
        }
        if(in_counter<7){
            System.out.println("NO");
        }
        in_counter=1;

    }

}

import java.util.Scanner;

public class RENAMETHISBITCH {

	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)) {

			String s = sc.next();
			int count = 0;
			boolean dang = false;

			for (int i = 0; i < s.length() - 1; i++) {

				if (s.charAt(i) == s.charAt(i + 1)) count++;
				else count = 0;

				if (count >= 6) dang = true;
			}

			if (dang) System.out.println("YES");
			else System.out.println("NO");
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}

import java.io.*;
public class FootballProblem {
    public static void main(String args[])throws Exception{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder team = new StringBuilder(in.readLine());
        int size=1;
        char current=team.charAt(0);
        boolean isDanger=false;
        for(int i=1;i<team.length();i++){
            if(current==team.charAt(i))
                size++;
            else {current=team.charAt(i);size=1;}
            if(size==7){
                isDanger=true;
                break;
            }
        }
        if(isDanger)
            System.out.println("YES");
        else System.out.println("NO");
    }
}

import java.util.Scanner;

public class Main {

    public static void main(String args[]) {
        final Scanner scanner = new Scanner(System.in);
        final char[] input = scanner.nextLine().toCharArray();

        int count = 1;
        for (int i = 1; i < input.length; i++) {
            final char prev = input[i - 1];
            final char current = input[i];
            if (prev == current) {
                count = count + 1;
            } else {
                count = 1;
            }
            if (count >= 7) {
                System.out.println("YES");
                return;
            }

        }

        System.out.println("NO");
    }

}

import java.util.Scanner;

public class Football {

    public static void main(String[] aks) {

        Scanner sc = new Scanner(System.in);
        String zeros = "0000000";
        String ones = "1111111";
        String x = sc.next();
        if (x.contains(zeros) || x.contains(ones)) {
            System.out.print("YES");
        } else {
            System.out.print("NO");
        }
    }
}

import java.util.Scanner;
public class Codeforces2 {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a=sc.next();
        if(a.length()>=7){
        	int t=0;
        	for(int i=0;i<=a.length()-7;i++){
        		if(a.substring(i,i+7).equals("0000000")||a.substring(i,i+7).equals("1111111")){
        			t=1;
        		}
        	}
        	if(t==1){
        		System.out.println("YES");
        	}else{
        		System.out.println("NO");
        	}
        }else{
        	System.out.println("NO");
        }
    }
}

import java.util.Scanner;

public class Football {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String line = scanner.nextLine();

		int maxOne = 0, maxZero = 0;
		int currOne = 0, currZero = 0;

		for (char c : line.toCharArray())
			if (c == '0') {
				currZero++;
				maxOne = maxOne < currOne ? currOne : maxOne;
				currOne &= 0;
			} else {
				currOne++;
				maxZero = maxZero < currZero ? currZero : maxZero;
				currZero &= 0;
			}
		maxOne = Math.max(maxOne, currOne);
		maxZero = Math.max(maxZero, currZero);

		if (maxOne >= 7 || maxZero >= 7)
			System.out.println("YES");
		else System.out.println("NO");
	}
}

import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    String players = in.next();
    int count = 0;

    for (int i=0; i<players.length(); i++){
      String players_index = players.substring(i,i+1);
      if (players_index.equals("1")){
        count+=1;
      }
      else if (players_index.equals("0")){
        count=0;
      }
      if (count>=7){
        System.out.println("YES");
        System.exit(0);
      }
    }

    count = 0;

    for (int i=0; i<players.length(); i++){
      String players_index = players.substring(i,i+1);
      if (players_index.equals("0")){
        count+=1;
      }
      else if (players_index.equals("1")){
        count=0;
      }
      if (count>=7){
        System.out.println("YES");
        System.exit(0);
      }
    }
      if (count<7){
        System.out.println("NO");
    }
  }
}

import java.util.Scanner;

public class Football96A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String teamform = in.nextLine();
        if(teamform.length() < 7){
            System.out.println("NO");
            return;
        }
        char[] formChar = teamform.toCharArray();
        int count = 0;
        for(int i = 0; i < formChar.length - 1; i++){
            if(formChar[i] == formChar[i+1]){
                count++;
            }
            else {
                count = 0;
            }
            if(count == 6){
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");

    }
}

import java.util.Scanner;

public class Main {

    private static boolean numberOfStandingPlayers(String str) {
        int numberOfStaPlayers = 0;
        for (int index = 0; index < str.length() - 1; index++) {
            if (str.charAt(index) == str.charAt(index + 1)) {

                numberOfStaPlayers++;
                if (numberOfStaPlayers == 6) {
                    return true;
                }

            } else {
                numberOfStaPlayers = 0;
            }

        }
        return false;
    }

    private static void printResult(boolean bool) {
        if (bool) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String str = new String("");
        str = input.next();
        boolean sideBySide = numberOfStandingPlayers(str);
        printResult(sideBySide);
    }

}

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

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner s=new Scanner(System.in);

		String n=s.next();
		boolean flag=false;
		Stack<Character> st=new Stack<>();
		for(int i=0;i<n.length();i++){
			char c=n.charAt(i);

			if(st.size()==0){
				st.push(c);
			}
			else if(st.peek()==c){
				st.push(c);
			}else if(st.peek()!=c){
				while(st.size()>0){
					st.pop();
				}
			}
			st.push(c);
			if(st.size()==7){
				flag=true;
			}
		}

		if(flag){
			System.out.println("YES");
		}else{
						System.out.println("NO");
		}
	}
}

import java.io.IOException;
import java.util.Scanner;

public class Football {

    public static void main(String[] args)  throws IOException
    {

        Scanner cs= new Scanner(System.in);
        String no=cs.next();
      int count1=0;
      int count2=0;
      for(int i=0;i<no.length();i++){
          if(  no.charAt(i)=='1'){
              count1++;
          }
         else {
              count1=0;
            }

      }
       for(int i=0;i<no.length();i++){
          if(  no.charAt(i)=='0'){
              count2++;
          }
         else {
              count2=0;
            }

      }
       if (count1 >=7 ||count2>=7){
            System.out.println("YES");
       }
       else
            System.out.println("NO");
    }

}

import java.util.*;
import java.io.*;
public class Main{
public static void main(String args[]) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        String str = bf.readLine();
        int cnt1=0,cnt2=0;
        boolean flag = false;
        for(int i=1; i<=str.length();i++)
        {
           while( i<str.length() && str.charAt(i-1) == str.charAt(i))
                {
                    cnt1++;
                    i++;
                    if(cnt1>=7)
                    {
                       System.out.println("YES");
                       return;
                    }
                }
                cnt1=0;
        }
            System.out.println("NO");
        }
}

import java.util.*;
public class Test
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
int l = s.length();
int flag=0;
for(int i=0;i<(l-6);i++)
{
    int p=i+7;

    if((s.substring(i,p)).equals("1111111") || (s.substring(i,p)).equals("0000000"))
    {   System.out.println(s.substring(i,p));
        flag=1;
        break;
    }
}
if(flag==1)
{
    System.out.print("YES");
}
else
{
    System.out.print("NO");
}
}
}

import java.util.Scanner;

public class jcp{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        String s=in.nextLine();
        int i;
        int o=0,t=0;
        int safe=0;
        int ru=1;
        int r=1;
        int l=s.length();
        for(i=0;i<=l-7;i++) {
        	if(i>-1) {
        	char a=s.charAt(i);
        	char b=s.charAt(i);
        	char c=s.charAt(i);
        	char d=s.charAt(i);
        	char e=s.charAt(i);
        	char f=s.charAt(i);
        	char g=s.charAt(i);
        	if((a=='1'&&b=='1'&&c=='1'&&d=='1'&&e=='1'&&f=='1'&&g=='1')||((a=='0'&&b=='0'&&c=='0'&&d=='0'&&e=='0'&&f=='0'&&g=='0'))) {
        		System.out.println("YES");
        		i=l;
        		ru=0;
        	}
        	else {
        		safe++;
        	}
        	}
        }

        if(safe==s.length()&&ru==1) {
        		r=0;
        	System.out.println("NO");
        }
        if((safe<7)||s.length()<7&&r==1)
        	System.out.println("NO");
    }
}

import java.io.*;
public class football {

    public static void main(String[] args)throws IOException {
        // TODO Auto-generated method stub
BufferedReader a=new BufferedReader(new InputStreamReader(System.in));
String s=a.readLine();
int c=0;boolean f=true;
if(s.length()>=7){
for(int i=0;i<=s.length()-6;i++){
    for(int i1=i+1;i1<=i+7;i1++){
        if(s.charAt(i)==s.charAt(i1))
            c++;
        else break;}
        if(c>=7){
            f=false;
        break;}

}
if(f)System.out.println("NO");
else System.out.println("YES");}

else System.out.println("NO");
    }

}

/**
 * @(#)Football.java
 *
 *
 * @author
 * @version 1.00 2011/7/24
 */
import java.util.*;
import java.io.*;
public class Football {

    public static void main(String[] args)throws Exception {
    	Scanner in = new Scanner(System.in);
    	String s = in.next();
    	int count = 0;
    	for(int i=0;i<s.length()-7;i++){
    		if((s.substring(i,i+7).equals("1111111"))||(s.substring(i,i+7).equals("0000000")) ){
    			count++;
    		}
    	}
		if(count>0){
			System.out.println ("YES");
		}else{
			System.out.println ("NO");
		}
    }
}

import java.util.*;
public class Football
{
	public static void main(String args[])
	{
		Scanner sc =new Scanner(System.in);
		String numstr = sc.next();
		char numarr[] = numstr.toCharArray();
		int flag=numarr[0];
		int count = 0;
		int x=0;
		int i=0;
		for(i=0;i<numstr.length();i++)
		{
			if(count>=7)
			{
				x=1;
				break;
			}
			if(numarr[i]==flag)
			{
				count++;
			}
			else
			{
				count=1;
				flag = numarr[i];
			}
		}
		if(x==0 && i!=numstr.length())
		{
			System.out.print("NO");
		}
		else
		{
			System.out.print("YES");
		}
	}
}

import java.util.Scanner;

public class CodeForce {

    public static void main(String[] args) {
     Scanner scan = new Scanner (System.in);
     String s = scan.next();
     int count = 0 ,count2=0;
        for (int i = 0; i <s.length(); i++) {
            if (Integer.parseInt(s.charAt(i)+"")==0)
            {
                count++;
              count2 = 0;
            }
            else
            {
                count2++;
                count =0 ;
            }
        }
        if (count>=7 || count2>=7)
            System.out.println("YES"+count+count2);
        else
            System.out.println("NO");

    }

}

import java.io.*;

public class Main
{

public static void main(String[] args)throws IOException
{
String str,strnew;

int i;
int c=0;

BufferedReader k= new BufferedReader(new InputStreamReader(System.in));

str=k.readLine();

char temp=str.charAt(0);
c++;
int l=str.length();
int f=0;
for(i=1;i<l;i++)
{
if(c>=7)
{
f=1;
break;
}
if(str.charAt(i)==temp)
{
c++;
continue;
}
else
{
c=1;
temp=str.charAt(i);
}
}

if(f==0)
System.out.println("NO");
else
System.out.println("YES");

}}

import java.util.Scanner;

public class Problem96A {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String str = scan.next();

		char c = str.charAt(0);

		int count = 1;
		int i;
		for(i=0; i<str.length()-1; i++)
		{
			if(str.charAt(i) == c)
			{
				count++;
				if(count>=7)
				{
					break;
				}
			}
			else
			{
				c = str.charAt(i);
				count=1;
			}
		}

		if(i>=(str.length()-1))
			System.out.println("NO");
		else
		System.out.println("YES");

	}
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int k = 0;

        for (int i = 1; i < s.length(); i++) {
            if (k == 6) {
                System.out.println("YES");
                break;
            }
            if (s.charAt(i) == s.charAt(i - 1)) k += 1;
            else k = 0;
        }
        if (k != 7) System.out.println("NO");
    }
}

import java.util.Scanner;

public class Football {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String num= input.nextLine();
        int answer1=1;
        int answer2=1;
        int q1=0;
        int q2=0;
        for (int i = 1; i <num.length() ; i++) {
            if(num.charAt(i)==num.charAt(i-1) && num.charAt(i)=='1' ){
                    answer1++;
            }
            else if(num.charAt(i)==num.charAt(i-1) && num.charAt(i)=='0' ){
                    answer2++;
            }
            else if(num.charAt(i)!=num.charAt(i-1)) {
                if(answer1>q1){
                    q1=answer1;
                    answer1=1;
                    }
                if(answer2>q2){
                    q2=answer2;
                    answer2=1;
                }

            }
        }

//        System.out.println(q1);
//        System.out.println(q2);
        if (q1>=7 || q2>=7){
            System.out.println("YES");
        }
        else System.out.println("NO");

    }
}

/**
 * @(#)test.java
 *
 *
 * @author
 * @version 1.00 2016/9/9
 */
import java.util.*;
public class test {

    /**
     * Creates a new instance of test.
     */
    public test() {
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

    	Scanner kbd = new Scanner(System.in);
        long s=kbd.nextLong();

        String z=Long.toString(s);
		char arr[]=z.toCharArray();

		for(int i=0;i<z.length();i++){
			if(z.contains("2")||z.contains("3")||z.contains("4")||z.contains("5")||z.contains("6")||z.contains("7")||z.contains("8")||z.contains("9")){
			System.exit(0);
				}
			}
		for(int o=0;o<z.length();o++){
			if(arr[o]=='0'){
				int	counter=+ 1;
				if(counter>=7){
					System.out.println("YES");
				}else{
					System.out.println("NO");
					System.exit(0);
					}

			}
		}

    }
}

import java.util.Scanner;
public class football {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String teams = sc.nextLine();
        if (teams.length() < 7) {
            System.out.println("NO");
            //System.out.println("1");
        } else {
            dangerous(teams);
        }
    }

    public static void dangerous(String teams) {
        int counter = 0;
        for (int i = 0; i < teams.length(); i++) {
            char player = teams.charAt(i);
            if (i > 0 && player == teams.charAt(i-1)) {
                counter++;
                //System.out.println("counter has incremented");
                if (counter >= 6) {
                    //System.out.println("breaking the loop");
                    break;
                }
            } else {
                counter = 0;
            }
            //System.out.println(counter);
            //System.out.println(player);
        }
        if (counter >= 6) {
            System.out.println("YES");
            System.out.println(counter);
        } else {
            System.out.println("NO");
            System.out.println(counter);
        }
    }
}

/**
 * Jerry Ma
 * Program: football
 */

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

public class football {
  public static void main (String [] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    int longest = 0, curLength = 0;
    char prevNum = '-';
    for (int count = 0; count < s.length(); count ++) {
      if (s.charAt(count) != prevNum) {
        prevNum = s.charAt(count);
        if (curLength > longest)
          longest = curLength;
      }
      curLength ++;
    }
    if (curLength > longest)
      longest = curLength;
    if (longest > 6)
      System.out.println("YES");
    else
      System.out.println("NO");
    System.exit(0);
  }
}

import java.util.Scanner;

public class Football96A {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();
        int count = 0;
        if (!input.isEmpty() && input.length() <= 100) {
            for (int i = 1; i <input.length(); i++) {
                if (input.charAt(i) == input.charAt(i-1)) {
                    count++;
                }
            }
        }
        if (count >= 7)
            System.out.println("YES " +count);
        else System.out.println("NO " +count);

    }
}

import java.util.Scanner;

public class Problem96A {
  static Scanner s = new Scanner(System.in);

  public static void main(String args[]) {
    int dangerLevel1 = 0;
    int dangerLevel0 = 0;

    while (s.hasNext()) {
      String ch = s.next();

      if (ch == "1") {
        dangerLevel0 = 0;
        dangerLevel1 += 1;
        if (dangerLevel1 == 7) {
          System.out.print("YES");
        }
      }

      if (ch == "0") {
        dangerLevel1 = 0;
        dangerLevel0 += 1;
        if (dangerLevel0 == 7) {
          System.out.print("YES");
        }
      }

      if (s.hasNext() == false) {
        if (dangerLevel1 == 0 && dangerLevel0 == 0 ) {
          System.out.print("NO");
        }
      }

    }
  }
}

/******************************************************************************

                            Online Java Compiler.
                Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/
import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String str = s.next();
		int val = 1;
		int ans = 0;
		for(int i = 0;i<str.length()-1;i++){
		      if(i == str.length()-2 && str.charAt(i) == str.charAt(i+1)){
		           ans = Math.max(ans,val);
		           ans = ans+1;
		           break;
		       }
		       if(str.charAt(i) == str.charAt(i+1)){
		           val++;
		       }else{
		         ans = Math.max(ans,val);
		         val = 0;
		       }
		       if(i == str.length()-2){
		           ans = Math.max(ans,val);
		       }

		}
		if(ans >= 7){
		    System.out.println("YES");
		}else{
		    System.out.println("NO");
		}
	}
}

import java.util.*;
public class Text1 {
public static boolean countPlayers(String x){
	int i = 0;
	int count = 0;
	while(i < x.length() - 1  ){
	if(x.charAt(i) == x.charAt(i+1)){
		count++;
	}else{
		count = 0;
	}
	if(count == 7)return true;
	i++;
	}
	return false;
}
public 	static void main(String[] args){
Scanner sc = new Scanner (System.in);
String x = sc.next();
System.out.println(countPlayers(x));
}
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
//package pkg20_football;

import java.util.Scanner;

/**
 *
 * @author lazaroalvarez
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here

        Scanner input = new Scanner(System.in);

        String positions = input.nextLine();
        int countCeros = 0;
        int countOnes = 0;

        for(char c: positions.toCharArray()){

            if(c == '0'){
                countOnes = 0;
                countCeros++;
                if(countCeros == 7){
                    System.out.println("YES");
                    return;
                }
            }else{
                countCeros = 0;
                countOnes++;
                if(countOnes == 7){
                    System.out.println("NO");
                    return;
                }
            }
        }
        System.out.println("NO");
    }
}

import java.util.Scanner;

/**
 *
 * @author Hazem
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner scanner = new Scanner(System.in);
        String text = scanner.nextLine();

        boolean result = false;

        for (int i = 0; i < text.length() && text.length() >= 7; i++) {

            result = text.substring(i, i + 6).matches("(.)\\1+");
            if (result) {
                break;
            }
        }

        System.out.println(result);
    }

}

import java.util.*;

public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        int countZ = 0;
        int countO = 0;

        for (int i = 1; i < input.length() - 1; i ++) {
            if (input.charAt(i) == '0' && input.charAt(i - 1) == '0') {
                countZ++;
                countO = 0;
            } else if (input.charAt(i) == '1' && input.charAt(i - 1) == '1') {
                countO++;
                countZ = 0;
            }
        }

        if (countZ >= 7) {
            System.out.println("YES");
        } else if (countO >= 7) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

import java.util.Scanner;
public class main {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String players = in.next();
        System.out.println(football(players));

    }
    public static String football(String players){
        int flag=0;
        for (int i = 0; i < players.length()-1; i++) {

            if(players.charAt(i+1)==players.charAt(i))
                flag++;
        }
        if(flag==7)
            return "YES";
        else
            return "NO";

    }
}

import java.util.Scanner;
public class Footba {

    public static void main(String[] args) {
        int count1 = 0, count = 0;
        Scanner Num = new Scanner(System.in);
        String Players = Num.next();
        for (int i = 0; i < Players.length() - 1; i++) {
            if (Players.charAt(i) == '0' && Players.charAt(i + 1) == '0') {
                count++;
            }
            if (Players.charAt(i) == '1' && Players.charAt(i + 1) == '1') {
                count1++;
            }
        }
        if (count >= 7 || count1 >= 7) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }

}

import java.util.*;
public class hello
{
	public static void main(String[] args) {
	    Scanner x=new Scanner(System.in);
	    String s=x.next();int k=0,i;int c1=0,c2=0;
	    int l=s.length();char ch;
	   for(i=0;i<l;i++)
	   {ch=s.charAt(i);
	   if(ch=='0')
		   c1++;
	   else
		   c2++;
	   }

	   if(c1>=7 ||c2>=7)
		   System.out.println("YES");
	   else
		   System.out.println("NO");

}
}

import java.util.*;
public class check
{
public static void main(String arsg[])
{
Scanner in=new Scanner(System.in);
String str;
int c=0;
System.out.println("Enter string");
str=in.nextLine();
int l=str.length();
for(int i=0;i<l-1;i++)
{
if(str.charAt(i)==(str.charAt(i+1)))
c=c+1;
if(c==7)
break;
}
if(c==7)
System.out.println("Yes");
else
System.out.println("No");
}
}

import java.util.Scanner;
public class Project {
    public static void main(String[] args) {

        String first;

        Scanner scanner1 = new Scanner(System.in);
        System.out.println("Please input the players!");
        System.out.println("Only 0 or 1 can be input!!!");
        first = scanner1.nextLine();

        String[] string = first.split("0");

        if (string.length>7){
            System.out.print("Yes");

        }else{
            System.out.print("No");
        }

    }
}

import java.util.*;
public class CF_96A {
    public static void main(String[] args) {
        Scanner in = new Scanner (System.in);
        String str = in.next();
        int countOne=0;
        int countZero=0;
        for (int i = 1; i <str.length(); i++) {
            if(str.charAt(i)=='1'&&str.charAt(i)==str.charAt(i-1)&&i<str.length())
                {
                 countOne++;
                 countZero=0;
                }
            else {
                countOne=0;
                countZero++;
            }
            if(str.charAt(i)=='0'&&str.charAt(i)==str.charAt(i-1)&&i<str.length()){
                countZero++;
                countOne=0;
            }
            else {
                countZero=0;
                countOne++;
            }
            if(countOne>=7||countZero>=7)break;
        }
        if(countOne>=7||countZero>=7)System.out.println("YES");
        else System.out.println("NO");
    }
}

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

public class implementationQue {

	public static void main(String args[])
	{
		Scanner s= new Scanner(System.in);
		String str=s.next();
		int count=0;
		int cz=0;
		int flag=0;
		for(int i=0;i<str.length();i++)
		{
			if(i<str.length()-1){
		if(str.charAt(i)==str.charAt(i+1))
		{
			if(str.charAt(i)=='1')
			{
				cz=0;
				count=count+1;
				if(count>=7)
				{
					flag=1;
					System.out.println("YES");
					break;
				}
			}
			else
			{
				count=0;
				cz=cz+1;
				if(cz>=7)
				{
					flag=1;
					System.out.println("YES");
					break;
				}
			}
		}}
		else if(str.charAt(i)=='1')
		{
			count++;
			if(count>=7)
			{
				flag=1;
				System.out.println("YES");
				break;
			}
			cz=0;
		}
		else if(str.charAt(i)=='0')
			{
			cz++;
			if(cz>=7)
			{
				flag=1;
				System.out.println("YES");
				break;
			}
			count=0;
			}
		//System.out.println(i+" "+cz+" "+count);
		}
		if(flag==0)
			System.out.println("NO");
	}
}

import java.util.Scanner;

public class Football96A {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();
        int count = 0;
        if (!input.isEmpty() && input.length() <= 100) {
            for (int i = 1; i <input.length(); i++) {
                if (input.charAt(i) == input.charAt(i-1)) {
                    count++;
                }
            }
        }
        if (count >= 7)
            System.out.println("YES");
        else System.out.println("NO");

    }
}

import java.util.Scanner;

public class Football {
    public static void main(String[] args) {
        Scanner read = new Scanner(System.in);
        String s = read.next();
        int count=0;
        char[] c = s.toCharArray();

        for (int i=0;i<s.length();i++) {
            for (int j=i+1;j<s.length();j++){
                if (c[i] == c[j]) {
                    count++;
                    break;
                }
                else {
                    count = 0;
                    break;
                }
            }
        }

        if (count>=7)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}

import java.util.Scanner;
public class Football {

public static void main(String[] args){
	Scanner s = new Scanner(System.in);
	String crowd = s.nextLine();
	char prev = crowd.charAt(0);
	char curr;
	int x = 4;
	int count = 0;
	boolean yes = false;
	for(int i = 0; i < crowd.length(); i ++) {
		curr = crowd.charAt(i);
		if(curr == prev) {
			count ++;
			if(count == 6) {

				System.out.println("YES");
				yes = true;
			}
		} else {
			System.out.println(count);
			count = 0;
		}
		prev = curr;
	}
	if(!yes){
		System.out.println("NO");
	}
}
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

//package ali;

import java.util.Scanner;

public class codeforse {
    public static void main(String[] args) {

    Scanner sc = new Scanner(System.in)   ;
    Boolean t1=true;
    Boolean t2=false;
     int count1=0;
     int count2=0;

String player =sc.next();

  if( player.length()<7 )
  {

    System.out.println("NO");
  }else {
          for (int i=0;i<player.length();   i++)  {
                      if ( player.charAt(i) =='0'){
                     if(t1==false){count1=0;}
                          count1++;

                      t1=true;
                      t2=true;  }
                             else {

                      t1=false;
                      if(t2==true){count2=0;}
                      count2 ++;
                      t2= false;
                      }
                      if (count1 >=7||count2>=7)
                          break;
                      }

}
        //System.out.println(player.length());
if (count1 >=7||count2>=7){System.out.println("YES");}

}
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        String entry=new String(input.next());
        int cnt0=0, cnt1=0;
        for(int i=0;i<entry.length();i++){
            if (entry.charAt(0)=='1')
                cnt1++;
            else
                cnt0++;
            entry=entry.substring(0);
        }

        if(cnt0>=7 || cnt1>=7)
            System.out.println("YES");
        else
            System.out.println("NO");
        input.close();
    }

}

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

public class sol
{
   	public static void main (String[] args)throws IOException{
		//code

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] a = br.readLine().trim().toCharArray();
		boolean flag = true;
		for(int i=1;i<a.length;i++)
		{
		    int count =0;
		    if(a[i-1] == a[i])
		    {
		        count++;
		    }
		    if(count>=7)
		    {
		        flag  = false;
		    }
		}
		if(flag)
		{
		    System.out.println("NO");
		}
		else
		{
		    System.out.println("YES");
		}

    }

}

import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		String situation = scanner.next();
		if(determineSituation(situation) >= 7){
			System.out.print("YES");
		}
		else{
			System.out.print("NO");
		}
		scanner.close();
	}

	public static int determineSituation(String situation){
		int counter = 1; //counter = number of things in a row
		for(int i = 1; i < situation.length(); ++i){
			if(situation.charAt(i) == situation.charAt(i-1)){
				counter++;
			}
			else{
				counter = 1;
			}
		}
		return counter;
	}

}

import java.io.*;
import java.util.*;
public class t7
{
public static void main(String arg[])
{
   String s;
   Scanner sc=new Scanner(System.in);
   s=sc.next();
   int count=0;
   int n=s.length();
   for(int i=0;i<n-1;i++)
   {
       count=0;
      for(int j=i+1;j<n;j++)
       {
            if(count>5)
            {
                System.out.println("YES");
                return;
            }
            if(s.charAt(i)==s.charAt(j))
                count++;
            else
            {
                count=0;
                break;
            }

       }
   }
        System.out.println("NO");
}
}

//package com.company;
import java.io.IOException;
import java.util.Scanner;

public class Football {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        String players = sc.nextLine();
        int len = players.length();
        char [] arrPlayers = new char[len + 100];
        for(int i = 0; i < len; i++){
            arrPlayers[i] = players.charAt(i);
        }
       String result = "POOOP";
        int counter = 0;
        for(int i = 0; i < len; i ++){
            for( int n = i; n < len; n++){
                if(arrPlayers[i] == arrPlayers[n + 1]){
                        counter++;

                        if(counter >= 6){
                            result = "YES";
                            break;

                        }
                }
            }
            if(counter >= 6){
                break;
            }
            counter = 0;
        }

        System.out.println(result);
    }

}

import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String[] args)
    {
        int c1=0,c2=0;
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char ch[] = s.toCharArray();
        for(int i=0 ; i<s.length();i++)
        {
            if(ch[i]=='1'){ c1++; c2--; }
            if(ch[i]=='0'){c1--; c2++;}
        }
        if(c1>=7||c2>=7) System.out.print("YES");
        else System.out.print("NO");
         sc.close();
        }

    }

import java.util.Scanner;

public class Solution04 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		char[] playersPos = scan.next().toCharArray();

		int zerosBeside = 1;
		int onesBeside = 1;

		for (int i = 1; i < playersPos.length; i++) {
			if (playersPos[i - 1] == playersPos[i] && playersPos[i] == '1') {
				onesBeside++;
				zerosBeside = 1;
			}

			if (playersPos[i - 1] == playersPos[i] && playersPos[i] == '0') {
				zerosBeside++;
				onesBeside = 1;
			}
		}

		System.out.println((zerosBeside >= 7 || onesBeside >= 7) ? "YES" : "NO");
	}
}

import java.util.Scanner;
public class Stone {
public static void main(String[] args) {

Scanner s=new Scanner(System.in);

String  f=s.next();
  boolean a=false;
  int c=0;

           for(int i=0;i<f.length()-1;i++)
     {
         if(((f.charAt(i))==(f.charAt(i+1))) )
            c++;
         else
             c=0;

        }
if(c>=7)
     System.out.println("YES");
else
     System.out.println("NO");

}

 }

//package practicejan;

import java.util.Scanner;

public class NewClass6 {
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        String S= new String();
        S=in.next();
        char[] ch = S.toCharArray();
        int n= S.length()-1;
         int sum=0,sum1=0;
        for(int i =0;i<n;i++)
        {
             sum=0;sum1=0;
            for(int j =0;j<i+7;j++)
            {
                if(i+j>n)
                    break;
                if(ch[i+j]=='0' )
                {
                    sum1++;
                }
                if(ch[i+j] =='1' )
                {
                    sum++;
                }

            }
             if(sum>=7 || sum1 >=7)
                 break;
        }
        if(sum>=7 || sum1>=7)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}

import java.util.*;

public class Main {

    public static void main(String[] args) {

     Scanner sc=new Scanner(System.in);

     String F=sc.next();

     if(F.contains("1111111"))
     {System.out.println("YES");}

     else
     {System.out.println("NO");}
    }

}

import java.util.Scanner;

public class Football {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.nextLine().toCharArray();
		int count = 1;
		for(int i = 1; i < arr.length; i++) {
			if(arr[i] == arr[i-1]) {
				count++;
				System.out.println(count);
				if(count == 7) {
					System.out.println("YES");
					return;
				}
			}
			count = 1;
		}
		System.out.println("NO");
	}
}

import java.sql.Array;
import java.util.Arrays;
import java.util.Scanner;

public class JavaApplication1 {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        String x = "1111111";
        String y = "0000000";
        String input = in.next();
        if (input.contains(x) || input.contains(x)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

}

import java.util.*;
public class file
{
    public static void main(String args[])
    {
        String s1;
        int count1=0;
        int count2=0;
        Scanner s=new Scanner(System.in);
        s1=s.nextLine();
        for(int i=0;i<s1.length();i++)
        {
            if(s1.charAt(i)==1)
            {
                count1++;
                count2=0;
                if(count1==7)
                break;
            }
            else if(s1.charAt(i)==0)
            {
            count2++;
            count1=0;
            if(count2==7)
            break;
            }
        }

        if(count1==7||count2==7)
        {
            System.out.println("YES");
        }
        else
         System.out.println("NO");
    }
}

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

public class Football {
    public static void main(String[] args) {
        Scanner scaner = new Scanner(System.in);

        String a = scaner.next();
        int dlugosc = a.length();
        int licznik = 1;

        List<Character> lista = new ArrayList<>();

        for (int i = 1; i <dlugosc-1 ; i++) {
            if(a.charAt(i) == a.charAt(i-1)){
                licznik++;
                if(licznik == 7){
                    System.out.println("YES");
                    break;
                }
            }else licznik = 1;
        }if (licznik < 6) System.out.println("NO");

    }
}

import java.util.Scanner;

public class jcp{
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        String s=in.nextLine();
        int i;
        int o=0,t=0;
        int safe=0;
        int ru=1;
        int r=1;
        int l=s.length();
        for(i=0;i<=l-7;i++) {
        	if(i>-1) {
        	char a=s.charAt(i);
        	char b=s.charAt(i);
        	char c=s.charAt(i);
        	char d=s.charAt(i);
        	char e=s.charAt(i);
        	char f=s.charAt(i);
        	char g=s.charAt(i);
        	if((a=='1'&&b=='1'&&c=='1'&&d=='1'&&e=='1'&&f=='1'&&g=='1')||((a=='0'&&b=='0'&&c=='0'&&d=='0'&&e=='0'&&f=='0'&&g=='0'))) {
        		System.out.println("YES");
        		i=l;
        		ru=0;
        		r=0;
        	}
        	else {
        		safe++;
        	}
        	}
        }

        if(safe==s.length()&&ru==1) {
        		r=0;
        	System.out.println("NO");
        }
        if(((safe<7)&&r==1)||(s.length()<7))
        	System.out.println("NO");
    }
}

import java.util.Scanner;
public class Stone {
public static void main(String[] args) {

Scanner s=new Scanner(System.in);

String  f=s.next();
  boolean a=false;
  int c=0;

           for(int i=0;i<f.length()-1;i++)
     {
         if(((f.charAt(i))==(f.charAt(i+1))) )
            c++;

        }
if(c>7)
     System.out.println("YES");
else
     System.out.println("NO");

}

 }

import java.util.Scanner;

public class Problem96A {
    public static void main(String[] args) {
        Scanner entrada = new Scanner(System.in);
        String sit = entrada.next();
        String aux = "";
        String aux2 = "";
        String aux3 = "";
        String aux4 = "";
        for (int i = 0; i < sit.length(); i++) {
            if (sit.charAt(i) == '1') {
                aux = "";
                aux2 = "";
                for (int j = i + 1; j < sit.length(); j++) {
                    aux += sit.charAt(j);
                }
                for (int j = i - 1; j > 0; j--) {
                    aux2 += sit.charAt(j);
                }
            } else if (sit.charAt(i) == '0') {
                aux3 = "";
                aux4 = "";
                for (int j = i + 1; j < sit.length(); j++) {
                    aux3 += sit.charAt(j);
                }
                for (int j = i - 1; j > 0; j--) {
                    aux4 += sit.charAt(j);
                }
            }
        }
        if (!aux.contains("0000000") && !aux2.contains("0000000") && !aux3.contains("1111111") && !aux4.contains("1111111") ){
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }
}

import java.util.Scanner;

public class aatring {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String str = s.next();
        int count = 0;
        int currentCount = 0;
        for(int i = 0;i<str.length();i++)
        {
            if(i == str.length()-1 && str.charAt(i) =='1')
            {
                currentCount++;
               count = currentCount;
               break;
            }
            if(str.charAt(i) == '1')
            {
                currentCount++;
            }
            if(str.charAt(i) == '0')
            {
                if(count < currentCount) {
                    count = currentCount;
                }
                currentCount = 0;
            }
        }
        int currentCount0 = 0;
        int count0 = 0;
        for(int i = 0;i<str.length();i++)
        {
            if(i == str.length()-1 && str.charAt(i) =='0')
            {
                currentCount0++;
                count0 = currentCount0;
                break;
            }
            if(str.charAt(i) == '0')
            {
                currentCount0++;
            }
            if(str.charAt(i) == '1')
            {
                if(count0 < currentCount0) {
                    count0 = currentCount0;
                }
                currentCount0 = 0;
            }
        }
        if(count0 >=7 || count >= 7)
        {
            System.out.println("YES");
        }
        else System.out.println("NO");
    }
}

import java.util.*;
public class Main {

    private static Scanner scanner=new Scanner(System.in);

    public static void main(String[] args) {
        String[]s=new String[1];
        int c=0;

        for(int i=0;i<s.length;i++)
        {
            s[i]=scanner.next();
        }
        char[]ac=new char[s[0].length()];
        for(int i=0;i<ac.length;i++)
        {
            ac[i]=s[0].charAt(i);
        }
        for(char i: ac)
        {
        if(i==i)
        {
            c++;
        }
        }
        if(c>6)
        {
            System.out.println("YES");
        }
        else
        {
            System.out.println("NO");
        }
    }
}
//

import java.util.Scanner;
public class Trial{
    public static void main(String[] args){
    	Scanner sc=new Scanner(System.in);
        String s=sc.nextLine();
        int sum=0;
        int count=0;
        char a[]=new char[s.length()];
        for(int i=0;i<s.length();i++) {
        	a[i]=(char) (s.charAt(i) % 48);
        }
        if(s.length()<7) {
        	count=2;
        }
        else {
        	int i=0;
        	while(i<=s.length()-8) {
        		for(int j=i;j<i+7;j++) {
        			sum+=a[j];

        		}

        		if(sum>=7 | sum==0) {
        			count=1;
        		}
        		sum=0;
        		i++;
        	}
        }
        if(count==1) System.out.println("Yes");
        else if(count==2) System.out.println("NO");

     }
}

import java.io.InputStreamReader;
import java.util.Scanner;

/**
 *
 * @author Bader Bushnaq
 */
public class ACM_training_q1
{
    public static void main(String[] args)
    {
        Scanner s=new Scanner(new InputStreamReader(System.in));
        String x=s.next();
        int c=0;
        char n=x.charAt(0);
        for(int i=0;i<x.length();i++)
        {
            if(c==7)
            {
                System.out.println("YES");
                break;
            }
            if(n!=x.charAt(i))
            {
                c=0;
                n=x.charAt(i);
                c++;
            }
            else
                if(n==x.charAt(i))
                c++;

        }
        if(c<7)
        {
            System.out.println("NO");
        }
    }

}

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        char[] chars = s.toCharArray();
        int c = 0;
        int b =0;

        for (int i = 0 ; i< chars.length;i++){
            if (chars[i] == '0'){
                c++;
            }
            else b++;
        }
        if (c>b){
            System.out.println("YES");
        }
        else System.out.println("NO");
    }
}

//package com.company;
import java.io.IOException;
import java.util.Scanner;

public class Football {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        String players = sc.nextLine();
        int len = players.length();
        char [] arrPlayers = new char[101];
        for(int i = 0; i < len; i++){
            arrPlayers[i] = players.charAt(i);
        }
       String result = "NO";
        int counter = 0;
        for(int i = 0; i < len; i ++){
            for( int n = i; n < len; n++){
                if(arrPlayers[i] == arrPlayers[n + 1]){
                        counter++;

                        if(counter >= 6){
                            result = "YES";
                            break;

                        }
                }
            }
            if(counter >= 6){
                break;
            }
            counter = 0;
        }

        System.out.println(result);
    }

}

import java.util.Scanner;

public class Main {
	public static String ifdan(String a){
		for(int i = 0; i<a.length()-7;i++){
			if(a.substring(i, i+7).equals("0000000")||a.substring(i, i+7).equals("1111111")){
				return "YES";
			}
		}
		return "NO";
	}
	public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		System.out.println(ifdan(s.next()));
	}
}

import java.util.Scanner;

public class Football {

    public static void main(String[] args) {

    Scanner sc=new Scanner(System.in);
    String s=sc.next();
    int count=0;
    l:for(int i=0;i<s.length()-1;i++)
    {
        if(s.charAt(i)==s.charAt(i+1))
        {count++;
        if(count==7)
        break l;
        }
        else
        count=1;
    }
    if(count==7)
        System.out.println("YES");
    else System.out.println("NO");
    }
}

import java.util.Scanner;
public class sunny{
    public static void main(String args[]){
        int i;
        int count=0;
        int count1 =0;
        int p=0;
        int q=0;
        String m;
        char []b=new char[100];
        Scanner a=new Scanner(System.in);
        m=a.nextLine();
        int l=m.length();
        for(i=0;i<l;i++){
            b[i]=m.charAt(i);
        }
        for(i=0;i<l;i++){
            if(b[i]=='1'){
                count++;
                if(b[i]!=b[i+1]){
                        p=0;
                    }
                if(b[i]==b[i+1]){
                    p++;
                    if(p==7){
                        break;
                    }
                }

            }else if(b[i]=='0'){
                count1++;
                if(b[i]!=b[i+1]){
                        q=0;
                    }
                 if(b[i]==b[i+1]){
                    q++;
                    if(q==7){
                        break;
                    }
                }
            }
        }
        if(count==l || count1==l){
            System.out.println("YES");
        }else if(p==7 || q==7){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}

import java.util.*;
public class Hodor {
public static void main(String[] args){
	Scanner sc = new Scanner (System.in);
	String verdict = "NO";
	String s = sc.next();
	int sum = 0;
	for(int i = 0; i != s.length()-1 ; i++){
		if (s.charAt(i)== s.charAt(i+1) ){
			sum++;
			if(sum >= 7)
			verdict = "YES";

	}else{
		sum = 0;
	}
}
	System.out.println(verdict);
}
}

import java.util.Scanner;
public class Football
{
	public static void main(String[] args)
	{
		Scanner scanIn = new Scanner(System.in);
		String currentCase = scanIn.nextLine();
		int currentZeros = 0, currentOnes = 0, x;
		boolean hit = false;
		for(int i=0; i<currentCase.length();i++)
        {
    	    x = currentCase.charAt(i)=='0'?currentZeros++:currentOnes++;

    	    if (currentCase.charAt(i)=='0' && currentOnes>6)
    	        hit = true;
            else
                currentOnes = 0;

    	    if (currentCase.charAt(i)=='1' && currentZeros>6)
    	        hit = true;
            else
                currentZeros = 0;

        }
        if (currentZeros>6 || currentOnes>6 || hit)
    	{
            System.out.println("YES");
            return;
        }
    	System.out.println("NO");
    }
}

import java.util.Scanner;
public class TestB {

    public static void main(String[] args) {
Scanner input=new Scanner(System.in);
String str=input.next();
int counter=1;
char[] c=new char[str.length()];
if(str.length()<=100 &&(str.contains("1") || str.contains("0"))){
    for (int i=0;i<str.length();i++) {
c[i]=str.charAt(i);
    }
    char c1=c[0];
    for (int i=1;i<c.length;i++) {
        if(c[i]==c1)
            counter++;
        else
        {c1=c[i];
        counter=1;
        }
    }
 if(counter>=7)
        System.out.println("YES");
 else if(counter<7)
        System.out.println("NO");
 else
     System.out.println("NO");
}
}
    }

import java.util.Scanner;

public class CF {
	static Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		String s =in.next();
		int i = 0;
		int zt=0;
		int ot=0;
		while(i<s.length()){

			if(s.charAt(i)=='1')
				ot++;
			else
				zt++;

			if (zt<7&&ot<7){
				zt=0;
				ot=0;
			}
			else
				break;

			i++;
		}
		if (zt>=7||ot>=7)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
}

import java.util.*;
public class JavaApplication121 {
public static void main(String[] args) {

    Scanner s1=new Scanner(System.in);
    long x=s1.nextLong();
    int count=1;
    String Xstring=String.valueOf(x);
    try{
    for (int i = 0; i <Xstring.length(); i++) {
        if(Xstring.charAt(i)==Xstring.charAt(i+1)){
        count +=1;
        if(count==7){System.out.println("YES");System.exit(0);}
        }
        else{count=0;}
    }}
    catch(IndexOutOfBoundsException e){System.out.println("NO");System.exit(0);}
    System.out.println("NO");
}}

import java.util.*;

public class Football {

    public static void main(String[] args) {

     Scanner userInput = new Scanner(System.in);

     String input;
     input=userInput.nextLine();

    int counter=0;

    for(int i=0 ; i<input.length()-1 ; i++) //8 times  01111111
    {

        //System.out.println(counter);

        if ( (counter+1) == 7 )
        {
            System.out.println("YES");
            break;
        }
        else if (input.charAt(i) == input.charAt(i+1))
            counter++;

        else if (input.charAt(i) != input.charAt(i+1))
            counter=0;
    }

    if ((counter+2) < 7 )
        {
            System.out.println("NO");
        }

    }

}

import java.util.Scanner;
public class Football {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String cad = sc.next();
		int cont = 1;
		int c = 0;
		for(int i=0; i<cad.length() - 1; i++) {
			if(cad.charAt(i) == cad.charAt(i + 1)) {
				cont++;
			}
			else {
				if(cont > c) {
					c = cont;
				}
			}
			cont = 0;
		}
		if(cont > c) {
			c = cont;
		}
		if(c >= 7) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}
	}
}

import java.util.Scanner;
public class TestB {

    public static void main(String[] args) {
Scanner input=new Scanner(System.in);
String str=input.next();
int cnt1=0;
int cnt2=0;
if(str.length()<=100 &&(str.contains("1") || str.contains("0"))){
    for (int i=0;i<str.length()-1;i++) {
        if(cnt1>=6 || cnt2>=6){
            System.out.println("YES");break;}
        if(str.charAt(i)=='1' && str.charAt(i+1)=='1')
            cnt1++;
        else  if(str.charAt(i)=='1' && str.charAt(i+1)=='0')
            cnt1--;
       else  if(str.charAt(i)=='0' && str.charAt(i+1)=='0')
            cnt2++;
           else  if(str.charAt(i)=='0' && str.charAt(i+1)=='1')
            cnt2--;}
         if(cnt1<6 && cnt2<6)
        System.out.println("NO");

}
}
    }

import java.util.Scanner;

public class CodeF {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
	Scanner input = new Scanner(System.in);

	String s = input.next();
	int count = 0;

	for (int i = 1; i < s.length(); i++) {
		if(s.charAt(i-1)==s.charAt(i))
			count++;
		if (count >= 7) {
			System.out.println("YES");
		break;
		}
		else continue;
		}

	if (count < 7)
		System.out.println("NO");

	}

}

import java.util.Scanner;

public class Football{
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);

		String a = s.next();
		int count = 0;
		int temp = 0;
		for(int i = 1; i < a.length() && a.length() > 1; i++) {
			if(a.charAt(i) == a.charAt(i-1))
				temp++;
			else {
				if(count < temp)
					count = temp;
				temp = 0;
			}
		}
		if(count >= 7)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
}

import java.util.*;

public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        int countZ = 0;
        int countO = 0;

        for (int i = 1; i < input.length() - 1; i ++) {
            if (input.charAt(i) == '0' && input.charAt(i - 1) == '0') {
                countZ++;
                countO = 0;
            } else if (input.charAt(i) == '1' && input.charAt(i - 1) == '1') {
                countO++;
                countZ = 0;
            }
        }

        if (countZ == 7) {
            System.out.println("YES");
        } else if (countO == 7) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        String entry=new String(input.next());
        int cnt0=0, cnt1=0;
        for(int i=0;i<entry.length();i++){
            if (entry.charAt(0)=='1')
                cnt1++;
            else
                cnt0++;
            entry=entry.substring(1);
        }

        if(cnt0>=7 || cnt1>=7)
            System.out.println("YES");
        else
            System.out.println("NO");
        input.close();
    }

}

import java.util.Scanner;

public class Main {
	public static void main(String[] ar)
    {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        char[] arr = str.toCharArray();

        int start = 0, end = 0;
        boolean flag = false;

        while(end < arr.length)
        {
        	if(arr[end] != arr[start])
        	{
        		if( (end - start) >= 7)
        		{
        			System.out.println("YES");
        			flag = true;
        			break;
        		}
        		else if(end+1 < arr.length) {
        				start = end;
        		}

        	}
        	else if(end == arr.length-1 && (end - start) >= 7)
        	{
        		System.out.println("YES");
    			flag = true;
        	}
        	end++;
        }
        if(!flag)
        	System.out.println("NO");

    }
}

import java.util.Scanner;
public class Main
{
	public static void main(String[] args)
	{
	     Scanner sc = new Scanner(System.in);
	     String s = sc.nextLine();
	     int count = 0;
	     int flag=0;
	     for(int i=0;i<s.length();i++)
	     {
	         if(s.charAt(i) == '1')
	         {
	             count++;
	         }
	         else
	         {
	             flag++;
	         }
	     }

	     if(count>=7 || flag>=7)
	     {
	         System.out.println("YES");
	     }
	     else
	     {
	         System.out.println("NO");
	     }
	}
}

import java.util.Scanner;

public class Football {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub

        Scanner in = new Scanner(System.in);

        String[] s = in.nextLine().split("");

        if(s.length > 101){
            System.out.println("NO");
            System.exit(0);
        }

        if((s.length-1) <8){
            System.out.println("NO");
            System.exit(0);
        }

        if(s.length==8){
            for(int k=1;k<2;k++){
                if(s[k] == s[1])
                    System.out.println("NO");
            }
        }

        int flag = 1;
        outer:
        for(int g=1;g<s.length;g++){

            if(s.length-g < 7){
                System.out.println("NO");
                break;
            }

            inner:
            for(int f=g;f<(g+7);f++){
                 if(s[g].equals(s[f])){

                      flag++;
                      if(flag == 7){

                          System.out.print("YES");
                          break outer;
                      }
                  }else if(!s[f].equals(s[g])){
                      break inner;
                  }
            }
            flag=1;
        }
    }

}

import java.util.*;

public class football {

	public static void main(String[] args) {
		int c=0;
		// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
String s=sc.nextLine();
int l=s.length();
for(int i=0;i<l-1;i++)
{
	if(s.charAt(i)==s.charAt(i+1))
	{
				c++;
	}

}
if (c<7)
	System.out.println("No");
else
	System.out.println("YES");
 sc.close();

}
}

import java.util.Scanner;
 public class Main {

    public static void main(String[] args)
    {
        Scanner sc = new Scanner (System.in);
        String x = sc.next();
        char y='1';
        char z='0';
        int c1 =0;
        int c2=0;
        for(int i=0;i<x.length();i++)
        {
            if(x.charAt(i)==y)
                c1++;
            else
                c1=0;

             if(x.charAt(i)==z)
                c2++;
             else
                 c2=0;

        }
        if(c1>=7||c2>=7)
            System.out.println("YES");
        else
            System.out.println("NO");

    }
}

import java.util.*;
public class Soln
{
    public static void main(String args[])
    {
        Scanner s=new Scanner (System.in);
        String ss=s.next();
        String h="0000000";
        String j="1111111";
        if(ss.indexOf(h)==-1||ss.indexOf(j)==-1)
        {
            System.out.println("NO");
        }else
                    System.out.println("YES");
    }
}

import java.util.Scanner;

public class Problem_96_A {

    public static int RecM(String S) {
        if (S.length() == 1) {
            return 0;
        } else {
            int M = 0;
            if (S.charAt(0) == S.charAt(1)) {
                return 1 + RecM(S.substring(1));
            } else {
                M = 0;
                return RecM(S.substring(1));
            }
        }
    }

    public static void main(String[] args) {
        Scanner Input = new Scanner(System.in);
        String S = Input.next();
        S = "XXX" + S + "XXX";
        int NNN = RecM(S);
        if (NNN >= 7) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

}

import java.util.Scanner;

public class hasasas {

	public static void main(String[] arg){

        Scanner input=new Scanner(System.in);

        String g1=input.next();
char arr[]=new char [100];
 arr= g1.toCharArray();int count=0;
  for(int i=0;i<arr.length;i++)
	 {
	for(int j=i+1;j<arr.length;j++)
	{if(count>=7){
		break;

	}

		if(arr[i]==arr[j])
		count++;
		else
			count=0;

	}

	 }

 if(count>=7)
  System.out.println("YES");
  else
	  System.out.println("NO");
	}
}

import java.util.Scanner;

/**
 *
 * @author Simran
 */
public class Football {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        String str;
        Scanner s = new Scanner(System.in);
        str = s.nextLine();
        int n;
        n = str.length();

        int t1 =0;
         int t2 =0;

          for (int i =0; i<n; i++){
        if(str.charAt(i) == '0'){
            t1 += 1;

        }//if closed

        else{
        t2 += 1;
        }//else closed
          }//for closed

          if (t1 >= 7 || t2 >= 7){
          System.out.println("YES");
          }//if closed
          else{
           System.out.println("NO");
          }//else closed
    }

}//main closed

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

public class football {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String l = br.readLine();
		System.out.println(danger(l));
	}

	public static String danger(String s) {

		for (int i = 0; i < s.length() - 1;) {

			String c = s.substring(i);

			if (c.charAt(0) == '0') {
				if (c.indexOf('1') > 6)
					return "YES";
				else if (c.indexOf('1') == -1)
					break;
				else
					i += c.indexOf('1');
			} else {
				if (c.indexOf('0') > 6)
					return "YES";
				else if (c.indexOf('0') == -1)
					break;
				else
					i += c.indexOf('0');
			}
		}

		return "NO";
	}

}

import java.util.Scanner;

/**
 * @author Farouk Elabady
 *
 */
public class Football {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String teamMembers = sc.nextLine();
        boolean dangerousFlag = false;
        int count = 0;
        for(int i=0; i < teamMembers.length()-1;i++) {
            if(teamMembers.charAt(i) == teamMembers.charAt(i+1)){
                count++;
                if(count >= 7)
                    dangerousFlag = true;
            }
            else {
                count =0 ;
            }
        }

        if(dangerousFlag) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

}

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        int k, n;
        int array[];
        int out=0;
        int contA = 0, contB = 0;
        String cadena1;
        //String cadena2;
        Scanner teclado = new Scanner(System.in);
        cadena1 = teclado.nextLine();

        array = new int[cadena1.length()];
        for (int i = 0 ; i<cadena1.length();i++) {
            array[i] = Integer.parseInt(String.valueOf(cadena1.charAt(i)));
            if (array[i] == 0){
                contA++;
                contB=0;
            } else {
                contB++;
                contA=0;
            }
            if (contA == 7){
                System.out.println("YES");
                break;
            }
        }
        //n = Integer.parseInt(teclado.next());
        //k = Integer.parseInt(teclado.next());
        //System.out.println("cadena1 = " + cadena1);
        //System.out.println("array = " + array[0]);
        //System.out.println("n = " + n);
        //System.out.println("k = " + k);
       /* array = new int[n];
        for(int i = 0; i<n; i++){
            array[i] = Integer.parseInt(teclado.next());
            if(array[i]>=array[k-1] && array[i]>=1 && array[i]>0){
                out++;
            }
            //System.out.println("array = " + array[i]);
        }
        /*for(int ñ = 0; ñ<k;ñ++){
            ++out;
        }*/
        //System.out.println(out);
        System.exit(0);
    }
}

import java.util.Scanner;

/**
 *
 * @author Simran
 */
public class Football1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here

         String str;
        Scanner s = new Scanner(System.in);
        str = s.nextLine();
        int n;
        n = str.length();
      int count =0;
      int x=0;
       for(int i =0; i<n; i++){

       count =0;
        for(int j =i+1; j<n;j++){
        if(str.charAt(i)==str.charAt(j)){
        count += 1;
            if(count==7){
                x=1;
         System.out.println("YES");
         break;
            }//if closed
            }//if closed
           else{
           break;
             }//else closed

        }
         if(x==1)
         {break;}}//for closed
      if(x==0){
        System.out.println("NO");
      }//if closed

    }

}//main closed

import java.io.*;
public class football {

    public static void main(String[] args)throws IOException {
        // TODO Auto-generated method stub
BufferedReader a=new BufferedReader(new InputStreamReader(System.in));
String s=a.readLine();
int c=0;boolean f=true;
if(s.length()>=7){
for(int i=0;i<=s.length()-6;i++){
    for(int i1=i+1;i1<=i+7;i1++){
        if(s.charAt(i)==s.charAt(i1))
            c++;
        else break;}
        if(c>=7){
            f=false;
        break;}

}
if(f)System.out.println("NO");
else System.out.println("YES");}

else System.out.println("NO");
    }

}

/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
        Scanner s = new Scanner(System.in);
        String str = s.nextLine();
        int flg=0;
        int count1 = 0, count2 =0;

        for(int i=0; i<str.length(); i++) {
           if (str.charAt(i) == '0') {
                    count1++;
                    count2 = 0;

                }
               else if(str.charAt(i) == '1') {
                    count1++;
                    count2 = 0;

                }

            if((count1 >= 7) ||(count2 >= 7))
               {
                   flg =1;

               }

        }
        if(flg ==1)
             System.out.println("YES");
        else
         System.out.println("NO");

        }

	}

import java.util.Scanner;

public class Football {

	public static void main(String[] args) {
		Scanner ler = new Scanner(System.in);
        int tamanho, i, j, jogadoresA = 0, jogadoresD = 0, flag = 0;
        String palavra = "";
        char a, b;

        palavra = ler.next();
        tamanho = palavra.length();

        if(tamanho<=7) {
        	System.out.println("NO");
        }else {
        	for(i = 0; i < tamanho; i++) {
        		for(j = i; j < tamanho; j++) {

        			//a = palavra.charAt(i);
        			//b = palavra.charAt(j);

            		if(palavra.charAt(i)!=palavra.charAt(j)) {
            			jogadoresD++;
            			jogadoresA = 0;
            		}else {
            			jogadoresA++;
            			break;
            		}

            	}

        		if(jogadoresA >= 7 || jogadoresD >= 7) {
        			System.out.println("YES");
        			flag = 1;
        			break;
        		}

        		jogadoresD = 0;

        	}

        	if(flag == 0) System.out.println("NO");

        }

	}

}

import java.util.*;
public class sol{
    public static void main(String[] args){
        int count = 0;
        boolean ans = false;
        Scanner console = new Scanner(System.in);
        String input = console.nextLine();
        for ( int i = 1; i < input.length(); i++ )
        {
            if ( input.charAt(i) == input.charAt(i-1) )
            {
                count ++;
            }
            if ( count == 7 )
            {
                ans = true;
                break;
            }
            else if ( input.charAt(i) != input.charAt(i-1) )
            {
                count = 0;
            }
        }
        if ( ans )
        {
            System.out.println("YES");
        }
        else
        {
            System.out.println("NO");
        }
    }
}

import java.util.Scanner;

public class Watermelon {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();

        char[] chars = s.toCharArray();
        int index = 0;
        int counter = 0;
        char planeNum;
        boolean isZeroOrOne = true;

        for (int i = 0; i < chars.length && isZeroOrOne; i++) {
            if (chars[i] != '0' && chars[i] != '1') {
                isZeroOrOne = false;
            }
        }

        if (isZeroOrOne && chars.length <= 100) {

            do {
                for (int i = index; i < chars.length - 1; i++) {
                    planeNum = chars[i];
                    int next = chars[i + 1];
                    index++;
                    if (planeNum == next) {
                        counter++;
                    } else {
                        counter = 0;
                        break;
                    }
                }
            } while (index < chars.length - 1 && counter < 7);

            if (counter > 7) {

                System.out.println("YES");
            } else {
                System.out.println("NO");
            }

        } else
            System.out.println("NO");
    }

}

import java.util.*;
public class Hodor {
public static void main(String[] args){
	Scanner sc = new Scanner (System.in);
	String verdict = "NO";
	String s = sc.next();
	int sum = 0;
	for(int i = 0; i != s.length()-1 ; i++){
		if (s.charAt(i)== s.charAt(i+1) ){
			sum++;
			}else{
			sum = 0;
			}
			if(sum == 7){
			verdict = "YES";

	}
}
	System.out.println(verdict);
}
}

import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String cad = sc.nextLine();
        boolean sw = false;
        int cont = 0;
        for (int i = 0; i < cad.length(); i++) {

            for (int j = i + 1; j < cad.length(); j++) {
                if (cad.charAt(i) == cad.charAt(j)) {
                    cont++;
                    if (cont == 7) {
                        sw = true;
                    }
                } else {
                    cont = 0;
                }

            }

        }
        if (sw) {
            System.out.println("NO");
        } else {
            System.out.println("YES");

        }

    }
}

import java.util.*;
public class Fytbol {

    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String k = sc.nextLine();
    k += "       ";
    boolean danger = false;
    for(int i = 0; i < k.length() ; i++){
    	String l = k.charAt(i) + "";
    	for(int j = i ; j < i+7 ; j++){
    		if(l.equals(k.charAt(j))){
    			danger = true;
    		}else{
    			danger = false;
    			break;
    		}
    	}
    }
   	if(danger){
   		System.out.println("YES");
   	}else{
   		System.out.println("NO");
   	}
    }
}

import java.util.Scanner;

public class main {

    public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str=sc.nextLine();

System.out.println(str.matches("w*(1111111|0000000)w*")?"YES":"NO");

    }
}

import java.util.Scanner;

public class hasasas {

	public static void main(String[] arg){

        Scanner input=new Scanner(System.in);

        String g1=input.next();
char arr[]=new char [100];
 arr= g1.toCharArray();int count=0;
  for(int i=0;i<arr.length;i++)
	 {
	for(int j=1;j<arr.length;j++)
	{if(count>=7){
		break;

	}

		if(arr[i]==arr[j])
		count++;
		else
			count=0;

	}

	 }

 if(count>=7)
  System.out.println("yes");
  else
	  System.out.println("no");
	}
}