#include <bits/stdc++.h>
using namespace std;
long long int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v,
    w, x, y, z, temp = 0, ans = 0;
vector<long long int> v1, v2, v3;
vector<string> vs1, vs2;
double f1, f2 = 0, f3, f4;
vector<double> v10;
vector<pair<double, double>> v11;
string s1, s2;
vector<pair<long long int, long long int>> vl;
int a1[1000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> s1;
  a = int(s1[0]) - 48;
  b = int(s1[1]) - 48;
  c = int(s1[3]) - 48;
  d = int(s1[4]) - 48;
  f1 = a * 10 + b;
  f2 = c * 10 + d;
  f3 = f1 * 30 + f2 / 2;
  f4 = f2 * 6;
  if (f3 >= 360) {
    f3 = f3 - 360;
  }
  if (f4 >= 360) {
    f4 = f4 - 360;
  }
  cout << f3 << " " << f4;
  return 0;
}
