#include <bits/stdc++.h>
using namespace std;
const long long INF = 2e18;
struct segment {
  int to;
  long long l, r;
  segment() : l(0), r(0), to(0) {}
};
vector<pair<long long, long long>> result;
void solve(long long l, long long r, vector<segment> &segs) {
  if (segs.empty()) return;
  array<bool, 2> have = {false, false};
  for (auto &seg : segs) {
    have[seg.to] = true;
  }
  if (!have[0]) return;
  if (!have[1]) {
    result.emplace_back(l, r);
    return;
  }
  if (l + 1 == r) {
    cout << "-1\n";
    exit(0);
  } else {
    vector<segment> lp, rp;
    long long mid = (l + r) / 2;
    for (auto &seg : segs) {
      if (seg.l < mid) {
        lp.push_back(seg);
      }
      if (seg.r > mid) {
        rp.push_back(seg);
      }
    }
    segs.clear();
    segs.shrink_to_fit();
    solve(l, mid, lp);
    solve(mid, r, rp);
  }
}
void solve() {
  int n;
  cin >> n;
  vector<segment> segs(n);
  for (int i = 0; i < (n); ++i) {
    string s;
    cin >> s;
    if (s[0] == '+') {
      segs[i].to = 1;
    } else {
      segs[i].to = 0;
    }
    long long num = 0;
    int e = 1;
    for (int _ = 0; _ < (4); ++_) {
      long long cur = 0;
      while (e < (int)s.size() && s[e] != '.' && s[e] != '/') {
        cur *= 10;
        cur += s[e] - '0';
        e++;
      }
      num *= 256;
      num += cur;
      e++;
    }
    long long r = num;
    if (e < (int)s.size()) {
      long long cur = 0;
      while (e < (int)s.size()) {
        cur *= 10;
        cur += s[e] - '0';
        e++;
      }
      r += 1ll << (32 - cur);
      r--;
    }
    segs[i].l = num;
    segs[i].r = r + 1;
  }
  long long N = 1ll << 32ll;
  solve(0, N, segs);
  cout << result.size() << '\n';
  for (auto &[l, r] : result) {
    vector<long long> kek;
    long long x = l;
    for (int _ = 0; _ < (4); ++_) {
      kek.push_back(x % 256);
      x /= 256;
    }
    long long need = r - l;
    long long w = 32;
    long long to = 1;
    while (to != need) {
      w--;
      to *= 2;
    }
    reverse((kek).begin(), (kek).end());
    for (int i = 0; i < (3); ++i) cout << kek[i] << '.';
    cout << kek[3] << '/' << w << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int tests = 1;
  for (int _ = 0; _ < (tests); ++_) {
    solve();
  }
  return 0;
}
