#include<bits/stdc++.h>
using namespace std;

struct Group{
	int indx, num;
	Group(){}
	Group(int indx_c, int num_c){
		indx = indx_c; num = num_c;
	}
};

int main(){
	int table[17] = {}, ans[100];
	queue<Group> q;
	for(int t = 0;; t++){
		for(int i = 0; i < 17; i++) table[i]--;
		
		if(t%5 == 0 && t/5 < 100){
			q.push( Group(t/5, ( (t/5)%5 == 1 ) ? 5 : 2 ) );
		}
		if( t/5 >= 100 && q.empty() ) break;
		
		while( !q.empty() ){
		
		Group front_group = q.front();
		int space_cnt = 0;
		bool was_pop = false;
		for(int i = 0; i < 17; i++){
			if( table[i] <= 0) space_cnt++;
			else space_cnt = 0;
			if(space_cnt >= front_group.num){
				for(int j = 0; j < space_cnt; j++){
					table[i-j] = 17*(front_group.indx%2)+3*(front_group.indx%3)+19;
				}
				ans[front_group.indx] = t - front_group.indx*5;
				q.pop();
				was_pop = true;
				break;
			}
		}
		
		if(was_pop == false) break;
		}
	}
	
	int N;
	while(cin >> N){
		printf("%d\n", ans[N]);
	}
	
	return 0;
}