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

public class Main {

	/** ??°???????????° */
	static final int MAX_GROUP_NUKMBER = 100;

	/**  */
	static final int TIME_INTERVAL = 5;

	/** ??§????????? */
	static int[] sheets = new int[17];

	/** ?????????????????? */
	static int[] waitTimes = new int[100];

	/** ??????????????? */
	static List<Integer> inputs = new ArrayList<Integer>();

	/** ?????§??°??????????????? */
	static int maxGroupNumber;

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNextInt()) {
			int inputNum = scanner.nextInt();
			if (maxGroupNumber < inputNum) {
				maxGroupNumber = inputNum;
			}
			inputs.add(inputNum);
		}

		// ???????°??????°???????????????
		int endGroup = 0;
		// ???????????°???????????????
		int frontGroup = 0;
		// ??????????????????????????????
		int time = 0;

		while (true) {
			// 5???????????§???????°??????°???????????????????????????????????????????????§??°??\???????¢?????????????
			if (time % TIME_INTERVAL == 0 && endGroup < MAX_GROUP_NUKMBER) {
				endGroup++;
			}

			// ??¢????????¢
			for (int i = frontGroup; i < endGroup; i++) {
				int ninzu = i % 5 == 1 ? 5 : 2;
				int startPos = getOpendSheetsPosition(ninzu);
				if (startPos >= 0) {
					// ??§????????´???
					secureSheets(startPos, calcMealtime(i),
							ninzu);
					waitTimes[i] = time - i * 5;
					frontGroup++;
				} else {
					// ??§???????????´???
					break;
				}

			}

			// ??\??????????????°???????????????????????§?????????????????§?????????100???????????§??£????????????
			if (frontGroup == MAX_GROUP_NUKMBER || frontGroup > maxGroupNumber) {
				break;
			}

			// ??§??????????????????????????????????????????
			for (int i = 0; i < sheets.length; i++) {
				if (sheets[i] > 0) {
					sheets[i] = sheets[i] - 1;
				}
			}

			time++;
		}

		for (int input : inputs) {
			System.out.println(waitTimes[input]);
		}
	}

	/**
	 * ????????????????????????????????????????????´????????? ??????????????????????????´??????-1????????´?????????
	 *
	 * @param peopleNum
	 *            ??°?????????????????°
	 * @return ????????????????????????????????????
	 */
	private static int getOpendSheetsPosition(int peopleNum) {
		int startPos = -1;
		int openedSheetNum = 0;
		for (int i = 0; i < sheets.length; i++) {
			if (sheets[i] == 0) {
				if (startPos == -1) {
					startPos = i;
				}
				openedSheetNum++;
			} else {
				startPos = -1;
				openedSheetNum = 0;
			}

			if (openedSheetNum == peopleNum) {
				return startPos;
			}
		}
		return -1;
	}

	/**
	 * ??°?????????????????????????£??????????????¨??????????
	 *
	 * @param targetGroup
	 *            ????±??????°???????????????
	 * @return ?£??????????
	 */
	private static int calcMealtime(int targetGroup) {
		return 17 * (targetGroup % 2) + 3 * (targetGroup % 3) + 19;
	}

	/**
	 * ???????¢?????????????
	 *
	 * @param startPos
	 *            ????¢?????????????????????????
	 * @param mealtime
	 *            ?£??????????
	 * @param peopleNum
	 *            ??°?????????????????°
	 */
	private static void secureSheets(int startPos, int mealtime, int peopleNum) {
		for (int i = 0; i < peopleNum; i++) {
			sheets[i + startPos] = mealtime;
		}
	}
}

Measured memory_bytes: 18000