Problem:
Score : 300 points

Problem Statement

Snuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.

Snuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:

Operation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.

For example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure.
If the die is rotated toward the right as shown in the figure, the side showing 3 will face upward.
Besides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.

Find the minimum number of operation Snuke needs to perform in order to score at least x points in total.

Constraints

1 ≦ x ≦ 10^{15}

x is an integer.

Input

The input is given from Standard Input in the following format:

x

Output

Print the answer.

Sample Input 1

7

Sample Output 1

2

Sample Input 2

149696127901

Sample Output 2

27217477801

Solution in Java8 (OpenJDK 1.8.0) (judge verdict: Time Limit Exceeded)

import java.util.Scanner;
public class Main {
	public static String plas(String a,String b){
		String q="";
		String w=" ";
		int alen=a.length();
		int blen=b.length();
		int plas=0;
		int ku=0;
		String a1="1";
		String b1="1";
		int a2=0,b2=0;
		int z=0,y=0,ir=1,ir2=0;
		if(alen>blen)
			ir=0;
		if(alen==blen)
			ir2=1;
		if(ir==0||ir2==1){
			y=alen-1;
			z=blen-1;
			while(z>=0){
				a1=a.substring(y,y+1);
				b1=b.substring(z,z+1);
				a2=Integer.valueOf(a1);
				b2=Integer.valueOf(b1);
				plas=a2+b2+ku;
				ku=plas/10;
				w=String.valueOf(plas%10);
				q=w+q;
				y--;
				z--;
			}
			while(y>=0){
				a1=a.substring(y,y+1);
				a2=Integer.valueOf(a1);
				plas=a2+ku;
				ku=plas/10;
				w=String.valueOf(plas%10);
				q=w+q;
				y--;
			}
		}
		else{
			z=alen-1;
			y=blen-1;
			while(z>=0){
				a1=a.substring(z,z+1);
				b1=b.substring(y,y+1);
				a2=Integer.valueOf(a1);
				b2=Integer.valueOf(b1);
				plas=a2+b2+ku;
				ku=plas/10;
				w=String.valueOf(plas%10);
				q=w+q;
				y--;
				z--;
			}
			while(y>=0){
				b1=b.substring(y,y+1);
				b2=Integer.valueOf(b1);
				plas=b2+ku;
				ku=plas/10;
				w=String.valueOf(plas%10);
				q=w+q;
				y--;
			}
		}
		if(ku!=0)
			q=ku+q;
		return q;
	}
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		String x=stdIn.next();
		String a="",b="0",b1="0",c="0",c1="0",d="1",e="",f="";
		int z=x.length(),y=0,m=0,n=0,v=0,w=0;
		while(true){
			if(y>z)
				break;
			else
				if(y==z){
					m=0;
					while(m<y){
						e=b1.substring(m,m+1);
						f=x.substring(m,m+1);
						v=Integer.valueOf(e);
						w=Integer.valueOf(f);
						if(v>w){
							n=1;
							break;
						}
						if(v<w)
							break;
						m++;
					}
				}
			if(m==y&&y!=0)
				break;
			if(n==1)
				break;
			a="6";
			b=b1;
			b1=plas(a,b);
			c=c1;
			c1=plas(c,d);
			y=b1.length();
			if(y>z)
				break;
			else
				if(y==z){
					m=0;
					while(m<y){
						e=b1.substring(m,m+1);
						f=x.substring(m,m+1);
						v=Integer.valueOf(e);
						w=Integer.valueOf(f);
						if(v>w){
							n=1;
							break;
						}
						if(v<w)
							break;
						m++;
					}
				}
			if(m==y)
				break;
			if(n==1)
				break;
			a="5";
			b=b1;
			b1=plas(a,b);
			c=c1;
			c1=plas(c,d);
			y=b1.length();
		}
		System.out.println(c1);
	}
}