import java.util.*;

public class Solution
{
    public static void main(String[] args) throws Exception
    {
        Scanner sc=new Scanner(System.in);
        int q,w,e,r,t;
        q=sc.nextInt();
        w=sc.nextInt();
        e=sc.nextInt();
        r=sc.nextInt();
        t=sc.nextInt();
        int res;
        res = min(q,w, e, r, t);
        System.out.println(res);
    }
    public static int min(int a,int b,int c,int d,int e){

        int m=0;
        for(int i=0;i<1000;i++){
            a-=1;
            b-=1;
            c-=2;
            d-=7;
            e-=4;
            if(a<0 | b<0 | c<0 | d<0 | e<0) break;
            m++;

        }
        return m;
    }

}

import java.util.*;

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

  Scanner scanner = new Scanner(System.in);
         int[] data = new int[5];
         int[] needed = {1,1,2,7,4};
         for(int i=0;i<5;i++){
          data[i]=scanner.nextInt();;
        }
         int count =0;
          wh: while(true){
          for(int i=0;i<5;i++){
          if(data[i]/needed[i]>=1){
           count++;
           data[i]=data[i]-needed[i];
           }
          else{
            break wh;}
          }
          }
          System.out.println(count/5);

}

 }

import java.util.Scanner;
public class Main{
public static void main(String[] args){
  Scanner sc=new Scanner(System.in);
  int[] arr={1,1,2,7,4};
  int[] a=new int[5];
  int min=Integer.MAX_VALUE;
  for(int i=0;i<5;i++){
     a[i]=sc.nextInt();
    if(a[i]/arr[i]<min){
      min=a[i]/arr[i];
    }
  }
  System.out.println(min);
}
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int need[] = {1, 1, 2, 7, 4};
        Scanner in = new Scanner(System.in);
        int has[] = new int[5];
        int min =Integer.MAX_VALUE;
        for(int i=0;i<5;i++)
        {
            has[i]=in.nextInt();
            if(has[i]/need[i]<min)
                min=has[i]/need[i];
        }
        System.out.println(min);

    }

}

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

import static java.lang.Math.*;

public class Main {
    FastIO io;

    // File names!!!

    void solve() throws IOException {
        int[] a = new int[] {1, 1, 2, 7, 4};
        int min = 1000000000;
        for (int i = 0; i < 5; i++) {
            int x = io.nextInt();
            min = min(min, x / a[i]);
        }
        io.println(min);
    }

    void run() {
        try {
            io = new FastIO();
            solve();
            io.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(abs(-1));
        }
    }

    public static void main(String[] args) {
        try {
            Locale.setDefault(Locale.US);
        } catch (Exception ignore) {
        }
        new Main().run();
    }

    class FastIO extends PrintWriter {
        private BufferedReader in;
        private StringTokenizer stok;

        FastIO() {
            super(System.out);
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        FastIO(String s) throws FileNotFoundException {
            super("".equals(s) ? "output.txt" : s + ".out");
            in = new BufferedReader(new FileReader("".equals(s) ? "input.txt" : s + ".in"));
        }

        public void close() {
            super.close();
            try {
                in.close();
            } catch (IOException ignored) {
            }
        }

        String next() {
            while (stok == null || !stok.hasMoreTokens()) {
                try {
                    stok = new StringTokenizer(in.readLine());
                } catch (Exception e) {
                    return null;
                }
            }
            return stok.nextToken();
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            try {
                return in.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        char[] nextCharArray() {
            return next().toCharArray();
        }

    }
}

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

public class Main {

    public static void main(String[] args) {
        try (InputStreamReader instream = new InputStreamReader(System.in);
             BufferedReader buffer = new BufferedReader(instream)) {
            String str = buffer.readLine();
            String[] split = str.split(" ");
            int[] arr = new int[split.length];
            int min = Integer.MAX_VALUE;
            for(int i=0; i<split.length; i++) {
                arr[i] = Integer.parseInt(split[i]);
                switch (i) {
                    case 0:
                        if (arr[i]<min)
                            min = arr[i];
                        break;
                    case 1:
                        if (arr[i]<min)
                            min = arr[i];
                        break;
                    case 2:
                        if (arr[i]/2<min)
                            min = arr[i]/2;
                        break;
                    case 3:
                        if (arr[i]/7<min)
                            min = arr[i]/7;
                        break;
                    case 4:
                        if (arr[i]/4<min)
                            min = arr[i]/4;
                        break;
                }
            }
            System.out.println(min);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Abra
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
  public void solve(int testNumber, InputReader in, OutputWriter out) {
    int a = in.nextInt();
    int b = in.nextInt();
    int c = in.nextInt();
    int d = in.nextInt();
    int e = in.nextInt();

    out.println(Maths.min(a, b, c / 2, d / 7, e / 4));
  }
}

class InputReader {
  BufferedReader  br;
  StringTokenizer in;

  public InputReader(String fileName) {
    try {
      br = new BufferedReader(new FileReader(fileName));
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }

  public InputReader(InputStream inputStream) {
    br = new BufferedReader(new InputStreamReader(inputStream));
  }

  boolean hasMoreTokens() {
    while (in == null || !in.hasMoreTokens()) {
      String s = nextLine();
      if (s == null) {
        return false;
      }
      in = new StringTokenizer(s);
    }
    return true;
  }

  public String nextString() {
    return hasMoreTokens() ? in.nextToken() : null;
  }

  public String nextLine() {
    try {
      in = null; // riad legacy
      return br.readLine();
    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }
  }

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

}

class OutputWriter extends PrintWriter {

  public OutputWriter(String fileName) throws FileNotFoundException {
    super(fileName);
  }

  public OutputWriter(OutputStream outputStream) {
    super(outputStream);
  }

  public OutputWriter(Writer writer) {
    super(writer);
  }

}

class Maths {

  public static long min(long... longs) {
    if (longs.length == 0) {
      throw new IllegalArgumentException("Arg must be non-empty");
    }

    long result = Long.MAX_VALUE;

    for (long aLong : longs) {
      result = Math.min(result, aLong);
    }

    return result;
  }

}

/*
Solution:

Runtime:
*/

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

public class magnumopus {
    int[] arr;
    int[] amounts = {1, 1, 2, 7, 4};

    magnumopus(BufferedReader in, PrintWriter out) throws IOException {
        StringTokenizer st = new StringTokenizer(in.readLine());
        arr = new int[5];
        for (int i = 0; i < 5; i++) arr[i] = Integer.parseInt(st.nextToken());
        int answer = 9999;
        for (int i = 0; i < 5; i++) answer = Math.min(arr[i] / amounts[i], answer);
        out.println(answer);
    }

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        new magnumopus(in, out);
        in.close();
        out.close();
    }
}

import java.util.*;
public class MagnumOpus
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int a1 = sc.nextInt();
int a2 = sc.nextInt();
int a3 = sc.nextInt();
int a4 = sc.nextInt();
int a5 = sc.nextInt();
int ans = Math.min(a1,a2);
ans = Math.min(ans,a3/2);
ans = Math.min(ans,a4/7);
ans = Math.min(ans,a5/4);
System.out.println(ans);
}
}

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Alex
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
    public void solve(int testNumber, InputReader in, OutputWriter out){
	    int[] a = IOUtils.readIntArray(in, 5);
	    out.printLine(Math.min(Math.min(Math.min(a[0], a[1]), Math.min(a[2] / 2, a[3] / 7)), a[4] / 4));
    }
}

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

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

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}
	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

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

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}
	public void close() {
		writer.close();
	}
	public void printLine(int i) {
		writer.println(i);
	}

}

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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Locale;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long prevTime = System.currentTimeMillis();
					new Main().run();
					System.err.println("Total time: "
							+ (System.currentTimeMillis() - prevTime) + " ms");
					System.err.println("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Object o = solve();
		if (o != null)
			out.println(o);
		out.close();
		in.close();
	}

	private Object solve() throws IOException {
		int[] arr= {1,1,2,7,4};
		int[] input = nia(5);
		int ret =Integer.MAX_VALUE;
		for(int i =0;i<arr.length;i++)
			ret= Math.min(input[i]/arr[i], ret);
		return ret;
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer strTok = new StringTokenizer("");

	String nextToken() throws IOException {
		while (!strTok.hasMoreTokens())
			strTok = new StringTokenizer(in.readLine());
		return strTok.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int[] nia(int size) throws IOException {
		int[] ret = new int[size];
		for (int i = 0; i < size; i++)
			ret[i] = ni();
		return ret;
	}

	long[] nla(int size) throws IOException {
		long[] ret = new long[size];
		for (int i = 0; i < size; i++)
			ret[i] = nl();
		return ret;
	}

	double[] nda(int size) throws IOException {
		double[] ret = new double[size];
		for (int i = 0; i < size; i++)
			ret[i] = nd();
		return ret;
	}

	String nextLine() throws IOException {
		strTok = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!strTok.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			strTok = new StringTokenizer(s);
		}
		return false;
	}

	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}

	void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array, String spec) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}

	void printArray(Object[] array) {
		boolean blank = false;
		for (Object x : array) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		boolean blank = false;
		for (Object x : collection) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	static String memoryStatus() {
		return (Runtime.getRuntime().totalMemory()
				- Runtime.getRuntime().freeMemory() >> 20)
				+ "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB";
	}

	public void pln() {
		out.println();
	}

	public void pln(int arg) {
		out.println(arg);
	}

	public void pln(long arg) {
		out.println(arg);
	}

	public void pln(double arg) {
		out.println(arg);
	}

	public void pln(String arg) {
		out.println(arg);
	}

	public void pln(boolean arg) {
		out.println(arg);
	}

	public void pln(char arg) {
		out.println(arg);
	}

	public void pln(float arg) {
		out.println(arg);
	}

	public void pln(Object arg) {
		out.println(arg);
	}

	public void p(int arg) {
		out.print(arg);
	}

	public void p(long arg) {
		out.print(arg);
	}

	public void p(double arg) {
		out.print(arg);
	}

	public void p(String arg) {
		out.print(arg);
	}

	public void p(boolean arg) {
		out.print(arg);
	}

	public void p(char arg) {
		out.print(arg);
	}

	public void p(float arg) {
		out.print(arg);
	}

	public void p(Object arg) {
		out.print(arg);
	}

}

import java.util.Scanner;

public class C {

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

		int a, b, c, d, e;
		a = in.nextInt();
		b = in.nextInt();
		c = in.nextInt();
		d = in.nextInt();
		e = in.nextInt();

		int r = Math.min(a, b);
		r = Math.min(r, c/2);
		r = Math.min(r,  d/7);
		r = Math.min(r,  e/4);
		System.out.println(r);
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class C {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer stok;

    String nextToken() throws IOException {
        while (stok == null || !stok.hasMoreTokens()) {
            String s = br.readLine();
            if (s == null) {
                return null;
            }
            stok = new StringTokenizer(s);
        }
        return stok.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    char nextChar() throws IOException {
        return (char) (br.read());
    }

    String nextLine() throws IOException {
        return br.readLine();
    }

    private void solve() throws IOException {
        int a = nextInt();
        int b = nextInt();
        int c = nextInt();
        int d = nextInt();
        int e = nextInt();
        out.println(Math.min(Math.min(Math.min(Math.min(a, b), c / 2), d / 7), e/4));
    }

    void run() throws IOException {
        // br = new BufferedReader(new FileReader("input.txt"));
        // out = new PrintWriter("output.txt");
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        br.close();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        // Locale.setDefault(Locale.US);
        new C().run();
    }
}

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

    public static void main(String... args) {
       Scanner in = new Scanner(System.in);
       ArrayList<Integer> n = new ArrayList();
       n.add(in.nextInt());
       n.add(in.nextInt());
       n.add(in.nextInt()/2);
       n.add(in.nextInt()/7);
       n.add(in.nextInt()/4);
       System.out.println(Collections.min(n));
    }
}

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

import static java.lang.Math.*;

/**
 * @author master_j
 */
public class Solution {
    private IO io;
    private static final String _localArg = "master_j";
    private final String _problemName = "";
    private final int _inMode = IO.STD_;
    private final int _outMode = IO.STD_;
    private final boolean _autoFlush = false;

    private void solve() throws IOException {
        final int N = 5;
        int b[] = new int[]{1, 1, 2, 7, 4};
        int min = Integer.MAX_VALUE;
        for(int i = 0; i<N; i++)
            min = min(min, io.nI() / b[i]);
        io.wln(min);
    }//2.2250738585072012e-308

    private void init(boolean local) throws IOException {
        if(local)
            io = new IO(IO._PUT_TXT, IO.STD_);
        else{
            if((_inMode == IO.PROBNAME_ || _outMode == IO.PROBNAME_) && _problemName.length() == 0)
                throw new IllegalStateException("You imbecile. Where's my <_problemName>?");
            io = new IO(_inMode, _outMode);
        }

        long nanoTime = 0;
        if(local){
            nanoTime -= System.nanoTime();
            if(_autoFlush)
                io.wln("NOTE: auto-flush is on.");
            io.wln("<output>");
            io.flush();
        }

        solve();
        io.flush();

        if(local){
            io.wln("</output>");
            nanoTime += System.nanoTime();
            long d9 = 1000000000, d6 = 1000000, d3 = 1000;
            if(nanoTime >= d9)
                io.wf("%d.%d seconds\n", nanoTime/d9, nanoTime%d9);
            else if(nanoTime >= d6)
                io.wf("%d.%d millis\n", nanoTime/d6, nanoTime%d6);
            else if(nanoTime >= d3)
                io.wf("%d.%d micros\n", nanoTime/d3, nanoTime%d3);
            else
                io.wf("%d nanos\n", nanoTime);
            io.flush();
        }

        io.close();
    }

    /**
     * Input-output class
     *
     * @author master_j
     * @version 0.3.2
     */
    private class IO {
//     _____________________________ _________________
//    |  mode  |      from/to       |  variable name  |
//    |--------|--------------------|-----------------|
//    |    0   |      System.*      |       STD_      |
//    |    1   |      *put.txt      |     _PUT_TXT    |
//    |    2   |  <_problemName>.*  |     PROBNAME_   |
//    |________|____________________|_________________|
//

        static final int STD_ = 0;
        static final int _PUT_TXT = 1;
        static final int PROBNAME_ = 2;

        StreamTokenizer st;
        BufferedReader br;
        Reader reader;

        PrintWriter pw;
        Writer writer;

        IO(int inMode, int outMode) throws IOException {
            Locale.setDefault(Locale.US);

            if(inMode == IO.STD_)
                reader = new InputStreamReader(System.in);
            else if(inMode == IO._PUT_TXT)
                reader = new FileReader("input.txt");
            else if(inMode == IO.PROBNAME_)
                reader = new FileReader(_problemName + ".in");
            else
                throw new IllegalStateException("You imbecile. How did you do that?");

            if(outMode == IO.STD_)
                writer = new OutputStreamWriter(System.out);
            else if(outMode == IO._PUT_TXT)
                writer = new FileWriter("output.txt");
            else if(outMode == IO.PROBNAME_)
                writer = new FileWriter(_problemName + ".out");
            else
                throw new IllegalStateException("You imbecille. Why did you do that?");

            br = new BufferedReader(reader);
            st = new StreamTokenizer(br);

            pw = new PrintWriter(writer, _autoFlush);
        }

        void wln()          {pw.println(); }
        void wln(boolean x) {pw.println(x);}
        void wln(char x)    {pw.println(x);}
        void wln(char x[])  {pw.println(x);}
        void wln(double x)  {pw.println(x);}
        void wln(float x)   {pw.println(x);}
        void wln(int x)     {pw.println(x);}
        void wln(long x)    {pw.println(x);}
        void wln(Object x)  {pw.println(x);}
        void wln(String x)  {pw.println(x);}

        void wf(String f, Object...o){pw.printf(f, o);}

        void w(boolean x)   {pw.print(x);}
        void w(char x)      {pw.print(x);}
        void w(char x[])    {pw.print(x);}
        void w(double x)    {pw.print(x);}
        void w(float x)     {pw.print(x);}
        void w(int x)       {pw.print(x);}
        void w(long x)      {pw.print(x);}
        void w(Object x)    {pw.print(x);}
        void w(String x)    {pw.print(x);}

        int nI() throws IOException    {st.nextToken(); return (int)st.nval;}
        double nD() throws IOException {st.nextToken(); return st.nval;}
        float nF() throws IOException  {st.nextToken(); return (float)st.nval;}
        long nL() throws IOException   {st.nextToken(); return (long)st.nval;}
        String nS() throws IOException {st.nextToken(); return st.sval;}

        void wc(String x){ wc(x.toCharArray()); }
        void wc(char c1, char c2){for(char c = c1; c<=c2; c++)wc(c);}
        void wc(char x[]){
            for(char c : x)
                wc(c);
        }
        void wc(char x){st.ordinaryChar(x); st.wordChars(x, x);}

        public boolean eof() {return st.ttype == StreamTokenizer.TT_EOF;}
        public boolean eol() {return st.ttype == StreamTokenizer.TT_EOL;}

        void flush(){pw.flush();}
        void close() throws IOException{reader.close(); br.close(); flush(); pw.close();}
    }

    public static void main(final String args[]) throws IOException {
        new Solution().init(args.length == 1 && args[0].equals(_localArg));
    }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
    public void solve(int testNumber, FastScanner in, PrintWriter out) {
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int d = in.nextInt();
        int e = in.nextInt();
        int ans = Math.min(a,b);
        ans = Math.min(ans,c / 2);
        ans = Math.min(ans,d / 7);
        ans = Math.min(ans,e / 4);
        out.print(ans);
    }
}

class FastScanner {
    public BufferedReader br;
    public StringTokenizer st;

    public FastScanner(InputStream stream) {
        br = new BufferedReader(new InputStreamReader(stream));
        st = null;
    }

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

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

}

import java.util.Scanner;

public class Main {

    public static void main(String... args) {
       Scanner in = new Scanner(System.in);
       int a  = in.nextInt();
       int b = in.nextInt();
       int c = in.nextInt()/2;
       int d = in.nextInt()/7;
       int e = in.nextInt()/4;

       if(a < b && a < c && a < d && a < e) System.out.println(a);
       else if (b < a && b < c && b < d && b < e) System.out.println(b);
       else if (c < b && c < a && c < d && c < e) System.out.println(c);
       else if (d < a && d < b && d < c && d < e) System.out.println(d);
       else System.out.println(e);
    }
}

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

public class Task1 {

	public static void main(String[] args) throws IOException {
		new Task1().solve();
	}

	public void solve() throws IOException {
		PrintWriter out = new PrintWriter(System.out);
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer tok = new StringTokenizer(in.readLine());
		long[] num = new long[5];
		num[0] = Long.valueOf(tok.nextToken());
		num[1] = Long.valueOf(tok.nextToken());
		num[2] = Long.valueOf(tok.nextToken())/2;
		num[3] = Long.valueOf(tok.nextToken())/7;
		num[4] = Long.valueOf(tok.nextToken())/4;
		long min = Long.MAX_VALUE;
		for (int i = 0; i < num.length; i++) {
			if(num[i] < min) min = num[i];
		}

		System.out.println(min);

	}

}

import java.io.*;
import java.util.*;
import java.*;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Random;
import java.lang.*;

import javax.naming.BinaryRefAddr;

public class zad {
private static BufferedReader in;
private static StringTokenizer tok;
private static PrintWriter out;
final static boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") !=null;

public static void init() throws FileNotFoundException{
if(ONLINE_JUDGE){
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
}
else{
in = new BufferedReader(new FileReader("input.txt"));
out = new PrintWriter("out.txt");
}
}

private static String readString() throws IOException {
while (tok == null || !tok.hasMoreTokens()) {
tok = new StringTokenizer(in.readLine());
}
return tok.nextToken();
}

private static int readInt() throws IOException {
return Integer.parseInt(readString());
}
private static double readDouble() throws IOException {
return Double.parseDouble(readString());
}
private static long readLong() throws IOException {
return Long.parseLong(readString());
}
private static float readFloat() throws IOException{
    return Float.parseFloat(readString());
}

public static class Point implements Comparable{

