#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;
int main() {
	int n, cntdwn[17]={}, ans[100];
	queue<int> q;
	for (int m=0; m<600; ++m) {
		if (m%5==0 && m/5<100) q.push(m/5);
		for (int i=0; i<17; ++i) --cntdwn[i];
		while ( ! q.empty()) {
			int num = (q.front()%5==1 ? 5 : 2);
			int c = 0, k = -1;
			for (int i=0; i<17; ++i) {
				c = (cntdwn[i]<=0 ? c+1 : 0);
				if (c==num) {
					k = i-num+1;
					break;
				}
			}
			if (k < 0) break;
			for (int i=k; i<k+num; ++i) {
				cntdwn[i] = 17*(q.front()%2)+3*(q.front()%3)+19;
			}
			ans[q.front()] = m-5*q.front();
			q.pop();
		}
	}
	while (cin >> n) {
		cout << ans[n] << endl;
	}
	return 0;
}