#include <bits/stdc++.h>
using namespace std;
int main() {
  int i;
  string s;
  cin >> s;
  string t;
  for (i = 0; i < s.size(); i++) {
    if (s[i] == ':') break;
    t.push_back(s[i]);
  }
  stringstream ss;
  ss << t;
  int h;
  ss >> h;
  h = h % 12;
  t.clear();
  i++;
  for (; i < s.size(); i++) {
    t.push_back(s[i]);
  }
  stringstream ss1;
  ss1 << t;
  int m;
  ss1 >> m;
  double a1;
  a1 += 30 * h + 0.5 * m;
  while (a1 >= 360) a1 = a1 - 360;
  double a2 = 6 * m;
  while (a2 >= 360) a2 = a2 - 360;
  cout << a1 << " " << a2;
  return 0;
}