    private int x;
    private int y;

    Point(int x, int mum){
        this.x = x;
        y = mum;
    }

    public int getX(){
        return x;
    }
    public  void setX(int x){
        this.x = x;
    }
    public int getY(){
        return y;
    }
    public boolean equals(Point b){
        if(this.x == b.getX() && this.y == b.getY())
            return true;
        return false;
    }
    public int compareTo(Object obj)
    {
      Point tmp = (Point)obj;
      if(this.x < tmp.getX())
      {
        /* текущее меньше полученного */
        return -1;
      }
      else if(this.x > tmp.getX())
      {
        /* текущее больше полученного */
        return 1;
      }
      /* текущее равно полученному */
      return 0;
    }

}

public static long factorial( long n )

{
    if(n==0){
        return 1;
    }

    if( n <= 1 )     // base case

        return 1;

    else

        return n * factorial( n - 1 );

}
public static long sum(long i){
    long k=0;
    while(i>0){
        k+=i%10;
        i/=10;
    }
    return k;
}

public static void Solve() throws IOException{

    int[] mas = new int[5];

    for(int i=0;i<5;i++){
        mas[i] = readInt();
        if(i==2){
            mas[i]/=2;
        }
        if(i==3){
            mas[i]/=7;
        }
        if(i==4){
            mas[i]/=4;
        }
    }

    Arrays.sort(mas);
    out.print(mas[0]);

}

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

in.close();
out.close();
}
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class MagnumOpus {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int[] ing = new int[5];
		for (int i = 0; i < 5; i ++) {
			int j = in.nextInt();
			if (i <= 1) ing[i] = j;
			else if (i == 2) ing[i] = j / 2;
			else if (i == 3) ing[i] = j / 7;
			else if (i == 4) ing[i] = j / 4;
		}
		ArrayList<Integer> copy = new ArrayList<Integer>();
		for (int i = 0; i < 5; i ++) {
			copy.add(ing[i]);
		}
		System.out.println(Collections.min(copy));
	}

}

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

public class Task1 {

    public static void main(String[] args) throws IOException {
        new Task1().solve();
    }

    int n;

    PrintWriter out;
    void solve() throws IOException{
        Reader in = new Reader();
        out = new PrintWriter( new BufferedWriter(new OutputStreamWriter(System.out)) );
        //out = new PrintWriter(new FileWriter(new File("output.txt")));

        int[] a = new int[5];
        int[] b = { 1,1,2,7,4 };

        for (int i = 0; i < 5; i++) {
            a[i] = in.nextInt();
            a[i] /= b[i];
        }

        Arrays.sort(a);
        System.out.println(a[0]);

        out.flush();
        out.close();
    }

}

class Reader {

    StringTokenizer token;
    BufferedReader in;

    public Reader() throws IOException {
      //  in = new BufferedReader( new FileReader( "input.txt" ) );
        in = new BufferedReader( new InputStreamReader( System.in ) );
    }

    public byte nextByte() throws IOException {
        return Byte.parseByte(Next());
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(Next());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(Next());
    }

    public String nextString() throws IOException {
        return in.readLine();
    }

    private String Next() throws IOException {
        while (token == null || !token.hasMoreTokens()) {
            token = new StringTokenizer(in.readLine());
        }
        return token.nextToken();
    }

}

import java.util.*;

/**
 *
 * @author owner
 */
public class JavaApplication8 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int firstNum[] = {in.nextInt(), in.nextInt(), in.nextInt() / 2, in.nextInt() / 7, in.nextInt() / 4};
        int max = 100000;
        for (int i = 0; i < firstNum.length; i++) {
            if (firstNum[i] < max) {
                max = firstNum[i];
            }
        }
        System.out.print(max);
    }
}

import static java.lang.Math.*;

import java.text.*;

public class C {

	public C () {
		Integer [] A = sc.nextInts();
		int [] B = new int [] { 1, 1, 2, 7, 4 };

		int res = INF;
		for (int i : rep(5))
			res = min(res, A[i] / B[i]);
		exit(res);
	}

	private static final int INF = (int) 1e9;
	private static int [] rep(int N) { return rep(0, N); }
	private static int [] rep(int S, int T) { if (T <= S) return new int [0]; int [] res = new int [T-S]; for (int i = S; i < T; ++i) res[i-S] = i; return res; }
	////////////////////////////////////////////////////////////////////////////////////
	private final static IOUtils.MyScanner sc = new IOUtils.MyScanner();
	private static void print (Object o, Object ...a) { IOUtils.print(o, a); }
	private static void exit (Object o, Object ...a) { print(o, a); exit(); }
	private static void exit() { IOUtils.exit(); }
	private static class IOUtils {
		public static class MyScanner {
			public String nextLine() { return readLine(); }
			public String [] nextStrings() { return split(nextLine()); }
			public Integer [] nextInts() {
				String [] L = nextStrings();
				Integer [] res = new Integer [L.length];
				for (int i = 0; i < L.length; ++i)
					res[i] = Integer.parseInt(L[i]);
				return res;
			}
			private String readLine() {
				try {
					return r.readLine();
				} catch (Exception e) {
					throw new Error (e);
				}
			}
			private final java.io.BufferedReader r;
			private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
			private MyScanner (java.io.BufferedReader r) {
				try {
					this.r = r;
					while (!r.ready())
						Thread.sleep(1);
					start();
				} catch (Exception e) {
					throw new Error(e);
				}
			}
			private String [] split(String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }
		}
		private static String build(Object o, Object... a) { return buildDelim(" ", o, a); }
		private static String buildDelim(String delim, Object o, Object... a) {
			StringBuilder b = new StringBuilder();
			append(b, o, delim);
			for (Object p : a)
				append(b, p, delim);
			return b.substring(delim.length());
		}
		//////////////////////////////////////////////////////////////////////////////////
		private static void start() { if (t == 0) t = millis(); }
		private static void append(StringBuilder b, Object o, String delim) {
			if (o.getClass().isArray()) {
				int len = java.lang.reflect.Array.getLength(o);
				for (int i = 0; i < len; ++i)
					append(b, java.lang.reflect.Array.get(o, i), delim);
			} else if (o instanceof Iterable<?>)
				for (Object p : (Iterable<?>) o)
					append(b, p, delim);
			else {
				if (o instanceof Double)
					o = new DecimalFormat("#.############").format(o);
				b.append(delim).append(o);
			}
		}
		private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);
		private static void print(Object o, Object ...a) { pw.println(build(o, a)); }
		private static void err(Object o, Object ...a) { System.err.println(build(o, a)); }
		private static void exit() {
			IOUtils.pw.close();
			System.out.flush();
			err("------------------");
			err(IOUtils.time());
			System.exit(0);
		}
		private static long t;
		private static long millis() { return System.currentTimeMillis(); }
		private static String time() { return "Time: " + (millis() - t) / 1000.0; }
	}
	public static void main (String[] args) { new C(); exit(); }
}

import java.util.Scanner;

public class C {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();

		int lol = Math.min(Math.min(a, b), Math.min(c/2, Math.min(d/7, e/4)));

		System.out.println(lol);
		System.exit(0);

	}

}

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

public class cf409c {
  static FastIO in = new FastIO(), out = in;

  public static void main(String[] args) {
    int ret = (int)1e9;
    ret = Math.min(ret, in.nextInt());
    ret = Math.min(ret, in.nextInt());
    ret = Math.min(ret, in.nextInt()/2);
    ret = Math.min(ret, in.nextInt()/7);
    ret = Math.min(ret, in.nextInt()/4);
    out.println(ret);
    out.close();
  }

  static class FastIO extends PrintWriter {
    BufferedReader br;
    StringTokenizer st;

    public FastIO() {
      this(System.in, System.out);
    }

    public FastIO(InputStream in, OutputStream out) {
      super(new BufferedWriter(new OutputStreamWriter(out)));
      br = new BufferedReader(new InputStreamReader(in));
      scanLine();
    }

    public void scanLine() {
      try {
        st = new StringTokenizer(br.readLine().trim());
      } catch (Exception e) {
        throw new RuntimeException(e.getMessage());
      }
    }

    public int numTokens() {
      if (!st.hasMoreTokens()) {
        scanLine();
        return numTokens();
      }
      return st.countTokens();
    }

    public String next() {
      if (!st.hasMoreTokens()) {
        scanLine();
        return next();
      }
      return st.nextToken();
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

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

import java.util.Scanner;

public class c409 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int[] have = {1, 1, 2, 7, 4};
		int max = Integer.MAX_VALUE;
		for (int i = 0; i < have.length; i++) {
			if (!in.hasNext()) {
				System.out.println(0);
				return;
			}
			max = Math.min(in.nextInt()/have[i], max);
		}
		System.out.println(max);
	}
}

import sun.misc.Compare;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.Calendar.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

import static java.math.BigInteger.*;

public class Main {

    double tBeg;
    PrintWriter err;

    void run(){
        //        try {
        //            br = new BufferedReader(new InputStreamReader(System.in));
        //            out = new PrintWriter(new OutputStreamWriter(System.out));
        //            br = new BufferedReader(new FileReader("input.txt"));
        //            out = new PrintWriter(new FileWriter("output.txt"));

        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
        Locale.setDefault(Locale.US);
        //oj = true;
        try{
            err = new PrintWriter(new OutputStreamWriter(System.err));
            if( oj ){
                br = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(new OutputStreamWriter(System.out));
            }
            else{
                br  = new BufferedReader(new FileReader("input.txt" ));
                //                br  = new BufferedReader(new FileReader("C:/inp.txt" ));
                out = new PrintWriter   (new FileWriter("output.txt"));
            }
        }catch(Exception e){
            MLE();
        }
        tBeg = System.currentTimeMillis();
        solve();
        if( !oj )out.println( "TIME: " + (System.currentTimeMillis() - tBeg ) / 1e3 );
        exit(0);
    }

    void exit( int val ){
        out.close();
        System.exit(val);
    }

    StringTokenizer st;
    BufferedReader br;
    PrintWriter out;

    String readLine(){
        try {
            return br.readLine();
        } catch (IOException e) {
            return null;
        }
    }

    String next(){
        while( st==null || !st.hasMoreElements() )
            st = new StringTokenizer(readLine());
        return st.nextToken();
    }

    int nextInt(){ return Integer.parseInt(next()); }
    long nextLong(){ return Long.parseLong(next()); }
    double nextDouble(){ return Double.parseDouble(next()); }

    void MLE(){
        int[][] arr = new int[1024*1024][]; for( int i = 0; i < 1024*1024; ++i ) arr[i] = new int[1024*1024];
    }

    void TLE(){
        for(;;);
    }

    public static void main(String[] args) {
        new Main().run();

        //        new Thread(null, new Runnable() {
        //            public void run() {
        //                try {
        //                    new Main().run();
        //                } catch (Exception e) {
        //                    int[][] arr = new int[1024*1024][]; for( int i = 0; i < 1024*1024; ++i ) arr[i] = new int[1024*1024];
        //                }
        //            }
        //        }, "LOLOL", 200 * (1<<20)).start();
    }
    ////////////////////////////////////////////////////////////////

    void solve() {
        int[] d = { 1, 1, 2, 7, 4 };
        int ans = Integer.MAX_VALUE;
        for( int i = 0; i < 5; ++i )
            ans = min( ans, nextInt() / d[i] );
        out.println( ans );
    }

}

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

public class ProbC {
    public static void main(String[] args) {
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);

        Application solver = new Application();
        solver.solve(System.in, out);

        out.close();
    }
}

class Application {
    public void solve(InputStream in, PrintWriter out) {
        Scanner scanner = new Scanner(in);

        int a[] = new int[] { 1, 1, 2, 7, 4};
        int total = 999999;
        for (int i = 0; i < 5; i++) {
            int n = scanner.nextInt();
            int num = n / a[i];
            if (num < total) {
                total = num;
            }
        }
        out.println(total);
    }
}

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

public class C {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

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

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
		int a[] = { nextInt(), nextInt(), nextInt() / 2, nextInt() / 7,
				nextInt() / 4 };
		Arrays.sort(a);
		out.println(a[0]);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new C().run();
	}

}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        int mas[] = new int[5];
        for(int i = 0; i < 5; i++) {
            mas[i] = sc.nextInt();
        }
        int res[] = new int[]{1,1,2,7,4};
        int min = -1;
        for(int i = 0; i < 5; i++) {
            mas[i] = mas[i]/res[i];
            if (min == -1) {
                min = mas[i];
            }
            if (min > mas[i]) {
                min = mas[i];
            }
        }
        System.out.println(min);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Code {
    public static int[] arr;
    public static List<Integer> store = new ArrayList<Integer>();
    public static List<Integer> rem = new ArrayList<Integer>();
    public static int K,X;
    public static int answer=0;

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

        BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
        String s = read.readLine();
    String[] arr = s.split(" ");

int[] var=new int[5];
int[] giv = {1,1,2,7,4};
for(int i=0;i<5;i++){
    var[i]=p(arr[i])/giv[i];

}
        Arrays.sort(var);
        System.out.println(var[0]);

    }

    public static int p(String s){
        return Integer.parseInt(s);
    }

}

import java.util.*;
import java.util.concurrent.ForkJoinTask;
import java.util.concurrent.RecursiveAction;
import java.util.concurrent.RecursiveTask;
import java.util.concurrent.atomic.AtomicInteger;
import java.io.*;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.math.*;

import javax.swing.plaf.SliderUI;

import static java.lang.Math.*;

public class Solution implements Runnable {

	public void solve() throws Exception {
		int a[] = new int [5];
		int result = Integer.MAX_VALUE / 2;
		for (int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
		}
		result = min(result, a[0] / 1);
		result = min(result, a[1] / 1);
		result = min(result, a[2] / 2);
		result = min(result, a[3] / 7);
		result = min(result, a[4] / 4);
		out.println(result);
	}

	static Throwable t;

	BufferedReader in;
	FastScanner sc;
	PrintWriter out;

	@Override
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			sc = new FastScanner(in);
			solve();
		} catch (Throwable t) {
			Solution.t = t;
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) throws Throwable {
		Thread thread = new Thread(null, new Solution(), "", 1 << 26);
		thread.start();
		thread.join();
		if (Solution.t != null)
			throw t;
	}

}

class FastScanner {

	BufferedReader in;
	StringTokenizer st;

	public FastScanner(BufferedReader in) {
		this.in = in;
	}

	public String nextToken() throws Exception {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	public int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws Exception {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws Exception {
		return Double.parseDouble(nextToken());
	}

}

interface ISingleton {

	public void doSomething();

}

class SingletonInjection {

	public static void inject(Class singletonClass, Object injection) throws Exception {
		Field field = singletonClass.getDeclaredField("instance");
		field.setAccessible(true);
		field.set(singletonClass, injection);
	}

}

class MockSingleton implements ISingleton {

	@Override
	public void doSomething() {
		// TODO Auto-generated method stub

	}

}

class Singleton implements ISingleton {

	private static ISingleton instance;

	public static ISingleton getInstance() {
		// create business singleton;
		return instance;
	}

	@Override
	public void doSomething() {
		// TODO Auto-generated method stub
	}

}

import java.util.*;

public class C {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int[] counts = new int[5];
    for (int i = 0; i < 5; ++i) counts[i] = in.nextInt();
    int min = Integer.MAX_VALUE;
    min = Math.min(min, counts[0]);
    min = Math.min(min, counts[1]);
    min = Math.min(min, counts[2]/2);
    min = Math.min(min, counts[3]/7);
    min = Math.min(min, counts[4]/4);
    System.out.println(min);
  }
}

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

public class C {

    void solve() throws IOException {
        in = new InputReader("__std");
        out = new OutputWriter("__std");

        int[] c = {1, 1, 2, 7, 4};
        int cnt = 100;
        for (int i = 0; i < 5; ++i) {
            int v = in.readInt() / c[i];
            if (v < cnt) cnt = v;
        }
        out.println(cnt);

        exit();
    }

    void exit() {
        //System.err.println((System.currentTimeMillis() - startTime) + " ms");
        out.close();
        System.exit(0);
    }

    InputReader in;
    OutputWriter out;

    //long startTime = System.currentTimeMillis();

    public static void main(String[] args) throws IOException {
        new C().solve();
    }

    class InputReader {

        private InputStream stream;

        private byte[] buffer = new byte[1024];
        private int pos, len;

        private int cur;

        private StringBuilder sb = new StringBuilder(32);

        InputReader(String name) throws IOException {
            if (name.equals("__std")) {
                stream = System.in;
            } else {
                stream = new FileInputStream(name);
            }
            cur = read();
        }

        private int read() throws IOException {
            if (len == -1) {
                throw new EOFException();
            }
            if (pos >= len) {
                pos = 0;
                len = stream.read(buffer);
                if (len == -1) return -1;
            }
            return buffer[pos++];
        }

        char readChar() throws IOException {
            if (cur == -1) {
                throw new EOFException();
            }
            char res = (char) cur;
            cur = read();
            return res;
        }

        int readInt() throws IOException {
            if (cur == -1) {
                throw new EOFException();
            }
            while (whitespace()) {
                cur = read();
            }
            if (cur == -1) {
                throw new EOFException();
            }
            int sign = 1;
            if (cur == '-') {
                sign = -1;
                cur = read();
            }
            int res = 0;
            while (!whitespace()) {
                if (cur < '0' || cur > '9') {
                    throw new NumberFormatException();
                }
                res *= 10;
                res += cur - '0';
                cur = read();
            }
            return res * sign;
        }

        long readLong() throws IOException {
            if (cur == -1) {
                throw new EOFException();
            }
            return Long.parseLong(readToken());
        }

        double readDouble() throws IOException {
            if (cur == -1) {
                throw new EOFException();
            }
            return Double.parseDouble(readToken());
        }

        String readLine() throws IOException {
            if (cur == -1) {
                throw new EOFException();
            }
            sb.setLength(0);
            while (cur != -1 && cur != '\r' && cur != '\n') {
                sb.append((char) cur);
                cur = read();
            }
            if (cur == '\r') {
                cur = read();
            }
            if (cur == '\n') {
                cur = read();
            }
            return sb.toString();
        }

        String readToken() throws IOException {
            if (cur == -1) {
                throw new EOFException();
            }
            while (whitespace()) {
                cur = read();
            }
            if (cur == -1) {
                throw new EOFException();
            }
            sb.setLength(0);
            while (!whitespace()) {
                sb.append((char) cur);
                cur = read();
            }
            return sb.toString();
        }

        boolean whitespace() {
            return cur == ' ' || cur == '\t' || cur == '\r' || cur == '\n' || cur == -1;
        }

        boolean eof() {
            return cur == -1;
        }
    }

    class OutputWriter {

        private PrintWriter writer;

        OutputWriter(String name) throws IOException {
            if (name.equals("__std")) {
                writer = new PrintWriter(System.out);
            } else {
                writer = new PrintWriter(name);
            }
        }

        void print(String format, Object ... args) {
            writer.print(new Formatter(Locale.US).format(format, args));
        }

        void println(String format, Object ... args) {
            writer.println(new Formatter(Locale.US).format(format, args));
        }

        void print(Object value) {
            writer.print(value);
        }

        void println(Object value) {
            writer.println(value);
        }

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

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

import java.util.*;
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;

public class C1
{
    FastScanner in;
    PrintWriter out;

