#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  char ch;
  cin >> n >> ch >> m;
  n %= 12;
  cout << 30 * n + m * 0.5 << " " << 6 * m;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
