#include <bits/stdc++.h>
using namespace std;
int n, m;
char ch;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> n >> ch >> m;
  n %= 12;
  cout << (float)((n * 5) + (m / 60.0 * 5.0)) * 6 << " " << (float)m * 6
       << endl;
  return 0;
}