    public int gcd(int a, int b)
    {
        while (b !=0)
        {
            int tmp = a % b;
            a = b;
            b = tmp;
        }

        return a;

    }

    public void solve() throws IOException
    {
        String str = in.br.readLine();

        String mas[] = str.split("\\s+");

        int val[] = new int[mas.length];

        for(int i = 0; i < mas.length; i++)
        {
            val[i] = Integer.parseInt(mas[i]);
        }

        int ret = 0;

        if(val.length >= 5)
        {
            ret = val[0];
            ret = Math.min(ret, val[1]);
            ret = Math.min(ret , val[2] / 2);
            ret = Math.min(ret , val[3]/ 7);
            ret = Math.min(ret , val[4]/ 4);
        }

        out.print(ret);

    }

    public void run() {
        try {
            //in  = new FastScanner(new File("sum.in"));
            //out = new PrintWriter(new File("sum.out"));

            in  = new FastScanner();
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner() {

            br = new BufferedReader(new InputStreamReader(System.in));

        }

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

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

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

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        int[] nextIntArray(int size)
        {
            int[] array = new int[size];

            for (int i = 0; i < size; i++){
                array[i] = nextInt();
            }

            return array;
        }

        long[] nextLongArray(int size)
        {
            long[] array = new long[size];

            for (int i = 0; i < size; i++){
                array[i] = nextLong();
            }

            return array;
        }

        BigInteger nextBigInteger()
        {
            return new BigInteger(next());
        }

        Point nextIntPoint()
        {
            int x = nextInt();
            int y = nextInt();
            return new Point(x, y);
        }

        Point[] nextIntPointArray(int size)
        {
            Point[] array = new Point[size];

            for (int index = 0; index < size; ++index){
                array[index] = nextIntPoint();
            }

            return array;
        }

        List<Integer>[] readGraph(int vertexNumber, int edgeNumber, boolean undirected)
        {
            List<Integer>[] graph = new List[vertexNumber];

            for (int index = 0; index < vertexNumber; ++index)
            {
                graph[index] = new ArrayList<Integer>();
            }

            while (edgeNumber-- > 0)
            {
                int from = nextInt() - 1;
                int to   = nextInt() - 1;

                graph[from].add(to);
                if(undirected)
                    graph[to].add(from);
            }

            return graph;
        }
    }

    public static void main(String[] arg)
    {
        new C1().run();
    }
}

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

public class B implements Runnable {

    private void solve() throws IOException {
        int n = 5;
        int[] rp = new int[] { 1, 1, 2, 7, 4 };
        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            int a = nextInt();
            ans = Math.min(ans, a / rp[i]);
        }
        System.out.println(ans);
    }

    public static void main(String[] args) {
        new B().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            String file = "";
			file = "console";
            if (file.equals("console")) {
                reader = new BufferedReader(new InputStreamReader(System.in));
                writer = new PrintWriter(System.out);
            } else if (file.equals("")) {
                reader = new BufferedReader(new FileReader(new File("input.txt")));
                writer = new PrintWriter(new File("output.txt"));
            } else {
                reader = new BufferedReader(new FileReader(new File(file + ".in")));
                writer = new PrintWriter(new File(file + ".out"));
            }
            solve();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(261);
        }
    }

    void halt() {
        writer.close();
        System.exit(0);
    }

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

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

    String nextLine() throws IOException {
        return reader.readLine();
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens())
            tokenizer = new StringTokenizer(nextLine());
        return tokenizer.nextToken();
    }

    int nextInt() throws NumberFormatException, IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws NumberFormatException, IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(nextToken());
    }
}

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

public class E {
	FastScanner in;
	PrintWriter out;

	public void solve() throws IOException {
		int[] c = new int[]{1, 1, 2, 7, 4};
		int[] a = new int[c.length];
		int ans = 100000;
		for (int i = 0; i < a.length; ++i) {
			a[i] = in.nextInt();
			ans = Math.min(ans, a[i] / c[i]);
		}
		System.out.println(ans);
	}

	public void run() {
		try {
			in = new FastScanner();
			out = new PrintWriter(System.out);

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

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

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

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	public static void main(String[] arg) {
		new E().run();
	}
}

import java.util.Scanner;

/**
 *
 * @author Mbt
 */
public class C {

    public static void main(String[] args) {
        new Solver().solve();
    }
}

class Solver{
    void solve(){
        Scanner reader= new Scanner(System.in);
        int[] counts= {1, 1, 2, 7, 4};
        int min=101;
        for (int i=0; i<5; i++){
            int a= reader.nextInt();
            min= Math.min(min, a/counts[i]);
        }
        System.out.println(min);

    }
}

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.util.ArrayList;
import java.util.Collections;

public class Task409C {

    public static void main(String... args) throws NumberFormatException,
            IOException {
        Solution.main(System.in, System.out);
    }

    static class Scanner {

        private final BufferedReader br;
        private String[] cache;
        private int cacheIndex;

        Scanner(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
            cache = new String[0];
            cacheIndex = 0;
        }

        int nextInt() throws IOException {
            if (cacheIndex >= cache.length) {
                cache = br.readLine().split(" ");
                cacheIndex = 0;
            }
            return Integer.parseInt(cache[cacheIndex++]);
        }

        int nextInt(int radix) throws IOException {
            if (cacheIndex >= cache.length) {
                cache = br.readLine().split(" ");
                cacheIndex = 0;
            }
            return Integer.parseInt(cache[cacheIndex++], radix);
        }

        long nextLong() throws IOException {
            if (cacheIndex >= cache.length) {
                cache = br.readLine().split(" ");
                cacheIndex = 0;
            }
            return Long.parseLong(cache[cacheIndex++]);
        }

        double nextDouble() throws IOException {
            if (cacheIndex >= cache.length) {
                cache = br.readLine().split(" ");
                cacheIndex = 0;
            }
            return Double.parseDouble(cache[cacheIndex++]);
        }

        String next() throws IOException {
            if (cacheIndex >= cache.length) {
                cache = br.readLine().split(" ");
                cacheIndex = 0;
            }
            return cache[cacheIndex++];
        }

        void close() throws IOException {
            br.close();
        }

    }

    static class Solution {

        public static void main(InputStream is, OutputStream os)
                throws NumberFormatException, IOException {
            PrintWriter pw = new PrintWriter(os);
            Scanner sc = new Scanner(is);

            ArrayList<Integer> a = new ArrayList<>(5);
            a.add(sc.nextInt());
            a.add(sc.nextInt());
            a.add(sc.nextInt()/2);
            a.add(sc.nextInt()/7);
            a.add(sc.nextInt()/4);

            pw.println(Collections.min(a));

            pw.flush();
            sc.close();
        }
    }

}

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

public class PrA implements Runnable {
    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    void solve() throws IOException {
        int[] a = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = nextInt();
        }
        a[0] /= 1;
        a[1] /= 1;
        a[2] /= 2;
        a[3] /= 7;
        a[4] /= 4;

        int min = a[0];
        for (int i = 0; i < 5; i++) {
            if (min > a[i])
                min = a[i];
        }

        out.println(min);
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            out.close();
        } catch (IOException e) {
        }
    }

    public static void main(String[] args) {
        new Thread(new PrA()).start();
    }
}

import java.util.Scanner;

public class C {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[6];
		for (int i = 0; i <= 4; i++)
			a[i] = sc.nextInt();
		System.out.println(Math.min(a[0], Math.min(
				Math.min(a[2] / 2, a[3] / 7), Math.min(a[4] / 4, a[1]))));
	}
}

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

public class Tasker1 {

    PrintWriter out;
    BufferedReader input;

    Tasker1() {
        try {
            input = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter(new FileWriter("output.txt"), true);
            solver();
        } catch (IOException ex) {
            input = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out,true);
            try {
                solver();
            } catch (IOException e) {
                e.printStackTrace();
            }
        } finally {
            try {
                input.close();
            } catch (IOException e) {

            }
            out.close();
        }
    }

    StringTokenizer st = new StringTokenizer("");

    private String nextToken() throws IOException {
        while (!st.hasMoreElements()) {
            st = new StringTokenizer(input.readLine());
        }
        return st.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private Long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private Double nextDouble() throws IOException {
        return Double.valueOf(nextToken());
    }

    public void solver() throws IOException {
        int a = nextInt();
        int b = nextInt();
        int c = nextInt();
        int d = nextInt();
        int e = nextInt();

        int needc = c/2;
        int needd = d/7;
        int neede = e/4;

        int min = a;
        if (b < min)
            min = b;
        if (needc < min)
            min = needc;
        if (needd < min)
            min = needd;
        if (neede < min)
            min = neede;
        System.out.println(min);

    }

    public static void main(String[] args) {
        new Tasker1();
    }

}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;

public class A {

	public static void main(String[] args) {
		FasterScanner sc = new FasterScanner();
		PrintWriter out = new PrintWriter(System.out);
		long[] need = new long[]{1,1,2,7,4};
		long best = Integer.MAX_VALUE;
		long[] has = new long[]{sc.nextLong(),sc.nextLong(),sc.nextLong(),sc.nextLong(),sc.nextLong()};
		for(int a=0;a<5;a++)
			best=Math.min(best,has[a]/need[a]);
		out.println(best);
		out.close();
	}

	private static int magic(char a, char b) {
		if(a=='8')return 1;
		if(a=='(')return -1;
		return 0;
	}

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

		public FasterScanner(){
			stream = System.in;
			//stream = new FileInputStream(new File("dec.in"));

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

		boolean isSpaceChar(int c){
			return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
		}
		boolean isEndline(int c){
			return c=='\n'||c=='\r'||c==-1;
		}
		int nextInt(){
			return Integer.parseInt(next());
		}
		long nextLong(){
			return Long.parseLong(next());
		}
		double nextDouble(){
			return Double.parseDouble(next());
		}
		String next(){
			int c = read();
			while(isSpaceChar(c))
				c=read();
			StringBuilder res = new StringBuilder();
			do{
				res.appendCodePoint(c);
				c=read();
			} while(!isSpaceChar(c));
			return res.toString();
		}
		String nextLine(){
			int c = read();
			while(isEndline(c))
				c=read();
			StringBuilder res = new StringBuilder();
			do{
				res.appendCodePoint(c);
				c = read();
			}while(!isEndline(c));
			return res.toString();
		}

	}

}

import java.util.*;
import java.math.*;

public class Main {

    static int min(int ...a) {
        int res = a[0];
        for(int i=0;i<a.length;i++) {
            res=  Math.min(res, a[i]);

        }
        return res;
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int d = in.nextInt();
        int e = in.nextInt();
        System.out.println(min(a, b, c/2, d/7, e/4));

        in.close();

    }
}

import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.min;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class C {

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	static void solve() throws Exception {
		int ans = nextInt();
		ans = min(ans, nextInt());
		ans = min(ans, nextInt() / 2);
		ans = min(ans, nextInt() / 7);
		ans = min(ans, nextInt() / 4);
		out.println(ans);
	}

	static int nextInt() throws IOException {
		return parseInt(next());
	}

	static long nextLong() throws IOException {
		return parseLong(next());
	}

	static double nextDouble() throws IOException {
		return parseDouble(next());
	}

	static String next() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

import java.util.*;
public class c {
public static void main(String[] args)
{
    Scanner input = new Scanner(System.in);
    int[] a = new int[5];
    for(int i = 0; i<5; i++) a[i] = input.nextInt();
    int res = Math.min(a[0], a[1]);
    res = Math.min(res, a[2]/2);
    res = Math.min(a[3]/7, res);
    res = Math.min(res, a[4]/4);
    System.out.println(res);
}
}

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

public class c1 {
	public static void main(String[] args) throws FileNotFoundException {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int ans = 100;
		int b[] = new int[5];
		b[0] = 1;
		b[1] = 1;
		b[2] = 2;
		b[3] = 7;
		b[4] = 4;
		for (int i = 0; i < 5; i++) {
			int a = in.nextInt();
			ans = Math.min(ans, a / b[i]);
		}
		out.print(ans);
		out.close();
	}
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public class solver {
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok;

    String readString() throws IOException{
        while (tok==null || !tok.hasMoreTokens()){
            try{
                tok=new StringTokenizer(in.readLine());
            }
            catch(Exception e){
                return null;
            }
        }
        return tok.nextToken();
    }
    int readInt() throws NumberFormatException, IOException{
        return Integer.parseInt(readString());
    }
    long readLong() throws NumberFormatException, IOException{
        return Long.parseLong(readString());
    }
    double readDouble() throws NumberFormatException, IOException{
        return Double.parseDouble(readString());
    }

    final static boolean OJ=System.getProperty("ONLINE_JUDGE")!=null;

    void init() throws FileNotFoundException{
        if (OJ){
            in=new BufferedReader(new InputStreamReader(System.in));
            out=new PrintWriter(System.out);
        }else{
            in=new BufferedReader(new InputStreamReader(System.in));
            out=new PrintWriter(System.out);
        }
    }
    int[] iMas(int n) throws NumberFormatException, IOException{
        int[] a=new int[n];
        for (int i=0;i<n;i++){
            a[i]=readInt();
        }
        return a;
    }

    int gcd (int a, int b) {
        if (b == 0)
            return a;
        else
            return gcd (b, a % b);
    }

    void solve() throws IOException{

        int[] a=new int[5];
        for (int i=0;i<5;i++){
            a[i]=readInt();
        }
        a[2]/=2;
        a[3]/=7;
        a[4]/=4;
        int min=Integer.MAX_VALUE;
        for (int i=0;i<5;i++) min=Math.min(min,a[i]);
        out.print(min);

    }

    void run() throws NumberFormatException, IOException{
        init();
        // long h=System.currentTimeMillis();
        solve();
        // System.err.println(System.currentTimeMillis()-h);
        out.close();
    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        new solver().run();
    }

}

import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R239_AprilFool_C
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new R239_AprilFool_C().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		int ans = 100;
		int b[] = new int[] {1,1,2,7,4};
		for (int i = 0; i < b.length; i++) {
			int a = in.nextInt();
			ans = Math.min(ans, a / b[i]);
		}
		out.print(ans);
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}

import java.util.Scanner;

public class MagnumOpus
{
	public static void main (String[] args)
	{ Scanner in=new Scanner(System.in);
	int a[]=new int[5]; for(int i=0;i<5;i++) a[i]=in.nextInt(); in.close();
	System.out.println(Math.min(a[0],Math.min(a[1],Math.min(a[2]/2,Math.min(a[3]/7,a[4]/4)))));
			}
}

import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		ArrayList<Integer> e = new ArrayList<Integer>();

		for(int i=0;i<5;i++){
			e.add(s.nextInt());
		}

		int max =700;
		int[] comp = {1,1,2,7,4};

		for(int i=0;i<5;i++){
			if(e.get(i) / comp[i] < max)
				max  = e.get(i) / comp[i];

		}

		System.out.println(max);
		s.close();
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class C{

	public static void main(String[] args) {
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int a = scan.nextInt(), b = scan.nextInt(), c = scan.nextInt(), d = scan.nextInt(), e = scan.nextInt(), res = 0;
		while(a >= 1 && b >= 1 && c >= 2 && d >= 7 && e >= 4){
			a--;
			b--;
			c-=2;
			d-=7;
			e-=4;
			res++;
		}
		out.println(res);
		out.close();
	}

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e){e.printStackTrace();}
		}

		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			return st.nextToken();
		}

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

		public long nextLong() {return Long.parseLong(next());}

		public double nextDouble() {return Double.parseDouble(next());}

		public String nextLine() {
			String line = "";
			if(st.hasMoreTokens()) line = st.nextToken();
			else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
			while(st.hasMoreTokens()) line += " "+st.nextToken();
			return line;
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n){
			long[] a = new long[n];
			for(int i = 0; i < n; i++) a[i] = nextLong();
			return a;
		}

		public double[] nextDoubleArray(int n){
			double[] a = new double[n];
			for(int i = 0; i < n; i++) a[i] = nextDouble();
			return a;
		}

		public char[][] nextGrid(int n, int m){
			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++) grid[i] = next().toCharArray();
			return grid;
		}
	}

}

import java.util.Scanner;
public class Main{
public static void main(String[] args){
  Scanner sc=new Scanner(System.in);
  int[] arr={1,1,2,7,4};
  int[] a=new int[5];
  int min=Integer.MAX_VALUE;
  for(int i=0;i<5;i++){
     a[i]=sc.nextInt();
    if(a[i]/arr[i]<min){
      min=a[i]/arr[i];
    }
  }
  System.out.println(min);
}
}

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int need[] = {1, 1, 2, 7, 4};
		Scanner in = new Scanner(System.in);
		int has[] = new int[5];
		int min =Integer.MAX_VALUE;
		for(int i=0;i<5;i++)
		{
			has[i]=in.nextInt();
			if(has[i]/need[i]<min)
				min=has[i]/need[i];
		}
		System.out.println(min);

	}

}

import java.util.*;
public class Main
{
    public static void main(String[]args)
    {
        int a[]={1,1,2,7,4};
        Scanner in=new Scanner(System.in);
        int b[]=new int[5];
        int min=Integer.MAX_VALUE;
        for(int i=0;i<5;i++)
        {
            b[i]=in.nextInt();
            if(b[i]/a[i]<min)
                min=b[i]/a[i];
        }
        System.out.println(min);
    }
}

import java.util.Scanner;

public class April_2014 {

    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);

        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        int d=sc.nextInt();
        int e=sc.nextInt();

        c/=2;
        d/=7;
        e/=4;

        System.out.println(Math.min(Math.min(a, b), Math.min(Math.min(c, d), e)));
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class C {

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		sc = new StringTokenizer("");
		int[] a = nxtIntArr(5);
		int[] req = { 1, 1, 2, 7, 4 };
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < 5; i++)
			min = Math.min(min, a[i] / req[i]);
		out.println(min);
		br.close();
		out.close();
	}

	static BufferedReader br;
	static StringTokenizer sc;
	static PrintWriter out;

	static String nxtTok() throws IOException {
		while (!sc.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null)
				return null;
			sc = new StringTokenizer(s.trim());
		}
		return sc.nextToken();
	}

	static int nxtInt() throws IOException {
		return Integer.parseInt(nxtTok());
	}

	static long nxtLng() throws IOException {
		return Long.parseLong(nxtTok());
	}

	static double nxtDbl() throws IOException {
		return Double.parseDouble(nxtTok());
	}

	static int[] nxtIntArr(int n) throws IOException {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtInt();
		return a;
	}

	static long[] nxtLngArr(int n) throws IOException {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtLng();
		return a;
	}

	static char[] nxtCharArr() throws IOException {
		return nxtTok().toCharArray();
	}
}

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

public class Main implements Runnable {

	public void _main() throws IOException {
		int[] d = {1, 1, 2, 7, 4};
		int res = Integer.MAX_VALUE;
		for (int i = 0; i < 5; i++) {
			res = Math.min(res, nextInt() / d[i]);
		}
		out.println(res);
	}

	private BufferedReader in;
	private PrintWriter out;
	private StringTokenizer st;

	private String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String rl = in.readLine();
			if (rl == null)
				return null;
			st = new StringTokenizer(rl);
		}
		return st.nextToken();
	}

	private int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	private long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	private double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public static void main(String[] args) {
		Locale.setDefault(Locale.UK);
		new Thread(new Main()).start();
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			//in = new BufferedReader(new FileReader("a.in"));
			//out = new PrintWriter(new FileWriter("a.out"));

			_main();

			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(202);
		}
	}

}

//package afc2014;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class C {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int[] a = na(5);
		a[2] /= 2;
		a[3] /= 7;
		a[4] /= 4;
		int min = 1000000000;
		for(int i = 0;i < 5;i++){
			min = Math.min(min, a[i]);
		}
		out.println(min);
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new C().run(); }

	private byte[] inbuf = new byte[1024];
	private int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;
