#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, d, e, i, j, k, l, n, m, x, y, t, p, f;
  scanf("%lld%lld%lld", &a, &b, &c);
  d = a + b;
  e = a % c;
  f = b % c;
  x = (a / c) + (b / c);
  y = d / c;
  if (x == y) {
    printf("%lld 0\n", x);
  } else {
    p = d % c;
    x = min(e, f);
    printf("%lld %lld\n", y, x - p);
  }
}
