#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int N = 1000005;
const double PI = 4 * atan(1);
const double eps = 1e-7;
long long x, y, z;
int main() {
  ios::sync_with_stdio(0);
  cin >> x >> y >> z;
  long long ans = 0;
  ans = x / z + y / z;
  long long a, b;
  a = x;
  b = y;
  long long c = (z - x % z) % z;
  long long res = 0;
  if (b >= c && ((a + c) / z + (b - c) / z) > ans) {
    ans = ((a + c) / z + (b - c) / z);
    res = c;
  }
  a = x;
  b = y;
  c = (z - y % z) % z;
  if (a >= c && ((a - c) / z + (b + c) / z) > ans) {
    ans = ((a + c) / z + (b - c) / z);
    res = c;
  } else if (a >= c && ((a - c) / z + (b + c) / z) == ans) {
    res = min(res, c);
  }
  cout << ans << " " << res << endl;
  return 0;
}