import java.util.SortedSet;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

    public static void main(String[] args) throws FileNotFoundException {
        //InputStream inputStream = new FileInputStream("bluetube.in");//System.in;
        //OutputStream outputStream = new FileOutputStream("bluetube.out");//.out;
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }
}

class Solver {

    public void solve(InputReader in, PrintWriter out) {
        int [] a = {1, 1, 2, 7, 4};

        int ans = 1000;

        for (int i = 0; i < 5; ++i) {
            ans = Math.min(ans, in.nextInt() / a[i]);
        }

        out.println(ans);

    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public long nextLong() {
        return Long.parseLong(next());
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        int[] a = new int[]{1, 1, 2, 7, 4};
        int[] b = new int[5];

        int temp, t;
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 5; i++) {
            b[i] = sc.nextInt();
        }

        temp = b[0] / a[0];
        for (int i = 1; i < 5; i++) {
            t = b[i] / a[i];
            if (t < temp)
                temp = t;
        }
        System.out.println("" + temp);

    }
}

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

public class C {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	static final int[] ARR = { 1, 1, 2, 7, 4 };

	void solve() throws IOException {
		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < ARR.length; i++) {
			int x = nextInt();
			ans = Math.min(ans, x / ARR[i]);
		}
		out.println(ans);
	}

	C() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new C();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

import java.util.Scanner;

public class c {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] r = { 1, 1, 2, 7, 4 };
        int MIN = Integer.MAX_VALUE, v = 0;
        for (int i = 0; i < 5; i++) {
            v = in.nextInt();
            MIN = Math.min(MIN, v / r[i]);
        }
        System.out.println(MIN);
    }
}

import java.util.Scanner;

public class CFMagnumOpus {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int[] materials = new int[5];
		int[] toMakeOne = {1, 1, 2, 7, 4};
		for (int i = 0; i < 5; i++) {
			materials[i] = scanner.nextInt();
		}
		int maxNumberAvailable = Integer.MAX_VALUE;
		for (int i = 0; i < 5; i++) {
			maxNumberAvailable = Math.min(materials[i]/toMakeOne[i], maxNumberAvailable);
		}
		System.out.println(maxNumberAvailable);
	}

}

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

public class AFB
{

private static StringTokenizer st;

    public static void nextLine(BufferedReader br) throws IOException
    {
        st = new StringTokenizer(br.readLine());
    }

    public static int nextInt()
    {
        return Integer.parseInt(st.nextToken());
    }

    public static String next()
    {
        return st.nextToken();
    }

    public static long nextLong()
    {
        return Long.parseLong(st.nextToken());
    }

    public static double nextDouble()
    {
        return Double.parseDouble(st.nextToken());
    }

    public static void main(String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        nextLine(br);
        int[] a = new int[5];
        int[] b = {1, 1, 2, 7, 4};
        int min = 200;
        for (int i = 0; i < 5; i++)
        {
            a[i] = nextInt();
        }
        for (int i = 0; i < 5; i++)
        {
            int val = (a[i] / b[i]);
            if (val < min) min = val;
        }
        System.out.println(min);
    }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
                int[] a = ArrayUtils.readIntArray(in, 5);
                a[2] /= 2;
                a[3] /= 7;
                a[4] /= 4;
                int res = a[0];
                for (int x : a)
                        res = Math.min(res, x);
                out.println(res);
        }
}

class FastScanner {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public FastScanner(InputStream inputStream)  {
                reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String nextToken() {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                        String line;
                        try {
                                line = reader.readLine();
                        } catch (IOException e) {
                                return null;
                        }
                        tokenizer = new StringTokenizer(line);
                }
                return tokenizer.nextToken();
        }

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

}

class ArrayUtils {

        public static int[] readIntArray(FastScanner in, int count) {
                int[] array = new int[count];
                for (int i = 0; i < count; i++)
                        array[i] = in.nextInt();
                return array;
        }

}

import java.util.Scanner;

public class MagnumOpus {

	public static void main(String[] args) {
		Scanner s=new Scanner(System.in);
		int arr[]=new int[5];
		for(int i=0;i<5;i++)
		{
			arr[i]=s.nextInt();
		}
		arr[0]/=1;
		arr[1]/=1;
		arr[2]/=2;
		arr[3]/=7;
		arr[4]/=4;
		int min=Math.min(arr[0], arr[1]);
		min=Math.min(min, arr[2]);
		min=Math.min(min, arr[3]);
		min=Math.min(min, arr[4]);
		System.out.println(min);
	}
}

import java.util.Scanner;

public class Aprel2014_H {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		for (int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
		}
		// 11274
		a[2] /= 2;
		a[3] /= 7;
		a[4] /= 4;
		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < 5; i++) {
			ans = Math.min(ans, a[i]);
		}
		System.out.println(ans);
	}
}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class r217_b {
    static StringTokenizer st;
    static BufferedReader br;
    static PrintWriter pw;
public static void main(String[] args)throws IOException {
    br=new BufferedReader(new InputStreamReader(System.in));
    pw=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

    int a[]=new int[6],min=101;
    a[1]=1;a[2]=1;a[3]=2;a[4]=7;a[5]=4;
    for (int i = 1; i <=5; i++)
    min=Math.min(nextInt()/a[i], min);
    pw.print(min);
    pw.close();
    }
private static int nextInt()throws IOException{
    return Integer.parseInt(next());
}
private static long nextLong()throws IOException{
    return Long.parseLong(next());
}
private static double nextDouble()throws IOException{
    return Double.parseDouble(next());
}
private static String next()throws IOException {
    while (st==null||!st.hasMoreTokens())
     st=new StringTokenizer(br.readLine());
    return st.nextToken();
}
}

import java.util.*;

public class Solution
{
    public static void main(String[] args) throws Exception
    {
        Scanner sc=new Scanner(System.in);
        int q,w,e,r,t;
        q=sc.nextInt();
        w=sc.nextInt();
        e=sc.nextInt();
        r=sc.nextInt();
        t=sc.nextInt();
        int res;
        res = min(q,w, e, r, t);
        System.out.println(res);
    }
    public static int min(int a,int b,int c,int d,int e){

        int m=0;
        for(int i=0;i<1000;i++){
            a-=1;
            b-=1;
            c-=2;
            d-=7;
            e-=4;
            if(a<0 | b<0 | c<0 | d<0 | e<0) break;
            m++;

        }
        return m;
    }

}

import java.util.*;

public class C {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int A = in.nextInt()/1;
    int B = in.nextInt()/1;
    int C = in.nextInt()/2;
    int D = in.nextInt()/7;
    int E = in.nextInt()/4;

    long ans = Math.min(A, B);
    ans = Math.min(ans, C);
    ans = Math.min(ans, D);
    ans = Math.min(ans, E);
    System.out.println(ans);
  }
}

import java.io.*;
import java.util.*;
import java.util.Map.Entry;

public class C {

    void run() throws IOException {
        int[] arr = na(5);
        int max = 10000;
        arr[2] /= 2;
        arr[3] /= 7;
        arr[4] /= 4;
        for (int a : arr) {
            max = Math.min(max, a);
        }
        pw.println(max);
    }

    int gcd(int a, int b) {
        return (b == 0) ? (a) : (gcd(b, a % b));
    }

    int[] na(int a_len) throws IOException {
        int[] _a = new int[a_len];
        for (int i = 0; i < a_len; i++)
            _a[i] = ni();
        return _a;
    }

    String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(next());
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    String nl() throws IOException {
        return br.readLine();
    }

    void tr(String debug) {
        if (!OJ)
            pw.println(" " + debug);
    }

    static PrintWriter pw;
    static BufferedReader br;
    static StringTokenizer st;
    static boolean OJ;

    public static void main(String[] args) throws IOException {
        long timeout = System.currentTimeMillis();
        OJ = System.getProperty("ONLINE_JUDGE") != null;
        pw = new PrintWriter(System.out);
        br = new BufferedReader(OJ ? new InputStreamReader(System.in) : new FileReader(new File("C.txt")));

        while (br.ready())
            new C().run();
        if (!OJ) {
            pw.println("----------------");
            pw.println(System.currentTimeMillis() - timeout);
        }
        br.close();
        pw.close();
    }

}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 5;
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();

        a[2] /= 2;
        a[3] /= 7;
        a[4] /= 4;

        int min = 100001;
        for (int i = 0; i < n; i++)
            if (a[i] < min)
                min = a[i];

        out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import java.util.Scanner;

public class C {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int ans = Math.min(
                Math.min(Math.min(in.nextInt(), in.nextInt()),
                        Math.min(in.nextInt() / 2, in.nextInt() / 7)),
                in.nextInt() / 4);
        System.out.println(ans);
    }
}

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * User: Epifanov Sergey
 * Date: 4/1/14
 * Package: PACKAGE_NAME
 */
public class C {
    public static void main(String[] args) {
        Scanner terminalInput = new Scanner(System.in);
        int a = terminalInput.nextInt();
        int b = terminalInput.nextInt();
        int c = terminalInput.nextInt();
        int d = terminalInput.nextInt();
        int e = terminalInput.nextInt();

        int res = Math.min(a / 1, Math.min(b / 1, Math.min(c / 2,
                Math.min(d / 7, e / 4))));
        System.out.println(res);
    }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int res = (int) 1e9;
        res = Math.min(res, in.nextInt());
        res = Math.min(res, in.nextInt());
        res = Math.min(res, in.nextInt() / 2);
        res = Math.min(res, in.nextInt() / 7);
        res = Math.min(res, in.nextInt() / 4);
        out.println(res);
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

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

}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int need[] = {1, 1, 2, 7, 4};
        Scanner in = new Scanner(System.in);
        int has[] = new int[5];
        int min =Integer.MAX_VALUE;
        for(int i=0;i<5;i++)
        {
            has[i]=in.nextInt();
            if(has[i]/need[i]<min)
                min=has[i]/need[i];
        }
        System.out.println(min);

    }

}

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

public class C {
	final static int MOD = 1000000007;

	public static void main(String[] args) throws Exception {
		FastReader in = new FastReader(System.in);
		int[] a = new int[100];
		for (int i = 0; i < 5; i++)
			a[i] = in.nextInt();
		int min = a[0];
		min = Math.min(min, a[1]);
		min = Math.min(min, a[2] / 2);
		min = Math.min(min, a[3] / 7);
		min = Math.min(min, a[4] / 4);
		System.out.println(min);
	}

	static class FastReader {
	    private boolean finished = false;

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

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

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

	        return buf[curChar++];
	    }

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

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

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

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

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

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

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

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

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

	    public BigInteger nextBigInteger() {
	        try {
	            return new BigInteger(nextString());
	        } catch (NumberFormatException e) {
	            throw new InputMismatchException();
	        }
	    }

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

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

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

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

	    public SpaceCharFilter getFilter() {
	        return filter;
	    }

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

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

import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

    public static void main(String... args) {
       Scanner in = new Scanner(System.in);
       PriorityQueue<Integer> n = new PriorityQueue();
       n.add(in.nextInt());
       n.add(in.nextInt());
       n.add(in.nextInt()/2);
       n.add(in.nextInt()/7);
       n.add(in.nextInt()/4);
       System.out.println(n.peek());
    }
}

import java.util.Scanner;

public class Main {

    public static void main(String... args) {
       Scanner in = new Scanner(System.in);
       int a  = in.nextInt();
       int b = in.nextInt();
       int c = in.nextInt()/2;
       int d = in.nextInt()/7;
       int e = in.nextInt()/4;
       System.out.println(Math.min(Math.min(Math.min(a,b),Math.min(b, c)), Math.min(d, e)));
    }
}

import java.util.Scanner;

public class Main {

    public static void main(String... args) {
       Scanner in = new Scanner(System.in);
       int a = in.nextInt();
       int b = in.nextInt();
       int c = in.nextInt();
       int d = in.nextInt();
       int e = in.nextInt();
       int count = 0;
       while(a>=1 && b>=1 && c>=2 && d>=7 && e>=4)
       {
           count++;
           a-=1;b-=1;c-=2;d-=7;e-=4;
       }
        System.out.println(count);

    }
}

import java.io.IOException;

public class C {

	private static final int IN_BUFFER_SIZE = 1 << 16;
	private static final int OUT_BUFFER_SIZE = 1 << 16;
	private byte[] input = new byte[IN_BUFFER_SIZE];
	private int ix = IN_BUFFER_SIZE;
	private int bytesRead = ix;
	private byte[] output = new byte[OUT_BUFFER_SIZE];
	private int ox = 0;

	private void readMore() {
		try {
			bytesRead = System.in.read(input, 0, IN_BUFFER_SIZE);
			if (bytesRead <= 0)
				throw new RuntimeException();
			ix = 0;
		} catch (IOException e) {
			throw new RuntimeException();
		}
	}

	private void flushOut() {
		System.out.write(output, 0, ox);
		ox = 0;
	}

	private void append(char c) {
		if (ox == OUT_BUFFER_SIZE)
			flushOut();
		output[ox++] = (byte) c;
	}

	private int nextInt() {
		skipSpaces();
		int ret = 0;
		if (ix == bytesRead) {
			readMore();
		}
		int sign = 1;
		if (input[ix] == '-') {
			sign = -1;
			ix++;
		}
		while (true) {
			if (ix == bytesRead) {
				try {
					readMore();
				} catch (RuntimeException e) {
					return ret;
				}
			}
			if (input[ix] < '0') {
				break;
			}
			ret *= 10;
			ret += input[ix++] - '0';
		}
		return sign * ret;
	}

	int cntSize;

	private void skipSpaces() {
		while (true) {
			if (ix == bytesRead) {
				readMore();
			}
			if (input[ix] > ' ')
				break;
			ix++;
		}
	}

	private char[] nn = new char[32];

	private void printInt(int n) {
		if (n == 0) {
			append('0');
		} else {
			if (n < 0) {
				append('-');
				n = -n;
			}
			int kk = 0;
			while (n > 0) {
				nn[kk++] = (char) (n % 10 + '0');
				n /= 10;
			}
			for (int i = kk - 1; i >= 0; i--) {
				append(nn[i]);
			}
		}
	}

	public static void main(String[] args) throws IOException {
		new C().work();
	}

	private void work() {
		int[] a = { 1, 1, 2, 7, 4 };
		int res = 1000;
		for (int i = 0; i < 5; i++) {
			res = Math.min(res, nextInt() / a[i]);
		}
		printInt(res);
		append('\n');
		if (ox > 0)
			flushOut();
		System.out.close();
	}
}

import java.util.ArrayList;
import java.util.Scanner;

public class MagnumOpus {
	static Scanner in = new Scanner(System.in);

	public static void main(String[] args){
		int min = Integer.MAX_VALUE;
		int AquaFortis = in.nextInt()/1;
		int AquaRegia = in.nextInt()/1;
		int Amalgama = in.nextInt()/2;
		int Minium = in.nextInt()/7;
		int Vitriol = in.nextInt()/4;

		if (min > AquaFortis) min = AquaFortis;
		if (min > AquaRegia) min = AquaRegia;
		if (min > Amalgama) min = Amalgama;
		if (min > Minium) min = Minium;
		if (min > Vitriol) min = Vitriol;

		System.out.println(min);
	}
}

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

import static java.lang.Math.min;

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

    public static void main(String[] args) throws IOException {
        int a = nextInt();
        int b = nextInt();
        int c = nextInt();
        int d = nextInt();
        int e = nextInt();
        System.out.println(min(a, min(b, min(c / 2, min(d / 7, e / 4)))));
    }

    static int nextInt() throws IOException {
        return in.nextInt();
    }
}

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),d=sc.nextInt(),e=sc.nextInt();
        c=c/2; d=d/7; e=e/4;
        int m=Math.min(a, Math.min(b,Math.min(c, Math.min(d, e))));
        System.out.println(m);
    }
}

import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		ArrayList<Integer> e = new ArrayList<Integer>();

		for(int i=0;i<5;i++){
			e.add(s.nextInt());
		}

		int max =0;
		int[] comp = {1,1,2,7,4};

		for(int i=0;i<5;i++){
			if(e.get(i) / comp[i] <max)
				max  = e.get(i) / comp[i];

		}

		System.out.println("1");
		s.close();
	}

}

import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		ArrayList<Integer> e = new ArrayList<Integer>();
//		while(s.hasNext()){
//
//		}
		System.out.println("1");
		s.close();
	}

}

import java.util.Scanner;

public class Aprel2014_H {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[5];
		for (int i = 0; i < 5; i++) {
			a[i] = sc.nextInt();
		}
		// 11274
		a[2] /= 2;
		a[3] /= 7;
		a[4] /= 4;
		int ans = 0;
		for (int i = 0; i < 4; i++) {
			ans = Math.min(a[i], a[i + 1]);
		}
		System.out.println(ans);
	}
}

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

import static java.lang.Math.*;

/**
 * @author master_j
 */
public class Solution {
    private IO io;
    private static final String _localArg = "master_j";
    private final String _problemName = "";
    private final int _inMode = IO.STD_;
    private final int _outMode = IO.STD_;
    private final boolean _autoFlush = false;

    private void solve() throws IOException {
        final int N = 5;
        int b[] = new int[]{2, 4, 6, 8, 10};
        int min = Integer.MAX_VALUE;
        for(int i = 0; i<N; i++)
            min = min(min, io.nI() / b[i]);
        io.wln(min);
    }//2.2250738585072012e-308

    private void init(boolean local) throws IOException {
        if(local)
            io = new IO(IO._PUT_TXT, IO.STD_);
        else{
            if((_inMode == IO.PROBNAME_ || _outMode == IO.PROBNAME_) && _problemName.length() == 0)
                throw new IllegalStateException("You imbecile. Where's my <_problemName>?");
            io = new IO(_inMode, _outMode);
        }

        long nanoTime = 0;
        if(local){
            nanoTime -= System.nanoTime();
            if(_autoFlush)
                io.wln("NOTE: auto-flush is on.");
            io.wln("<output>");
            io.flush();
        }

        solve();
        io.flush();

        if(local){
            io.wln("</output>");
            nanoTime += System.nanoTime();
            long d9 = 1000000000, d6 = 1000000, d3 = 1000;
            if(nanoTime >= d9)
                io.wf("%d.%d seconds\n", nanoTime/d9, nanoTime%d9);
            else if(nanoTime >= d6)
                io.wf("%d.%d millis\n", nanoTime/d6, nanoTime%d6);
            else if(nanoTime >= d3)
                io.wf("%d.%d micros\n", nanoTime/d3, nanoTime%d3);
            else
                io.wf("%d nanos\n", nanoTime);
            io.flush();
        }

        io.close();
    }

    /**
     * Input-output class
     *
     * @author master_j
     * @version 0.3.2
     */
    private class IO {
//     _____________________________ _________________
//    |  mode  |      from/to       |  variable name  |
//    |--------|--------------------|-----------------|
//    |    0   |      System.*      |       STD_      |
//    |    1   |      *put.txt      |     _PUT_TXT    |
//    |    2   |  <_problemName>.*  |     PROBNAME_   |
//    |________|____________________|_________________|
//

        static final int STD_ = 0;
        static final int _PUT_TXT = 1;
        static final int PROBNAME_ = 2;

        StreamTokenizer st;
        BufferedReader br;
        Reader reader;

        PrintWriter pw;
        Writer writer;

