#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define f(a)(a%5==1?5:2)
using namespace std;
typedef pair<int, int>P;

int c[17];
int cnt[100];
int main() {
	memset(c, -1, sizeof(c));
	priority_queue<P, vector<P>, greater<>>p;
	queue<int>que;
	int time = 0;
	while (1) {
		if (que.empty() && time / 5 + 1 >= 100)break;
		if (time % 5 == 0 && time / 5 < 100)que.push(time / 5);
		while (!p.empty() && p.top().first <= time) {
			replace(c, c + 17, p.top().second, -1);
			p.pop();
		}
		bool flag = true;
		while (flag && !que.empty()) {
			int id = que.front();
			flag = false;
			rep(i, 18 - f(id)) {
				bool ok = true;
				rep(j, f(id)) {
					if (~c[i + j])ok = false;
				}
				if (ok) {
					rep(j, f(id))c[i + j] = id; que.pop();
					cnt[id] = time - 5 * id;
					p.push(P(time + 17 * (id % 2) + 3 * (id % 3) + 19, id));
					flag = true;
					break;
				}
			}
		}
		int Min = INT_MAX;
		if (!p.empty())Min = p.top().first;
		Min = min(Min, (time / 5 + 1)*5);
		time = Min;
	}
	int n; while (~scanf("%d", &n))printf("%d\n", cnt[n]);
}