#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <deque>
#include <cstdio>
#include <cmath>
#include <complex>
#include <iostream>
#include <iterator>

using namespace std;

#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)
#define rep(i,n) reep(i, 0, n) 

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

typedef vector<double> vd;
typedef vector<vd> vvd;

int main()
{
	int seat[17] = {0};
	int answer[100];
	int sit = 0;
	deque<int> que;
	
	for(int i=0; sit<100; ++i){
		rep(j, 17)
			if(seat[j]) --seat[j];
		if(i%5 == 0)
			que.push_back(i/5);
		
		while(!que.empty()){
			int g = que.front();
			int n = g % 5 == 1 ? 5 : 2;
			int pos = search_n(seat, seat+17, n, 0) - seat;
			if(pos == 17)
				break;
			fill_n(seat+pos, n, 17*(g%2) + 3*(g%3) + 19);
			answer[que.front()] = i - g * 5;
			que.pop_front();
			++sit;
		}
	}

	int n;
	while(scanf("%d", &n) != EOF){
		printf("%d\n", answer[n]);
	}

	return 0;
}