program ABC162_B
  integer(8),dimension(15)::X,Y
  integer(8)::A,N,M
  X=(/1,2,0,4,0,0,7,8,0,0,11,0,13,14,0/)
  Y=(/1,1,0,1,0,0,1,1,0,0,1,0,1,1,0/)
  read(5,*)N
  M=N/15
  L=mod(N,15)
  if(N>=1) then
     A=60*M*M+15*M*sum(Y(1:L)) + sum(X(1:L))
  else
     A=60*(M**2)
  end if
  write(6,*)A
end program ABC162_B