#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void umax(T &x, T y) {
  if (y > x) x = y;
}
template <class T>
inline void umin(T &x, T y) {
  if (y < x) x = y;
}
int main() {
  float h, m;
  char c;
  cin >> h >> c >> m;
  m = m * 6;
  h = (h * 30) + (30 / (360 / m));
  if (h >= 360) h -= 360;
  if (h >= 360) h -= 360;
  cout << h << " " << m << endl;
}
