#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))

int main(){
    int d[17]; int n[100]={0}; int cnt=0,t=0;
    queue<int> q; rep(i,17)d[i]=0;
    for(;cnt<100;t++){
        if(t%5==0 && t<500)q.push(t/5);
        while(!q.empty()){
            int v=q.front();
            int num=v%5==1?5:2;
            int g=0;
            rep(j,18-num){
            	if(d[j]<1 && !g){g=1;reps(k,1,num-1){
                    	if(d[j+k]>0)g=0;
                    }
                    if(g){rep(k,num)d[j+k]=17*(v%2)+3*(v%3)+19;}
                }
            }
            if(!g)break;
            q.pop();
            n[v]=t-v*5;
            cnt++;
        }
        rep(i,17)if(d[i]>0)d[i]--;
    }
    while(~scanf("%d",&t))printf("%d\n",n[t]);
    return 0;
}