#include <iostream>using namespace std;
int main() { int h; cin >> h; cout << (h%15)+(h/15)*(-9)+9;
}