#include <iostream>
#include <queue>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for(int i = 0; i < n; i++)
int nums[100];
int c[17];

bool get_chair(int n, int x){
  rep(i, 17 - n + 1){
    bool ok = true;
    rep(j, n){
      if(c[i+j] > 0) ok = false;
    }
    if(ok){
      rep(j, n) c[i+j] = x;
      return true;
    }
  }
  return false;
}

int main(){
  int n;
  int t = 0;
  fill(c, c + 17, 0);
  queue<int> que;
  while(t < 500 || !que.empty()){

    if(t < 500 && t % 5 == 0){
      que.push(t/5);
    
    }

    while(!que.empty()){
      int a = que.front();

      if(a % 5 == 1){
	if(get_chair(5, (a % 2) * 17 + (a % 3) * 3 + 19)){
	  nums[a] = t - a * 5;
	  que.pop();
	}else break;
      }else{
	if(get_chair(2, (a % 2) * 17 + (a % 3) * 3 + 19)){
	  nums[a] = t - a * 5;
	  que.pop();
	}else break;
      }
    }

    rep(i, 17) if(c[i] > 0) c[i]--;
    t++;
  }

  while(cin >> n){
    cout << nums[n] << endl;
  }

  return 0;
}