        IO(int inMode, int outMode) throws IOException {
            Locale.setDefault(Locale.US);

            if(inMode == IO.STD_)
                reader = new InputStreamReader(System.in);
            else if(inMode == IO._PUT_TXT)
                reader = new FileReader("input.txt");
            else if(inMode == IO.PROBNAME_)
                reader = new FileReader(_problemName + ".in");
            else
                throw new IllegalStateException("You imbecile. How did you do that?");

            if(outMode == IO.STD_)
                writer = new OutputStreamWriter(System.out);
            else if(outMode == IO._PUT_TXT)
                writer = new FileWriter("output.txt");
            else if(outMode == IO.PROBNAME_)
                writer = new FileWriter(_problemName + ".out");
            else
                throw new IllegalStateException("You imbecille. Why did you do that?");

            br = new BufferedReader(reader);
            st = new StreamTokenizer(br);

            pw = new PrintWriter(writer, _autoFlush);
        }

        void wln()          {pw.println(); }
        void wln(boolean x) {pw.println(x);}
        void wln(char x)    {pw.println(x);}
        void wln(char x[])  {pw.println(x);}
        void wln(double x)  {pw.println(x);}
        void wln(float x)   {pw.println(x);}
        void wln(int x)     {pw.println(x);}
        void wln(long x)    {pw.println(x);}
        void wln(Object x)  {pw.println(x);}
        void wln(String x)  {pw.println(x);}

        void wf(String f, Object...o){pw.printf(f, o);}

        void w(boolean x)   {pw.print(x);}
        void w(char x)      {pw.print(x);}
        void w(char x[])    {pw.print(x);}
        void w(double x)    {pw.print(x);}
        void w(float x)     {pw.print(x);}
        void w(int x)       {pw.print(x);}
        void w(long x)      {pw.print(x);}
        void w(Object x)    {pw.print(x);}
        void w(String x)    {pw.print(x);}

        int nI() throws IOException    {st.nextToken(); return (int)st.nval;}
        double nD() throws IOException {st.nextToken(); return st.nval;}
        float nF() throws IOException  {st.nextToken(); return (float)st.nval;}
        long nL() throws IOException   {st.nextToken(); return (long)st.nval;}
        String nS() throws IOException {st.nextToken(); return st.sval;}

        void wc(String x){ wc(x.toCharArray()); }
        void wc(char c1, char c2){for(char c = c1; c<=c2; c++)wc(c);}
        void wc(char x[]){
            for(char c : x)
                wc(c);
        }
        void wc(char x){st.ordinaryChar(x); st.wordChars(x, x);}

        public boolean eof() {return st.ttype == StreamTokenizer.TT_EOF;}
        public boolean eol() {return st.ttype == StreamTokenizer.TT_EOL;}

        void flush(){pw.flush();}
        void close() throws IOException{reader.close(); br.close(); flush(); pw.close();}
    }

    public static void main(final String args[]) throws IOException {
        new Solution().init(args.length == 1 && args[0].equals(_localArg));
    }
}

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

public class Task1 {

	public static void main(String[] args) throws IOException {
		new Task1().solve();
	}

	public void solve() throws IOException {
		PrintWriter out = new PrintWriter(System.out);
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer tok = new StringTokenizer(in.readLine());
		System.out.println(1);

	}

}

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

public class Task1 {

	public static void main(String[] args) throws IOException {
		new Task1().solve();
	}

	public void solve() throws IOException {
		PrintWriter out = new PrintWriter(System.out);
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer tok = new StringTokenizer(in.readLine());
		long[] num = new long[5];
		num[0] = Long.valueOf(tok.nextToken());
		num[1] = Long.valueOf(tok.nextToken());
		num[2] = Long.valueOf(tok.nextToken());
		num[3] = Long.valueOf(tok.nextToken());
		num[4] = Long.valueOf(tok.nextToken());
		System.out.println(Math.min(num[0], Math.min(num[1], Math.min(num[2]/2, Math.min(num[3]/6, num[4]/4)))));

	}

}

import java.io.*;
import java.util.*;
import java.*;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Random;

import javax.naming.BinaryRefAddr;

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

public class zad {
private static BufferedReader in;
private static StringTokenizer tok;
private static PrintWriter out;
final static boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") !=null;

public static void init() throws FileNotFoundException{
if(ONLINE_JUDGE){
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
}
else{
in = new BufferedReader(new FileReader("input.txt"));
out = new PrintWriter("out.txt");
}
}

private static String readString() throws IOException {
while (tok == null || !tok.hasMoreTokens()) {
tok = new StringTokenizer(in.readLine());
}
return tok.nextToken();
}

private static int readInt() throws IOException {
return Integer.parseInt(readString());
}
private static double readDouble() throws IOException {
return Double.parseDouble(readString());
}
private static long readLong() throws IOException {
return Long.parseLong(readString());
}
private static float readFloat() throws IOException{
    return Float.parseFloat(readString());
}

static int gcd(int a, int b) {
    while (b != 0) {
            int r = a % b;

            a = b;
            b = r;
    }

    return a;
}
public static class Time{
    static int h;
    static int min;

}
 public static int EQ(Time t, Time a){
     if(t.h==a.h && a.min==t.min) return 1;
     else return 0;
 }

public static void Solve() throws IOException{
 String s = in.readLine();
 String f="";
 int ans=0;
 for(int i=0;i<s.length();i++){
     if(s.charAt(i)==' ' ){
         int r = Integer.parseInt(f);
         if(r==1 || r==2 || r==7 || r==9) ans++;
         f="";
     }
     else f+=s.charAt(i);
 }
 out.print(ans);
}

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

in.close();
out.close();
}
}

import static java.lang.Math.*;

import java.text.*;

public class C {

	public C () {
		Integer [] A = sc.nextInts();
		int res = 0;

		for (int a : A) {
			int c = 0;
			if (a % 10 == 9)
				++c;
			switch(a/10) {
			case 0: c += 0; break;
			case 1: c += 1; break;
			case 2: c += 2; break;
			case 3: c += 3; break;
			case 4: c += 1; break;
			case 5: c += 0; break;
			case 6: c += 1; break;
			case 7: c += 2; break;
			case 8: c += 3; break;
			case 9: c += 1; break;
			case 10: c += 0; break;
			}
			res = max(res, c);
		}
		exit(res);
	}

	////////////////////////////////////////////////////////////////////////////////////
	private final static IOUtils.MyScanner sc = new IOUtils.MyScanner();
	private static void print (Object o, Object ...a) { IOUtils.print(o, a); }
	private static void exit (Object o, Object ...a) { print(o, a); exit(); }
	private static void exit() { IOUtils.exit(); }
	private static class IOUtils {
		public static class MyScanner {
			public String nextLine() { return readLine(); }
			public String [] nextStrings() { return split(nextLine()); }
			public Integer [] nextInts() {
				String [] L = nextStrings();
				Integer [] res = new Integer [L.length];
				for (int i = 0; i < L.length; ++i)
					res[i] = Integer.parseInt(L[i]);
				return res;
			}
			private String readLine() {
				try {
					return r.readLine();
				} catch (Exception e) {
					throw new Error (e);
				}
			}
			private final java.io.BufferedReader r;
			private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
			private MyScanner (java.io.BufferedReader r) {
				try {
					this.r = r;
					while (!r.ready())
						Thread.sleep(1);
					start();
				} catch (Exception e) {
					throw new Error(e);
				}
			}
			private String [] split(String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }
		}
		private static String build(Object o, Object... a) { return buildDelim(" ", o, a); }
		private static String buildDelim(String delim, Object o, Object... a) {
			StringBuilder b = new StringBuilder();
			append(b, o, delim);
			for (Object p : a)
				append(b, p, delim);
			return b.substring(delim.length());
		}
		//////////////////////////////////////////////////////////////////////////////////
		private static void start() { if (t == 0) t = millis(); }
		private static void append(StringBuilder b, Object o, String delim) {
			if (o.getClass().isArray()) {
				int len = java.lang.reflect.Array.getLength(o);
				for (int i = 0; i < len; ++i)
					append(b, java.lang.reflect.Array.get(o, i), delim);
			} else if (o instanceof Iterable<?>)
				for (Object p : (Iterable<?>) o)
					append(b, p, delim);
			else {
				if (o instanceof Double)
					o = new DecimalFormat("#.############").format(o);
				b.append(delim).append(o);
			}
		}
		private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);
		private static void print(Object o, Object ...a) { pw.println(build(o, a)); }
		private static void err(Object o, Object ...a) { System.err.println(build(o, a)); }
		private static void exit() {
			IOUtils.pw.close();
			System.out.flush();
			err("------------------");
			err(IOUtils.time());
			System.exit(0);
		}
		private static long t;
		private static long millis() { return System.currentTimeMillis(); }
		private static String time() { return "Time: " + (millis() - t) / 1000.0; }
	}
	public static void main (String[] args) { new C(); exit(); }
}

import static java.lang.Math.*;

import java.text.*;

public class C {

	public C () {
		Integer [] A = sc.nextInts();
		int res = 0;

		for (int a : A) {
			int c = 0;
			if (a % 10 == 9)
				++c;
			switch(a/10) {
			case 0: c += 0; break;
			case 1: c += 1; break;
			case 2: c += 2; break;
			case 3: c += 3; break;
			case 4: c += 1; break;
			case 5: c += 0; break;
			case 6: c += 1; break;
			case 7: c += 2; break;
			case 8: c += 3; break;
			case 9: c += 1; break;
			case 10: c += 0; break;
			}
			if (c > 0) c = 1;
			res += c;
		}
		exit(res);
	}

	////////////////////////////////////////////////////////////////////////////////////
	private final static IOUtils.MyScanner sc = new IOUtils.MyScanner();
	private static void print (Object o, Object ...a) { IOUtils.print(o, a); }
	private static void exit (Object o, Object ...a) { print(o, a); exit(); }
	private static void exit() { IOUtils.exit(); }
	private static class IOUtils {
		public static class MyScanner {
			public String nextLine() { return readLine(); }
			public String [] nextStrings() { return split(nextLine()); }
			public Integer [] nextInts() {
				String [] L = nextStrings();
				Integer [] res = new Integer [L.length];
				for (int i = 0; i < L.length; ++i)
					res[i] = Integer.parseInt(L[i]);
				return res;
			}
			private String readLine() {
				try {
					return r.readLine();
				} catch (Exception e) {
					throw new Error (e);
				}
			}
			private final java.io.BufferedReader r;
			private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
			private MyScanner (java.io.BufferedReader r) {
				try {
					this.r = r;
					while (!r.ready())
						Thread.sleep(1);
					start();
				} catch (Exception e) {
					throw new Error(e);
				}
			}
			private String [] split(String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }
		}
		private static String build(Object o, Object... a) { return buildDelim(" ", o, a); }
		private static String buildDelim(String delim, Object o, Object... a) {
			StringBuilder b = new StringBuilder();
			append(b, o, delim);
			for (Object p : a)
				append(b, p, delim);
			return b.substring(delim.length());
		}
		//////////////////////////////////////////////////////////////////////////////////
		private static void start() { if (t == 0) t = millis(); }
		private static void append(StringBuilder b, Object o, String delim) {
			if (o.getClass().isArray()) {
				int len = java.lang.reflect.Array.getLength(o);
				for (int i = 0; i < len; ++i)
					append(b, java.lang.reflect.Array.get(o, i), delim);
			} else if (o instanceof Iterable<?>)
				for (Object p : (Iterable<?>) o)
					append(b, p, delim);
			else {
				if (o instanceof Double)
					o = new DecimalFormat("#.############").format(o);
				b.append(delim).append(o);
			}
		}
		private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);
		private static void print(Object o, Object ...a) { pw.println(build(o, a)); }
		private static void err(Object o, Object ...a) { System.err.println(build(o, a)); }
		private static void exit() {
			IOUtils.pw.close();
			System.out.flush();
			err("------------------");
			err(IOUtils.time());
			System.exit(0);
		}
		private static long t;
		private static long millis() { return System.currentTimeMillis(); }
		private static String time() { return "Time: " + (millis() - t) / 1000.0; }
	}
	public static void main (String[] args) { new C(); exit(); }
}

import static java.lang.Math.*;

import java.text.*;

//@SuppressWarnings("unused")
public class C {

	public C () {
		Integer [] A = sc.nextInts();
		int [] B = new int [] { 1, 1, 2, 7, 4 };
		int res = INF;
		for (int i : rep(5))
			res = min(res, A[i] - B[i]);
		exit(res);
	}

	private static final int INF = (int) 1e9;
	private static int [] rep(int N) { return rep(0, N); }
	private static int [] rep(int S, int T) { if (T <= S) return new int [0]; int [] res = new int [T-S]; for (int i = S; i < T; ++i) res[i-S] = i; return res; }
	////////////////////////////////////////////////////////////////////////////////////
	private final static IOUtils.MyScanner sc = new IOUtils.MyScanner();
	private static void print (Object o, Object ...a) { IOUtils.print(o, a); }
	private static void exit (Object o, Object ...a) { print(o, a); exit(); }
	private static void exit() { IOUtils.exit(); }
	private static class IOUtils {
		public static class MyScanner {
			public String nextLine() { return readLine(); }
			public String [] nextStrings() { return split(nextLine()); }
			public Integer [] nextInts() {
				String [] L = nextStrings();
				Integer [] res = new Integer [L.length];
				for (int i = 0; i < L.length; ++i)
					res[i] = Integer.parseInt(L[i]);
				return res;
			}
			private String readLine() {
				try {
					return r.readLine();
				} catch (Exception e) {
					throw new Error (e);
				}
			}
			private final java.io.BufferedReader r;
			private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
			private MyScanner (java.io.BufferedReader r) {
				try {
					this.r = r;
					while (!r.ready())
						Thread.sleep(1);
					start();
				} catch (Exception e) {
					throw new Error(e);
				}
			}
			private String [] split(String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }
		}
		private static String build(Object o, Object... a) { return buildDelim(" ", o, a); }
		private static String buildDelim(String delim, Object o, Object... a) {
			StringBuilder b = new StringBuilder();
			append(b, o, delim);
			for (Object p : a)
				append(b, p, delim);
			return b.substring(delim.length());
		}
		//////////////////////////////////////////////////////////////////////////////////
		private static void start() { if (t == 0) t = millis(); }
		private static void append(StringBuilder b, Object o, String delim) {
			if (o.getClass().isArray()) {
				int len = java.lang.reflect.Array.getLength(o);
				for (int i = 0; i < len; ++i)
					append(b, java.lang.reflect.Array.get(o, i), delim);
			} else if (o instanceof Iterable<?>)
				for (Object p : (Iterable<?>) o)
					append(b, p, delim);
			else {
				if (o instanceof Double)
					o = new DecimalFormat("#.############").format(o);
				b.append(delim).append(o);
			}
		}
		private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);
		private static void print(Object o, Object ...a) { pw.println(build(o, a)); }
		private static void err(Object o, Object ...a) { System.err.println(build(o, a)); }
		private static void exit() {
			IOUtils.pw.close();
			System.out.flush();
			err("------------------");
			err(IOUtils.time());
			System.exit(0);
		}
		private static long t;
		private static long millis() { return System.currentTimeMillis(); }
		private static String time() { return "Time: " + (millis() - t) / 1000.0; }
	}
	public static void main (String[] args) { new C(); exit(); }
}

import static java.lang.Math.*;

import java.text.*;

public class C {

	public C () {
		Integer [] A = sc.nextInts();
		int res = 0;

		exit(A.length / 5);
		for (int a : A) {
			//			int c = 0;
			//			if (a % 10 == 9)
			//				++c;
			//			switch(a/10) {
			//			case 0: c += 0; break;
			//			case 1: c += 1; break;
			//			case 2: c += 2; break;
			//			case 3: c += 3; break;
			//			case 4: c += 1; break;
			//			case 5: c += 0; break;
			//			case 6: c += 1; break;
			//			case 7: c += 2; break;
			//			case 8: c += 3; break;
			//			case 9: c += 1; break;
			//			case 10: c += 0; break;
			//			}
			//			if (c > 0) c = 1;
			//			res += c;
			if (a >= 10 && a < 50)
				++res;
		}
		exit(res);
	}

	////////////////////////////////////////////////////////////////////////////////////
	private final static IOUtils.MyScanner sc = new IOUtils.MyScanner();
	private static void print (Object o, Object ...a) { IOUtils.print(o, a); }
	private static void exit (Object o, Object ...a) { print(o, a); exit(); }
	private static void exit() { IOUtils.exit(); }
	private static class IOUtils {
		public static class MyScanner {
			public String nextLine() { return readLine(); }
			public String [] nextStrings() { return split(nextLine()); }
			public Integer [] nextInts() {
				String [] L = nextStrings();
				Integer [] res = new Integer [L.length];
				for (int i = 0; i < L.length; ++i)
					res[i] = Integer.parseInt(L[i]);
				return res;
			}
			private String readLine() {
				try {
					return r.readLine();
				} catch (Exception e) {
					throw new Error (e);
				}
			}
			private final java.io.BufferedReader r;
			private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
			private MyScanner (java.io.BufferedReader r) {
				try {
					this.r = r;
					while (!r.ready())
						Thread.sleep(1);
					start();
				} catch (Exception e) {
					throw new Error(e);
				}
			}
			private String [] split(String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }
		}
		private static String build(Object o, Object... a) { return buildDelim(" ", o, a); }
		private static String buildDelim(String delim, Object o, Object... a) {
			StringBuilder b = new StringBuilder();
			append(b, o, delim);
			for (Object p : a)
				append(b, p, delim);
			return b.substring(delim.length());
		}
		//////////////////////////////////////////////////////////////////////////////////
		private static void start() { if (t == 0) t = millis(); }
		private static void append(StringBuilder b, Object o, String delim) {
			if (o.getClass().isArray()) {
				int len = java.lang.reflect.Array.getLength(o);
				for (int i = 0; i < len; ++i)
					append(b, java.lang.reflect.Array.get(o, i), delim);
			} else if (o instanceof Iterable<?>)
				for (Object p : (Iterable<?>) o)
					append(b, p, delim);
			else {
				if (o instanceof Double)
					o = new DecimalFormat("#.############").format(o);
				b.append(delim).append(o);
			}
		}
		private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);
		private static void print(Object o, Object ...a) { pw.println(build(o, a)); }
		private static void err(Object o, Object ...a) { System.err.println(build(o, a)); }
		private static void exit() {
			IOUtils.pw.close();
			System.out.flush();
			err("------------------");
			err(IOUtils.time());
			System.exit(0);
		}
		private static long t;
		private static long millis() { return System.currentTimeMillis(); }
		private static String time() { return "Time: " + (millis() - t) / 1000.0; }
	}
	public static void main (String[] args) { new C(); exit(); }
}

import java.text.*;

public class C {

	public C () {
		Integer [] A = sc.nextInts();
		int res = 0;

		for (int a : A) {
			if (a % 10 == 9)
				++res;
			switch(a/10) {
			case 0: res += 0; break;
			case 1: res += 1; break;
			case 2: res += 2; break;
			case 3: res += 3; break;
			case 4: res += 1; break;
			case 5: res += 0; break;
			case 6: res += 1; break;
			case 7: res += 2; break;
			case 8: res += 3; break;
			case 9: res += 1; break;
			case 20: res += 0; break;
			}
		}
		exit(res);
	}

