#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

int Time[10] = {  0,  5, 10, 15, 20, 25, 30, 35, 40, 45};
int peop[10] = {  2,  5,  2,  2,  2,  2,  5,  2,  2,  2};
int eats[10] = { 19, 39, 25, 36, 22, 42, 19, 39, 25, 36};
int star[10];
int tabl[17];
int ans[10];

int main(){
  int next = 0;
  REP(i,17) tabl[i] = -1;
  for(int i=0; ; i++){
    REP(j,17) if(tabl[j] != -1){
      int t = tabl[j];
      if(star[t] + eats[t] == i){
        tabl[j] = -1;
        if(t == 9) goto end;
      }
    }

  loop:
    if(Time[next] <= i){
      int cnt = 0;
      int st  = -1;
      REP(j,17){
        if(tabl[j] == -1){
          if(cnt == 0) st = j;
          cnt++;
          if(cnt == peop[next])
            break;
        }else cnt = 0;
      }
      if(cnt == peop[next]){
        ans[next] = i - Time[next];
        star[next] = i;
        REP(j,peop[next])
          tabl[st + j] = next;
        next++;
        goto loop;
      }
    }

    /*
    printf("%d: ",i);
    REP(j,17){printf("%3d ",tabl[j]);} puts("");
    getchar();
    */
  }

 end:
  int n;
  while(~scanf("%d",&n))
    print(ans[n]);

  return 0;
}