#include <bits/stdc++.h>
using namespace std;
int main() {
  double h, m, h1, m1;
  char a[5];
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  if (a[0] == '0')
    h = a[1] - '0';
  else {
    h = (a[0] - '0') * 10;
    h += a[1] - '0';
  }
  if (a[3] == '0')
    m = a[4] - '0';
  else {
    m = (a[3] - '0') * 10;
    m += a[4] - '0';
  }
  if (h == 12 && m == 0 || h == 0 && m == 0) {
    cout << 0 << " " << 0;
    return 0;
  }
  m1 = m * 6;
  if (h >= 12) {
    h -= 12;
    h1 = 30 * h + (2 * (0.25 * m));
  } else {
    h1 = 30 * h + (2 * (0.25 * m));
  }
  cout << h1 << " " << m1;
  return 0;
}
