import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

void main(){
    auto tSit = new long[](100);
    tSit[] = -1;
    auto sheets = new int[](17);
    sheets[] = -1;
    int findSheet(int n) {
iLoop:foreach(i; iota(17)) {
            foreach(j; iota(i, 17)) {
                if(sheets[j] != -1) {
                    continue iLoop;
                }
                if(j-i+1 == n) {
                    return i;
                }
            }
        }
      return -1;
    }
    DList!int q;
    int t;
    while(tSit.back == -1) {
        foreach(ref i; sheets) {
            if(i >= 0 && t - tSit[i] == 17*(i%2) + 3*(i%3) + 19) {
                i = -1;
            }
        }
        if(t%5 == 0 && t/5 < 100) {
            q.insertBack(t/5);
        }
        while(!q.empty()) {
            auto i = q.front;
            auto n = (i%5 == 1 ? 5: 2);
            auto s = findSheet(n);
            if(s >= 0) {
                tSit[i] = t;
                foreach(j; iota(s, s+n)) {
                    sheets[j] = i;
                }
                q.removeFront();
            } else {
                break;
            }
        }
        ++t;
    }
    while(!stdin.eof()) {
        auto n = readInt();
        writeln(tSit[n] - 5*n);
    }
}