	////////////////////////////////////////////////////////////////////////////////////
	private final static IOUtils.MyScanner sc = new IOUtils.MyScanner();
	private static void print (Object o, Object ...a) { IOUtils.print(o, a); }
	private static void exit (Object o, Object ...a) { print(o, a); exit(); }
	private static void exit() { IOUtils.exit(); }
	private static class IOUtils {
		public static class MyScanner {
			public String nextLine() { return readLine(); }
			public String [] nextStrings() { return split(nextLine()); }
			public Integer [] nextInts() {
				String [] L = nextStrings();
				Integer [] res = new Integer [L.length];
				for (int i = 0; i < L.length; ++i)
					res[i] = Integer.parseInt(L[i]);
				return res;
			}
			private String readLine() {
				try {
					return r.readLine();
				} catch (Exception e) {
					throw new Error (e);
				}
			}
			private final java.io.BufferedReader r;
			private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
			private MyScanner (java.io.BufferedReader r) {
				try {
					this.r = r;
					while (!r.ready())
						Thread.sleep(1);
					start();
				} catch (Exception e) {
					throw new Error(e);
				}
			}
			private String [] split(String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }
		}
		private static String build(Object o, Object... a) { return buildDelim(" ", o, a); }
		private static String buildDelim(String delim, Object o, Object... a) {
			StringBuilder b = new StringBuilder();
			append(b, o, delim);
			for (Object p : a)
				append(b, p, delim);
			return b.substring(delim.length());
		}
		//////////////////////////////////////////////////////////////////////////////////
		private static void start() { if (t == 0) t = millis(); }
		private static void append(StringBuilder b, Object o, String delim) {
			if (o.getClass().isArray()) {
				int len = java.lang.reflect.Array.getLength(o);
				for (int i = 0; i < len; ++i)
					append(b, java.lang.reflect.Array.get(o, i), delim);
			} else if (o instanceof Iterable<?>)
				for (Object p : (Iterable<?>) o)
					append(b, p, delim);
			else {
				if (o instanceof Double)
					o = new DecimalFormat("#.############").format(o);
				b.append(delim).append(o);
			}
		}
		private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);
		private static void print(Object o, Object ...a) { pw.println(build(o, a)); }
		private static void err(Object o, Object ...a) { System.err.println(build(o, a)); }
		private static void exit() {
			IOUtils.pw.close();
			System.out.flush();
			err("------------------");
			err(IOUtils.time());
			System.exit(0);
		}
		private static long t;
		private static long millis() { return System.currentTimeMillis(); }
		private static String time() { return "Time: " + (millis() - t) / 1000.0; }
	}
	public static void main (String[] args) { new C(); exit(); }
}

import static java.lang.Math.*;

import java.text.*;

//@SuppressWarnings("unused")
public class C {

	public C () {
		Integer [] A = sc.nextInts();
		int [] B = new int [] { 1, 1, 2, 7, 4 };
		int res = INF;
		for (int i : rep(5))
			res = min(res, abs(A[i] - B[i]));
		exit(res);
	}

	private static final int INF = (int) 1e9;
	private static int [] rep(int N) { return rep(0, N); }
	private static int [] rep(int S, int T) { if (T <= S) return new int [0]; int [] res = new int [T-S]; for (int i = S; i < T; ++i) res[i-S] = i; return res; }
	////////////////////////////////////////////////////////////////////////////////////
	private final static IOUtils.MyScanner sc = new IOUtils.MyScanner();
	private static void print (Object o, Object ...a) { IOUtils.print(o, a); }
	private static void exit (Object o, Object ...a) { print(o, a); exit(); }
	private static void exit() { IOUtils.exit(); }
	private static class IOUtils {
		public static class MyScanner {
			public String nextLine() { return readLine(); }
			public String [] nextStrings() { return split(nextLine()); }
			public Integer [] nextInts() {
				String [] L = nextStrings();
				Integer [] res = new Integer [L.length];
				for (int i = 0; i < L.length; ++i)
					res[i] = Integer.parseInt(L[i]);
				return res;
			}
			private String readLine() {
				try {
					return r.readLine();
				} catch (Exception e) {
					throw new Error (e);
				}
			}
			private final java.io.BufferedReader r;
			private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
			private MyScanner (java.io.BufferedReader r) {
				try {
					this.r = r;
					while (!r.ready())
						Thread.sleep(1);
					start();
				} catch (Exception e) {
					throw new Error(e);
				}
			}
			private String [] split(String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }
		}
		private static String build(Object o, Object... a) { return buildDelim(" ", o, a); }
		private static String buildDelim(String delim, Object o, Object... a) {
			StringBuilder b = new StringBuilder();
			append(b, o, delim);
			for (Object p : a)
				append(b, p, delim);
			return b.substring(delim.length());
		}
		//////////////////////////////////////////////////////////////////////////////////
		private static void start() { if (t == 0) t = millis(); }
		private static void append(StringBuilder b, Object o, String delim) {
			if (o.getClass().isArray()) {
				int len = java.lang.reflect.Array.getLength(o);
				for (int i = 0; i < len; ++i)
					append(b, java.lang.reflect.Array.get(o, i), delim);
			} else if (o instanceof Iterable<?>)
				for (Object p : (Iterable<?>) o)
					append(b, p, delim);
			else {
				if (o instanceof Double)
					o = new DecimalFormat("#.############").format(o);
				b.append(delim).append(o);
			}
		}
		private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);
		private static void print(Object o, Object ...a) { pw.println(build(o, a)); }
		private static void err(Object o, Object ...a) { System.err.println(build(o, a)); }
		private static void exit() {
			IOUtils.pw.close();
			System.out.flush();
			err("------------------");
			err(IOUtils.time());
			System.exit(0);
		}
		private static long t;
		private static long millis() { return System.currentTimeMillis(); }
		private static String time() { return "Time: " + (millis() - t) / 1000.0; }
	}
	public static void main (String[] args) { new C(); exit(); }
}

import static java.lang.Math.*;
import static java.math.BigInteger.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

import java.io.*;
import java.text.*;
import java.util.*;
import java.util.Map.Entry;

@SuppressWarnings("unused")
public class C {

	public C () {
		exit(1);
	}

