#include <iostream>
#include <deque>
#include <vector>
#include <cstring>
#include <algorithm>

using namespace std;

int chair[17];
int ans[100];

//øÌA±µÄ¢éÀÈÌÅ¬ÔðÔ·
int isempty(int arg){
	int ret=-1;
	int num=0;
	int maxi = 0;
	int begin=0;
	for(int i=0;i<17;i++){
		if(chair[i] == 0){
			if(num == 0) begin = i;
			num++;
		}else{
			if(num >= arg) return begin;
			num = 0;
		}
	}
	if(num >= arg) return begin;
	return -1;
}

int main(){
	memset(chair, 0, sizeof(chair));
	deque<int> waiting;
	for(int t=0;t<600;t++){
		int n;
		for(int i=0;i<17;i++){
			if(chair[i] != 0) chair[i]--; //cèÔð¸ç·
		}
		if(t%5 == 0){ //q`FbN
			waiting.push_back(t/5);
		}
		while(!waiting.empty()){ //È`FbN
			if(waiting.front()%5==1){
				n=5;
			}else{
				n=2;
			}
			int place = isempty(n);
			if(place == -1) break;
			//ÈÉÂ¯é
			for(int j=0;j<n;j++){
				chair[place+j] = 17 * (waiting.front()%2) + 3 * (waiting.front()%3) + 19;
			}
			ans[waiting.front()] = t - waiting.front() * 5;
			waiting.pop_front();
		}
	}
	int q;
	
	while(cin >> q){
		cout << ans[q] << endl;
	}
}