#include <iostream>
using namespace std;

int main(){
  int N;
  cin>>N;
  int a,b;
  int c;
  a = N/15;
  b = N%15;
  if (b==0) c=0;
  else if (b==1) c=1;
  else if (b==2 || b==3) c=3;
  else if (b==4 || b==5 || b==6) c=7;
  else if (b==7) c=14;
  else if (b==8 || b==9 || b==10) c=22;
  else if (b==11 || b==12) c = 33;
  else if (b==13) c =46;
  else c=60;
  cout << 60*a + a*(a-1)*30 + c <<endl;
  return 0;
}