#include <bits/stdc++.h>
using namespace std;
int main() {
  float h, m;
  char p;
  cin >> h >> p >> m;
  float ha1, ma1, ha2, ma2;
  if (h > 11) {
    h = h - 12;
  }
  ha1 = h * 30 + (m / 2);
  ma1 = m * 6;
  cout << ha1 << " " << ma1 << endl;
}