	///////////////////////////////////////////////////////////////////////////
	private static final double eps = 1e-9;
	private static final int INF = (int) 1e9;
	private static final long LINF = (long) 1e18;
	private static final double DINF = 1e50;
	private static final int MOD = (int) 1e9 + 7;
	///////////////////////////////////////////////////////////////////////////
	private static <K, V> void add(Map<K, List<V>> map, K key, V value) {
		if (!map.containsKey(key))
			map.put(key, new ArrayList<V>());
		map.get(key).add(value);
	}
	private static Integer [] cc (Integer [][] E, int N) {
		Integer [] res = singletons(N);
		dsu(E, 0, E.length, res);
		for (int i = 0; i < N; ++i)
			res[i] = root(res, i);
		return res;
	}
	private static int [] ccw (int [] D) { return new int [] { -D[1], D[0] }; }
	private static long ceil(double x) { return round(Math.ceil(x - eps)); }
	private static long ceil (long p, long q) { return fc(p, q, true); }
	private static double [] cross (double [] X, double [] Y) { assert X.length <= 3 && Y.length <= 3; X = copyOf(X, 3); Y = copyOf(Y, 3); return new double [] { X[1]*Y[2] - Y[1]*X[2], X[2]*Y[0] - Y[2]*X[0], X[0]*Y[1] - Y[0]*X[1] }; }
	private static int [] cw (int [] D) { return new int [] { D[1], -D[0] }; }
	private static Integer [] dec(Integer [] A) {
		for (int i = 0; i < A.length; ++i)
			--A[i];
		return A;
	}
	private static Integer [][] dec(Integer [][] E) {
		for (Integer [] e : E)
			for (int i = 0; i < e.length; ++i)
				--e[i];
		return E;
	}
	private static <T> T [] deepClone(T [] a) {
		try {
			ByteArrayOutputStream bout = new ByteArrayOutputStream();
			ObjectOutputStream  out = new ObjectOutputStream(bout);
			out.writeObject(a);
			ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
			ObjectInputStream in = new ObjectInputStream(bin);
			@SuppressWarnings("unchecked") T [] res = (T[]) in.readObject();
			return res;
		} catch (Exception e) {
			throw new Error(e);
		}
	}
	private static double [] diff (double [] X, double [] Y) { return sum(X, scalar(-1, Y)); }
	private static int [] digits(long N, int B, int sz) {
		int [] res = new int [sz];
		for (int i = sz - 1; i >= 0; --i)
			if (N > 0) {
				res[i] = (int)(N % B);
				N /= B;
			}
		return res;
	}
	private static int digitSum(long N) {
		int res = 0;
		for (; N > 0; res += N % 10, N /= 10);
		return res;
	}
	private static double dist (double [] X, double [] Y) { return norm(diff(X, Y)); }
	private static double dot(double [] X, double [] Y) { double res = 0; for (int i = 0; i < min(X.length, Y.length); ++i) res += X[i] * Y[i]; return res; }
	private static int dsu(Integer [][] E, int s, int t, Integer [] C) {
		int res = 0;
		for (int i = s; i < t; ++i) {
			Integer [] e = E[i];
			int u = root(C, e[0] - 1), v = root(C, e[1] - 1);
			if (u != v)
				++res;
			C[u] = C[v];
		}
		return res;
	}
	private static long [] envelope(long [] f, Long [] c) {
		int N = f.length;
		long [] res = new long [N]; res[0] = f[0];
		int [] T = new int [N]; int Z = 0;
		for (int i = 1, k = 0; i < N; ++i) {
			for (;;)
				if (Z > 0 && (f[i] - f[T[Z]]) * (T[Z] - T[Z-1]) <=  (f[T[Z]] - f[T[Z-1]]) * (i - T[Z]))
					--Z;
				else {
					T[++Z] = i;
					break;
				}

			k = min(k, Z);
			for (; k < Z && (f[T[k+1]] - f[T[k]]) <= c[i] * (T[k+1] - T[k]); ++k);
			res[i] = f[T[k]] - c[i] * T[k];
		}
		return res;
	}
	private static boolean eq(double x, double y) { return abs(x - y) < eps; }
	private static long [] fact(int N) {
		long [] res = new long [N+1];
		res[0] = 1;
		for (int i = 1; i <= N; ++i)
			res[i] = res[i-1] * i;
		return res;
	}
	private static long fc(long p, long q, boolean up) {
		if (up) {
			if (q < 0) return fc(-p, -q, true);
			else if (p < 0) return -fc(-p, q, false);
			else return (p+q-1) / q;
		} else if (q < 0) return fc(-p, -q, false);
		else if (p < 0) return -fc(-p, q, true);
		else return p / q;
	}
	private static long floor(double x) { return round(Math.floor(x + eps)); }
	private static long floor(long p, long q) { return fc(p, q, false); }
	private static <T extends Comparable<T>> int fmax(T [] A) { return fmax(A, 0, A.length); }
	private static <T extends Comparable<T>> int fmax(T [] A, int s, int t) {
		int res = s;
		for (int i = s; i < t; ++i)
			if (A[i].compareTo(A[res]) > 0)
				res = i;
		return res;
	}
	private static int [] freq(int [] A, int N) {
		int [] res = new int [N];
		for (int i = 0; i < A.length; ++i)
			++res[A[i]];
		return res;
	}
	private static boolean [][] fw(boolean [][] G) {
		int N = G.length;
		for (int k = 0; k < N; ++k)
			for (int i = 0; i < N; ++i)
				for (int j = 0; j < N; ++j)
					G[i][j] = G[i][j] || (G[i][k] && G[k][j]);
		return G;
	}
	private static long [][] fw(long [][] G) {
		int N = G.length;
		for (int k = 0; k < N; ++k)
			for (int i = 0; i < N; ++i)
				for (int j = 0; j < N; ++j)
					G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
		return G;
	}
	private static long gcd(long x, long y) { return valueOf(x).gcd(valueOf(y)).longValue(); }
	private static boolean geq(double x, double y) { return x > y - eps; }
	private static int [][] graph (int N, Integer [][] E) { return wgraph(N, E)[0]; }
	private static boolean greater(double x, double y) { return x > y + eps; }
	private static int [] inc(int ... a) {
		for (int i = 0; i < a.length; ++i)
			++a[i];
		return a;
	}
	private static boolean integer(double x) { return eq(x, floor(x)); }
	private static Integer [] invert(Integer [] J) {
		int N = J.length;
		Integer [] res = new Integer [N];
		for (int i = 0; i < N; ++i)
			res[J[i]] = i;
		return res;
	}
	private static long [][] islands(int N) {
		long [][] res = new long [N][N];
		for (long [] r : res)
			fill(r, LINF);
		for (int i = 0; i < N; ++i)
			res[i][i] = 0;
		return res;
	}
	private static boolean leq(double x, double y) { return x < y + eps; }
	private static boolean less(double x, double y) { return  x < y - eps; }
	private static int [][] manacher(char [] C, char separator) {
		int N = C.length, M = 2*N+1;
		char [] D = new char [M]; fill(D, separator);
		for (int i = 0; i < N; ++i)
			D[2*i+1] = C[i];
		int [] L = new int [M];
		int c = 0, r = 0;
		int m = 0, n = 0;
		for (int i = 1; i < M; i++) {
			if (i > r) {
				L[i] = 0; m = i-1; n = i+1;
			} else {
				int j = 2*c - i;
				if (L[j] < (r-i)) {
					L[i] = L[j];
					m = -1;
				} else {
					L[i] = r-i;
					n = r+1; m = 2*i - n;
				}
			}
			while (m >= 0 && n < M && D[m] == D[n]) {
				++L[i]; --m; ++n;
			}
			if ((i + L[i]) > r) {
				c = i; r = i + L[i];
			}
		}
		int [][] res = new int [2][N];
		for (int i = 0; i < N; ++ i) {
			res[0][i] = L[2*i+2];
			res[1][i] = L[2*i+1];
		}
		return res;
	}
	private static <T extends Comparable<T>> T maximum(T x, T y) { return x.compareTo(y) > 0 ? x : y; }
	private static <T extends Comparable<T>> T maximum(@SuppressWarnings("unchecked") T ... A) { return A[fmax(A)]; }
	private static <T extends Comparable<T>> T minimum(T x, T y) { return x.compareTo(y) < 0 ? x : y; }
	private static long mod(long x) { return mod(x, MOD); }
	private static long mod(long x, long mod) { return ((x % mod) + mod) % mod; }
	private static long [][] modBin(int N, int K) {
		long [][] res = new long [N+1][K+1];
		for (int n = 0; n <= N; ++n) {
			res[n][0] = 1;
			for (int k = 1; k <= K && k <= n; ++k)
				res[n][k] = mod(res[n-1][k] + res[n-1][k-1]);
		}
		return res;
	}
	private static long [] modFact(int N) {
		long [] res = new long [N]; res[0] = 1;
		for (int i = 1; i < N; ++i)
			res[i] = mod(res[i-1] * i);
		return res;
	}
	private static long modInv(long x) { return modPow(x, -1); }
	private static long modPow(long b, long e) { return valueOf(b).modPow(valueOf(e), valueOf(MOD)).longValue(); }
	private static <T> T [] newArray(T [] A, int N) {
		T [] res = copyOf(A, N);
		fill(res, null);
		return res;
	}
	private static double norm (double ...X) { return sqrt(dot(X, X)); }
	private static double [] normalize(double ...X) { return eq(norm(X), 0) ? X : scalar(1/norm(X), X); }
	private static <T> boolean palindrome(T X) {
		char [] C = X.toString().toCharArray();
		int N = C.length;
		for (int i = 0; 2*i <= N; ++i)
			if (C[i] != C[N-i-1])
				return false;
		return true;
	}
	private static int [][] permutations(int N) {
		if (N == 1)
			return new int [][] {{ 0 }};

		int [][] P = permutations(N-1);

		int [][] Q = new int[N * P.length][N];
		for (int i = 0, n = 0; i < P.length; ++i)
			for (int j = 0; j < N; ++j, ++n) {
				for (int k = 0; k < N-1; ++k) {
					int x = P[i][k];
					Q[n][k] = x < j ? x : x+1;
				}
				Q[n][N-1] = j;
			}
		return Q;
	}
	private static <T> T [] permute(T [] A, Integer [] J) {
		T [] res = A.clone();
		for (int i = 0; i < J.length; ++i)
			res[i] = A[J[i]];
		return res;
	}
	private static long pow (long b, int e) { return valueOf(b).pow(e).longValue(); }
	private static int [] prefixFunction(char [] C) {
		int [] res = new int [C.length];
		prefixFunction(C, C, res, 0);
		return res;
	}
	private static void prefixFunction(char [] C, char [] P, int [] F, int i) {
		int j = i > 0 ? F[i-1] : 0;
		for (int k = 0; k < C.length; ++k)
			if (i+k > 0) {
				while (j > 0 && C[k] != P[j])
					j = F[j-1];
				if (C[k] == P[j])
					++j;
				F[i+k] = j;
			}
	}
	private static boolean prime(long N) { return valueOf(N).isProbablePrime(50); }
	private static Long [] primeFactorization(long N) {
		List<Long> res = new ArrayList<Long>();
		for (long p = 2; p*p <= N; ++p)
			while (N % p == 0) {
				res.add(p);
				N /= p;
			}
		if (N > 1)
			res.add(N);
		return res.toArray(new Long[0]);
	}
	private static Integer [] primes(int N) {
		boolean [] C = new boolean [N+1];
		int Q = (int)floor(sqrt(N));
		for (int p = 3; p <= Q; p += 2)
			if (!C[p]) {
				int R = N/p;
				for (int j = p; j <= R; ++j)
					C[j*p] = true;
			}
		List<Integer> res = new ArrayList<Integer>();
		if (N >= 2)
			res.add(2);
		for (int p = 3; p <= N; p += 2)
			if (!C[p])
				res.add(p);
		return res.toArray(new Integer[0]);
	}
	private static double [] project(double [] X, double [] K) { return diff(X, scalar(dot(X,K)/dot(K,K), K)); }
	private static long qnorm (long ...X) {
		long S = 0;
		for (long x : X)
			S += x*x;
		return S;
	}
	private static int [] rep(int N) { return rep(0, N); }
	private static int [] rep(int S, int T) { if (T <= S) return new int [0]; int [] res = new int [T-S]; for (int i = S; i < T; ++i) res[i-S] = i; return res; }
	private static int [] req(int N) { return req(0, N); }
	private static int [] req(int S, int T) { return rep(S, T+1); }
	private static String reverse (String S) { return new StringBuilder(S).reverse().toString(); }
	private static int root (Integer [] C, int s) {
		int res = s;
		while (C[res] != res)
			res = C[res];
		int v = s;
		while (v != res) {
			v = C[v];
			C[v] = res;
		}
		return C[s] = res;
	}
	private static double [] scalar (double c, double ...X) { double [] res = new double [X.length]; for (int i = 0; i < X.length; ++i) res[i] = c * X[i]; return res; }
	private static int [] sep(int N) { return sep(0, N); }
	private static int [] sep(int S, int T) { if (T <= S) return new int [0]; int [] res = new int [T-S]; for (int i = S; i < T; ++i) res[T-1-i] = i; return res; }
	private static int [] seq(int S, int T) { return sep(S, T+1); }
	private static <T> T [] shift(T [] A, int k) {
		int N = A.length;
		T [] res = newArray(A, N+k);
		System.arraycopy(A, 0, res, k, N);
		return res;
	}
	private static <T extends Comparable<T>> Integer [] si(final T [] X) { return si(X, reverseOrder(reverseOrder())); }
	private static <T> Integer [] si(final T [] X, final Comparator<T> C) {
		int N = X.length;
		Integer [] res = new Integer [N];
		for (int i = 0; i < N; ++i)
			res[i] = i;
		sort(res, new Comparator<Integer>() {
			public int compare(Integer i, Integer j) {
				int res = C.compare(X[i], X[j]);
				return res != 0 ? res : i.compareTo(j);
			}
		});
		return res;
	}
	private static Integer [] singletons(int N) {
		Integer [] res = new Integer [N];
		for (int i = 0; i < N; ++i)
			res[i] = i;
		return res;
	}
	private static <T> Queue<T> stack() { return asLifoQueue(new LinkedList<T>()); }
	private static double [] sum (double [] ...X) {
		int L = 0;
		for (double[] x : X)
			L = max(L, x.length);
		double [] res = new double [L];
		for (double[] x : X)
			for (int j = 0; j < x.length; ++j)
				res[j] += x[j];
		return res;
	}
	private static Character [] toObject(char ... A) { Character [] res = new Character [A.length];	for (int i = 0; i < A.length; ++i) res[i] = A[i]; return res; }
	private static Character [][] toObject(char [] ... A) { Character [][] res = new Character [A.length][]; for (int i = 0; i < A.length; ++i) res[i] = toObject(A[i]); return res; }
	private static Integer [] toObject(int ... A) { Integer [] res = new Integer [A.length]; for (int i = 0; i < A.length; ++i) res[i] = A[i]; return res; }
	private static double [] toPrimitive(Double ... A) { double [] res = new double [A.length]; for (int i = 0; i < A.length; ++i) res[i] = A[i]; return res; }
	private static double [][] toPrimitive(Double [] ... A) { double [][] res = new double [A.length][]; for (int i = 0; i < A.length; ++i) res[i] = toPrimitive(A[i]); return res; }
	private static char [][] toPrimitive(String [] S) {	char [][] res = new char [S.length][]; for (int i = 0; i < S.length; ++i) res[i] = S[i].toCharArray(); return res; }
	private static String toString(long x, int L) {
		long D = 1;
		for (int i = 0; i < L; ++i, D *= 10);
		String res = ("" + (D + x)).substring(1);
		return res;
	}
	private static <T> T [][] transpose(T [][] S) {
		int R = S.length, C = S[0].length;
		T [][] res = newArray(S, C);
		for (int i = 0; i < C; ++i) {
			res[i] = newArray(S[0], R);
			for (int j = 0; j < R; ++j)
				res[i][j] = S[j][i];
		}
		return res;
	}
	private static Integer [][] treeToEdges(Integer [] T) {
		Integer [][] res = new Integer [T.length][];
		for (int i = 0; i < T.length; ++i)
			res[i] = new Integer [] { T[i], i+2 };
		return res;
	}
	private static int [][] vtk(int [][] KV, int W) {
		int [] C = new int [W+1];
		for (int [] kv : KV)
			C[kv[1]]++;
		int [][] res = new int [W+1][];
		for (int v = 0; v <= W; ++v)
			res[v] = new int [C[v]];
		fill(C, 0);
		for (int [] kv : KV)
			res[kv[1]][C[kv[1]]++] = kv[0];
		return res;
	}
	private static <T> Map<T, Integer> vtk(@SuppressWarnings("unchecked") T ... A) {
		Map<T, Integer> res = new HashMap<>();
		for (int i = 0; i < A.length; ++i)
			res.put(A[i], i);
		return res;
	}
	private static int [][][] wgraph(int N, Integer [][] E) {
		int [] D = new int [N];
		for (Integer [] e : E) {
			int x = e[0] - 1, y = e[1] - 1;
			++D[x]; ++D[y];
		}
		int [][][] res = new int [2][N][];
		for (int i = 0; i < 2; ++i)
			for (int j = 0; j < N; ++j)
				res[i][j] = new int [D[j]];
		D = new int [N];
		for (Integer [] e : E) {
			int x = e[0] - 1, y = e[1] - 1, z = e.length > 2 ? e[2] : 1;
			res[0][x][D[x]] = y; res[0][y][D[y]] = x;
			res[1][x][D[x]] = res[1][y][D[y]] = z;
			++D[x]; ++D[y];
		}
		return res;
	}
	private static boolean zero(double ...X) { return eq(norm(X), 0); }
	private static int [] zFunction(char [] C) {
		int [] res = new int [C.length];
		int L = 0, R = 1;
		for (int i = 1; i < C.length; ++i) {
			if (i < R) {
				res[i] = min(res[i-L], R-i);
				if (res[i] == R-i)
					for (int j = 0; R+j < C.length && C[R+j] == C[R-i+j]; ++j, ++res[i]);
			} else
				for (int j = 0; i+j < C.length && C[i+j] == C[j]; ++j, ++res[i]);
			if (res[i] >= R-i) {
				L = i;
				R = i + res[i];
			}
		}
		return res;
	}
	////////////////////////////////////////////////////////////////////////////////////
	private static class AhoCorasick {
		private static class Node {
			final String val; boolean in; Node sf, dsf;
			final Map<Character, Node> ch = new HashMap<>();
			Node(String val) { this.val = val; }
			String suffix(char c) {
				if (ch.containsKey(c))
					return ch.get(c).val;
				else if (sf != null)
					return sf.suffix(c);
				else
					return "";
			}
			void words(Collection<String> C) {
				if (in)
					C.add(val);
				if (dsf != null)
					dsf.words(C);
			}
		}
		private final Map<String, Node> all = new HashMap<String, Node>();
		private final Node root = new Node("");
		public AhoCorasick(String [] W) {
			all.put(root.val, root);
			for (String w : W) {
				Node p = root;
				for (int i = 1; i < w.length(); ++i) {
					Node q = get(w.substring(0, i));
					p.ch.put(w.charAt(i-1), q);
					p = q;
				}
				p.ch.put(w.charAt(w.length() - 1), get(w));
				get(w).in = true;
			}
			for (Node p : all.values()) {
				String v = p.val;
				while (p.sf == null && v.length() > 0) {
					v = v.substring(1);
					p.sf = all.get(v);
				}
				if (p.sf != null && p.sf.in)
					p.dsf = p.sf;
				while (p.dsf == null && v.length() > 0) {
					v = v.substring(1);
					Node q = all.get(v);
					if (q != null && q.in)
						p.dsf = q;
				}
			}
		}
		public String [] prefixes() { return all.keySet().toArray(new String [0]); }
		public String suffix(String p, char c) { return all.get(p).suffix(c); }
		public String [] words(String p) {
			List<String> res = new ArrayList<>();
			all.get(p).words(res);
			return res.toArray(new String [0]);
		}
		private Node get(String v) {
			if (!all.containsKey(v))
				all.put(v, new Node(v));
			return all.get(v);
		}
	}
	private static class Circle {
		public final double [] C;
		public final double R;
		public static final Circle R2 = new Circle(new double [2], DINF);
		public Circle(double [] C, double R) { this.C = C; this.R = R; }
		public static Circle toCircumference(double [] ...X) {
			assert X.length > 0 && X.length <= 3;
			switch(X.length) {
			case 1: return new Circle(X[0], 0);
			case 2: return new Circle(scalar(.5, sum(X)), .5 * dist(X[0], X[1]));
			case 3: return	calc(X[0], X[1], X[2]);
			default: throw new Error();
			}
		}
		public static Circle toCircle(double [] ...X) {
			assert X.length > 0; shuffle(asList(X));
			return welzl(X, X.length, new double[3][], 0);
		}
		private static Circle calc(double [] X, double [] Y, double [] Z) {
			assert X.length == 2 && Y.length == 2 && Z.length == 2;
			boolean u = eq(X[0], Y[0]), v = eq(Y[0], Z[0]);
			if (u && v) return R2;
			else if (u) return calc(Y, Z, X);
			else if (v) return calc(Z, X, Y);
			else {
				double U = (Y[1] - X[1]) / (Y[0] - X[0]);
				double V = (Z[1] - Y[1]) / (Z[0] - Y[0]);
				if (eq(U, V)) return R2;
				if (eq(U, 0)) return calc(Z, Y, X);
				double CX = (U * V * (X[1] - Z[1]) + V * (X[0] + Y[0]) - U * (Y[0] + Z[0])) / (2 * (V - U));
				double CY = ((X[0] + Y[0]) / 2 - CX) / U + (X[1] + Y[1]) / 2;
				double [] C = new double [] { CX, CY };
				double R = dist(C, X); assert eq(dist(C, Y), R) && eq(dist(C, Z), R);
				return new Circle(C, R);
			}
		}
		private static Circle welzl(double [][] X, int N, double [][] S, int K) {
			if (K == 3) return Circle.toCircumference(S);
			else if (K == 0 && N == 1) return new Circle(X[0], 0);
			else if (K == 1 && N == 1) return Circle.toCircumference(S[0], X[0]);
			else if (K == 2 && N == 0) return Circle.toCircumference(S[0], S[1]);
			else {
				Circle C = welzl(X, N-1, S, K);
				if (greater(dist(C.C, X[N-1]), C.R)) {
					S[K++] = X[N-1];
					C = welzl(X, N-1, S, K);
				}
				return C;
			}
		}
		public String toString() { Map<String, Object> M = new HashMap<>(); M.put("C", Arrays.toString(C)); M.put("R", R); return M.toString(); }
	}
	private static class Fenwick {
		private final long [] X;
		public Fenwick(int N) { X = new long [N]; }
		public void add(long x, int i) {
			++i; assert i <= X.length;
			while (i <= X.length) {
				X[i-1] += x; // MOD?
				i += (i & (-i));
			}
		}
		public long get(int to) {
			assert to <= X.length;
			long res = 0;
			for (; to > 0; res += X[to-1], to -= (to & (-to)));
			return res;
		}
	}
	private static class LCA {
		private int [][] P;
		private int [] L, T;
		private int N, G;
		public LCA(int [] T) {
			this.T = T;
			N = T.length; G = Integer.numberOfTrailingZeros(Integer.highestOneBit(2*N));
			L = new int [N]; fill(L, -1);
			for (int i = 0; i < N; ++i)
				level(i);
			P = new int [N][G];
			for (int i = 0; i < N; ++i)
				for (int j = 0; 1 << j < N; ++j)
					P[i][j] = -1;
			for (int i = 0; i < N; ++i)
				P[i][0] = T[i];
			for (int j = 1; (1 << j) < N; ++j)
				for (int i = 0; i < N; ++i)
					if (P[i][j - 1] != -1)
						P[i][j] = P[P[i][j - 1]][j - 1];
		}
		public int query(int p, int q) {
			if (L[p] < L[q])
				return query(q, p);
			int log; for (log = 1; (1 << log) <= L[p]; ++log); --log;
			for (int i = log; i >= 0; --i)
				if (L[p] - (1 << i) >= L[q])
					p = P[p][i];
			if (p == q)
				return p;
			for (int i = log; i >= 0; --i)
				if (P[p][i] != -1 && P[p][i] != P[q][i]) {
					p = P[p][i]; q = P[q][i];
				}
			return T[p];
		}
		private int level(int i) {
			if (T[i] == i)
				L[i] = 0;
			else if (L[i] == -1)
				L[i] = 1 + level(T[i]);
			return L[i];
		}
	}
	private static class MatrixRangeSum {
		private final long [][] S;
		public long get(int r1, int c1, int r2, int c2) { return S[r2][c2] - S[r1][c2] - S[r2][c1] + S[r1][c1]; }
		public MatrixRangeSum (long [][] A) {
			int R = A.length, C = A[0].length;
			S = new long [R+1][C+1];
			for (int i = 1; i <= R; ++i)
				for (int j = 1; j <= C; ++j)
					S[i][j] = S[i-1][j] + S[i][j-1] - S[i-1][j-1] + A[i-1][j-1];
		}
	}
	private static class Rodrigues {
		private final double [] K, T;
		public Rodrigues(double ... A) {
			assert A.length <= 3; A = copyOf(A, 3);
			K = normalize(new double [] { -A[1], A[0] }); double [] L = new double [] { K[1], -K[0] };
			if (!zero(K)) {
				double [] V = new double [3];
				while (zero(V))
					V = project(project(new double [] { random(), random(), random() }, A), K);
				T = normalize(new double [] { dot(L, V), V[2] });
			} else
				T = null;
		}
		public double [] rotate(double ... X) {
			assert X.length <= 3; X = copyOf(X, 3);
			if (T != null) {
				double [] Y = scalar(T[0], X);
				Y = sum(Y, scalar(T[1], cross(K, X)));
				X = sum(Y, scalar(dot(K, X) * (1 - T[0]), K));
			}
			assert eq(X[2], 0);
			return copyOf(X, 2);
		}
	}
	private static class RootedTree {
		final int [] J, D, H;
		RootedTree (int [][] F) {
			int N = F.length;
			int [][] G = new int [N][];
			J = new int [N];
			D = new int [N];
			H = new int [N];
			java.util.Arrays.fill(J, -1);
			int [] C = new int [N], E = new int [N], Q = new int [N];
			int L = 1, K = 0;
			while (L > 0) {
				int q = Q[--L];
				J[q] = K;
				D[K++] = E[q];
				for (int i = 0; i < F[q].length; ++i)
					if (J[F[q][i]] == -1) {
						J[F[q][i]] = -2;
						E[F[q][i]] = 1 + E[q];
						Q[L++] = F[q][i];
					} else
						F[q][i] = -1;
			}
			for (int i = 0; i < N; ++i) {
				for (int j : F[i])
					if (j != -1)
						++C[i];
				G[J[i]] = new int [C[i]];
				for (int j = 0, k = 0; j < F[i].length; ++j)
					if (F[i][j] != -1)
						G[J[i]][k++] = J[F[i][j]];
			}
			int M = 1;
			L = 1;
			Q[0] = 0;
			while (L > 0) {
				int q = Q[--L];
				if (q >= 0) {
					Q[L++] = -(q+1);
					for (int i = 0; i < G[q].length; ++i)
						Q[L++] = G[q][i];
				} else {
					q = -(q+1);
					H[q] = M = max(M, q+1);
				}
			}
		}
	}
	private static class SetNode {
		private final SetNode L, R;
		private final int from, to, m;
		private final Object NO_VALUE;
		private Object X = null;
		private SetNode(int from, int to, Object NO_VALUE) {
			assert(from < to);
			this.NO_VALUE = NO_VALUE;
			this.from = from;
			this.to = to;
			m = (from + to) / 2;
			if (m > from) {
				L = new SetNode(from, m, NO_VALUE);
				R = new SetNode(m, to, NO_VALUE);
			} else
				L = R = null;
		}
		private void set(Object X, int from, int to) {
			assert(from >= this.from && to <= this.to && from < to);
			if (from == this.from && to == this.to)
				this.X = X;
			else {
				dfs(this.X, this.from, from);
				dfs(X, from, to);
				dfs(this.X, to, this.to);
				this.X = NO_VALUE;
			}
		}
		private void dfs(Object X, int from, int to) {
			if (NO_VALUE.equals(X))
				return;
			if (from == to)
				return;
			if (from < m)
				L.set(X, from, min(to, m));
			if (to > m)
				R.set(X, max(from, m), to);
		}
		private Object get(int i) {
			assert(from <= i && i < to);
			Object res = null;
			if (!NO_VALUE.equals(X))
				res = X;
			else if (i < m)
				res = L.get(i);
			else if (i >= m && m > from)
				res = R.get(i);
			else
				assert false;
			return res;
		}
	}
	private static class SumNode {
		private final SumNode L, R;
		private final int from, to, m;
		private long X = 0;
		private SumNode(int from, int to) {
			assert(from < to);
			this.from = from;
			this.to = to;
			m = (from + to) / 2;
			if (m > from) {
				L = new SumNode(from, m);
				R = new SumNode(m, to);
			} else
				L = R = null;
		}
		private void add(long X, int from, int to) {
			assert(from >= this.from && to <= this.to && from < to);
			if (from == this.from && to == this.to)
				this.X += X;
			else {
				if (from < m)
					L.add(X, from, min(to, m));
				if (to > m)
					R.add(X, max(from, m), to);
			}
		}
		private long get(int i) {
			assert(from <= i && i < to);
			long res = X;
			if (i < m)
				res += L.get(i);
			if (i >= m && m > from)
				res += R.get(i);
			return res;
		}
	}
	private static class Tu {
		private static class ple<T extends Comparable<T>> implements Comparable<ple<T>> {
			public final T [] a;
			public ple(@SuppressWarnings("unchecked") T ... a) { this.a = a; }
			public int compareTo(ple<T> o) {
				if (a.length > o.a.length)
					return -o.compareTo(this);
				for (int i = 0; i < a.length; ++i)
					if (a[i].compareTo(o.a[i]) != 0)
						return a[i].compareTo(o.a[i]);
				return a.length - o.a.length;
			}
			@SuppressWarnings("unchecked") public boolean equals(Object o) { return Arrays.equals(a, ((ple<T>)o).a); }
			public int hashCode() { return Arrays.hashCode(a); };
			public String toString() { return Arrays.toString(a); }
		}
	}
	private static class XTreeMap<K> extends TreeMap<K, Long> {
		private static final long serialVersionUID = 1L;
		public void dec(K key) { dec(key, 1); }
		public void dec(K key, long value) { inc(key, -value); }
		public Entry<K, Long> fmax() {
			Entry<K, Long> res = null;
			for (Entry<K, Long> x : entrySet())
				if (res == null || x.getValue() > res.getValue())
					res = x;
			return res;
		}
		public Long get (Object key) { return containsKey(key) ? super.get(key) : 0; }
		public void inc(K key) { inc(key, 1); }
		public void inc(K key, long value) { put(key, get(key) + value); }
		public void maximum(K key, long value) { put(key, max(get(key), value)); }
		public Long put(K key, Long value) {
			if (value != 0)
				return super.put(key, value);
			else
				return remove(key);
		}
	}
	////////////////////////////////////////////////////////////////////////////////////
	private final static IOUtils.MyScanner sc = new IOUtils.MyScanner();
	private static void print (Object o, Object ...a) { IOUtils.print(o, a); }
	private static void clock(Object o, Object ...a) { err(IOUtils.time(), o, a); }
	private static void err(Object o, Object ...a) { IOUtils.err(o, a); }
	private static void exit (Object o, Object ...a) { print(o, a); exit(); }
	private static void exit() { IOUtils.exit(); }
	private static class IOUtils {
		public static class MyScanner {
			public String next() { newLine(); return line[index++]; }
			public char nextChar() { return next().charAt(0); }
			public int nextInt() { return Integer.parseInt(next()); }
			public long nextLong() { return Long.parseLong(next()); }
			public double nextDouble() { return Double.parseDouble(next()); }
			public String nextLine() { line = null; return readLine(); }
			public String [] nextStrings() { return split(nextLine()); }
			public char [] nextChars() { return next ().toCharArray (); }
			public Integer [] nextInts() {
				String [] L = nextStrings();
				Integer [] res = new Integer [L.length];
				for (int i = 0; i < L.length; ++i)
					res[i] = Integer.parseInt(L[i]);
				return res;
			}
			public Long [] nextLongs() {
				String [] L = nextStrings();
				Long [] res = new Long [L.length];
				for (int i = 0; i < L.length; ++i)
					res[i] = Long.parseLong(L[i]);
				return res;
			}
			public Double [] nextDoubles() {
				String [] L = nextStrings();
				Double [] res = new Double [L.length];
				for (int i = 0; i < L.length; ++i)
					res[i] = Double.parseDouble(L[i]);
				return res;
			}
			public String [] next (int N) {
				String [] res = new String [N];
				for (int i = 0; i < N; ++i)
					res[i] = next();
				return res;
			}
			public Integer [] nextInt (int N) {
				Integer [] res = new Integer [N];
				for (int i = 0; i < N; ++i)
					res[i] = nextInt();
				return res;
			}
			public Long [] nextLong (int N) {
				Long [] res = new Long [N];
				for (int i = 0; i < N; ++i)
					res[i] = nextLong();
				return res;
			}
			public Double [] nextDouble (int N) {
				Double [] res = new Double [N];
				for (int i = 0; i < N; ++i)
					res[i] = nextDouble();
				return res;
			}
			public String [] nextLine(int N) {
				String [] a = new String [N];
				for(int i = 0; i < N; ++i)
					a[i] = nextLine();
				return a;
			}
			public String [][] nextStrings (int N) {
				String [][] res = new String [N][];
				for (int i = 0; i < N; ++i)
					res[i] = nextStrings();
				return res;
			}
			public char [][] nextChars(int N) {
				char [][] res = new char [N][];
				for (int i = 0; i < N; ++i)
					res[i] = nextChars();
				return res;
			}
			public Integer [][] nextInts (int N) {
				Integer [][] res = new Integer [N][];
				for (int i = 0; i < N; ++i)
					res[i] = nextInts();
				return res;
			}
			public Long [][] nextLongs (int N) {
				Long [][] res = new Long [N][];
				for (int i = 0; i < N; ++i)
					res[i] = nextLongs();
				return res;
			}
			public Double [][] nextDoubles (int N) {
				Double [][] res = new Double [N][];
				for (int i = 0; i < N; ++i)
					res[i] = nextDoubles();
				return res;
			}
			//////////////////////////////////////////////
			private boolean eol() { return index == line.length; }
			private String readLine() {
				try {
					return r.readLine();
				} catch (Exception e) {
					throw new Error (e);
				}
			}
			private final java.io.BufferedReader r;
			private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
			private MyScanner (java.io.BufferedReader r) {
				try {
					this.r = r;
					while (!r.ready())
						Thread.sleep(1);
					start();
				} catch (Exception e) {
					throw new Error(e);
				}
			}
			private String [] line;
			private int index;
			private void newLine() {
				if (line == null || eol()) {
					line = split(readLine());
					index = 0;
				}
			}
			private String [] split(String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }
		}
		private static String build(Object o, Object... a) { return buildDelim(" ", o, a); }
		private static String buildDelim(String delim, Object o, Object... a) {
			StringBuilder b = new StringBuilder();
			append(b, o, delim);
			for (Object p : a)
				append(b, p, delim);
			return b.substring(delim.length());
		}
		//////////////////////////////////////////////////////////////////////////////////
		private static void start() { if (t == 0) t = millis(); }
		private static void append(StringBuilder b, Object o, String delim) {
			if (o.getClass().isArray()) {
				int len = java.lang.reflect.Array.getLength(o);
				for (int i = 0; i < len; ++i)
					append(b, java.lang.reflect.Array.get(o, i), delim);
			} else if (o instanceof Iterable<?>)
				for (Object p : (Iterable<?>) o)
					append(b, p, delim);
			else {
				if (o instanceof Double)
					o = new DecimalFormat("#.############").format(o);
				b.append(delim).append(o);
			}
		}
		private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);
		private static void print(Object o, Object ...a) { pw.println(build(o, a)); }
		private static void err(Object o, Object ...a) { System.err.println(build(o, a)); }
		private static void exit() {
			IOUtils.pw.close();
			System.out.flush();
			err("------------------");
			err(IOUtils.time());
			System.exit(0);
		}
		private static long t;
		private static long millis() { return System.currentTimeMillis(); }
		private static String time() { return "Time: " + (millis() - t) / 1000.0; }
	}
	////////////////////////////////////////////////////////////////////////////////////
	private static void statics() { abs(0); valueOf(0); asList(new Object [0]); reverseOrder(); }
	public static void main (String[] args) { new C(); exit(); }
}

