#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll x, y, z;
  cin >> x >> y >> z;
  ll k = (x + y) / z;
  cout << (x + y) / z << " ";
  if (k == (x / z) + (y / z)) {
    cout << "0";
    return 0;
  }
  ll a = x % z;
  ll b = y % z;
  cout << min(z - a, z - b);
  return 0;
}
