#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int a, b, c;
  cin >> a >> b >> c;
  long long int x(a + b);
  cout << x / c << " ";
  if ((a / c) + (b / c) == x / c) {
    cout << 0;
  } else {
    cout << min(min(a % c, c - a % c), min(b % c, c - b % c));
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t(1);
  for (long long int i = 1; i < t + 1; i++) {
    solve();
  }
  return 0;
}