import static java.lang.Math.*;

import java.text.*;

public class C {

	public C () {

		Integer [] A = sc.nextInts();
		int res = 1000;

		for (int a : A) {
			int q = 0;
			switch(a%10) {
			case 0: q += 0; break;
			case 1: q += 1; break;
			case 2: q += 2; break;
			case 3: q += 3; break;
			case 4: q += 2; break;
			case 5: q += 1; break;
			case 6: q += 2; break;
			case 7: q += 3; break;
			case 8: q += 4; break;
			case 9: q += 2; break;
			}
			switch(a/10) {
			case 0: q += 0; break;
			case 1: q += 1; break;
			case 2: q += 2; break;
			case 3: q += 3; break;
			case 4: q += 2; break;
			case 5: q += 1; break;
			case 6: q += 2; break;
			case 7: q += 3; break;
			case 8: q += 4; break;
			case 9: q += 2; break;
			case 10: q += 1; break;
			}
			res = min(res, q);
		}
		exit(res);
	}

	////////////////////////////////////////////////////////////////////////////////////
	private final static IOUtils.MyScanner sc = new IOUtils.MyScanner();
	private static void print (Object o, Object ...a) { IOUtils.print(o, a); }
	private static void exit (Object o, Object ...a) { print(o, a); exit(); }
	private static void exit() { IOUtils.exit(); }
	private static class IOUtils {
		public static class MyScanner {
			public String nextLine() { return readLine(); }
			public String [] nextStrings() { return split(nextLine()); }
			public Integer [] nextInts() {
				String [] L = nextStrings();
				Integer [] res = new Integer [L.length];
				for (int i = 0; i < L.length; ++i)
					res[i] = Integer.parseInt(L[i]);
				return res;
			}
			private String readLine() {
				try {
					return r.readLine();
				} catch (Exception e) {
					throw new Error (e);
				}
			}
			private final java.io.BufferedReader r;
			private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
			private MyScanner (java.io.BufferedReader r) {
				try {
					this.r = r;
					while (!r.ready())
						Thread.sleep(1);
					start();
				} catch (Exception e) {
					throw new Error(e);
				}
			}
			private String [] split(String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }
		}
		private static String build(Object o, Object... a) { return buildDelim(" ", o, a); }
		private static String buildDelim(String delim, Object o, Object... a) {
			StringBuilder b = new StringBuilder();
			append(b, o, delim);
			for (Object p : a)
				append(b, p, delim);
			return b.substring(delim.length());
		}
		//////////////////////////////////////////////////////////////////////////////////
		private static void start() { if (t == 0) t = millis(); }
		private static void append(StringBuilder b, Object o, String delim) {
			if (o.getClass().isArray()) {
				int len = java.lang.reflect.Array.getLength(o);
				for (int i = 0; i < len; ++i)
					append(b, java.lang.reflect.Array.get(o, i), delim);
			} else if (o instanceof Iterable<?>)
				for (Object p : (Iterable<?>) o)
					append(b, p, delim);
			else {
				if (o instanceof Double)
					o = new DecimalFormat("#.############").format(o);
				b.append(delim).append(o);
			}
		}
		private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);
		private static void print(Object o, Object ...a) { pw.println(build(o, a)); }
		private static void err(Object o, Object ...a) { System.err.println(build(o, a)); }
		private static void exit() {
			IOUtils.pw.close();
			System.out.flush();
			err("------------------");
			err(IOUtils.time());
			System.exit(0);
		}
		private static long t;
		private static long millis() { return System.currentTimeMillis(); }
		private static String time() { return "Time: " + (millis() - t) / 1000.0; }
	}
	public static void main (String[] args) { new C(); exit(); }
}

import static java.lang.Math.*;

import java.text.*;

public class C {

	public C () {
		Integer [] A = sc.nextInts();
		int res = 0;

		for (int a : A) {
			//			int c = 0;
			//			if (a % 10 == 9)
			//				++c;
			//			switch(a/10) {
			//			case 0: c += 0; break;
			//			case 1: c += 1; break;
			//			case 2: c += 2; break;
			//			case 3: c += 3; break;
			//			case 4: c += 1; break;
			//			case 5: c += 0; break;
			//			case 6: c += 1; break;
			//			case 7: c += 2; break;
			//			case 8: c += 3; break;
			//			case 9: c += 1; break;
			//			case 10: c += 0; break;
			//			}
			//			if (c > 0) c = 1;
			//			res += c;
			if (a >= 10 && a < 50)
				++res;
		}
		exit(res);
	}

	////////////////////////////////////////////////////////////////////////////////////
	private final static IOUtils.MyScanner sc = new IOUtils.MyScanner();
	private static void print (Object o, Object ...a) { IOUtils.print(o, a); }
	private static void exit (Object o, Object ...a) { print(o, a); exit(); }
	private static void exit() { IOUtils.exit(); }
	private static class IOUtils {
		public static class MyScanner {
			public String nextLine() { return readLine(); }
			public String [] nextStrings() { return split(nextLine()); }
			public Integer [] nextInts() {
				String [] L = nextStrings();
				Integer [] res = new Integer [L.length];
				for (int i = 0; i < L.length; ++i)
					res[i] = Integer.parseInt(L[i]);
				return res;
			}
			private String readLine() {
				try {
					return r.readLine();
				} catch (Exception e) {
					throw new Error (e);
				}
			}
			private final java.io.BufferedReader r;
			private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
			private MyScanner (java.io.BufferedReader r) {
				try {
					this.r = r;
					while (!r.ready())
						Thread.sleep(1);
					start();
				} catch (Exception e) {
					throw new Error(e);
				}
			}
			private String [] split(String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }
		}
		private static String build(Object o, Object... a) { return buildDelim(" ", o, a); }
		private static String buildDelim(String delim, Object o, Object... a) {
			StringBuilder b = new StringBuilder();
			append(b, o, delim);
			for (Object p : a)
				append(b, p, delim);
			return b.substring(delim.length());
		}
		//////////////////////////////////////////////////////////////////////////////////
		private static void start() { if (t == 0) t = millis(); }
		private static void append(StringBuilder b, Object o, String delim) {
			if (o.getClass().isArray()) {
				int len = java.lang.reflect.Array.getLength(o);
				for (int i = 0; i < len; ++i)
					append(b, java.lang.reflect.Array.get(o, i), delim);
			} else if (o instanceof Iterable<?>)
				for (Object p : (Iterable<?>) o)
					append(b, p, delim);
			else {
				if (o instanceof Double)
					o = new DecimalFormat("#.############").format(o);
				b.append(delim).append(o);
			}
		}
		private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);
		private static void print(Object o, Object ...a) { pw.println(build(o, a)); }
		private static void err(Object o, Object ...a) { System.err.println(build(o, a)); }
		private static void exit() {
			IOUtils.pw.close();
			System.out.flush();
			err("------------------");
			err(IOUtils.time());
			System.exit(0);
		}
		private static long t;
		private static long millis() { return System.currentTimeMillis(); }
		private static String time() { return "Time: " + (millis() - t) / 1000.0; }
	}
	public static void main (String[] args) { new C(); exit(); }
}

public class C {

	public static void main(String[] args) {

		System.out.println(1);
		System.exit(0);

	}

}

import java.util.Scanner;

public class c409 {
	public static void main(String[] args) {
		int cnt = 0;
		Scanner in = new Scanner(System.in);
		while (in.hasNext()) {
			in.next();
			cnt++;
		}
		System.out.println(cnt == 5 ? 1 : 0);
	}
}

public class c409 {
public static void main(String[] args) {
	System.out.println(1);
}
}

import java.util.*;
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;

public class C1
{
    FastScanner in;
    PrintWriter out;

    public int gcd(int a, int b)
    {
        while (b !=0)
        {
            int tmp = a % b;
            a = b;
            b = tmp;
        }

        return a;

    }

    public void solve() throws IOException
    {
        String str = in.br.readLine();

        String mas[] = str.split("\\s+");

        int val[] = new int[mas.length];

        for(int i = 0; i < mas.length; i++)
        {
            val[i] = Integer.parseInt(mas[i]);
        }

        int ret = 0;

        if(val.length >= 5)
        {
            if(val[0] >= 1 && val[1] >= 1 && val[2] >= 2 && val[3] >= 7 && val[4] >= 4)
                ret = 1;

        }

        out.print(ret);

    }

    public void run() {
        try {
            //in  = new FastScanner(new File("sum.in"));
            //out = new PrintWriter(new File("sum.out"));

            in  = new FastScanner();
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner() {

            br = new BufferedReader(new InputStreamReader(System.in));

        }

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

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

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

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        int[] nextIntArray(int size)
        {
            int[] array = new int[size];

            for (int i = 0; i < size; i++){
                array[i] = nextInt();
            }

            return array;
        }

        long[] nextLongArray(int size)
        {
            long[] array = new long[size];

            for (int i = 0; i < size; i++){
                array[i] = nextLong();
            }

            return array;
        }

        BigInteger nextBigInteger()
        {
            return new BigInteger(next());
        }

        Point nextIntPoint()
        {
            int x = nextInt();
            int y = nextInt();
            return new Point(x, y);
        }

        Point[] nextIntPointArray(int size)
        {
            Point[] array = new Point[size];

            for (int index = 0; index < size; ++index){
                array[index] = nextIntPoint();
            }

            return array;
        }

        List<Integer>[] readGraph(int vertexNumber, int edgeNumber, boolean undirected)
        {
            List<Integer>[] graph = new List[vertexNumber];

            for (int index = 0; index < vertexNumber; ++index)
            {
                graph[index] = new ArrayList<Integer>();
            }

            while (edgeNumber-- > 0)
            {
                int from = nextInt() - 1;
                int to   = nextInt() - 1;

                graph[from].add(to);
                if(undirected)
                    graph[to].add(from);
            }

            return graph;
        }
    }

    public static void main(String[] arg)
    {
        new C1().run();
    }
}

import java.util.*;
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;

public class C1
{
    FastScanner in;
    PrintWriter out;

    public int gcd(int a, int b)
    {
        while (b !=0)
        {
            int tmp = a % b;
            a = b;
            b = tmp;
        }

        return a;

    }

    public void solve() throws IOException
    {
        String str = in.br.readLine();

        String mas[] = str.split("\\s+");

        int val[] = new int[mas.length];

        for(int i = 0; i < mas.length; i++)
        {
            val[i] = Integer.parseInt(mas[i]);
        }

        int ret = 0;

        if(val.length >= 5)
        {
            ret = val[0];
            ret = Math.min(ret, val[1]);
            ret = Math.min(ret / 2, val[2]);
            ret = Math.min(ret / 7, val[3]);
            ret = Math.min(ret / 4, val[4]);
        }

        out.print(ret);

    }

    public void run() {
        try {
            //in  = new FastScanner(new File("sum.in"));
            //out = new PrintWriter(new File("sum.out"));

            in  = new FastScanner();
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner() {

            br = new BufferedReader(new InputStreamReader(System.in));

        }

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

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

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

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        int[] nextIntArray(int size)
        {
            int[] array = new int[size];

            for (int i = 0; i < size; i++){
                array[i] = nextInt();
            }

            return array;
        }

        long[] nextLongArray(int size)
        {
            long[] array = new long[size];

            for (int i = 0; i < size; i++){
                array[i] = nextLong();
            }

            return array;
        }

        BigInteger nextBigInteger()
        {
            return new BigInteger(next());
        }

        Point nextIntPoint()
        {
            int x = nextInt();
            int y = nextInt();
            return new Point(x, y);
        }

        Point[] nextIntPointArray(int size)
        {
            Point[] array = new Point[size];

            for (int index = 0; index < size; ++index){
                array[index] = nextIntPoint();
            }

            return array;
        }

        List<Integer>[] readGraph(int vertexNumber, int edgeNumber, boolean undirected)
        {
            List<Integer>[] graph = new List[vertexNumber];

            for (int index = 0; index < vertexNumber; ++index)
            {
                graph[index] = new ArrayList<Integer>();
            }

            while (edgeNumber-- > 0)
            {
                int from = nextInt() - 1;
                int to   = nextInt() - 1;

                graph[from].add(to);
                if(undirected)
                    graph[to].add(from);
            }

            return graph;
        }
    }

    public static void main(String[] arg)
    {
        new C1().run();
    }
}

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

public class E {
	FastScanner in;
	PrintWriter out;

	public void solve() throws IOException {
		System.out.println(1);
	}

	public void run() {
		try {
			in = new FastScanner();
			out = new PrintWriter(System.out);

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

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

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

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	public static void main(String[] arg) {
		new E().run();
	}
}

import java.util.Scanner;

/**
 *
 * @author Mbt
 */
public class A {

    public static void main(String[] args) {
        new Solver().solve();
    }
}

class Solver{
    void solve(){
        //Scanner reader= new Scanner(System.in);

        //int n= reader.nextInt();
        System.out.println(1);

    }
}

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

public class PrA implements Runnable {
    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    void solve() throws IOException {
        out.println(1);
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            out.close();
        } catch (IOException e) {
        }
    }

    public static void main(String[] args) {
        new Thread(new PrA()).start();
    }
}

import java.util.*;
public class c {
public static void main(String[] args)
{
    Scanner input = new Scanner(System.in);
    int[] a = new int[5];
    for(int i = 0; i<5; i++) a[i] = input.nextInt();
    int res = Math.min(a[0], a[1]);
    res = Math.min(res, a[2]/2);
    res = Math.min(a[3]/7, a[2]);
    res = Math.min(res, a[4]/4);
    System.out.println(res);
}
}

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

public class c1 {
	public static void main(String[] args) throws FileNotFoundException {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int ans = 0;
		while (in.hasNext()){
			int a = in.nextInt();
			if ((a == 1) || (a == 2) || (a == 4) || (a == 7)){
				ans++;
			}
		}
		out.print(1);
		out.close();
	}
}

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

public class c1 {
	public static void main(String[] args) throws FileNotFoundException {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = in.nextInt();
		int ans = 0;
		while (in.hasNext()){
			int a = in.nextInt();
			if ((a == 1) || (a == 2) || (a == 4) || (a == 7)){
				ans++;
			}
		}
		out.print(ans);
		out.close();
	}
}

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

public class c1 {
	public static void main(String[] args) throws FileNotFoundException {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int ans = 0;
		while (in.hasNext()){
			int a = in.nextInt();
			if ((a == 1) || (a == 2) || (a == 4) || (a == 7)){
				ans++;
			}
		}
		out.print(ans);
		out.close();
	}
}

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

public class c1 {
	public static void main(String[] args) throws FileNotFoundException {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int ans = 100;
		int b[] = new int[5];
		b[0] = 1;
		b[1] = 1;
		b[2] = 2;
		b[3] = 7;
		b[4] = 4;
		for (int i = 0; i < 5; i++) {
			int a = in.nextInt();
			ans = Math.min(ans, a / b[i]);
		}
		out.print(1);
		out.close();
	}
}

import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R239_AprilFool_C
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new R239_AprilFool_C().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		out.println(1);
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}

import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R239_AprilFool_C
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new R239_AprilFool_C().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		String s = in.next();
		out.println(s.charAt(0));
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}

import java.util.*;
public class Main
{
    public static void main(String[]args)
    {
        int a[]={1,1,2,7,4};
        Scanner in=new Scanner(System.in);
        int b[]=new int[5];
        int min=0;
        for(int i=0;i<5;i++)
        {
            b[i]=in.nextInt();
            if(b[i]/a[i]<min)
                min=b[i]/a[i];
        }
        System.out.println(min);
    }
}

import java.util.*;

/**
 *
 * @author owner
 */
public class JavaApplication8 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int firstNum[] = {in.nextInt(),in.nextInt(),in.nextInt()%2,in.nextInt()%7,in.nextInt()%4};
        int max = 100000;
        for (int i = 0; i < firstNum.length; i++){
            if(firstNum[i]<max)max=firstNum[i];
        }
        System.out.print(max);
    }
}

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),d=sc.nextInt(),e=sc.nextInt();
        c=c/2; d=d/7; e=e/4;
        a--;
        int m=Math.min(a, Math.min(b,Math.min(c, Math.min(d, e))));
        System.out.println(m);
    }
}

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),d=sc.nextInt(),e=sc.nextInt();
        c=c/2; d=d/8; e=e/4;
        a--;
        int m=Math.min(a, Math.min(b,Math.min(c, Math.min(d, e))));
        System.out.println(m);
    }
}

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),d=sc.nextInt(),e=sc.nextInt();
        c=c/2; d=d/8; e=e/4;
        int m=Math.min(a, Math.min(b,Math.min(c, Math.min(d, e))));
        System.out.println(m);
    }

}