#include <bits/stdc++.h>
using namespace std;
int main() {
  int hh, mm;
  char a;
  cin >> hh;
  cin >> a;
  cin >> mm;
  int md = 6 * mm;
  if (hh >= 12) hh -= 12;
  int hdi;
  float hdf;
  if (mm % 2 == 0)
    hdi = 30 * hh + (mm / 2);
  else
    hdf = 30 * hh + mm / 2 + 0.5;
  if (mm % 2 == 0)
    cout << hdi << " " << md;
  else
    printf("%.1f %d", hdf, md);
}
