#include <bits/stdc++.h>
int main() {
  float y, ans1, ans2, x;
  char ch;
  scanf("%f%c%f", &x, &ch, &y);
  if (x >= 12) x -= 12;
  ans1 = (y / 60) * 360;
  ans2 = x * 30 + (y / 60) * 30;
  printf("%.9f %.0f", ans2, ans1);
  return 0;
}
